Added "Manual" to inventory source options

The 'manual' option was not being shown b/c it's value was an empty string.
This commit is contained in:
Jared Tabor
2014-12-17 15:27:32 -05:00
parent 7d9f4aac47
commit 6e3cd5bc54
2 changed files with 17 additions and 16 deletions

View File

@@ -42,7 +42,7 @@ angular.module('SourceFormDefinition', [])
credential: { credential: {
label: 'Cloud Credential', label: 'Cloud Credential',
type: 'lookup', type: 'lookup',
ngShow: "source && source.value !== '' && source.value !== 'custom'", ngShow: "source && source.value !== 'manual' && source.value !== 'custom'",
sourceModel: 'credential', sourceModel: 'credential',
sourceField: 'name', sourceField: 'name',
ngClick: 'lookUpCredential()', ngClick: 'lookUpCredential()',
@@ -109,7 +109,7 @@ angular.module('SourceFormDefinition', [])
source_script: { source_script: {
label : "Custom Inventory Script", label : "Custom Inventory Script",
type: 'lookup', type: 'lookup',
ngShow: "source && source.value !== '' && source.value === 'custom'", ngShow: "source && source.value === 'custom'",
sourceModel: 'source_script', sourceModel: 'source_script',
sourceField: 'name', sourceField: 'name',
ngClick: 'lookUpCustom_inventory()', ngClick: 'lookUpCustom_inventory()',
@@ -118,7 +118,7 @@ angular.module('SourceFormDefinition', [])
}, },
extra_vars: { extra_vars: {
label: 'Environment Variables', //"{{vars_label}}" , label: 'Environment Variables', //"{{vars_label}}" ,
ngShow: "source && (source.value=='custom')", ngShow: "source && source.value=='custom' ",
type: 'textarea', type: 'textarea',
addRequired: false, addRequired: false,
editRequird: false, editRequird: false,
@@ -183,13 +183,13 @@ angular.module('SourceFormDefinition', [])
checkbox_group: { checkbox_group: {
label: 'Update Options', label: 'Update Options',
type: 'checkbox_group', type: 'checkbox_group',
ngShow: "source && (source.value !== '' && source.value !== null)", ngShow: "source && (source.value !== 'manual' && source.value !== null)",
fields: [{ fields: [{
name: 'overwrite', name: 'overwrite',
label: 'Overwrite', label: 'Overwrite',
type: 'checkbox', type: 'checkbox',
ngShow: "source.value !== '' && source.value !== null", ngShow: "source.value !== 'manual' && source.value !== null",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
awPopOver: '<p>If checked, all child groups and hosts not found on the external source will be deleted from ' + awPopOver: '<p>If checked, all child groups and hosts not found on the external source will be deleted from ' +
@@ -203,7 +203,7 @@ angular.module('SourceFormDefinition', [])
name: 'overwrite_vars', name: 'overwrite_vars',
label: 'Overwrite Variables', label: 'Overwrite Variables',
type: 'checkbox', type: 'checkbox',
ngShow: "source.value !== '' && source.value !== null", ngShow: "source.value !== 'manual' && source.value !== null",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
awPopOver: '<p>If checked, all variables for child groups and hosts will be removed and replaced by those ' + awPopOver: '<p>If checked, all variables for child groups and hosts will be removed and replaced by those ' +
@@ -217,7 +217,7 @@ angular.module('SourceFormDefinition', [])
name: 'update_on_launch', name: 'update_on_launch',
label: 'Update on Launch', label: 'Update on Launch',
type: 'checkbox', type: 'checkbox',
ngShow: "source.value !== '' && source.value !== null", ngShow: "source.value !== 'manual' && source.value !== null",
addRequired: false, addRequired: false,
editRequired: false, editRequired: false,
awPopOver: '<p>Each time a job runs using this inventory, refresh the inventory from the selected source before ' + awPopOver: '<p>Each time a job runs using this inventory, refresh the inventory from the selected source before ' +
@@ -234,7 +234,7 @@ angular.module('SourceFormDefinition', [])
type: 'number', type: 'number',
integer: true, integer: true,
min: 0, min: 0,
ngShow: "source && source.value !== '' && update_on_launch", ngShow: "source && source.value !== 'manual' && update_on_launch",
spinner: true, spinner: true,
"default": 0, "default": 0,
addRequired: false, addRequired: false,

View File

@@ -35,7 +35,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
if (choices[i][0] !== 'file') { if (choices[i][0] !== 'file') {
scope[variable].push({ scope[variable].push({
label: ((choices[i][0] === '') ? 'Manual' : choices[i][1]), label: ((choices[i][0] === '') ? 'Manual' : choices[i][1]),
value: choices[i][0] value: (choices[i][0] === '') ? 'manual' : choices[i][0]
}); });
} }
} }
@@ -876,8 +876,8 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
modal_scope.groupVariablesLoadedRemove(); modal_scope.groupVariablesLoadedRemove();
} }
modal_scope.groupVariablesLoadedRemove = modal_scope.$on('groupVariablesLoaded', function () { modal_scope.groupVariablesLoadedRemove = modal_scope.$on('groupVariablesLoaded', function () {
modal_scope.showSourceTab = (mode === 'edit' && group.has_inventory_sources && Empty(group.summary_fields.inventory_source.source)) ? false : true; modal_scope.showSourceTab = (mode === 'edit' && group.has_inventory_sources && Empty(group.summary_fields.inventory_source.source) && sources_scope.source.value!=='manual') ? false : true;
modal_scope.showSchedulesTab = (mode === 'edit' && sources_scope.source && sources_scope.source.value) ? true : false; modal_scope.showSchedulesTab = (mode === 'edit' && sources_scope.source && sources_scope.source.value!=='manual') ? true : false;
if (mode === 'edit' && modal_scope.showSourceTab) { if (mode === 'edit' && modal_scope.showSourceTab) {
// the use has access to the source tab, so they may create a schedule // the use has access to the source tab, so they may create a schedule
GroupsScheduleListInit({ scope: modal_scope, url: schedules_url }); GroupsScheduleListInit({ scope: modal_scope, url: schedules_url });
@@ -945,13 +945,14 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
} }
if (fld === 'source') { if (fld === 'source') {
found = false; found = false;
data.source = (data.source === "" ) ? "manual" : data.source;
for (i = 0; i < sources_scope.source_type_options.length; i++) { for (i = 0; i < sources_scope.source_type_options.length; i++) {
if (sources_scope.source_type_options[i].value === data.source) { if (sources_scope.source_type_options[i].value === data.source) {
sources_scope.source = sources_scope.source_type_options[i]; sources_scope.source = sources_scope.source_type_options[i];
found = true; found = true;
} }
} }
if (!found || sources_scope.source.value === "") { if (!found || sources_scope.source.value === "manual") {
sources_scope.groupUpdateHide = true; sources_scope.groupUpdateHide = true;
} else { } else {
sources_scope.groupUpdateHide = false; sources_scope.groupUpdateHide = false;
@@ -1187,7 +1188,7 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
group_by, group_by,
data = { data = {
group: group_id, group: group_id,
source: ((sources_scope.source && sources_scope.source.value) ? sources_scope.source.value : ''), source: ((sources_scope.source && sources_scope.source.value!=='manual') ? sources_scope.source.value : ''),
source_path: sources_scope.source_path, source_path: sources_scope.source_path,
credential: sources_scope.credential, credential: sources_scope.credential,
overwrite: sources_scope.overwrite, overwrite: sources_scope.overwrite,
@@ -1230,7 +1231,7 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
} }
// the API doesn't expect the credential to be passed with a custom inv script // the API doesn't expect the credential to be passed with a custom inv script
if(sources_scope.source.value === 'custom'){ if(sources_scope.source && sources_scope.source.value === 'custom'){
delete(data.credential); delete(data.credential);
} }
@@ -1347,7 +1348,7 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
// Start the update process // Start the update process
modal_scope.updateGroup = function () { modal_scope.updateGroup = function () {
if (sources_scope.source === "" || sources_scope.source === null) { if (sources_scope.source === "manual" || sources_scope.source === null) {
Alert('Missing Configuration', 'The selected group is not configured for updates. You must first edit the group, provide Source settings, ' + Alert('Missing Configuration', 'The selected group is not configured for updates. You must first edit the group, provide Source settings, ' +
'and then run an update.', 'alert-info'); 'and then run an update.', 'alert-info');
} else if (sources_scope.status === 'updating') { } else if (sources_scope.status === 'updating') {
@@ -1366,7 +1367,7 @@ function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, Sched
// Change the lookup and regions when the source changes // Change the lookup and regions when the source changes
sources_scope.sourceChange = function () { sources_scope.sourceChange = function () {
parent_scope.showSchedulesTab = (mode === 'edit' && sources_scope.source && sources_scope.source.value) ? true : false; parent_scope.showSchedulesTab = (mode === 'edit' && sources_scope.source && sources_scope.source.value!=="manual") ? true : false;
SourceChange({ scope: sources_scope, form: SourceForm }); SourceChange({ scope: sources_scope, form: SourceForm });
}; };