Commit d384df2f authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '326197-change-runner-identifiers-job-sidebar-admin-list' into 'master'

Display runner identifiers consistently

See merge request gitlab-org/gitlab!58904
parents ead7045a 98601b62
...@@ -51,7 +51,9 @@ export default { ...@@ -51,7 +51,9 @@ export default {
}); });
}, },
runnerId() { runnerId() {
return `${this.job.runner.description} (#${this.job.runner.id})`; const { id, short_sha: token, description } = this.job?.runner;
return `#${id} (${token}) ${description}`;
}, },
shouldRenderBlock() { shouldRenderBlock() {
return Boolean(this.hasAnyDetail || this.hasTimeout || this.hasTags); return Boolean(this.hasAnyDetail || this.hasTimeout || this.hasTags);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
class RunnerEntity < Grape::Entity class RunnerEntity < Grape::Entity
include RequestAwareEntity include RequestAwareEntity
expose :id, :description expose :id, :description, :short_sha
expose :edit_path, if: -> (*) { can_edit_runner? } do |runner| expose :edit_path, if: -> (*) { can_edit_runner? } do |runner|
edit_project_runner_path(project, runner) edit_project_runner_path(project, runner)
......
-# Note: This file should stay aligned with:
-# `app/views/groups/runners/_runner.html.haml`
.gl-responsive-table-row{ id: dom_id(runner) } .gl-responsive-table-row{ id: dom_id(runner) }
.table-section.section-10.section-wrap .table-section.section-10.section-wrap
.table-mobile-header{ role: 'rowheader' }= _('Type') .table-mobile-header{ role: 'rowheader' }= _('Type')
...@@ -13,14 +16,12 @@ ...@@ -13,14 +16,12 @@
- unless runner.active? - unless runner.active?
%span.badge.badge-pill.gl-badge.sm.badge-danger= _("paused") %span.badge.badge-pill.gl-badge.sm.badge-danger= _("paused")
.table-section.section-10 .table-section.section-30
.table-mobile-header{ role: 'rowheader' }= _('Runner token') .table-mobile-header{ role: 'rowheader' }= s_('Runners|Runner')
.table-mobile-content .table-mobile-content
= link_to runner.short_sha, admin_runner_path(runner) = link_to("##{runner.id} (#{runner.short_sha})", admin_runner_path(runner))
.gl-text-truncate
.table-section.section-20 %span{ title: runner.description, data: { toggle: 'tooltip', container: 'body' } }
.table-mobile-header{ role: 'rowheader' }= _('Description')
.table-mobile-content.str-truncated.has-tooltip{ title: runner.description }
= runner.description = runner.description
.table-section.section-10 .table-section.section-10
......
...@@ -122,8 +122,7 @@ ...@@ -122,8 +122,7 @@
.table-holder .table-holder
.gl-responsive-table-row.table-row-header{ role: 'row' } .gl-responsive-table-row.table-row-header{ role: 'row' }
.table-section.section-10{ role: 'rowheader' }= _('Type/State') .table-section.section-10{ role: 'rowheader' }= _('Type/State')
.table-section.section-10{ role: 'rowheader' }= _('Runner token') .table-section.section-30{ role: 'rowheader' }= s_('Runners|Runner')
.table-section.section-20{ role: 'rowheader' }= _('Description')
.table-section.section-10{ role: 'rowheader' }= _('Version') .table-section.section-10{ role: 'rowheader' }= _('Version')
.table-section.section-10{ role: 'rowheader' }= _('IP Address') .table-section.section-10{ role: 'rowheader' }= _('IP Address')
.table-section.section-5{ role: 'rowheader' }= _('Projects') .table-section.section-5{ role: 'rowheader' }= _('Projects')
......
...@@ -86,8 +86,7 @@ ...@@ -86,8 +86,7 @@
.table-holder .table-holder
.gl-responsive-table-row.table-row-header{ role: 'row' } .gl-responsive-table-row.table-row-header{ role: 'row' }
.table-section.section-10{ role: 'rowheader' }= _('Type/State') .table-section.section-10{ role: 'rowheader' }= _('Type/State')
.table-section.section-10{ role: 'rowheader' }= _('Runner token') .table-section.section-30{ role: 'rowheader' }= s_('Runners|Runner')
.table-section.section-20{ role: 'rowheader' }= _('Description')
.table-section.section-10{ role: 'rowheader' }= _('Version') .table-section.section-10{ role: 'rowheader' }= _('Version')
.table-section.section-10{ role: 'rowheader' }= _('IP Address') .table-section.section-10{ role: 'rowheader' }= _('IP Address')
.table-section.section-5{ role: 'rowheader' }= _('Projects') .table-section.section-5{ role: 'rowheader' }= _('Projects')
......
-# Note: This file should stay aligned with:
-# `app/views/admin/runners/_runner.html.haml`
.gl-responsive-table-row{ id: dom_id(runner) } .gl-responsive-table-row{ id: dom_id(runner) }
.table-section.section-10.section-wrap .table-section.section-10.section-wrap
.table-mobile-header{ role: 'rowheader' }= _('Type') .table-mobile-header{ role: 'rowheader' }= _('Type')
...@@ -15,14 +18,12 @@ ...@@ -15,14 +18,12 @@
%span.badge.badge-pill.gl-badge.sm.badge-danger %span.badge.badge-pill.gl-badge.sm.badge-danger
= _('paused') = _('paused')
.table-section.section-10 .table-section.section-30
.table-mobile-header{ role: 'rowheader' }= _('Runner token') .table-mobile-header{ role: 'rowheader' }= s_('Runners|Runner')
.table-mobile-content .table-mobile-content
= link_to runner.short_sha, group_runner_path(@group, runner) = link_to("##{runner.id} (#{runner.short_sha})", group_runner_path(@group, runner))
.gl-text-truncate
.table-section.section-20 %span{ title: runner.description, data: { toggle: 'tooltip', container: 'body' } }
.table-mobile-header{ role: 'rowheader' }= _('Description')
.table-mobile-content.str-truncated.has-tooltip{ title: runner.description }
= runner.description = runner.description
.table-section.section-10 .table-section.section-10
......
---
title: Display runner token and description consistently in the job sidebar and admin
list
merge_request: 58904
author:
type: changed
...@@ -27181,9 +27181,6 @@ msgstr "" ...@@ -27181,9 +27181,6 @@ msgstr ""
msgid "Runner API" msgid "Runner API"
msgstr "" msgstr ""
msgid "Runner token"
msgstr ""
msgid "Runner tokens" msgid "Runner tokens"
msgstr "" msgstr ""
...@@ -27271,6 +27268,9 @@ msgstr "" ...@@ -27271,6 +27268,9 @@ msgstr ""
msgid "Runners|Revision" msgid "Runners|Revision"
msgstr "" msgstr ""
msgid "Runners|Runner"
msgstr ""
msgid "Runners|Runner #%{runner_id}" msgid "Runners|Runner #%{runner_id}"
msgstr "" msgstr ""
......
...@@ -34,11 +34,22 @@ describe('Job Sidebar Details Container', () => { ...@@ -34,11 +34,22 @@ describe('Job Sidebar Details Container', () => {
}); });
describe('when no details are available', () => { describe('when no details are available', () => {
it('should render an empty container', () => { beforeEach(() => {
createWrapper(); createWrapper();
});
it('should render an empty container', () => {
expect(wrapper.html()).toBe(''); expect(wrapper.html()).toBe('');
}); });
it.each(['duration', 'erased_at', 'finished_at', 'queued', 'runner', 'coverage'])(
'should not render %s details when missing',
async (detail) => {
await store.dispatch('receiveJobSuccess', { [detail]: undefined });
expect(findAllDetailsRow()).toHaveLength(0);
},
);
}); });
describe('when some of the details are available', () => { describe('when some of the details are available', () => {
...@@ -49,7 +60,7 @@ describe('Job Sidebar Details Container', () => { ...@@ -49,7 +60,7 @@ describe('Job Sidebar Details Container', () => {
['erased_at', 'Erased: 3 weeks ago'], ['erased_at', 'Erased: 3 weeks ago'],
['finished_at', 'Finished: 3 weeks ago'], ['finished_at', 'Finished: 3 weeks ago'],
['queued', 'Queued: 9 seconds'], ['queued', 'Queued: 9 seconds'],
['runner', 'Runner: local ci runner (#1)'], ['runner', 'Runner: #1 (ABCDEFGH) local ci runner'],
['coverage', 'Coverage: 20%'], ['coverage', 'Coverage: 20%'],
])('uses %s to render job-%s', async (detail, value) => { ])('uses %s to render job-%s', async (detail, value) => {
await store.dispatch('receiveJobSuccess', { [detail]: job[detail] }); await store.dispatch('receiveJobSuccess', { [detail]: job[detail] });
......
...@@ -958,6 +958,7 @@ export default { ...@@ -958,6 +958,7 @@ export default {
artifacts: [null], artifacts: [null],
runner: { runner: {
id: 1, id: 1,
short_sha: 'ABCDEFGH',
description: 'local ci runner', description: 'local ci runner',
edit_path: '/root/ci-mock/runners/1/edit', edit_path: '/root/ci-mock/runners/1/edit',
}, },
......
...@@ -20,6 +20,7 @@ RSpec.describe RunnerEntity do ...@@ -20,6 +20,7 @@ RSpec.describe RunnerEntity do
it 'contains required fields' do it 'contains required fields' do
expect(subject).to include(:id, :description) expect(subject).to include(:id, :description)
expect(subject).to include(:edit_path) expect(subject).to include(:edit_path)
expect(subject).to include(:short_sha)
end end
end end
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