-
Notifications
You must be signed in to change notification settings - Fork 356
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
Physical server page #970
Physical server page #970
Changes from 1 commit
ca99b62
95edeb1
0ef30c0
d60cc0a
3c0e12f
8affee9
aa60337
92c7549
4feb863
7142a11
bef6016
471a4e2
fb91056
ea20828
0a3a4a3
4b2916a
7bb757a
7ad7e4b
019c7f4
fefe826
4d82e5d
5c0ef75
dc082d9
6d646bc
26de5af
4b08d75
87c39e4
f3c5a59
f069e05
19d23a1
f3f6bdc
9b82528
7e836c4
762d426
3f36681
8adb93b
301bb36
1c139d0
017ae3f
088fb68
0fc2547
4bfd07a
462f14f
13ee483
420a230
ee96de7
6e61f01
fd8c51e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,13 +44,6 @@ def set_ownership | |
if @explorer | ||
@sb[:explorer] = true | ||
ownership(ownership_items) | ||
if @ownershipitems.empty? | ||
add_flash(_('None of the selected items allow ownership changes'), :error) | ||
|
||
@refresh_div = "flash_msg_div" | ||
@refresh_partial = "layouts/flash_msg" | ||
return | ||
end | ||
else | ||
if role_allows?(:feature => "vm_ownership") | ||
drop_breadcrumb(:name => _("Set Ownership"), :url => "/vm_common/ownership") | ||
|
@@ -60,7 +53,6 @@ def set_ownership | |
end | ||
end | ||
end | ||
|
||
alias_method :image_ownership, :set_ownership | ||
alias_method :instance_ownership, :set_ownership | ||
alias_method :vm_ownership, :set_ownership | ||
|
@@ -84,7 +76,6 @@ def ownership(ownership_items = []) | |
drop_breadcrumb(:name => _("Set Ownership"), :url => "/vm_common/ownership") | ||
ownership_items = params[:rec_ids] if params[:rec_ids] | ||
build_ownership_info(ownership_items) | ||
return if @ownershipitems.empty? | ||
build_targets_hash(@ownershipitems) | ||
if @sb[:explorer] | ||
@refresh_partial = "shared/views/ownership" | ||
|
@@ -108,10 +99,8 @@ def build_ownership_info(ownership_items) | |
Rbac.filtered(MiqGroup.non_tenant_groups).each { |g| @groups[g.description] = g.id.to_s } | ||
|
||
@user = @group = DONT_CHANGE_OWNER if ownership_items.length > 1 | ||
ownership_scope = klass.where(:id => ownership_items) | ||
ownership_scope = ownership_scope.with_ownership if klass.respond_to?(:with_ownership) | ||
@origin_ownership_items = ownership_items | ||
@ownershipitems = ownership_scope.order(:name) | ||
|
||
@ownershipitems = klass.find(ownership_items).sort_by(&:name) | ||
@view = get_db_view(klass == VmOrTemplate ? Vm : klass) # Instantiate the MIQ Report view object | ||
@view.table = MiqFilter.records2table(@ownershipitems, @view.cols + ['id']) | ||
end | ||
|
@@ -127,18 +116,11 @@ def build_ownership_hash(ownership_items) | |
@group = group ? group.id.to_s : nil | ||
Rbac.filtered(MiqGroup).each { |g| @groups[g.description] = g.id.to_s } | ||
@user = @group = DONT_CHANGE_OWNER if ownership_items.length > 1 | ||
@ownershipitems = Rbac.filtered(klass.where(:id => ownership_items).order(:name), :class => klass) | ||
raise _('Invalid items passed') unless @ownershipitems.pluck(:id).to_set == ownership_items.map(&:to_i).to_set | ||
@ownershipitems = klass.find(ownership_items).sort_by(&:name) | ||
{:user => @user, | ||
:group => @group} | ||
end | ||
|
||
def valid_items_for(klass, param_ids) | ||
scope = klass.respond_to?(:with_ownership) ? klass.with_ownership : klass | ||
checked_ids = Rbac.filtered(scope.where(:id => param_ids)).pluck(:id) | ||
checked_ids.to_set == param_ids.to_set | ||
end | ||
|
||
def ownership_update | ||
case params[:button] | ||
when "cancel" | ||
|
@@ -169,10 +151,7 @@ def ownership_update | |
end | ||
|
||
klass = get_class_from_controller_param(request.parameters[:controller]) | ||
param_ids = params[:objectIds].map(&:to_i) | ||
raise _('Invalid items selected.') unless valid_items_for(klass, param_ids) | ||
|
||
result = klass.set_ownership(param_ids, opts) | ||
result = klass.set_ownership(params[:objectIds].map(&:to_i), opts) | ||
unless result == true | ||
result["missing_ids"].each { |msg| add_flash(msg, :error) } if result["missing_ids"] | ||
result["error_updating"].each { |msg| add_flash(msg, :error) } if result["error_updating"] | ||
|
@@ -208,7 +187,7 @@ def ownership_update | |
# Retire 1 or more VMs | ||
def retirevms | ||
assert_privileges(params[:pressed]) | ||
vms = find_checked_items_with_rbac(VmOrTemplate) | ||
vms = find_checked_items | ||
if !%w(orchestration_stack service).include?(request.parameters["controller"]) && !%w(orchestration_stacks).include?(params[:display]) && | ||
VmOrTemplate.find(vms).any? { |vm| !vm.supports_retire? } | ||
add_flash(_("Set Retirement Date does not apply to selected %{model}") % | ||
|
@@ -1873,20 +1852,13 @@ def process_cloud_object_storage_buttons(pressed) | |
end | ||
|
||
def cloud_object_store_button_operation(klass, task) | ||
# Map to instance method name | ||
case task | ||
when "delete" | ||
method = "#{task}_#{klass.name.underscore.to_sym}" | ||
display_name = _(task.capitalize) | ||
else | ||
display_name = _(task.capitalize) | ||
method = task = "#{klass.name.underscore.to_sym}_#{task}" | ||
end | ||
method = "#{task}_#{klass.name.underscore.to_sym}" | ||
display_name = _(task.capitalize) | ||
|
||
items = [] | ||
|
||
# Either a list or coming from a different controller | ||
if @lastaction == "show_list" || %w(cloud_object_store_containers cloud_object_store_objects).include?(@display) | ||
if @lastaction == "show_list" || !%w(cloud_object_store_container).include?(request.parameters["controller"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of making these changes here in |
||
items = find_checked_items | ||
if items.empty? | ||
add_flash(_("No %{model} were selected for %{task}") % | ||
|
@@ -1920,11 +1892,9 @@ def get_rec_cls | |
when "service" | ||
return Service | ||
when "cloud_object_store_container" | ||
params[:pressed].starts_with?("cloud_object_store_object") ? CloudObjectStoreObject : CloudObjectStoreContainer | ||
when "cloud_object_store_object" | ||
CloudObjectStoreObject | ||
CloudObjectStoreContainer | ||
when "ems_storage" | ||
params[:pressed].starts_with?("cloud_object_store_object") ? CloudObjectStoreObject : CloudObjectStoreContainer | ||
CloudObjectStoreContainer | ||
else | ||
return VmOrTemplate | ||
end | ||
|
@@ -1944,9 +1914,6 @@ def process_objects(objs, task, display_name = nil) | |
when "CloudObjectStoreContainer" | ||
objs, _objs_out_reg = filter_ids_in_region(objs, "CloudObjectStoreContainer") | ||
klass = CloudObjectStoreContainer | ||
when "CloudObjectStoreObject" | ||
objs, _objs_out_reg = filter_ids_in_region(objs, "CloudObjectStoreObject") | ||
klass = CloudObjectStoreObject | ||
end | ||
|
||
assert_rbac(current_user, get_rec_cls, objs) | ||
|
@@ -2511,6 +2478,18 @@ def refreshhosts | |
host_button_operation('refresh_ems', _('Refresh')) | ||
end | ||
|
||
def refreshphysicalservers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. |
||
#TODO refresh physical servers | ||
end | ||
|
||
def deletephysicalservers | ||
#TODO delete physical servers | ||
end | ||
|
||
def editphysicalservers | ||
#TODO edit physical servers | ||
end | ||
|
||
# Scan all selected or single displayed host(s) | ||
def scanhosts | ||
assert_privileges("host_scan") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was the
rbac
call replaced with the non-rbac one?