-
Notifications
You must be signed in to change notification settings - Fork 898
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
Update ::Button::OrchestrationTemplateEditRemove methods #11078
Update ::Button::OrchestrationTemplateEditRemove methods #11078
Conversation
def disabled? | ||
@record.in_use? | ||
end | ||
|
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.
should have
needs_record
?
806da26
to
274634c
Compare
end | ||
end | ||
end | ||
self[:title] = if self[:id] =~ /_edit$/ |
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.
@jzigmund I think this should be assigned to self[:title]
only if disabled?
returns true
. It seems to me that this could lead to a situation where you would have enabled button with label saying you can not do the operation.
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.
yep, good catch ;-)
274634c
to
8fbe42f
Compare
@miq-bot remove_label wip |
@martinpovolny @romanblanco please review |
@jzigmund can you address rubocop's issue? |
… and clean calculate_properties inside the button class
8fbe42f
to
070d601
Compare
@jzigmund @martinpovolny otherwise, code looks good to me 👍 |
Checked commits jzigmund/manageiq@c2ea53f~...070d601 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 |
Purpose or Intent
Updated already defined button class, used in Services/Catalogs/listnav 'Orchestration Templates'.
1st commit - Method
calculate_properties
in::Button::Basic
class is calling thedisabled?
so let the setting of the enable flag there, just calldisabled?
defined in the class. Also remove the code frombuild_toolbar_disable_button
in toolbar_builder.rb (that's the main goal of the refactoring).if @view_context.x_active_tree == :ot_tree && @record
is not needed as I found the buttons of the class generated inot_tree
only.@record
is checked before thecalculate_properties
method call.2nd commit - role_allows? will be solved in #10942
Marking the PR as WIP as it needs to have solved PR mentioned above.
Links
Parent issue: #6259