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

69 lines
1.4 KiB
Vue
Raw Normal View History

2018-12-13 13:39:08 +05:30
<script>
2019-02-13 22:33:31 +05:30
import { GlLink } from '@gitlab/ui';
2018-12-13 13:39:08 +05:30
import tooltip from '~/vue_shared/directives/tooltip';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import Icon from '~/vue_shared/components/icon.vue';
import delayedJobMixin from '~/jobs/mixins/delayed_job_mixin';
import { sprintf } from '~/locale';
export default {
components: {
CiIcon,
Icon,
GlLink,
},
directives: {
tooltip,
},
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;
},
},
};
</script>
<template>
<div
class="build-job"
:class="{
retried: job.retried,
2019-02-13 22:33:31 +05:30
active: isActive,
2018-12-13 13:39:08 +05:30
}"
>
<gl-link
v-tooltip
:href="job.status.details_path"
:title="tooltipText"
data-boundary="viewport"
class="js-job-link"
>
2019-02-13 22:33:31 +05:30
<icon v-if="isActive" name="arrow-right" class="js-arrow-right icon-arrow-right" />
2018-12-13 13:39:08 +05:30
<ci-icon :status="job.status" />
<span>{{ job.name ? job.name : job.id }}</span>
2019-02-13 22:33:31 +05:30
<icon v-if="job.retried" name="retry" class="js-retry-icon" />
2018-12-13 13:39:08 +05:30
</gl-link>
</div>
</template>