mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
Merge pull request #6536 from mabashian/6520-inv-src-verbosity
Fixed verbosity select on inventory source form
This commit is contained in:
commit
71641bdfb7
@ -171,13 +171,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
|||||||
initRegionSelect();
|
initRegionSelect();
|
||||||
};
|
};
|
||||||
// region / source options callback
|
// region / source options callback
|
||||||
$scope.$on('choicesReadyGroup', function() {
|
|
||||||
initRegionSelect();
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$on('choicesReadyVerbosity', function() {
|
|
||||||
initVerbositySelect();
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$on('sourceTypeOptionsReady', function() {
|
$scope.$on('sourceTypeOptionsReady', function() {
|
||||||
initSourceSelect();
|
initSourceSelect();
|
||||||
@ -216,7 +209,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
|||||||
field: 'source_regions',
|
field: 'source_regions',
|
||||||
variable: 'rax_regions',
|
variable: 'rax_regions',
|
||||||
choice_name: 'rax_region_choices',
|
choice_name: 'rax_region_choices',
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
options: inventorySourcesOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -225,7 +217,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
|||||||
field: 'source_regions',
|
field: 'source_regions',
|
||||||
variable: 'ec2_regions',
|
variable: 'ec2_regions',
|
||||||
choice_name: 'ec2_region_choices',
|
choice_name: 'ec2_region_choices',
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
options: inventorySourcesOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -234,7 +225,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
|||||||
field: 'source_regions',
|
field: 'source_regions',
|
||||||
variable: 'gce_regions',
|
variable: 'gce_regions',
|
||||||
choice_name: 'gce_region_choices',
|
choice_name: 'gce_region_choices',
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
options: inventorySourcesOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -243,7 +233,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
|||||||
field: 'source_regions',
|
field: 'source_regions',
|
||||||
variable: 'azure_regions',
|
variable: 'azure_regions',
|
||||||
choice_name: 'azure_region_choices',
|
choice_name: 'azure_region_choices',
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
options: inventorySourcesOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -253,22 +242,23 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
|
|||||||
field: 'group_by',
|
field: 'group_by',
|
||||||
variable: 'ec2_group_by',
|
variable: 'ec2_group_by',
|
||||||
choice_name: 'ec2_group_by_choices',
|
choice_name: 'ec2_group_by_choices',
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
options: inventorySourcesOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initRegionSelect();
|
||||||
|
|
||||||
GetChoices({
|
GetChoices({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
field: 'verbosity',
|
field: 'verbosity',
|
||||||
variable: 'verbosity_options',
|
variable: 'verbosity_options',
|
||||||
callback: 'choicesReadyVerbosity',
|
|
||||||
options: inventorySourcesOptions
|
options: inventorySourcesOptions
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initVerbositySelect();
|
||||||
|
|
||||||
GetSourceTypeOptions({
|
GetSourceTypeOptions({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
variable: 'source_type_options'
|
variable: 'source_type_options'
|
||||||
//callback: 'sourceTypeOptionsReady' this callback is hard-coded into GetSourceTypeOptions(), included for ref
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,8 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
inventorySourceData, SourcesService, inventoryData, inventorySourcesOptions, Empty,
|
inventorySourceData, SourcesService, inventoryData, inventorySourcesOptions, Empty,
|
||||||
Wait, Rest, Alert, ProcessErrors) {
|
Wait, Rest, Alert, ProcessErrors) {
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
$scope.projectBasePath = GetBasePath('projects');
|
||||||
$scope.canAdd = inventorySourcesOptions.actions.POST;
|
$scope.canAdd = inventorySourcesOptions.actions.POST;
|
||||||
// instantiate expected $scope values from inventorySourceData
|
// instantiate expected $scope values from inventorySourceData
|
||||||
_.assign($scope,
|
_.assign($scope,
|
||||||
@ -35,6 +34,12 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
$scope.credential_name = inventorySourceData.summary_fields.credential.name;
|
$scope.credential_name = inventorySourceData.summary_fields.credential.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(inventorySourceData.source === 'scm') {
|
||||||
|
$scope.project = inventorySourceData.source_project;
|
||||||
|
$scope.project_name = inventorySourceData.summary_fields.source_project.name;
|
||||||
|
updateSCMProject();
|
||||||
|
}
|
||||||
|
|
||||||
// display custom inventory_script name
|
// display custom inventory_script name
|
||||||
if (inventorySourceData.source === 'custom') {
|
if (inventorySourceData.source === 'custom') {
|
||||||
$scope.inventory_script_name = inventorySourceData.summary_fields.source_script.name;
|
$scope.inventory_script_name = inventorySourceData.summary_fields.source_script.name;
|
||||||
@ -45,16 +50,69 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
$scope.canAdd = val;
|
$scope.canAdd = val;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.$on('sourceTypeOptionsReady', function() {
|
||||||
|
initSourceSelect();
|
||||||
|
});
|
||||||
|
|
||||||
$scope.envParseType = 'yaml';
|
$scope.envParseType = 'yaml';
|
||||||
|
|
||||||
initSources();
|
initSources();
|
||||||
|
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
field: 'verbosity',
|
||||||
|
variable: 'verbosity_options',
|
||||||
|
options: inventorySourcesOptions
|
||||||
|
});
|
||||||
|
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < $scope.verbosity_options.length; i++) {
|
||||||
|
if ($scope.verbosity_options[i].value === $scope.verbosity) {
|
||||||
|
$scope.verbosity = $scope.verbosity_options[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var getInventoryFiles = function (project) {
|
initVerbositySelect();
|
||||||
|
|
||||||
|
$scope.$watch('verbosity', initVerbositySelect);
|
||||||
|
|
||||||
|
// Register a watcher on project_name
|
||||||
|
if ($scope.getInventoryFilesUnregister) {
|
||||||
|
$scope.getInventoryFilesUnregister();
|
||||||
|
}
|
||||||
|
$scope.getInventoryFilesUnregister = $scope.$watch('project', function (newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue) {
|
||||||
|
updateSCMProject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function initVerbositySelect(){
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#inventory_source_verbosity',
|
||||||
|
multiple: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function sync_inventory_file_select2() {
|
||||||
|
CreateSelect2({
|
||||||
|
element:'#inventory-file-select',
|
||||||
|
addNew: true,
|
||||||
|
multiple: false,
|
||||||
|
scope: $scope,
|
||||||
|
options: 'inventory_files',
|
||||||
|
model: 'inventory_file'
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: figure out why the inventory file model is being set to
|
||||||
|
// dirty
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSCMProject() {
|
||||||
var url;
|
var url;
|
||||||
|
|
||||||
if (!Empty(project)) {
|
if (!Empty($scope.project)) {
|
||||||
url = GetBasePath('projects') + project + '/inventories/';
|
url = GetBasePath('projects') + $scope.project + '/inventories/';
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@ -78,10 +136,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
Wait('stop');
|
Wait('stop');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// Detect and alert user to potential SCM status issues
|
|
||||||
var checkSCMStatus = function () {
|
|
||||||
if (!Empty($scope.project)) {
|
if (!Empty($scope.project)) {
|
||||||
Rest.setUrl(GetBasePath('projects') + $scope.project + '/');
|
Rest.setUrl(GetBasePath('projects') + $scope.project + '/');
|
||||||
Rest.get()
|
Rest.get()
|
||||||
@ -108,31 +163,115 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
msg: 'Failed to get project ' + $scope.project + '. GET returned status: ' + status });
|
msg: 'Failed to get project ' + $scope.project + '. GET returned status: ' + status });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// Register a watcher on project_name
|
|
||||||
if ($scope.getInventoryFilesUnregister) {
|
|
||||||
$scope.getInventoryFilesUnregister();
|
|
||||||
}
|
}
|
||||||
$scope.getInventoryFilesUnregister = $scope.$watch('project', function (newValue, oldValue) {
|
|
||||||
if (newValue !== oldValue) {
|
|
||||||
getInventoryFiles(newValue);
|
|
||||||
checkSCMStatus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function sync_inventory_file_select2() {
|
function initSourceSelect() {
|
||||||
|
$scope.source = _.find($scope.source_type_options, { value: inventorySourceData.source });
|
||||||
|
var source = $scope.source && $scope.source.value ? $scope.source.value : null;
|
||||||
|
|
||||||
CreateSelect2({
|
CreateSelect2({
|
||||||
element:'#inventory-file-select',
|
element: '#inventory_source_source',
|
||||||
addNew: true,
|
multiple: false
|
||||||
multiple: false,
|
|
||||||
scope: $scope,
|
|
||||||
options: 'inventory_files',
|
|
||||||
model: 'inventory_file'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: figure out why the inventory file model is being set to
|
if (source === 'ec2' || source === 'custom' ||
|
||||||
// dirty
|
source === 'vmware' || source === 'openstack' ||
|
||||||
|
source === 'scm') {
|
||||||
|
|
||||||
|
var varName;
|
||||||
|
if (source === 'scm') {
|
||||||
|
varName = 'custom_variables';
|
||||||
|
} else {
|
||||||
|
varName = source + '_variables';
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope[varName] = $scope[varName] === (null || undefined) ? '---' : $scope[varName];
|
||||||
|
|
||||||
|
ParseVariableString(inventorySourceData.source_vars);
|
||||||
|
ParseTypeChange({
|
||||||
|
scope: $scope,
|
||||||
|
field_id: varName,
|
||||||
|
variable: varName,
|
||||||
|
parse_variable: 'envParseType',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initRegionData() {
|
||||||
|
var source = $scope.source === 'azure_rm' ? 'azure' : $scope.source;
|
||||||
|
var regions = inventorySourceData.source_regions.split(',');
|
||||||
|
// azure_rm regions choices are keyed as "azure" in an OPTIONS request to the inventory_sources endpoint
|
||||||
|
$scope.source_region_choices = $scope[source + '_regions'];
|
||||||
|
|
||||||
|
// the API stores azure regions as all-lowercase strings - but the azure regions received from OPTIONS are Snake_Cased
|
||||||
|
if (source === 'azure') {
|
||||||
|
$scope.source_regions = _.map(regions, (region) => _.find($scope[source + '_regions'], (o) => o.value.toLowerCase() === region));
|
||||||
|
}
|
||||||
|
// all other regions are 1-1
|
||||||
|
else {
|
||||||
|
$scope.source_regions = _.map(regions, (region) => _.find($scope[source + '_regions'], (o) => o.value === region));
|
||||||
|
}
|
||||||
|
$scope.group_by_choices = source === 'ec2' ? $scope.ec2_group_by : null;
|
||||||
|
if (source === 'ec2') {
|
||||||
|
var group_by = inventorySourceData.group_by.split(',');
|
||||||
|
$scope.group_by = _.map(group_by, (item) => _.find($scope.ec2_group_by, { value: item }));
|
||||||
|
}
|
||||||
|
initRegionSelect();
|
||||||
|
}
|
||||||
|
|
||||||
|
function initSources() {
|
||||||
|
GetSourceTypeOptions({
|
||||||
|
scope: $scope,
|
||||||
|
variable: 'source_type_options'
|
||||||
|
});
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
field: 'source_regions',
|
||||||
|
variable: 'rax_regions',
|
||||||
|
choice_name: 'rax_region_choices',
|
||||||
|
options: inventorySourcesOptions
|
||||||
|
});
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
field: 'source_regions',
|
||||||
|
variable: 'ec2_regions',
|
||||||
|
choice_name: 'ec2_region_choices',
|
||||||
|
options: inventorySourcesOptions
|
||||||
|
});
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
field: 'source_regions',
|
||||||
|
variable: 'gce_regions',
|
||||||
|
choice_name: 'gce_region_choices',
|
||||||
|
options: inventorySourcesOptions
|
||||||
|
});
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
field: 'source_regions',
|
||||||
|
variable: 'azure_regions',
|
||||||
|
choice_name: 'azure_region_choices',
|
||||||
|
options: inventorySourcesOptions
|
||||||
|
});
|
||||||
|
GetChoices({
|
||||||
|
scope: $scope,
|
||||||
|
field: 'group_by',
|
||||||
|
variable: 'ec2_group_by',
|
||||||
|
choice_name: 'ec2_group_by_choices',
|
||||||
|
options: inventorySourcesOptions
|
||||||
|
});
|
||||||
|
|
||||||
|
initRegionData();
|
||||||
|
}
|
||||||
|
|
||||||
|
function initRegionSelect() {
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#inventory_source_source_regions',
|
||||||
|
multiple: true
|
||||||
|
});
|
||||||
|
CreateSelect2({
|
||||||
|
element: '#inventory_source_group_by',
|
||||||
|
multiple: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.lookupCredential = function(){
|
$scope.lookupCredential = function(){
|
||||||
@ -155,19 +294,6 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.projectBasePath = GetBasePath('projects');
|
|
||||||
|
|
||||||
var initRegionSelect = function() {
|
|
||||||
CreateSelect2({
|
|
||||||
element: '#inventory_source_source_regions',
|
|
||||||
multiple: true
|
|
||||||
});
|
|
||||||
CreateSelect2({
|
|
||||||
element: '#inventory_source_group_by',
|
|
||||||
multiple: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.lookupCredential = function(){
|
$scope.lookupCredential = function(){
|
||||||
let kind = ($scope.source.value === "ec2") ? "aws" : $scope.source.value;
|
let kind = ($scope.source.value === "ec2") ? "aws" : $scope.source.value;
|
||||||
$state.go('.credential', {
|
$state.go('.credential', {
|
||||||
@ -197,6 +323,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
overwrite_vars: $scope.overwrite_vars,
|
overwrite_vars: $scope.overwrite_vars,
|
||||||
update_on_launch: $scope.update_on_launch,
|
update_on_launch: $scope.update_on_launch,
|
||||||
update_cache_timeout: $scope.update_cache_timeout || 0,
|
update_cache_timeout: $scope.update_cache_timeout || 0,
|
||||||
|
verbosity: $scope.verbosity.value,
|
||||||
// comma-delimited strings
|
// comma-delimited strings
|
||||||
group_by: _.map($scope.group_by, 'value').join(','),
|
group_by: _.map($scope.group_by, 'value').join(','),
|
||||||
source_regions: _.map($scope.source_regions, 'value').join(',')
|
source_regions: _.map($scope.source_regions, 'value').join(',')
|
||||||
@ -207,8 +334,14 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
params.source = $scope.source.value;
|
params.source = $scope.source.value;
|
||||||
if ($scope.source.value === 'scm') {
|
if ($scope.source.value === 'scm') {
|
||||||
params.update_on_project_update = $scope.update_on_project_update;
|
params.update_on_project_update = $scope.update_on_project_update;
|
||||||
|
params.source_project = $scope.project;
|
||||||
|
|
||||||
|
if ($scope.inventory_file === '/ (project root)') {
|
||||||
|
params.source_path = "";
|
||||||
|
} else {
|
||||||
params.source_path = $scope.inventory_file;
|
params.source_path = $scope.inventory_file;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
params.source = null;
|
params.source = null;
|
||||||
}
|
}
|
||||||
@ -254,152 +387,6 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
|
|||||||
initRegionSelect();
|
initRegionSelect();
|
||||||
};
|
};
|
||||||
|
|
||||||
function initSourceSelect() {
|
init();
|
||||||
$scope.source = _.find($scope.source_type_options, { value: inventorySourceData.source });
|
|
||||||
var source = $scope.source && $scope.source.value ? $scope.source.value : null;
|
|
||||||
|
|
||||||
CreateSelect2({
|
|
||||||
element: '#inventory_source_source',
|
|
||||||
multiple: false
|
|
||||||
});
|
|
||||||
|
|
||||||
if (source === 'ec2' || source === 'custom' ||
|
|
||||||
source === 'vmware' || source === 'openstack' ||
|
|
||||||
source === 'scm') {
|
|
||||||
|
|
||||||
var varName;
|
|
||||||
if (source === 'scm') {
|
|
||||||
varName = 'custom_variables';
|
|
||||||
} else {
|
|
||||||
varName = source + '_variables';
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope[varName] = $scope[varName] === (null || undefined) ? '---' : $scope[varName];
|
|
||||||
|
|
||||||
ParseVariableString(inventorySourceData.source_vars);
|
|
||||||
ParseTypeChange({
|
|
||||||
scope: $scope,
|
|
||||||
field_id: varName,
|
|
||||||
variable: varName,
|
|
||||||
parse_variable: 'envParseType',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initRegionData() {
|
|
||||||
var source = $scope.source.value === 'azure_rm' ? 'azure' : $scope.source.value;
|
|
||||||
var regions = inventorySourceData.source_regions.split(',');
|
|
||||||
// azure_rm regions choices are keyed as "azure" in an OPTIONS request to the inventory_sources endpoint
|
|
||||||
$scope.source_region_choices = $scope[source + '_regions'];
|
|
||||||
|
|
||||||
// the API stores azure regions as all-lowercase strings - but the azure regions received from OPTIONS are Snake_Cased
|
|
||||||
if (source === 'azure') {
|
|
||||||
$scope.source_regions = _.map(regions, (region) => _.find($scope[source + '_regions'], (o) => o.value.toLowerCase() === region));
|
|
||||||
}
|
|
||||||
// all other regions are 1-1
|
|
||||||
else {
|
|
||||||
$scope.source_regions = _.map(regions, (region) => _.find($scope[source + '_regions'], (o) => o.value === region));
|
|
||||||
}
|
|
||||||
$scope.group_by_choices = source === 'ec2' ? $scope.ec2_group_by : null;
|
|
||||||
if (source === 'ec2') {
|
|
||||||
var group_by = inventorySourceData.group_by.split(',');
|
|
||||||
$scope.group_by = _.map(group_by, (item) => _.find($scope.ec2_group_by, { value: item }));
|
|
||||||
}
|
|
||||||
initRegionSelect();
|
|
||||||
}
|
|
||||||
|
|
||||||
function initSources() {
|
|
||||||
GetSourceTypeOptions({
|
|
||||||
scope: $scope,
|
|
||||||
variable: 'source_type_options',
|
|
||||||
//callback: 'sourceTypeOptionsReady' this callback is hard-coded into GetSourceTypeOptions(), included for ref
|
|
||||||
});
|
|
||||||
GetChoices({
|
|
||||||
scope: $scope,
|
|
||||||
field: 'source_regions',
|
|
||||||
variable: 'rax_regions',
|
|
||||||
choice_name: 'rax_region_choices',
|
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
|
||||||
});
|
|
||||||
GetChoices({
|
|
||||||
scope: $scope,
|
|
||||||
field: 'source_regions',
|
|
||||||
variable: 'ec2_regions',
|
|
||||||
choice_name: 'ec2_region_choices',
|
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
|
||||||
});
|
|
||||||
GetChoices({
|
|
||||||
scope: $scope,
|
|
||||||
field: 'source_regions',
|
|
||||||
variable: 'gce_regions',
|
|
||||||
choice_name: 'gce_region_choices',
|
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
|
||||||
});
|
|
||||||
GetChoices({
|
|
||||||
scope: $scope,
|
|
||||||
field: 'source_regions',
|
|
||||||
variable: 'azure_regions',
|
|
||||||
choice_name: 'azure_region_choices',
|
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
|
||||||
});
|
|
||||||
GetChoices({
|
|
||||||
scope: $scope,
|
|
||||||
field: 'group_by',
|
|
||||||
variable: 'ec2_group_by',
|
|
||||||
choice_name: 'ec2_group_by_choices',
|
|
||||||
callback: 'choicesReadyGroup',
|
|
||||||
options: inventorySourcesOptions
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function initVerbositySelect(){
|
|
||||||
CreateSelect2({
|
|
||||||
element: '#inventory_source_verbosity',
|
|
||||||
multiple: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function sync_verbosity_select2() {
|
|
||||||
CreateSelect2({
|
|
||||||
element:'#inventory_source_verbosity',
|
|
||||||
multiple: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.$on('choicesReadyVerbosity', function() {
|
|
||||||
var i;
|
|
||||||
for (i = 0; i < $scope.verbosity_options.length; i++) {
|
|
||||||
if ($scope.verbosity_options[i].value === $scope.verbosity) {
|
|
||||||
$scope.verbosity = $scope.verbosity_options[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
initVerbositySelect();
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$watch('verbosity', sync_verbosity_select2);
|
|
||||||
|
|
||||||
GetChoices({
|
|
||||||
scope: $scope,
|
|
||||||
field: 'verbosity',
|
|
||||||
variable: 'verbosity_options',
|
|
||||||
callback: 'choicesReadyVerbosity',
|
|
||||||
options: inventorySourcesOptions
|
|
||||||
});
|
|
||||||
|
|
||||||
// region / source options callback
|
|
||||||
$scope.$on('choicesReadyGroup', function() {
|
|
||||||
if (angular.isObject($scope.source)) {
|
|
||||||
initRegionData();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$on('sourceTypeOptionsReady', function() {
|
|
||||||
initSourceSelect();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -286,7 +286,7 @@ return {
|
|||||||
ngOptions: 'v.label for v in verbosity_options track by v.value',
|
ngOptions: 'v.label for v in verbosity_options track by v.value',
|
||||||
ngShow: "source && (source.value !== '' && source.value !== null)",
|
ngShow: "source && (source.value !== '' && source.value !== null)",
|
||||||
"default": 0,
|
"default": 0,
|
||||||
required: true,
|
disableChooseOption: true,
|
||||||
column: 1,
|
column: 1,
|
||||||
awPopOver: "<p>" + i18n._("Control the level of output ansible will produce for inventory source update jobs.") + "</p>",
|
awPopOver: "<p>" + i18n._("Control the level of output ansible will produce for inventory source update jobs.") + "</p>",
|
||||||
dataTitle: i18n._('Verbosity'),
|
dataTitle: i18n._('Verbosity'),
|
||||||
@ -346,7 +346,8 @@ return {
|
|||||||
label: 'Update on Project Update',
|
label: 'Update on Project Update',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
ngShow: "source.value === 'scm'",
|
ngShow: "source.value === 'scm'",
|
||||||
awPopOver: '<p>TODO</p>',
|
awPopOver: '<p>Each time the selected project is updated, refresh the inventory from the selected source before ' +
|
||||||
|
'executing job tasks.</p>',
|
||||||
dataTitle: 'Update on Project Update',
|
dataTitle: 'Update on Project Update',
|
||||||
dataContainer: 'body',
|
dataContainer: 'body',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
|
Loading…
Reference in New Issue
Block a user