Skip to content

Commit

Permalink
Added remove resources option in the form
Browse files Browse the repository at this point in the history
Added an option to ask user if they want to remove associated resources as part of service retirement, default is set to "none" with options none/pre/post.
Fixed existing JS spec test.

https://www.pivotaltracker.com/story/show/141238703
  • Loading branch information
h-kataria committed Mar 8, 2017
1 parent 5857a28 commit 85ec1b7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
retirement_variables: {},
retirement_editMode: false,
retirement_cloud_type: '',
remove_resources: 'none',
remove_resources_types: {"None": "none", "Pre": "pre", "Post": "post"},
cloud_types: ["Amazon", "Azure", "Google", "Openstack", "Vmware"]
};
vm.formId = catalogItemFormId;
Expand Down Expand Up @@ -70,6 +72,7 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
};

var getConfigInfo = function(configData) {
vm.catalogItemModel.remove_resources = configData.remove_resources;
vm.catalogItemModel.provisioning_repository_id = configData.provision.repository_id;
vm.catalogItemModel.provisioning_playbook_id = configData.provision.playbook_id;
vm.catalogItemModel.provisioning_machine_credential_id = configData.provision.credential_id;
Expand Down Expand Up @@ -145,6 +148,7 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
prov_type: "generic_ansible_playbook",
type: "ServiceTemplateAnsiblePlaybook",
config_info: {
remove_resources: configData.remove_resources,
provision: {
repository_id: configData.provisioning_repository_id,
playbook_id: configData.provisioning_playbook_id,
Expand Down
11 changes: 11 additions & 0 deletions app/views/catalog/_st_angular_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@
%option{"value" => ""}
= "<#{_('Unassigned')}>"

.form-group
%label.col-md-2.control-label{"for" => "catalog_id"}
= _('Would you like to remove associated resources as part of service retirement?')
.col-md-8
%select{"ng-model" => "vm.catalogItemModel.remove_resources",
"name" => "vm.catalogItemModel.remove_resources",
'ng-options' => "v as k for (k, v) in vm.catalogItemModel.remove_resources_types",
:checkchange => true,
"pf-select" => true}
= render :partial => "layouts/angular/multi_tab_ansible_form_options",
:locals => {:record => @record, :ng_model => "vm.catalogItemModel"}
= render :partial => "layouts/angular/x_edit_buttons_angular"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('catalogItemFormController', function() {
prov_type: 'generic_ansible_playbook',
type: 'ServiceTemplateAnsiblePlaybook',
config_info: {
remove_resources: 'pre',
provision: {
dialog_id: '10000000000031',
repository_id: undefined,
Expand Down

0 comments on commit 85ec1b7

Please sign in to comment.