1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
<script>
import { GlIcon, GlSprintf, GlTooltipDirective } from '@gitlab/ui';
import { sprintf, __ } from '~/locale';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue';
import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue';
import RunnerName from '../runner_name.vue';
import RunnerTags from '../runner_tags.vue';
import RunnerTypeBadge from '../runner_type_badge.vue';
import { formatJobCount } from '../../utils';
import {
I18N_NO_DESCRIPTION,
I18N_LOCKED_RUNNER_DESCRIPTION,
I18N_VERSION_LABEL,
I18N_LAST_CONTACT_LABEL,
I18N_CREATED_AT_LABEL,
I18N_CREATED_AT_BY_LABEL,
} from '../../constants';
import RunnerSummaryField from './runner_summary_field.vue';
export default {
components: {
GlIcon,
GlSprintf,
TimeAgo,
RunnerSummaryField,
RunnerName,
RunnerTags,
RunnerTypeBadge,
RunnerUpgradeStatusIcon: () =>
import('ee_component/ci/runner/components/runner_upgrade_status_icon.vue'),
UserAvatarLink,
TooltipOnTruncate,
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
runner: {
type: Object,
required: true,
},
},
computed: {
jobCount() {
return formatJobCount(this.runner.jobCount);
},
createdBy() {
return this.runner?.createdBy;
},
createdByImgAlt() {
const name = this.createdBy?.name;
if (name) {
return sprintf(__("%{name}'s avatar"), { name });
}
return null;
},
},
i18n: {
I18N_NO_DESCRIPTION,
I18N_LOCKED_RUNNER_DESCRIPTION,
I18N_VERSION_LABEL,
I18N_LAST_CONTACT_LABEL,
I18N_CREATED_AT_LABEL,
I18N_CREATED_AT_BY_LABEL,
},
};
</script>
<template>
<div>
<div class="gl-mb-3">
<slot :runner="runner" name="runner-name">
<runner-name :runner="runner" />
</slot>
<gl-icon
v-if="runner.locked"
v-gl-tooltip
:title="$options.i18n.I18N_LOCKED_RUNNER_DESCRIPTION"
name="lock"
/>
<runner-type-badge :type="runner.runnerType" size="sm" class="gl-vertical-align-middle" />
</div>
<div class="gl-mb-3 gl-ml-auto gl-display-inline-flex gl-max-w-full">
<template v-if="runner.version">
<div class="gl-flex-shrink-0">
<runner-upgrade-status-icon :runner="runner" />
<gl-sprintf :message="$options.i18n.I18N_VERSION_LABEL">
<template #version>{{ runner.version }}</template>
</gl-sprintf>
</div>
<div class="gl-text-secondary gl-mx-2" aria-hidden="true">·</div>
</template>
<tooltip-on-truncate
class="gl-text-truncate gl-display-block"
:class="{ 'gl-text-secondary': !runner.description }"
:title="runner.description"
>
{{ runner.description || $options.i18n.I18N_NO_DESCRIPTION }}
</tooltip-on-truncate>
</div>
<div>
<runner-summary-field icon="clock">
<gl-sprintf :message="$options.i18n.I18N_LAST_CONTACT_LABEL">
<template #timeAgo>
<time-ago v-if="runner.contactedAt" :time="runner.contactedAt" />
<template v-else>{{ __('Never') }}</template>
</template>
</gl-sprintf>
</runner-summary-field>
<runner-summary-field v-if="runner.ipAddress" icon="disk" :tooltip="__('IP Address')">
{{ runner.ipAddress }}
</runner-summary-field>
<runner-summary-field icon="pipeline" data-testid="job-count" :tooltip="__('Jobs')">
{{ jobCount }}
</runner-summary-field>
<runner-summary-field icon="calendar">
<template v-if="createdBy">
<gl-sprintf :message="$options.i18n.I18N_CREATED_AT_BY_LABEL">
<template #timeAgo>
<time-ago v-if="runner.createdAt" :time="runner.createdAt" />
</template>
<template #avatar>
<user-avatar-link
:link-href="createdBy.webUrl"
:img-src="createdBy.avatarUrl"
img-css-classes="gl-vertical-align-top"
:img-size="16"
:img-alt="createdByImgAlt"
:tooltip-text="createdBy.username"
/>
</template>
</gl-sprintf>
</template>
<template v-else>
<gl-sprintf :message="$options.i18n.I18N_CREATED_AT_LABEL">
<template #timeAgo>
<time-ago v-if="runner.createdAt" :time="runner.createdAt" />
</template>
</gl-sprintf>
</template>
</runner-summary-field>
</div>
<runner-tags class="gl-display-block" :tag-list="runner.tagList" size="sm" />
</div>
</template>
|