Commit a3b3b98c authored by Miguel Rincon's avatar Miguel Rincon

Fix runner detail pages breadcrumbs and navigation

This change adds relevant links to breadcrumbs and active sidebar menus
so users can navigate between the CI/CD settings and the specific
runners more easily.

Changelog: changed
parent a4a789c6
...@@ -1366,7 +1366,6 @@ RSpec/AnyInstanceOf: ...@@ -1366,7 +1366,6 @@ RSpec/AnyInstanceOf:
- 'spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb' - 'spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb'
- 'spec/views/layouts/_head.html.haml_spec.rb' - 'spec/views/layouts/_head.html.haml_spec.rb'
- 'spec/views/projects/artifacts/_artifact.html.haml_spec.rb' - 'spec/views/projects/artifacts/_artifact.html.haml_spec.rb'
- 'spec/views/shared/runners/show.html.haml_spec.rb'
- 'spec/workers/archive_trace_worker_spec.rb' - 'spec/workers/archive_trace_worker_spec.rb'
- 'spec/workers/build_coverage_worker_spec.rb' - 'spec/workers/build_coverage_worker_spec.rb'
- 'spec/workers/build_hooks_worker_spec.rb' - 'spec/workers/build_hooks_worker_spec.rb'
......
...@@ -600,7 +600,6 @@ Rails/ShortI18n: ...@@ -600,7 +600,6 @@ Rails/ShortI18n:
Exclude: Exclude:
- 'app/models/project_services/chat_message/pipeline_message.rb' - 'app/models/project_services/chat_message/pipeline_message.rb'
- 'app/uploaders/content_type_whitelist.rb' - 'app/uploaders/content_type_whitelist.rb'
- 'spec/views/shared/runners/show.html.haml_spec.rb'
# Offense count: 1144 # Offense count: 1144
# Configuration parameters: ForbiddenMethods, AllowedMethods. # Configuration parameters: ForbiddenMethods, AllowedMethods.
......
...@@ -10,7 +10,6 @@ class Groups::RunnersController < Groups::ApplicationController ...@@ -10,7 +10,6 @@ class Groups::RunnersController < Groups::ApplicationController
feature_category :continuous_integration feature_category :continuous_integration
def show def show
render 'shared/runners/show'
end end
def edit def edit
......
...@@ -48,7 +48,6 @@ class Projects::RunnersController < Projects::ApplicationController ...@@ -48,7 +48,6 @@ class Projects::RunnersController < Projects::ApplicationController
end end
def show def show
render 'shared/runners/show'
end end
def toggle_shared_runners def toggle_shared_runners
......
...@@ -26,6 +26,8 @@ module GroupsHelper ...@@ -26,6 +26,8 @@ module GroupsHelper
applications#show applications#show
applications#edit applications#edit
packages_and_registries#index packages_and_registries#index
groups/runners#show
groups/runners#edit
] ]
end end
......
...@@ -723,6 +723,8 @@ module ProjectsHelper ...@@ -723,6 +723,8 @@ module ProjectsHelper
badges#index badges#index
pages#show pages#show
packages_and_registries#index packages_and_registries#index
projects/runners#show
projects/runners#edit
] ]
end end
......
- add_page_specific_style 'page_bundles/ci_status' - add_page_specific_style 'page_bundles/ci_status'
- page_title @runner.short_sha - breadcrumb_title @runner.short_sha
- page_title "##{@runner.id} (#{@runner.short_sha})"
- add_to_breadcrumbs _('Runners'), admin_runners_path - add_to_breadcrumbs _('Runners'), admin_runners_path
- breadcrumb_title page_title
- if Feature.enabled?(:runner_detailed_view_vue_ui, current_user, default_enabled: :yaml) - if Feature.enabled?(:runner_detailed_view_vue_ui, current_user, default_enabled: :yaml)
#js-runner-detail{ data: {runner_id: @runner.id} } #js-runner-detail{ data: {runner_id: @runner.id} }
......
- page_title _('Edit'), "#{@runner.description} ##{@runner.id}", _('Runners') - breadcrumb_title _('Edit')
- page_title _('Edit'), "##{@runner.id} (#{@runner.short_sha})"
- add_to_breadcrumbs _('CI/CD Settings'), group_settings_ci_cd_path(@group)
- add_to_breadcrumbs "#{@runner.short_sha}", group_runner_path(@group, @runner)
%h2.page-title %h2.page-title
= s_('Runners|Runner #%{runner_id}' % { runner_id: @runner.id }) = s_('Runners|Runner #%{runner_id}' % { runner_id: @runner.id })
......
- add_to_breadcrumbs _('CI/CD Settings'), group_settings_ci_cd_path(@group)
= render 'shared/runners/runner_details', runner: @runner
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
%span %span
= _('Repository') = _('Repository')
= nav_link(controller: :ci_cd) do = nav_link(controller: [:ci_cd, 'groups/runners']) do
= link_to group_settings_ci_cd_path(@group), title: _('CI/CD') do = link_to group_settings_ci_cd_path(@group), title: _('CI/CD') do
%span %span
= _('CI/CD') = _('CI/CD')
......
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
%span %span
= _('Repository') = _('Repository')
- if !@project.archived? && @project.feature_available?(:builds, current_user) - if !@project.archived? && @project.feature_available?(:builds, current_user)
= nav_link(controller: :ci_cd) do = nav_link(controller: [:ci_cd, 'projects/runners']) do
= link_to project_settings_ci_cd_path(@project), title: _('CI/CD') do = link_to project_settings_ci_cd_path(@project), title: _('CI/CD') do
%span %span
= _('CI/CD') = _('CI/CD')
......
- page_title _('Edit'), "#{@runner.description} ##{@runner.id}", _('Runners') - breadcrumb_title _('Edit')
- page_title _('Edit'), "##{@runner.id} (#{@runner.short_sha})"
- add_to_breadcrumbs _('CI/CD Settings'), project_settings_ci_cd_path(@project)
- add_to_breadcrumbs "#{@runner.short_sha}", project_runner_path(@project, @runner)
%h2.page-title %h2.page-title
= s_('Runners|Runner #%{runner_id}' % { runner_id: @runner.id }) = s_('Runners|Runner #%{runner_id}' % { runner_id: @runner.id })
......
- add_to_breadcrumbs _('CI/CD Settings'), project_settings_ci_cd_path(@project)
= render 'shared/runners/runner_details', runner: @runner
- page_title "#{@runner.description} ##{@runner.id}", _("Runners") - breadcrumb_title runner.short_sha
- page_title "##{runner.id} (#{runner.short_sha})"
%h2.page-title %h2.page-title
= s_('Runners|Runner #%{runner_id}' % { runner_id: @runner.id }) = s_('Runners|Runner #%{runner_id}' % { runner_id: runner.id })
= render 'shared/runners/runner_type_badge', runner: @runner = render 'shared/runners/runner_type_badge', runner: runner
.table-holder .table-holder
%table.table %table.table
...@@ -12,51 +13,51 @@ ...@@ -12,51 +13,51 @@
%th= s_('Runners|Value') %th= s_('Runners|Value')
%tr %tr
%td= s_('Runners|Active') %td= s_('Runners|Active')
%td= @runner.active? ? _('Yes') : _('No') %td= runner.active? ? _('Yes') : _('No')
%tr %tr
%td= s_('Runners|Protected') %td= s_('Runners|Protected')
%td= @runner.ref_protected? ? _('Yes') : _('No') %td= runner.ref_protected? ? _('Yes') : _('No')
%tr %tr
%td= s_('Runners|Can run untagged jobs') %td= s_('Runners|Can run untagged jobs')
%td= @runner.run_untagged? ? _('Yes') : _('No') %td= runner.run_untagged? ? _('Yes') : _('No')
- unless @runner.group_type? - unless runner.group_type?
%tr %tr
%td= s_('Runners|Locked to this project') %td= s_('Runners|Locked to this project')
%td= @runner.locked? ? _('Yes') : _('No') %td= runner.locked? ? _('Yes') : _('No')
%tr %tr
%td= s_('Runners|Tags') %td= s_('Runners|Tags')
%td %td
- @runner.tag_list.sort.each do |tag| - runner.tag_list.sort.each do |tag|
%span.badge.badge-primary %span.badge.badge-primary
= tag = tag
%tr %tr
%td= s_('Runners|Name') %td= s_('Runners|Name')
%td= @runner.name %td= runner.name
%tr %tr
%td= s_('Runners|Version') %td= s_('Runners|Version')
%td= @runner.version %td= runner.version
%tr %tr
%td= s_('Runners|IP Address') %td= s_('Runners|IP Address')
%td= @runner.ip_address %td= runner.ip_address
%tr %tr
%td= s_('Runners|Revision') %td= s_('Runners|Revision')
%td= @runner.revision %td= runner.revision
%tr %tr
%td= s_('Runners|Platform') %td= s_('Runners|Platform')
%td= @runner.platform %td= runner.platform
%tr %tr
%td= s_('Runners|Architecture') %td= s_('Runners|Architecture')
%td= @runner.architecture %td= runner.architecture
%tr %tr
%td= s_('Runners|Description') %td= s_('Runners|Description')
%td= @runner.description %td= runner.description
%tr %tr
%td= s_('Runners|Maximum job timeout') %td= s_('Runners|Maximum job timeout')
%td= @runner.maximum_timeout_human_readable %td= runner.maximum_timeout_human_readable
%tr %tr
%td= s_('Runners|Last contact') %td= s_('Runners|Last contact')
%td %td
- if @runner.contacted_at - if runner.contacted_at
= time_ago_with_tooltip @runner.contacted_at = time_ago_with_tooltip runner.contacted_at
- else - else
= s_('Never') = s_('Never')
---
title: Fix breadcrumbs and navigation in runner details pages
merge_request: 60129
author:
type: changed
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'shared/runners/show.html.haml' do RSpec.describe 'shared/runners/_runner_details.html.haml' do
include PageLayoutHelper include PageLayoutHelper
let(:runner) do let(:runner) do
...@@ -14,7 +14,7 @@ RSpec.describe 'shared/runners/show.html.haml' do ...@@ -14,7 +14,7 @@ RSpec.describe 'shared/runners/show.html.haml' do
end end
before do before do
assign(:runner, runner) allow(view).to receive(:runner) { runner }
end end
subject do subject do
...@@ -24,7 +24,7 @@ RSpec.describe 'shared/runners/show.html.haml' do ...@@ -24,7 +24,7 @@ RSpec.describe 'shared/runners/show.html.haml' do
describe 'Page title' do describe 'Page title' do
before do before do
expect_any_instance_of(PageLayoutHelper).to receive(:page_title).with("#{runner.description} ##{runner.id}", 'Runners') expect(view).to receive(:page_title).with("##{runner.id} (#{runner.short_sha})")
end end
it 'sets proper page title' do it 'sets proper page title' do
...@@ -147,7 +147,7 @@ RSpec.describe 'shared/runners/show.html.haml' do ...@@ -147,7 +147,7 @@ RSpec.describe 'shared/runners/show.html.haml' do
context 'when runner have already contacted' do context 'when runner have already contacted' do
let(:runner) { create(:ci_runner, contacted_at: DateTime.now - 6.days) } let(:runner) { create(:ci_runner, contacted_at: DateTime.now - 6.days) }
let(:expected_contacted_at) { I18n.localize(runner.contacted_at, format: "%b %d, %Y") } let(:expected_contacted_at) { I18n.l(runner.contacted_at, format: "%b %d, %Y") }
it { is_expected.to have_content("Last contact #{expected_contacted_at}") } it { is_expected.to have_content("Last contact #{expected_contacted_at}") }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment