-
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
Toolbar refactoring: Ops #417
Merged
+257
−157
Merged
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2b51370
Create mixin with methods that determine the active tree and tab
9af4dce
Refactor schedule_run_now button in Ops
630cc05
Refactor buttons in ops' diagnostics tree
af8a4e2
Edit GenericFeatureButton's feature retrieval
c4d4d2b
Refactor buttons in ops' rbac_tree
b277753
Refactor buttons in ops' vmdb_tree
34ea18f
Remove #hide_button_ops method
f38754d
Review response: Simplify rbac_tree button assignements
5587124
Review response: Rollback changes done to TenantEdit class and its un…
b318fc7
Review response: Add icon to schedule_run_now button
e87b26f
Review response: Set ScheduleRunNow parent to Basic
164ce76
Assign reload_server_tree button to its class
0cd906f
Review response: Rollback GenericFeatureButton#initialize implementation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
app/helpers/application_helper/button/mixins/active_context_mixin.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
def active_tree?(tree) | ||
if tree.kind_of?(Array) | ||
tree.include?(@view_context.x_active_tree) | ||
else | ||
tree == @view_context.x_active_tree | ||
end | ||
end | ||
|
||
def active_tab?(tab) | ||
if tab.kind_of?(Array) | ||
tab.include?(@view_context.active_tab) | ||
else | ||
tab == @view_context.active_tab | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::ScheduleRunNow < ApplicationHelper::Button::ButtonWithoutRbacCheck | ||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tree?(:settings_tree) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,8 @@ class ApplicationHelper::Toolbar::MiqScheduleCenter < ApplicationHelper::Toolbar | |
:schedule_run_now, | ||
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.
|
||
'collect', | ||
t = N_('Queue up this Schedule to run now'), | ||
t), | ||
t, | ||
:klass => ApplicationHelper::Button::ScheduleRunNow), | ||
] | ||
), | ||
]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
spec/helpers/application_helper/buttons/schedule_run_now_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe ApplicationHelper::Button::ScheduleRunNow do | ||
let(:view_context) { setup_view_context_with_sandbox(:active_tree => tree) } | ||
let(:button) { described_class.new(view_context, {}, {}, {}) } | ||
|
||
describe '#visible?' do | ||
subject { button.visible? } | ||
context 'when active_tree != settings_tree' do | ||
let(:tree) { :not_settings_tree } | ||
it { expect(subject).to be_falsey } | ||
end | ||
context 'when active_tree == settings_tree' do | ||
let(:tree) { :settings_tree } | ||
it { expect(subject).to be_truthy } | ||
end | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@vecerek Hm, i know I've suggested to use
ButtonWithoutRbacCheck
class, but now, when I'm trying the button, I'm getting back error message:So, the buttons parent class probably should be
Basic
, as it was apparently disabled for me for a reason, and the only strange thing to me, is that the OOTBadmin
user does not have rights to use this feature.Seems like other issue to me.
cc/ @dclarizio