Skip to content

Commit

Permalink
Fixed Service Reconfigure Form and Request Summary Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidResende0 committed Nov 2, 2023
1 parent b18bc9b commit 486083e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
14 changes: 9 additions & 5 deletions app/controllers/service_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def button
service_retire
when 'service_retire_now'
service_retire_now
when 'service_reconfigure'
javascript_redirect(:action => 'service_reconfigure', :id => params[:id])
end
end

Expand Down Expand Up @@ -60,16 +62,18 @@ def edit
checked[0] = params[:id] if checked.blank? && params[:id]
@service = find_record_with_rbac(Service, checked[0])
@in_a_form = true
drop_breadcrumb(:name => _("Edit Service\"%{name}\"") % {:name => @service.name}, :url => "/service/edit/#{@service.id}")
drop_breadcrumb(:name => _("Edit Service \"%{name}\"") % {:name => @service.name}, :url => "/service/edit/#{@service.id}")
end

def service_reconfigure
service = Service.find_by(:id => params[:id])
assert_privileges('service_reconfigure')

service = find_record_with_rbac(Service, params[:id])
service_template = service.service_template
resource_action = service_template.resource_actions.find_by(:action => 'Reconfigure') if service_template

@right_cell_text = _("Reconfigure Service \"%{name}\"") % {:name => service.name}
dialog_locals = {:resource_action_id => resource_action.id, :target_id => service.id}
@dialog_locals = {:resource_action_id => resource_action.id, :target_id => service.id}
@in_a_form = true
drop_breadcrumb(:name => _("Reconfigure Service \"%{name}\"") % {:name => service.name}, :url => "/service/service_reconfigure/#{service.id}")
end

def service_form_fields
Expand Down
25 changes: 22 additions & 3 deletions app/views/miq_request/_service_reconfigure_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,30 @@
- ra = st.resource_actions.find_by_action('Reconfigure') if st
- if ra && ra.dialog
- values = @miq_request.options[:dialog]
- opts = {}
- opts = {:reconfigure => true}
- wf = ResourceActionWorkflow.new(values, current_user, ra, opts)
%fieldset
%h3
= _("Dialog Options")
.row
.col-md-12.col-lg-12
= render :partial => "shared/dialogs/dialog_provision",
:locals => {:wf => ResourceActionWorkflow.new(values, current_user, ra, opts)}
#dialog_tabs
%ul.nav.nav-tabs{'role' => 'tablist'}
- wf.dialog.dialog_tabs.each_with_index do |tab, tab_index|
- options = tab_index == 0 ? {:class => "active"} : {}
= miq_tab_header(tab.id, nil, options) do
= _(tab.label)
.tab-content
- wf.dialog.dialog_tabs.each_with_index do |tab, tab_index|
- options = tab_index == 0 ? {:class => "active"} : {}
= miq_tab_content(tab.id, nil, options) do
- tab.dialog_groups.each do |group|
%div{:id => "group_#{group.id}_div"}
%h3{:title => "#{group.description}"}
= _(group.label)
- unless group.dialog_fields.empty?
.form-horizontal
- group.dialog_fields.each do |field|
= render :partial => "miq_request/request_dialog_details",
:locals => {:wf => wf, :field => field}
%hr
1 change: 1 addition & 0 deletions app/views/service/service_reconfigure.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= render :partial => "shared/dialogs/reconfigure_dialog"
4 changes: 2 additions & 2 deletions app/views/shared/dialogs/_reconfigure_dialog.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
'on-click' => "vm.cancelClicked($event)"}
:javascript
ManageIQ.angular.app.value('resourceActionId', '#{resource_action_id}');
ManageIQ.angular.app.value('targetId', '#{target_id}');
ManageIQ.angular.app.value('resourceActionId', '#{@dialog_locals[:resource_action_id]}');
ManageIQ.angular.app.value('targetId', '#{@dialog_locals[:target_id]}');
miq_bootstrap('.wrapper');
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2777,6 +2777,7 @@
:get => %w(
dialog_load
download_data
service_reconfigure
reconfigure_form_fields
retire
button
Expand Down

0 comments on commit 486083e

Please sign in to comment.