From e15a5196f4368ba951e3f8108d2ca058a9af863b Mon Sep 17 00:00:00 2001 From: Miguel Rincon <mrincon@gitlab.com> Date: Mon, 1 Nov 2021 15:25:53 +0100 Subject: [PATCH] Remove jobs and projects columns This change removes the job count and project count from the runner admin UI. Changelog: removed --- .../runner/components/runner_list.vue | 27 +--------- app/assets/javascripts/runner/constants.js | 1 - .../graphql/runner_node.fragment.graphql | 2 - spec/features/admin/admin_runners_spec.rb | 9 ++-- .../runner/components/runner_list_spec.js | 53 ------------------- 5 files changed, 5 insertions(+), 87 deletions(-) diff --git a/app/assets/javascripts/runner/components/runner_list.vue b/app/assets/javascripts/runner/components/runner_list.vue index 3f6ea389288c6..a8796ae6a654c 100644 --- a/app/assets/javascripts/runner/components/runner_list.vue +++ b/app/assets/javascripts/runner/components/runner_list.vue @@ -1,9 +1,8 @@ <script> import { GlTable, GlTooltipDirective, GlSkeletonLoader } from '@gitlab/ui'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; -import { formatNumber, __, s__ } from '~/locale'; +import { __, s__ } from '~/locale'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; -import { RUNNER_JOB_COUNT_LIMIT } from '../constants'; import RunnerActionsCell from './cells/runner_actions_cell.vue'; import RunnerSummaryCell from './cells/runner_summary_cell.vue'; import RunnerTypeCell from './cells/runner_type_cell.vue'; @@ -54,18 +53,6 @@ export default { }, }, methods: { - formatProjectCount(projectCount) { - if (projectCount === null) { - return __('n/a'); - } - return formatNumber(projectCount); - }, - formatJobCount(jobCount) { - if (jobCount > RUNNER_JOB_COUNT_LIMIT) { - return `${formatNumber(RUNNER_JOB_COUNT_LIMIT)}+`; - } - return formatNumber(jobCount); - }, runnerTrAttr(runner) { if (runner) { return { @@ -80,9 +67,7 @@ export default { tableField({ key: 'summary', label: s__('Runners|Runner'), width: 30 }), tableField({ key: 'version', label: __('Version') }), tableField({ key: 'ipAddress', label: __('IP Address') }), - tableField({ key: 'projectCount', label: __('Projects'), width: 5 }), - tableField({ key: 'jobCount', label: __('Jobs'), width: 5 }), - tableField({ key: 'tagList', label: __('Tags') }), + tableField({ key: 'tagList', label: __('Tags'), width: 20 }), tableField({ key: 'contactedAt', label: __('Last contact') }), tableField({ key: 'actions', label: '' }), ], @@ -123,14 +108,6 @@ export default { {{ ipAddress }} </template> - <template #cell(projectCount)="{ item: { projectCount } }"> - {{ formatProjectCount(projectCount) }} - </template> - - <template #cell(jobCount)="{ item: { jobCount } }"> - {{ formatJobCount(jobCount) }} - </template> - <template #cell(tagList)="{ item: { tagList } }"> <runner-tags :tag-list="tagList" size="sm" /> </template> diff --git a/app/assets/javascripts/runner/constants.js b/app/assets/javascripts/runner/constants.js index a2fb9d9efd84b..b5f7ee670889b 100644 --- a/app/assets/javascripts/runner/constants.js +++ b/app/assets/javascripts/runner/constants.js @@ -1,7 +1,6 @@ import { s__ } from '~/locale'; export const RUNNER_PAGE_SIZE = 20; -export const RUNNER_JOB_COUNT_LIMIT = 1000; export const GROUP_RUNNER_COUNT_LIMIT = 1000; export const I18N_FETCH_ERROR = s__('Runners|Something went wrong while fetching runner data.'); diff --git a/app/assets/javascripts/runner/graphql/runner_node.fragment.graphql b/app/assets/javascripts/runner/graphql/runner_node.fragment.graphql index 68d6f02f799bd..0835e3c7c092c 100644 --- a/app/assets/javascripts/runner/graphql/runner_node.fragment.graphql +++ b/app/assets/javascripts/runner/graphql/runner_node.fragment.graphql @@ -10,6 +10,4 @@ fragment RunnerNode on CiRunner { locked tagList contactedAt - jobCount - projectCount } diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index c6810086ac4c3..d8227bb9bb491 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -28,36 +28,33 @@ expect(page).to have_text "Runners currently online: 1" end - it 'with an instance runner shows an instance badge and no project count' do + it 'with an instance runner shows an instance badge' do runner = create(:ci_runner, :instance) visit admin_runners_path within "[data-testid='runner-row-#{runner.id}']" do expect(page).to have_selector '.badge', text: 'shared' - expect(page).to have_text 'n/a' end end - it 'with a group runner shows a group badge and no project count' do + it 'with a group runner shows a group badge' do runner = create(:ci_runner, :group, groups: [group]) visit admin_runners_path within "[data-testid='runner-row-#{runner.id}']" do expect(page).to have_selector '.badge', text: 'group' - expect(page).to have_text 'n/a' end end - it 'with a project runner shows a project badge and project count' do + it 'with a project runner shows a project badge' do runner = create(:ci_runner, :project, projects: [project]) visit admin_runners_path within "[data-testid='runner-row-#{runner.id}']" do expect(page).to have_selector '.badge', text: 'specific' - expect(page).to have_text '1' end end diff --git a/spec/frontend/runner/components/runner_list_spec.js b/spec/frontend/runner/components/runner_list_spec.js index e24dffea1eb30..a3814c1277a4b 100644 --- a/spec/frontend/runner/components/runner_list_spec.js +++ b/spec/frontend/runner/components/runner_list_spec.js @@ -1,6 +1,5 @@ import { GlTable, GlSkeletonLoader } from '@gitlab/ui'; import { mount, shallowMount } from '@vue/test-utils'; -import { cloneDeep } from 'lodash'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import RunnerList from '~/runner/components/runner_list.vue'; @@ -47,8 +46,6 @@ describe('RunnerList', () => { 'Runner', 'Version', 'IP Address', - 'Projects', - 'Jobs', 'Tags', 'Last contact', '', // actions has no label @@ -76,8 +73,6 @@ describe('RunnerList', () => { // Other fields expect(findCell({ fieldKey: 'version' }).text()).toBe(version); expect(findCell({ fieldKey: 'ipAddress' }).text()).toBe(ipAddress); - expect(findCell({ fieldKey: 'projectCount' }).text()).toBe('1'); - expect(findCell({ fieldKey: 'jobCount' }).text()).toBe('0'); expect(findCell({ fieldKey: 'tagList' }).text()).toBe(''); expect(findCell({ fieldKey: 'contactedAt' }).text()).toEqual(expect.any(String)); @@ -88,54 +83,6 @@ describe('RunnerList', () => { expect(actions.findByTestId('toggle-active-runner').exists()).toBe(true); }); - describe('Table data formatting', () => { - let mockRunnersCopy; - - beforeEach(() => { - mockRunnersCopy = cloneDeep(mockRunners); - }); - - it('Formats null project counts', () => { - mockRunnersCopy[0].projectCount = null; - - createComponent({ props: { runners: mockRunnersCopy } }, mount); - - expect(findCell({ fieldKey: 'projectCount' }).text()).toBe('n/a'); - }); - - it('Formats 0 project counts', () => { - mockRunnersCopy[0].projectCount = 0; - - createComponent({ props: { runners: mockRunnersCopy } }, mount); - - expect(findCell({ fieldKey: 'projectCount' }).text()).toBe('0'); - }); - - it('Formats big project counts', () => { - mockRunnersCopy[0].projectCount = 1000; - - createComponent({ props: { runners: mockRunnersCopy } }, mount); - - expect(findCell({ fieldKey: 'projectCount' }).text()).toBe('1,000'); - }); - - it('Formats job counts', () => { - mockRunnersCopy[0].jobCount = 1000; - - createComponent({ props: { runners: mockRunnersCopy } }, mount); - - expect(findCell({ fieldKey: 'jobCount' }).text()).toBe('1,000'); - }); - - it('Formats big job counts with a plus symbol', () => { - mockRunnersCopy[0].jobCount = 1001; - - createComponent({ props: { runners: mockRunnersCopy } }, mount); - - expect(findCell({ fieldKey: 'jobCount' }).text()).toBe('1,000+'); - }); - }); - it('Shows runner identifier', () => { const { id, shortSha } = mockRunners[0]; const numericId = getIdFromGraphQLId(id); -- GitLab