Skip to content

Commit

Permalink
Merge pull request #2722 from yaacov/uniform-behaviour-timeline-utili…
Browse files Browse the repository at this point in the history
…zation-button

Uniform the behaviour of timeline and utilization button
(cherry picked from commit d1f626f)

https://bugzilla.redhat.com/show_bug.cgi?id=1513602
  • Loading branch information
himdel authored and simaishi committed Nov 15, 2017
1 parent 01803f5 commit d012b90
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 15 deletions.
11 changes: 10 additions & 1 deletion app/helpers/application_helper/button/container_perf.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
class ApplicationHelper::Button::ContainerPerf < ApplicationHelper::Button::Basic
needs(:@record)

def initialize(view_context, view_binding, instance_data, props)
super
@entity = props[:options][:entity] || N_('Entity')
end

def disabled?
@error_message = _('No Capacity & Utilization data has been collected for this Container') unless @record.has_perf_data?
unless @record.has_perf_data?
@error_message = _('No Capacity & Utilization data has been collected for this %{entity}') %
{:entity => _(@entity)}
end

@error_message.present?
end
end
3 changes: 2 additions & 1 deletion app/helpers/application_helper/toolbar/container_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ApplicationHelper::Toolbar::ContainerCenter < ApplicationHelper::Toolbar::
N_('Timelines'),
:url => "/show",
:url_parms => "?display=timeline",
:options => {:entity => 'Container'},
:options => {:entity => N_('Container')},
:klass => ApplicationHelper::Button::ContainerTimeline
),
button(
Expand All @@ -23,6 +23,7 @@ class ApplicationHelper::Toolbar::ContainerCenter < ApplicationHelper::Toolbar::
N_('Utilization'),
:url => "/show",
:url_parms => "?display=performance",
:options => {:entity => N_('Container')},
:klass => ApplicationHelper::Button::ContainerPerf
),
]
Expand Down
11 changes: 7 additions & 4 deletions app/helpers/application_helper/toolbar/container_group_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ class ApplicationHelper::Toolbar::ContainerGroupCenter < ApplicationHelper::Tool
button(
:container_group_timeline,
'ff ff-timeline fa-lg',
N_('Show Timelines for this Group'),
N_('Show Timelines for this Pod'),
N_('Timelines'),
:url => "/show",
:url_parms => "?display=timeline",
:options => {:entity => 'Group'},
:options => {:entity => N_('Pod')},
:klass => ApplicationHelper::Button::ContainerTimeline),
button(
:container_group_perf,
'ff ff-monitoring fa-lg',
N_('Show Capacity & Utilization data for this Group'),
N_('Show Capacity & Utilization data for this Pod'),
N_('Utilization'),
:url => "/show",
:url_parms => "?display=performance"),
:url_parms => "?display=performance",
:options => {:entity => N_('Pod')},
:klass => ApplicationHelper::Button::ContainerPerf,
),
]
),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ class ApplicationHelper::Toolbar::ContainerNodeCenter < ApplicationHelper::Toolb
N_('Timelines'),
:url => "/show",
:url_parms => "?display=timeline",
:options => {:entity => 'Node'},
:options => {:entity => N_('Node')},
:klass => ApplicationHelper::Button::ContainerTimeline),
button(
:container_node_perf,
'ff ff-monitoring fa-lg',
N_('Show Capacity & Utilization data for this Node'),
N_('Utilization'),
:url => "/show",
:url_parms => "?display=performance"),
:url_parms => "?display=performance",
:options => {:entity => N_('Node')},
:klass => ApplicationHelper::Button::ContainerPerf,
),
button(
:ems_container_ad_hoc_metrics,
'fa fa-tachometer fa-1xplus',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ class ApplicationHelper::Toolbar::ContainerProjectCenter < ApplicationHelper::To
N_('Timelines'),
:url => "/show",
:url_parms => "?display=timeline",
:options => {:entity => 'Project'},
:options => {:entity => N_('Project')},
:klass => ApplicationHelper::Button::ContainerTimeline),
button(
:container_project_perf,
'ff ff-monitoring fa-lg',
N_('Show Capacity & Utilization data for this Project'),
N_('Utilization'),
:url => "/show",
:url_parms => "?display=performance"),
:url_parms => "?display=performance",
:options => {:entity => N_('Project')},
:klass => ApplicationHelper::Button::ContainerPerf,
),
]
),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class ApplicationHelper::Toolbar::ContainerServiceCenter < ApplicationHelper::To
N_('Show Capacity & Utilization data for this Service'),
N_('Utilization'),
:url => "/show",
:url_parms => "?display=performance"),
:url_parms => "?display=performance",
:options => {:entity => N_('Service')},
:klass => ApplicationHelper::Button::ContainerPerf,
),
]
),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ class ApplicationHelper::Toolbar::EmsContainerCenter < ApplicationHelper::Toolba
'ff ff-timeline fa-lg',
N_('Show Timelines for this Containers Provider'),
N_('Timelines'),
:klass => ApplicationHelper::Button::GenericFeatureButton,
:options => {:feature => :timeline},
:klass => ApplicationHelper::Button::ContainerTimeline,
:options => {:feature => :timeline, :entity => N_('Provider')},
:url_parms => "?display=timeline"),
button(
:ems_container_perf,
'ff ff-monitoring fa-lg',
N_('Show Capacity & Utilization data for this Provider'),
N_('Utilization'),
:klass => ApplicationHelper::Button::GenericFeatureButton,
:options => {:feature => :performance},
:klass => ApplicationHelper::Button::ContainerPerf,
:options => {:feature => :performance, :entity => N_('Provider')},
:url_parms => "?display=performance"),
button(
:ems_container_ad_hoc_metrics,
Expand Down

0 comments on commit d012b90

Please sign in to comment.