Skip to content

Commit

Permalink
Save new dialog value & other UI issues fixed
Browse files Browse the repository at this point in the history
Fixed saving of new dialog name, reset 'Hosts' field when playbook is selected on Retirement tab during edit and fixed issues related to initialization of Escalate Privilege switch

https://bugzilla.redhat.com/show_bug.cgi?id=1448228
  • Loading branch information
h-kataria committed May 10, 2017
1 parent 70aec6d commit 4f29b13
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
vm.catalogItemModel.provisioning_dialog_name = configData.provision.new_dialog_name;
vm.catalogItemModel.provisioning_key = '';
vm.catalogItemModel.provisioning_value = '';
vm.catalogItemModel.provisioning_become_enabled = configData.provision.become_enabled
if (configData.provision.become_enabled === undefined) {
vm.catalogItemModel.provisioning_become_enabled = false;
} else {
vm.catalogItemModel.provisioning_become_enabled = configData.provision.become_enabled;
}
setExtraVars('provisioning_variables', configData.provision.extra_vars);

if (typeof configData.retirement.repository_id !== 'undefined') {
Expand All @@ -124,7 +128,11 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
vm.catalogItemModel.retirement_remove_resources = configData.retirement.remove_resources;
vm.catalogItemModel.retirement_machine_credential_id = configData.retirement.credential_id;
}
vm.catalogItemModel.retirement_become_enabled = configData.retirement.become_enabled
if (configData.retirement.become_enabled === undefined) {
vm.catalogItemModel.retirement_become_enabled = false;
} else {
vm.catalogItemModel.retirement_become_enabled = configData.retirement.become_enabled;
}
vm.catalogItemModel.retirement_network_credential_id = configData.retirement.network_credential_id;
vm.catalogItemModel.retirement_cloud_credential_id = setIfDefined(configData.retirement.cloud_credential_id);
vm.catalogItemModel.retirement_inventory = configData.retirement.hosts;
Expand Down Expand Up @@ -216,7 +224,7 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
if (configData.provisioning_cloud_credential_id !== '')
catalog_item['config_info']['provision']['cloud_credential_id'] = configData.provisioning_cloud_credential_id;

if (configData.provisioning_dialog_id !== '') {
if (configData.provisioning_dialog_id !== undefined && configData.provisioning_dialog_id !== '') {
catalog_item['config_info']['provision']['dialog_id'] = configData.provisioning_dialog_id;
} else if (configData.provisioning_dialog_name !== '')
catalog_item['config_info']['provision']['new_dialog_name'] = configData.provisioning_dialog_name;
Expand Down Expand Up @@ -339,6 +347,14 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
})
};

// reset fields when retirement playbook type is changed
$scope.$watch('vm._retirement_playbook', function(value) {
if (value && (vm.catalogItemModel.retirement_inventory === undefined || vm.catalogItemModel.retirement_inventory === '')) {
vm.catalogItemModel.retirement_inventory = 'localhost';
vm.catalogItemModel.retirement_become_enabled = false;
}
});

$scope.$watch('vm._provisioning_repository', function(value) {
if (value) {
vm.repositoryChanged("provisioning", value.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('catalogItemFormController', function() {
'var1': {'default': 'default_val1'},
'var2': {'default': 'default_val2'}
},
become_enabled: undefined,
become_enabled: false,
network_credential_id: undefined
},
retirement: {
Expand Down

0 comments on commit 4f29b13

Please sign in to comment.