-
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
Changes from 5 commits
2b51370
9af4dce
630cc05
af8a4e2
c4d4d2b
b277753
34ea18f
f38754d
5587124
b318fc7
e87b26f
164ce76
0cd906f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::DiagnosticsAuditLogs < ApplicationHelper::Button::Basic | ||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tree?(:diagnostics_tree) && active_tab?('diagnostics_audit_log') | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::DiagnosticsEvmLogs < ApplicationHelper::Button::Basic | ||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tree?(:diagnostics_tree) && active_tab?('diagnostics_evm_log') | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::DiagnosticsLogs < ApplicationHelper::Button::CollectLogs | ||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tree?(:diagnostics_tree) && active_tab?('diagnostics_collect_logs') | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::DiagnosticsProductionLogs < ApplicationHelper::Button::Basic | ||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tree?(:diagnostics_tree) && active_tab?('diagnostics_production_log') | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::DiagnosticsSummary < ApplicationHelper::Button::Basic | ||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tree?(:diagnostics_tree) && active_tab?('diagnostics_summary') | ||
end | ||
end |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class ApplicationHelper::Button::RbacCommonFeatureButton < ApplicationHelper::Button::GenericFeatureButton | ||
delegate :rbac_common_feature_for_buttons, :to => :@view_context | ||
|
||
def role_allows_feature? | ||
role_allows?(:feature => rbac_common_feature_for_buttons(@feature)) | ||
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. @vecerek I was pretty confused at this point, because you check availability of a After explanation, I've understood, that's why you've changed Isn't it better to use /cc @PanSpagetka 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. I agree that it look confusing when you have button named |
||
end | ||
|
||
def visible? | ||
true | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class ApplicationHelper::Button::RefreshWorkers < ApplicationHelper::Button::Basic | ||
needs :@record, :@sb | ||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
@view_context.x_active_tree == :diagnostics_tree && @sb[:active_tab] == 'diagnostics_workers' | ||
active_tree?(:diagnostics_tree) && active_tab?('diagnostics_workers') | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::ReloadServerTree < ApplicationHelper::Button::Basic | ||
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. No button has been assigned to this class. The assignment needs to be added. /cc @romanblanco 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. @romanblanco just pushed the changes, could you check it in UI, please? |
||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tree?(:diagnostics_tree) && active_tab?(%w(diagnostics_roles_servers diagnostics_servers_roles)) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::ScheduleRunNow < ApplicationHelper::Button::ButtonWithoutRbacCheck | ||
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. @vecerek Hm, i know I've suggested to use So, the buttons parent class probably should be Seems like other issue to me. cc/ @dclarizio |
||
include ApplicationHelper::Button::Mixins::ActiveContextMixin | ||
|
||
def visible? | ||
active_tree?(:settings_tree) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
class ApplicationHelper::Button::TenantAdd < ApplicationHelper::Button::GenericFeatureButton | ||
class ApplicationHelper::Button::TenantAdd < ApplicationHelper::Button::RbacCommonFeatureButton | ||
needs :@record | ||
delegate :role_allows?, :rbac_common_feature_for_buttons, :to => :@view_context | ||
|
||
def role_allows_feature? | ||
role_allows?(:feature => rbac_common_feature_for_buttons(self[:child_id])) | ||
end | ||
|
||
def visible? | ||
true | ||
[email protected]? | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
class ApplicationHelper::Button::TenantEdit < ApplicationHelper::Button::Basic | ||
needs :@record | ||
|
||
class ApplicationHelper::Button::TenantEdit < ApplicationHelper::Button::RbacCommonFeatureButton | ||
def disabled? | ||
@record.source | ||
@record.try!(:source) | ||
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. There is no need to modify this class, because it is not needed to add this to summary toolbar. |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationHelper::Button::ZoneLogDepotEdit < ApplicationHelper::Button::DiagnosticsLogs | ||
def visible? | ||
return false if active_tree?(:diagnostics_tree) && | ||
(active_tab?('diagnostics_roles_servers') || active_tab?('diagnostics_servers_roles')) | ||
super | ||
end | ||
end |
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), | ||
] | ||
), | ||
]) | ||
|
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 Why not just