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; return true;
} }
if (typeof str === 'undefined') {
return '---';
}
if (typeof str !== 'string') { if (typeof str !== 'string') {
const yamlStr = jsyaml.safeDump(str); const yamlStr = jsyaml.safeDump(str);
// jsyaml.safeDump doesn't process an empty object correctly // jsyaml.safeDump doesn't process an empty object correctly

View File

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

View File

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

View File

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

View File

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

View File

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