Skip to content

Commit

Permalink
Merge pull request #5973 from PanSpagetka/add-ownership-keypair
Browse files Browse the repository at this point in the history
  • Loading branch information
h-kataria authored and simaishi committed Aug 15, 2019
1 parent 3cad7fe commit f0b1b50
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/auth_key_pair_cloud_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class AuthKeyPairCloudController < ApplicationController
include Mixins::GenericSessionMixin
include Mixins::GenericButtonMixin
include Mixins::BreadcrumbsMixin
include Mixins::CheckedIdMixin
include Mixins::Actions::VmActions::Ownership

def self.display_methods
%w[instances]
Expand Down Expand Up @@ -38,6 +40,10 @@ def specific_buttons(pressed)
when 'auth_key_pair_cloud_new'
javascript_redirect(:action => 'new')
true
when 'auth_key_pair_ownership'
@ownershipitems = find_records_with_rbac(ManageIQ::Providers::CloudManager::AuthKeyPair, checked_or_params)
javascript_redirect(:action => 'ownership', :rec_ids => @ownershipitems.map(&:id))
true
end
end

Expand Down Expand Up @@ -206,7 +212,7 @@ def process_deletions(key_pairs)
private

def textual_group_list
[%i[properties relationships], %i[tags]]
[%i[properties relationships lifecycle], %i[tags]]
end
helper_method :textual_group_list

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/mixins/actions/vm_actions/ownership.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def get_class_from_controller_param(controller)
VmOrTemplate
when "miq_template"
MiqTemplate
when "auth_key_pair_cloud"
ManageIQ::Providers::CloudManager::AuthKeyPair
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ class ApplicationHelper::Toolbar::AuthKeyPairCloudCenter < ApplicationHelper::To
t,
:url_parms => "&refresh=y",
:confirm => N_("Warning: The selected Key Pair and ALL of its components will be permanently removed!")),
button(
:auth_key_pair_ownership,
'pficon pficon-user fa-lg',
N_('Set Ownership for the selected items'),
N_('Set Ownership'),
:klass => ApplicationHelper::Button::SetOwnership),
button(
:auth_key_pair_cloud_download,
'pficon pficon-save fa-lg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ class ApplicationHelper::Toolbar::AuthKeyPairCloudsCenter < ApplicationHelper::T
t,
:klass => ApplicationHelper::Button::AuthKeyPairCloudCreate),
separator,
button(
:auth_key_pair_ownership,
'pficon pficon-user fa-lg',
N_('Set Ownership for the selected items'),
N_('Set Ownership'),
:url_parms => "main_div",
:send_checked => true,
:enabled => false,
:onwhen => "1+"),
button(
:auth_key_pair_cloud_delete,
'pficon pficon-delete fa-lg',
Expand Down
15 changes: 15 additions & 0 deletions app/helpers/auth_key_pair_cloud_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,19 @@ def textual_vms
end
h
end

def textual_group_lifecycle
TextualGroup.new(
_("Lifecycle"),
%i[owner group]
)
end

def textual_owner
@record.evm_owner.try(:name)
end

def textual_group
{:label => _("Group"), :value => @record.miq_group.try(:description)}
end
end
2 changes: 2 additions & 0 deletions app/views/auth_key_pair_cloud/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
- if @display == 'instances'
= render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"}
- elsif @ownershipitems
= render :partial => "shared/views/ownership"
- elsif @showtype == 'main'
= render :partial => "layouts/textual_groups_generic"
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
tag_edit_form_field_changed
ems_form_choices
download_private_key
ownership
) +
compare_get,
:post => %w(
Expand All @@ -145,6 +146,8 @@
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
ownership_form_fields
ownership_update
protect
quick_search
sections_field_changed
Expand Down

0 comments on commit f0b1b50

Please sign in to comment.