Commit e15a5196 authored by Miguel Rincon's avatar Miguel Rincon

Remove jobs and projects columns

This change removes the job count and project count from the runner
admin UI.

Changelog: removed
parent 57fea91f
<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>
......
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.');
......
......@@ -10,6 +10,4 @@ fragment RunnerNode on CiRunner {
locked
tagList
contactedAt
jobCount
projectCount
}
......@@ -28,36 +28,33 @@ RSpec.describe "Admin Runners" do
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
......
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);
......
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