diff --git a/app/models/resource_action_workflow.rb b/app/models/resource_action_workflow.rb index 550ef80bf8c8..b0d276c5eac1 100644 --- a/app/models/resource_action_workflow.rb +++ b/app/models/resource_action_workflow.rb @@ -21,7 +21,8 @@ def initialize(values, requester, resource_action, options = {}) Vmdb::Deprecation.deprecate_methods(self, :dialogs => :dialog) - def submit_request + def submit_request(data) + update_dialog_field_values(data) if data.present? process_request(ServiceOrder::STATE_ORDERED) end @@ -29,6 +30,10 @@ def add_request_to_cart process_request(ServiceOrder::STATE_CART) end + def update_dialog_field_values(data) + @dialog.load_values_into_fields(data.values.first) + end + def process_request(state) result = {:errors => validate_dialog} return result unless result[:errors].blank? diff --git a/app/models/service_template.rb b/app/models/service_template.rb index a62826fc2605..73340dcd0e4e 100644 --- a/app/models/service_template.rb +++ b/app/models/service_template.rb @@ -417,7 +417,7 @@ def order(user_or_id, options = nil, request_options = nil, schedule_time = nil) ) {:schedule => schedule} else - workflow.submit_request + workflow.submit_request(data = nil) end end diff --git a/spec/models/resource_action_workflow_spec.rb b/spec/models/resource_action_workflow_spec.rb index eea11b8babe7..eb3d76e23516 100644 --- a/spec/models/resource_action_workflow_spec.rb +++ b/spec/models/resource_action_workflow_spec.rb @@ -69,7 +69,7 @@ :userid => admin.userid, :message => "Service Reconfigure requested by <#{admin.userid}> for Service:[#{target.id}]" ) - response = subject.submit_request + response = subject.submit_request(data = nil) expect(response).to include(:errors => []) end end @@ -86,7 +86,7 @@ expect_any_instance_of(ResourceAction).to receive(:deliver_to_automate_from_dialog).and_call_original expect(MiqAeEngine).to receive(:deliver_queue) # calls into automate expect(AuditEvent).not_to receive(:success) - response = subject.submit_request + response = subject.submit_request(data = nil) expect(response).to eq(:errors => []) end end @@ -103,7 +103,7 @@ expect(subject).not_to receive(:make_request) expect_any_instance_of(ResourceAction).to receive(:deliver_to_automate_from_dialog) - subject.submit_request + subject.submit_request(data = nil) end end end