gitlab-org--gitlab-foss/app/assets/javascripts/jobs/components/job_container_item.vue

70 lines
1.5 KiB
Vue
Raw Normal View History

2018-10-22 17:43:43 +00:00
<script>
import { GlLink, GlIcon, GlTooltipDirective } from '@gitlab/ui';
import delayedJobMixin from '~/jobs/mixins/delayed_job_mixin';
import { sprintf } from '~/locale';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
2018-10-22 17:43:43 +00:00
export default {
components: {
CiIcon,
GlIcon,
GlLink,
2018-10-22 17:43:43 +00:00
},
directives: {
GlTooltip: GlTooltipDirective,
2018-10-22 17:43:43 +00:00
},
mixins: [delayedJobMixin],
2018-10-22 17:43:43 +00:00
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) {
2018-11-02 13:18:30 +00:00
return sprintf(text, { remainingTime: this.remainingTime });
}
return text;
2018-10-22 17:43:43 +00:00
},
},
};
</script>
<template>
<div
class="build-job gl-relative"
:class="{
retried: job.retried,
2018-11-16 20:07:38 +00:00
active: isActive,
}"
2018-10-22 17:43:43 +00:00
>
<gl-link
v-gl-tooltip:tooltip-container.left
2018-10-22 17:43:43 +00:00
:href="job.status.details_path"
:title="tooltipText"
class="js-job-link gl-display-flex gl-align-items-center"
2018-10-22 17:43:43 +00:00
>
<gl-icon
v-if="isActive"
name="arrow-right"
class="js-arrow-right icon-arrow-right gl-absolute gl-display-block"
/>
2018-10-22 17:43:43 +00:00
<ci-icon :status="job.status" />
<span class="text-truncate w-100">{{ job.name ? job.name : job.id }}</span>
2018-10-22 17:43:43 +00:00
<gl-icon v-if="job.retried" name="retry" />
</gl-link>
2018-10-22 17:43:43 +00:00
</div>
</template>