-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt the changes suggested by @jzigmund
- Loading branch information
Attila Vecerek
committed
Oct 27, 2016
1 parent
0f79a50
commit 2797d55
Showing
2 changed files
with
19 additions
and
53 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,23 +1,7 @@ | ||
class ApplicationHelper::Button::RefreshWorkers < ApplicationHelper::Button::Basic | ||
needs :@record, :@lastaction, :@sb, :@layout | ||
needs :@record, :@sb | ||
|
||
def visible? | ||
return false if miq? && !(ops? && diagnostics_worker_tab?) | ||
return !%w(download_logs evm_logs audit_logs).include?(@lastaction) if @record.class == NilClass | ||
true | ||
end | ||
|
||
private | ||
|
||
def diagnostics_worker_tab? | ||
@view_context.x_active_tree == :diagnostics_tree && @sb[:active_tab] == 'diagnostics_workers' | ||
end | ||
|
||
def miq? | ||
@record.class == MiqServer || @record.class == MiqRegion | ||
end | ||
|
||
def ops? | ||
@layout == 'ops' | ||
end | ||
end |
54 changes: 18 additions & 36 deletions
54
spec/helpers/application_helper/buttons/refresh_workers_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