-
Notifications
You must be signed in to change notification settings - Fork 144
Added create orchestration template service dialog action. #596
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
Conversation
2862096 to
f67954b
Compare
36560e6 to
64d2c9a
Compare
b90e6b4 to
e5f9155
Compare
e5f9155 to
be28a43
Compare
be28a43 to
7467580
Compare
4843599 to
546910f
Compare
|
Ping @lpichler |
|
|
||
| def validate_orchestration_template_dialog_create_data(data) | ||
| bad_attrs = [] | ||
| ORCHESTRATION_TEMPLATE_DIALOG_REQUIRED_ATTRS.each { |attr| bad_attrs << attr if data[attr].blank? } |
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.
@Hyperkid123
maybe rename bad_attrs to missing_attributes ? and then do:
missing_attributes = ORCHESTRATION_TEMPLATE_DIALOG_REQUIRED_ATTRS - data.keyswhat do you think ?
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.
and think you need to check that in data are just ORCHESTRATION_TEMPLATE_DIALOG_REQUIRED_ATTRS keys, right ?
so you can do in addition
invalid_attributes = data.keys - ORCHESTRATION_TEMPLATE_DIALOG_REQUIRED_ATTRS
raise BadRequestError if invalid_attributes.present?
| before_action :set_additional_attributes, :only => [:index, :show] | ||
|
|
||
| CONTENT_PARAMS = %w[target_type target_id resource_action_id].freeze | ||
| ORCHESTRATION_TEMPLATE_DIALOG_REQUIRED_ATTRS = %w[ot_id label].freeze |
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.
probably enough is ORCHESTRATION_TEMPLATE_DIALOG_ATTRIBUTES (without REQUIRED)
|
|
||
| def orchestration_template_service_dialog_resource(_type, _id, data) | ||
| validate_orchestration_template_dialog_create_data(data) | ||
| ot = OrchestrationTemplate.find(data['ot_id']) |
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.
what if ot is nil (not exist in DB)
I think we need to cover it by some error message.
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.
ot it would be nice to use orchestration_template variable.
e11ed9e to
c5b0c80
Compare
c5b0c80 to
e9ca325
Compare
|
Checked commit Hyperkid123@e9ca325 with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
|
thanks @Hyperkid123 👍 |
Action for creating service dialog from orchestration template. Part of an effort of refactoring orchestration dialog forms. Based on current implementation in ui classic which this should eventually replace.
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/catalog_controller.rb#L1108