fix codemirror in add host, add inventory, and workflow job details

This commit is contained in:
Keith Grant 2019-03-22 10:11:18 -04:00
parent 8e48a3a523
commit 7476fefd65
6 changed files with 11 additions and 25 deletions

View File

@ -73,6 +73,9 @@ function atCodeMirrorController (
return true;
}
if (typeof str === 'undefined') {
return '---';
}
if (typeof str !== 'string') {
const yamlStr = jsyaml.safeDump(str);
// jsyaml.safeDump doesn't process an empty object correctly

View File

@ -5,8 +5,8 @@
*************************************************/
export default
['$scope', '$state', '$stateParams', 'GenerateForm', 'ParseTypeChange', 'HostsService', 'host', '$rootScope',
function($scope, $state, $stateParams, GenerateForm, ParseTypeChange, HostsService, host, $rootScope){
['$scope', '$state', '$stateParams', 'GenerateForm', 'HostsService', 'host', '$rootScope',
function($scope, $state, $stateParams, GenerateForm, HostsService, host, $rootScope){
$scope.parseType = 'yaml';
$scope.formCancel = function(){
$state.go('^', null, {reload: true});

View File

@ -4,26 +4,18 @@
* All Rights Reserved
*************************************************/
export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition', 'ParseTypeChange',
export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition',
'GenerateForm', 'HostsService', 'GetBasePath', 'ToJSON', 'canAdd',
function($state, $stateParams, $scope, RelatedHostsFormDefinition, ParseTypeChange,
function($state, $stateParams, $scope, RelatedHostsFormDefinition,
GenerateForm, HostsService, GetBasePath, ToJSON, canAdd) {
init();
function init() {
$scope.canAdd = canAdd;
$scope.parseType = 'yaml';
$scope.host = { enabled: true };
// apply form definition's default field values
GenerateForm.applyDefaults(RelatedHostsFormDefinition, $scope);
ParseTypeChange({
scope: $scope,
field_id: 'host_host_variables',
variable: 'host_variables',
parse_variable: 'parseType'
});
}
$scope.formCancel = function() {
$state.go('^');

View File

@ -30,14 +30,6 @@ function InventoriesAdd($scope, $location,
// apply form definition's default field values
GenerateForm.applyDefaults(form, $scope);
$scope.parseType = 'yaml';
ParseTypeChange({
scope: $scope,
variable: 'inventory_variables',
parse_variable: 'parseType',
field_id: 'inventory_inventory_variables'
});
}
// Save

View File

@ -1,8 +1,8 @@
export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
'jobLabels', 'workflowNodes', '$scope', 'ParseTypeChange',
'jobLabels', 'workflowNodes', '$scope',
'ParseVariableString', 'count', '$state', 'i18n', 'WorkflowChartService', '$filter',
'moment', function(workflowData, workflowResultsService,
workflowDataOptions, jobLabels, workflowNodes, $scope, ParseTypeChange,
workflowDataOptions, jobLabels, workflowNodes, $scope,
ParseVariableString, count, $state, i18n, WorkflowChartService, $filter,
moment) {
let nodeRef;
@ -167,7 +167,6 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
// set up a read only code mirror for extra vars
$scope.variables = ParseVariableString($scope.workflow.extra_vars);
$scope.parseType = 'yaml';
$scope.varsTooltip= i18n._('Read only view of extra variables added to the workflow.');
$scope.varsLabel = i18n._('Extra Variables');
$scope.varsName = 'extra_vars';

View File

@ -220,12 +220,12 @@
<!-- EXTRA VARIABLES DETAIL -->
<at-code-mirror
ng-if="variables"
variables="{{ variables }}"
variables="variables"
tooltip="{{ varsTooltip }}"
label="{{ varsLabel }}"
label-class="WorkflowResults-extraVarsLabel"
name="{{ varsName }}"
disabled="disabled">
disabled="true">
</at-code-mirror>
<!-- LABELS DETAIL -->