Skip to content

Commit

Permalink
Merge pull request #6045 from rvsia/utilization-breadcrumbs
Browse files Browse the repository at this point in the history
Introduce breadcrumbs to utilization controller

(cherry picked from commit 9e7e711)

https://bugzilla.redhat.com/show_bug.cgi?id=1741188
  • Loading branch information
Martin Povolny authored and simaishi committed Mar 25, 2020
1 parent 50a18f0 commit f17e792
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/controllers/utilization_controller.rb
Expand Up @@ -5,6 +5,7 @@ class UtilizationController < ApplicationController
menu_section(:vi)

include OptimizeHelper
include Mixins::BreadcrumbsMixin

def index
@explorer = true
Expand Down Expand Up @@ -224,6 +225,7 @@ def replace_right_cell(_nodetype)
presenter.set_visibility(@sb[:active_tab] == 'report', :toolbar)

presenter.update(:main_div, r[:partial => 'utilization_tabs'])
presenter.update(:breadcrumbs, r[:partial => 'layouts/breadcrumbs'])
presenter[:right_cell_text] = @right_cell_text
presenter[:build_calendar] = {
:date_from => @sb[:options][:sdate],
Expand All @@ -243,4 +245,13 @@ def summ_hashes
@sb[:summary][:storage]&.each { |r| a.push("section" => _("Disk"), "item" => r[0], "value" => r[1]) }
a
end

def breadcrumbs_options
{
:breadcrumbs => [
{:title => _("Overview")},
{:title => _("Utilization")},
],
}
end
end
8 changes: 8 additions & 0 deletions spec/controllers/utilization_controller_spec.rb
Expand Up @@ -34,4 +34,12 @@
end
end
end

describe "breadcrumbs" do
it "display breadcrumbs" do
get :index

expect(controller.data_for_breadcrumbs).to eq([{:title=>"Overview"}, {:title=>"Utilization"}])
end
end
end

0 comments on commit f17e792

Please sign in to comment.