debian-mirror-gitlab/app/assets/javascripts/jobs/components/job_container_item.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
1.7 KiB
Vue
Raw Normal View History

2018-12-13 13:39:08 +05:30
<script>
2021-01-03 14:25:43 +05:30
import { GlLink, GlIcon, GlTooltipDirective } from '@gitlab/ui';
2018-12-13 13:39:08 +05:30
import delayedJobMixin from '~/jobs/mixins/delayed_job_mixin';
import { sprintf } from '~/locale';
2021-03-11 19:13:27 +05:30
import CiIcon from '~/vue_shared/components/ci_icon.vue';
2018-12-13 13:39:08 +05:30
export default {
components: {
CiIcon,
2020-11-24 15:15:51 +05:30
GlIcon,
2018-12-13 13:39:08 +05:30
GlLink,
},
directives: {
2021-01-03 14:25:43 +05:30
GlTooltip: GlTooltipDirective,
2018-12-13 13:39:08 +05:30
},
mixins: [delayedJobMixin],
props: {
job: {
type: Object,
required: true,
},
isActive: {
type: Boolean,
required: true,
},
},
computed: {
tooltipText() {
const { name, status } = this.job;
const text = `${name} - ${status.tooltip}`;
if (this.isDelayedJob) {
return sprintf(text, { remainingTime: this.remainingTime });
}
return text;
},
2021-06-08 01:23:25 +05:30
jobName() {
return this.job.name ? this.job.name : this.job.id;
},
classes() {
return {
retried: this.job.retried,
'gl-font-weight-bold': this.isActive,
};
},
dataTestId() {
return this.isActive ? 'active-job' : null;
},
2018-12-13 13:39:08 +05:30
},
};
</script>
<template>
2021-06-08 01:23:25 +05:30
<div class="build-job gl-relative" :class="classes">
2018-12-13 13:39:08 +05:30
<gl-link
2021-09-04 01:27:46 +05:30
v-gl-tooltip.left.viewport
2018-12-13 13:39:08 +05:30
:href="job.status.details_path"
:title="tooltipText"
2021-06-08 01:23:25 +05:30
class="gl-display-flex gl-align-items-center"
:data-testid="dataTestId"
2018-12-13 13:39:08 +05:30
>
2020-11-24 15:15:51 +05:30
<gl-icon
2019-07-31 22:56:46 +05:30
v-if="isActive"
name="arrow-right"
2021-06-08 01:23:25 +05:30
class="icon-arrow-right gl-absolute gl-display-block"
2019-07-31 22:56:46 +05:30
/>
2018-12-13 13:39:08 +05:30
<ci-icon :status="job.status" />
2021-06-08 01:23:25 +05:30
<span class="gl-text-truncate gl-w-full">{{ jobName }}</span>
2018-12-13 13:39:08 +05:30
2021-04-17 20:07:23 +05:30
<gl-icon v-if="job.retried" name="retry" />
2018-12-13 13:39:08 +05:30
</gl-link>
</div>
</template>