Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ManageIQ/manageiq-ui-classic into…
Browse files Browse the repository at this point in the history
… update_playbook_service_template_save_button

# Conflicts:
#	app/assets/javascripts/controllers/catalog/catalog_item_form_controller.js
  • Loading branch information
lgalis committed Mar 28, 2017
2 parents a0467a5 + a3e98a7 commit d3df71e
Show file tree
Hide file tree
Showing 14 changed files with 116 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
retirement_network_credential_id: '',
retirement_cloud_credential_id: '',
retirement_inventory: 'localhost',
retirement_dialog_existing: 'existing',
retirement_dialog_id: '',
retirement_dialog_name: '',
retirement_key: '',
retirement_value: '',
retirement_variables: {},
Expand Down Expand Up @@ -62,6 +59,8 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
vm.catalogItemModel.provisioning_dialog_id = catalogItemData.provisioning_dialog_id;
vm.catalogItemModel.retirement_dialog_id = catalogItemData.retirement_dialog_id;
vm.formOptions(catalogItemData.config_info);
vm.catalogItemModel.provisioning_dialog_id = catalogItemData.provisioning_dialog_id;
vm.formOptions();
getConfigInfo(catalogItemData.config_info);
vm.afterGet = true;
vm.modelCopy = angular.copy(vm.catalogItemModel);
Expand Down Expand Up @@ -118,9 +117,6 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
getRemoveResourcesTypes();
vm.catalogItemModel.retirement_remove_resources = configData.retirement.remove_resources;
vm.catalogItemModel.retirement_machine_credential_id = configData.retirement.credential_id;
vm.catalogItemModel.retirement_dialog_existing = configData.retirement.dialog_id ? "existing" : "create";
vm.catalogItemModel.retirement_dialog_id = configData.retirement.dialog_id;
vm.catalogItemModel.retirement_dialog_name = configData.retirement.new_dialog_name;
}
vm.catalogItemModel.retirement_network_credential_id = configData.retirement.network_credential_id;
vm.catalogItemModel.retirement_cloud_credential_id = configData.retirement.cloud_credential_id;
Expand Down Expand Up @@ -214,19 +210,13 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
retirement['repository_id'] = configData.retirement_repository_id;
retirement['playbook_id'] = configData.retirement_playbook_id;
retirement['credential_id'] = configData.retirement_machine_credential_id;
retirement['dialog_id'] = configData.retirement_dialog_id;
}
if (configData.retirement_network_credential_id !== '')
catalog_item['config_info']['retirement']['network_credential_id'] = configData.retirement_network_credential_id;

if (configData.retirement_cloud_credential_id !== '')
catalog_item['config_info']['retirement']['cloud_credential_id'] = configData.retirement_cloud_credential_id;

if (angular.isDefined(vm.catalogItemModel.retirement_dialog_id) && configData.retirement_dialog_id !== '') {
catalog_item['config_info']['retirement']['dialog_id'] = configData.retirement_dialog_id;
} else if (angular.isDefined(vm.catalogItemModel.retirement_dialog_name) && configData.retirement_dialog_name !== '')
catalog_item['config_info']['retirement']['new_dialog_name'] = configData.retirement_dialog_name;

return catalog_item;
}

Expand All @@ -241,7 +231,6 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
// list of service dialogs
API.get("/api/service_dialogs/?expand=resources&attributes=id,label&sort_by=label&sort_order=ascending").then(function(data) {
vm.dialogs = data.resources
vm._retirement_dialog = _.find(vm.dialogs, {id: vm.catalogItemModel.retirement_dialog_id});
vm._provisioning_dialog = _.find(vm.dialogs, {id: vm.catalogItemModel.provisioning_dialog_id});
})

Expand Down Expand Up @@ -453,7 +442,7 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
};

// watch for all the drop downs on screen
"catalog provisioning_playbook retirement_playbook provisioning_machine_credential retirement_machine_credential provisioning_network_credential retirement_network_credential provisioning_cloud_credential retirement_cloud_credential provisioning_dialog retirement_dialog".split(" ").forEach(idWatch)
"catalog provisioning_playbook retirement_playbook provisioning_machine_credential retirement_machine_credential provisioning_network_credential retirement_network_credential provisioning_cloud_credential retirement_cloud_credential provisioning_dialog".split(" ").forEach(idWatch)

function idWatch(name) {
field_name = "vm._" + name;
Expand Down Expand Up @@ -492,9 +481,6 @@ ManageIQ.angular.app.controller('catalogItemFormController', ['$scope', 'catalog
if (vm.retirement_cloud_type !== '')
$scope.cloudTypeChanged('retirement');
vm.catalogItemModel.retirement_inventory = vm.catalogItemModel.provisioning_inventory;
vm.catalogItemModel.retirement_dialog_existing = vm.catalogItemModel.provisioning_dialog_existing;
vm.catalogItemModel.retirement_dialog_id = vm.catalogItemModel.provisioning_dialog_id;
vm.catalogItemModel.retirement_dialog_name = vm.catalogItemModel.provisioning_dialog_name;
vm.catalogItemModel.retirement_key = '';
vm.catalogItemModel.retirement_value = '';
vm.catalogItemModel.retirement_variables = angular.copy(vm.catalogItemModel.provisioning_variables);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ManageIQ.angular.app.controller('cloudVolumeFormController', ['$scope', 'cloudVolumeFormId', 'miqService', 'API', function($scope, cloudVolumeFormId, miqService, API) {
ManageIQ.angular.app.controller('cloudVolumeFormController', ['$scope', 'miqService', 'API', 'cloudVolumeFormId', 'storageManagerId', function($scope, miqService, API, cloudVolumeFormId, storageManagerId) {
var init = function() {
$scope.cloudVolumeModel = {
aws_encryption: false,
Expand Down Expand Up @@ -27,6 +27,11 @@ ManageIQ.angular.app.controller('cloudVolumeFormController', ['$scope', 'cloudVo
.then(getCloudVolumeFormDataComplete)
.catch(miqService.handleFailure);
}

if (storageManagerId) {
$scope.cloudVolumeModel.storage_manager_id = storageManagerId;
$scope.storageManagerChanged(storageManagerId);
}
};

function getCloudVolumeFormDataComplete(data) {
Expand Down
1 change: 0 additions & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,6 @@ def fetch_playbook_details
playbook_details[:retirement][:machine_credential] = ManageIQ::Providers::EmbeddedAnsible::AutomationManager::MachineCredential.find_by(:id => retirement[:credential_id]).name
playbook_details[:retirement][:network_credential] = ManageIQ::Providers::EmbeddedAnsible::AutomationManager::NetworkCredential.find_by(:id => retirement[:network_credential_id]).name if retirement[:network_credential_id]
playbook_details[:retirement][:cloud_credential] = ManageIQ::Providers::EmbeddedAnsible::AutomationManager::CloudCredential.find_by(:id => retirement[:cloud_credential_id]).name if retirement[:cloud_credential_id]
fetch_dialog(playbook_details, retirement[:dialog_id], :retirement)
end
end
playbook_details
Expand Down
14 changes: 9 additions & 5 deletions app/controllers/cloud_volume_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,13 @@ def new
@volume = CloudVolume.new
@in_a_form = true
@storage_manager_choices = {}
ExtManagementSystem.all.each { |ems| @storage_manager_choices[ems.name] = ems.id if ems.supports_block_storage? }
if params[:storage_manager_id]
@storage_manager_id = params[:storage_manager_id]
ems = find_by_id_filtered(ExtManagementSystem, @storage_manager_id)
@storage_manager_choices[ems.name] = ems.id
else
ExtManagementSystem.all.each { |ems| @storage_manager_choices[ems.name] = ems.id if ems.supports_block_storage? }
end
drop_breadcrumb(
:name => _("Add New %{model}") % {:model => ui_lookup(:table => 'cloud_volume')},
:url => "/cloud_volume/new"
Expand All @@ -281,8 +287,7 @@ def create
assert_privileges("cloud_volume_new")
case params[:button]
when "cancel"
javascript_redirect :action => 'show_list',
:flash_msg => _("Add of new %{model} was cancelled by the user") % {:model => ui_lookup(:table => 'cloud_volume')}
cancel_action(_("Add of new %{model} was cancelled by the user") % {:model => ui_lookup(:table => 'cloud_volume')})

when "add"
@volume = CloudVolume.new
Expand Down Expand Up @@ -337,11 +342,10 @@ def create_finished
}, :error)
end

@breadcrumbs.pop if @breadcrumbs
session[:edit] = nil
session[:flash_msgs] = @flash_array.dup if @flash_array

javascript_redirect :action => "show_list"
javascript_redirect previous_breadcrumb_url
end

def edit
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/ems_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ def button
javascript_redirect :controller => "host_aggregate", :action => "edit", :id => find_checked_items[0]
elsif params[:pressed] == "cloud_tenant_edit"
javascript_redirect :controller => "cloud_tenant", :action => "edit", :id => find_checked_items[0]
elsif params[:pressed] == "cloud_volume_new"
javascript_redirect :controller => "cloud_volume", :action => "new", :storage_manager_id => params[:id]
elsif params[:pressed] == "cloud_volume_edit"
javascript_redirect :controller => "cloud_volume", :action => "edit", :id => find_checked_items[0]
elsif params[:pressed].ends_with?("_edit") || ["#{pfx}_miq_request_new", "#{pfx}_clone",
Expand Down
13 changes: 13 additions & 0 deletions app/helpers/application_helper/button/cloud_network_new.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class ApplicationHelper::Button::CloudNetworkNew < ApplicationHelper::Button::ButtonNewDiscover
def calculate_properties
super
if disabled?
self[:title] = _("No cloud providers support creating cloud networks.")
end
end

# disable button if no active providers support create action
def disabled?
EmsNetwork.all.none? { |ems| CloudNetwork.class_by_ems(ems).supports_create? }
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module ApplicationHelper::Button::Mixins::SubListViewScreenMixin
def sub_list_view_screen?
@lastaction == 'show' && !@display.in?(%w(main vms instances all_vms))
@lastaction == 'show' && !@display.in?(%w(main vms instances all_vms cloud_volumes))
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ class ApplicationHelper::Toolbar::CloudNetworkCenter < ApplicationHelper::Toolba
'pficon pficon-edit fa-lg',
t = N_('Edit this Cloud Network'),
t,
:url_parms => 'main_div'),
:url_parms => 'main_div',
:klass => ApplicationHelper::Button::GenericFeatureButtonWithDisable,
:options => {:feature => :update}
),
button(
:cloud_network_delete,
'pficon pficon-delete fa-lg',
t = N_('Delete this Cloud Network'),
t,
:url_parms => 'main_div',
:confirm => N_('Warning: This Cloud Network and ALL of its components will be removed!')
:confirm => N_('Warning: This Cloud Network and ALL of its components will be removed!'),
:klass => ApplicationHelper::Button::GenericFeatureButtonWithDisable,
:options => {:feature => :delete}
)
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class ApplicationHelper::Toolbar::CloudNetworksCenter < ApplicationHelper::Toolb
'pficon pficon-add-circle-o fa-lg',
t = N_('Add a new Cloud Network'),
t,
:klass => ApplicationHelper::Button::ButtonNewDiscover),
:klass => ApplicationHelper::Button::CloudNetworkNew
),
separator,
# TODO: Restore when cross controllers show_list issue fully in place
# https://github.com/ManageIQ/manageiq/pull/12551
Expand Down
14 changes: 0 additions & 14 deletions app/views/catalog/_sandt_tree_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -321,20 +321,6 @@
= h(key)
%td
= h(value)
.form-group
%label.col-md-3.control-label
= _('Dialog')
.col-md-9
- if retirement[:dialog]
- if role_allows?(:feature => "dialog_accord", :any => true)
- params = {:controller => 'miq_ae_customization', :action => 'show', :id => "dg-#{to_cid(retirement[:dialog_id])}"}
= link_to(retirement[:dialog],
params,
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
:title => retirement[:dialog])
- else
= h(retirement[:dialog])
:javascript
miq_tabs_init("#st_tabs");
Expand Down
4 changes: 3 additions & 1 deletion app/views/cloud_volume/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
= _('Storage Manager')
.col-md-8
= select_tag("storage_manager_id",
options_for_select([["<#{_('Choose')}>", nil]] + @storage_manager_choices.sort, disabled: ["<#{_('Choose')}>", nil]),
options_for_select((@storage_manager_id.nil? ? [["<#{_('Choose')}>", nil]] : []) + @storage_manager_choices.sort, disabled: ["<#{_('Choose')}>", nil]),
"ng-model" => "cloudVolumeModel.storage_manager_id",
"ng-change" => "storageManagerChanged(cloudVolumeModel.storage_manager_id)",
"required" => "",
"disabled" => !@storage_manager_id.nil?,
:checkchange => true,
"selectpicker-for-select-tag" => "")
%span.help-block{"ng-show" => "angularForm.storage_manager_id.$error.required"}
Expand Down Expand Up @@ -87,4 +88,5 @@
:javascript
ManageIQ.angular.app.value('cloudVolumeFormId', '#{@volume.id || "new"}');
ManageIQ.angular.app.value('storageManagerId', '#{@storage_manager_id}');
miq_bootstrap('#form_div');
69 changes: 35 additions & 34 deletions app/views/layouts/angular/_ansible_form_options_angular.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -188,38 +188,39 @@
%button{:class => "btn btn-link", :type => "button", "ng-click" => "vm.removeKeyValue('#{prefix}', this.key, this.key_value, $index)", "ng-disabled" => "#{ng_model}.#{prefix}_editMode"}
%span{:class => "pficon pficon-delete"}

.form-group
%label.col-md-3.control-label
= _("Dialog")
.col-md-3
%label.radio-inline
%input{"ng-model" => "vm.#{prefix}_dialog_existing", :type => "radio", :value => "existing", "ng-click" => "vm.toggleDialogSelection('#{prefix}', 'existing')", "ng-checked" => "#{ng_model}.#{prefix}_dialog_existing == 'existing'"}
= _("Use Existing")
.col-md-6{"ng-class" => "{'has-error': angularForm.#{prefix}_dialog_id.$invalid}", "ng-if" => "#{ng_model}.#{prefix}_dialog_existing == 'existing'"}
%select{"ng-model" => "vm._#{prefix}_dialog",
"name" => "#{prefix}_dialog_id",
'ng-options' => 'dialog as dialog.label for dialog in vm.dialogs',
"ng-required" => "vm.fieldsRequired('#{prefix}') && #{ng_model}.#{prefix}_dialog_existing == 'existing'",
:checkchange => true,
"data-live-search" => "true",
'pf-select' => true}
%option{"value" => ""}
= "<#{_('Choose')}>"
%span.help-block{"ng-show" => "angularForm.#{prefix}_dialog_id.$error.$invalid"}
= _("Required")
- if prefix == "provisioning"
.form-group
%label.col-md-3.control-label
= _("Dialog")
.col-md-3
%label.radio-inline
%input{"ng-model" => "vm.#{prefix}_dialog_existing", :type => "radio", :value => "existing", "ng-click" => "vm.toggleDialogSelection('#{prefix}', 'existing')", "ng-checked" => "#{ng_model}.#{prefix}_dialog_existing == 'existing'"}
= _("Use Existing")
.col-md-6{"ng-class" => "{'has-error': angularForm.#{prefix}_dialog_id.$invalid}", "ng-if" => "#{ng_model}.#{prefix}_dialog_existing == 'existing'"}
%select{"ng-model" => "vm._#{prefix}_dialog",
"name" => "#{prefix}_dialog_id",
'ng-options' => 'dialog as dialog.label for dialog in vm.dialogs',
"ng-required" => "vm.fieldsRequired('#{prefix}') && #{ng_model}.#{prefix}_dialog_existing == 'existing'",
:checkchange => true,
"data-live-search" => "true",
'pf-select' => true}
%option{"value" => ""}
= "<#{_('Choose')}>"
%span.help-block{"ng-show" => "angularForm.#{prefix}_dialog_id.$error.$invalid"}
= _("Required")

.form-group
%label.col-md-3.control-label
.col-md-3
%label.radio-inline
%input{"ng-model" => "vm.#{prefix}_dialog_existing", :type => "radio", :value => "create", "ng-click" => "vm.toggleDialogSelection('#{prefix}', 'create')", "ng-checked" => ("#{ng_model}.#{prefix}_dialog_existing == 'create'")}
= _("Create New")
.col-md-6{"ng-class" => "{'has-error': angularForm.#{prefix}_dialog_name.$invalid}", "ng-if" => "#{ng_model}.#{prefix}_dialog_existing == 'create'"}
%input.form-control{:type => "text",
'ng-model' => "#{ng_model}.#{prefix}_dialog_name",
:name => "vm.#{prefix}_dialog_name",
:maxlength => 50,
"ng-required" => "vm.fieldsRequired('#{prefix}') && #{ng_model}.#{prefix}_dialog_existing == 'create'",
"checkchange" => ""}
%span.help-block{"ng-show" => "angularForm.#{prefix}_dialog_name.$error.$invalid"}
= _("Required")
.form-group
%label.col-md-3.control-label
.col-md-3
%label.radio-inline
%input{"ng-model" => "vm.#{prefix}_dialog_existing", :type => "radio", :value => "create", "ng-click" => "vm.toggleDialogSelection('#{prefix}', 'create')", "ng-checked" => ("#{ng_model}.#{prefix}_dialog_existing == 'create'")}
= _("Create New")
.col-md-6{"ng-class" => "{'has-error': angularForm.#{prefix}_dialog_name.$invalid}", "ng-if" => "#{ng_model}.#{prefix}_dialog_existing == 'create'"}
%input.form-control{:type => "text",
'ng-model' => "#{ng_model}.#{prefix}_dialog_name",
:name => "vm.#{prefix}_dialog_name",
:maxlength => 50,
"ng-required" => "vm.fieldsRequired('#{prefix}') && #{ng_model}.#{prefix}_dialog_existing == 'create'",
"checkchange" => ""}
%span.help-block{"ng-show" => "angularForm.#{prefix}_dialog_name.$error.$invalid"}
= _("Required")
7 changes: 2 additions & 5 deletions spec/controllers/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,7 @@
:hosts => 'many',
:credential_id => auth.id,
:repository_id => repository.id,
:playbook_id => playbook.id,
:dialog_id => dialog.id
:playbook_id => playbook.id
}
}
}
Expand All @@ -794,9 +793,7 @@
:remove_resources => nil,
:repository => repository.name,
:playbook => playbook.name,
:machine_credential => auth.name,
:dialog => "Some Label",
:dialog_id => dialog.id
:machine_credential => auth.name
}
}
expect(playbook_details).to eq(st_details)
Expand Down
Loading

0 comments on commit d3df71e

Please sign in to comment.