2021-05-19 21:12:42 +00:00
|
|
|
<script>
|
|
|
|
import { GlTable, GlTooltipDirective, GlSkeletonLoader } from '@gitlab/ui';
|
2021-11-25 18:14:13 +00:00
|
|
|
import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate.vue';
|
2021-05-19 21:12:42 +00:00
|
|
|
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
|
2021-11-05 12:10:25 +00:00
|
|
|
import { __, s__ } from '~/locale';
|
2021-05-19 21:12:42 +00:00
|
|
|
import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue';
|
2021-06-07 09:10:26 +00:00
|
|
|
import RunnerActionsCell from './cells/runner_actions_cell.vue';
|
2021-10-01 12:13:32 +00:00
|
|
|
import RunnerSummaryCell from './cells/runner_summary_cell.vue';
|
2021-11-08 12:12:07 +00:00
|
|
|
import RunnerStatusCell from './cells/runner_status_cell.vue';
|
2021-05-19 21:12:42 +00:00
|
|
|
import RunnerTags from './runner_tags.vue';
|
|
|
|
|
|
|
|
const tableField = ({ key, label = '', width = 10 }) => {
|
|
|
|
return {
|
|
|
|
key,
|
|
|
|
label,
|
|
|
|
thClass: [
|
|
|
|
`gl-w-${width}p`,
|
|
|
|
'gl-bg-transparent!',
|
|
|
|
'gl-border-b-solid!',
|
|
|
|
'gl-border-b-gray-100!',
|
|
|
|
'gl-py-5!',
|
|
|
|
'gl-px-0!',
|
|
|
|
'gl-border-b-1!',
|
|
|
|
],
|
|
|
|
tdClass: ['gl-py-5!', 'gl-px-1!'],
|
|
|
|
tdAttr: {
|
|
|
|
'data-testid': `td-${key}`,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlTable,
|
|
|
|
GlSkeletonLoader,
|
2021-11-25 18:14:13 +00:00
|
|
|
TooltipOnTruncate,
|
2021-05-19 21:12:42 +00:00
|
|
|
TimeAgo,
|
2021-06-07 09:10:26 +00:00
|
|
|
RunnerActionsCell,
|
2021-10-01 12:13:32 +00:00
|
|
|
RunnerSummaryCell,
|
2021-05-19 21:12:42 +00:00
|
|
|
RunnerTags,
|
2021-11-08 12:12:07 +00:00
|
|
|
RunnerStatusCell,
|
2021-05-19 21:12:42 +00:00
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
loading: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
runners: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
runnerTrAttr(runner) {
|
|
|
|
if (runner) {
|
|
|
|
return {
|
|
|
|
'data-testid': `runner-row-${getIdFromGraphQLId(runner.id)}`,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
fields: [
|
2021-11-08 12:12:07 +00:00
|
|
|
tableField({ key: 'status', label: s__('Runners|Status') }),
|
|
|
|
tableField({ key: 'summary', label: s__('Runners|Runner ID'), width: 30 }),
|
2021-05-19 21:12:42 +00:00
|
|
|
tableField({ key: 'version', label: __('Version') }),
|
|
|
|
tableField({ key: 'ipAddress', label: __('IP Address') }),
|
2021-11-05 12:10:25 +00:00
|
|
|
tableField({ key: 'tagList', label: __('Tags'), width: 20 }),
|
2021-05-19 21:12:42 +00:00
|
|
|
tableField({ key: 'contactedAt', label: __('Last contact') }),
|
|
|
|
tableField({ key: 'actions', label: '' }),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<gl-table
|
|
|
|
:busy="loading"
|
|
|
|
:items="runners"
|
|
|
|
:fields="$options.fields"
|
|
|
|
:tbody-tr-attr="runnerTrAttr"
|
2021-07-12 18:09:09 +00:00
|
|
|
data-testid="runner-list"
|
2021-05-19 21:12:42 +00:00
|
|
|
stacked="md"
|
|
|
|
fixed
|
|
|
|
>
|
2021-05-26 12:10:41 +00:00
|
|
|
<template v-if="!runners.length" #table-busy>
|
|
|
|
<gl-skeleton-loader v-for="i in 4" :key="i" />
|
2021-05-19 21:12:42 +00:00
|
|
|
</template>
|
|
|
|
|
2021-11-08 12:12:07 +00:00
|
|
|
<template #cell(status)="{ item }">
|
|
|
|
<runner-status-cell :runner="item" />
|
2021-05-19 21:12:42 +00:00
|
|
|
</template>
|
|
|
|
|
2021-10-01 12:13:32 +00:00
|
|
|
<template #cell(summary)="{ item, index }">
|
|
|
|
<runner-summary-cell :runner="item">
|
|
|
|
<template #runner-name="{ runner }">
|
|
|
|
<slot name="runner-name" :runner="runner" :index="index"></slot>
|
|
|
|
</template>
|
|
|
|
</runner-summary-cell>
|
2021-05-19 21:12:42 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #cell(version)="{ item: { version } }">
|
2021-11-25 18:14:13 +00:00
|
|
|
<tooltip-on-truncate class="gl-display-block gl-text-truncate" :title="version">
|
|
|
|
{{ version }}
|
|
|
|
</tooltip-on-truncate>
|
2021-05-19 21:12:42 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #cell(ipAddress)="{ item: { ipAddress } }">
|
2021-11-25 18:14:13 +00:00
|
|
|
<tooltip-on-truncate class="gl-display-block gl-text-truncate" :title="ipAddress">
|
|
|
|
{{ ipAddress }}
|
|
|
|
</tooltip-on-truncate>
|
2021-05-19 21:12:42 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #cell(tagList)="{ item: { tagList } }">
|
|
|
|
<runner-tags :tag-list="tagList" size="sm" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #cell(contactedAt)="{ item: { contactedAt } }">
|
|
|
|
<time-ago v-if="contactedAt" :time="contactedAt" />
|
|
|
|
<template v-else>{{ __('Never') }}</template>
|
|
|
|
</template>
|
|
|
|
|
2021-06-07 09:10:26 +00:00
|
|
|
<template #cell(actions)="{ item }">
|
|
|
|
<runner-actions-cell :runner="item" />
|
2021-05-19 21:12:42 +00:00
|
|
|
</template>
|
|
|
|
</gl-table>
|
|
|
|
</div>
|
|
|
|
</template>
|