Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Set Ownership to Key Pairs #5973

Merged
merged 2 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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