2017-09-10 17:25:29 +05:30
|
|
|
<script>
|
|
|
|
import detailRow from './sidebar_detail_row.vue';
|
|
|
|
import loadingIcon from '../../vue_shared/components/loading_icon.vue';
|
|
|
|
import timeagoMixin from '../../vue_shared/mixins/timeago';
|
|
|
|
import { timeIntervalInWords } from '../../lib/utils/datetime_utility';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'SidebarDetailsBlock',
|
2018-03-17 18:26:18 +05:30
|
|
|
components: {
|
|
|
|
detailRow,
|
|
|
|
loadingIcon,
|
|
|
|
},
|
|
|
|
mixins: [
|
|
|
|
timeagoMixin,
|
|
|
|
],
|
2017-09-10 17:25:29 +05:30
|
|
|
props: {
|
|
|
|
job: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
isLoading: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
runnerHelpUrl: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
shouldRenderContent() {
|
|
|
|
return !this.isLoading && Object.keys(this.job).length > 0;
|
|
|
|
},
|
|
|
|
coverage() {
|
|
|
|
return `${this.job.coverage}%`;
|
|
|
|
},
|
|
|
|
duration() {
|
|
|
|
return timeIntervalInWords(this.job.duration);
|
|
|
|
},
|
|
|
|
queued() {
|
|
|
|
return timeIntervalInWords(this.job.queued);
|
|
|
|
},
|
|
|
|
runnerId() {
|
|
|
|
return `#${this.job.runner.id}`;
|
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
hasTimeout() {
|
|
|
|
return this.job.metadata != null && this.job.metadata.timeout_human_readable !== null;
|
|
|
|
},
|
|
|
|
timeout() {
|
|
|
|
if (this.job.metadata == null) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
let t = this.job.metadata.timeout_human_readable;
|
|
|
|
if (this.job.metadata.timeout_source !== '') {
|
|
|
|
t += ` (from ${this.job.metadata.timeout_source})`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return t;
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
renderBlock() {
|
|
|
|
return this.job.merge_request ||
|
|
|
|
this.job.duration ||
|
|
|
|
this.job.finished_data ||
|
|
|
|
this.job.erased_at ||
|
|
|
|
this.job.queued ||
|
|
|
|
this.job.runner ||
|
|
|
|
this.job.coverage ||
|
|
|
|
this.job.tags.length ||
|
|
|
|
this.job.cancel_path;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<template v-if="shouldRenderContent">
|
|
|
|
<div
|
|
|
|
class="block retry-link"
|
2018-03-17 18:26:18 +05:30
|
|
|
v-if="job.retry_path || job.new_issue_path"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
<a
|
|
|
|
v-if="job.new_issue_path"
|
|
|
|
class="js-new-issue btn btn-new btn-inverted"
|
2018-03-17 18:26:18 +05:30
|
|
|
:href="job.new_issue_path"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
New issue
|
|
|
|
</a>
|
|
|
|
<a
|
|
|
|
v-if="job.retry_path"
|
|
|
|
class="js-retry-job btn btn-inverted-secondary"
|
|
|
|
:href="job.retry_path"
|
|
|
|
data-method="post"
|
2018-03-17 18:26:18 +05:30
|
|
|
rel="nofollow"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
Retry
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div :class="{block : renderBlock }">
|
|
|
|
<p
|
|
|
|
class="build-detail-row js-job-mr"
|
2018-03-17 18:26:18 +05:30
|
|
|
v-if="job.merge_request"
|
|
|
|
>
|
|
|
|
<span class="build-light-text">
|
2017-09-10 17:25:29 +05:30
|
|
|
Merge Request:
|
|
|
|
</span>
|
|
|
|
<a :href="job.merge_request.path">
|
2018-03-17 18:26:18 +05:30
|
|
|
!{{ job.merge_request.iid }}
|
2017-09-10 17:25:29 +05:30
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<detail-row
|
|
|
|
class="js-job-duration"
|
|
|
|
v-if="job.duration"
|
|
|
|
title="Duration"
|
|
|
|
:value="duration"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
<detail-row
|
|
|
|
class="js-job-finished"
|
|
|
|
v-if="job.finished_at"
|
|
|
|
title="Finished"
|
|
|
|
:value="timeFormated(job.finished_at)"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
<detail-row
|
|
|
|
class="js-job-erased"
|
|
|
|
v-if="job.erased_at"
|
|
|
|
title="Erased"
|
|
|
|
:value="timeFormated(job.erased_at)"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
<detail-row
|
|
|
|
class="js-job-queued"
|
|
|
|
v-if="job.queued"
|
|
|
|
title="Queued"
|
|
|
|
:value="queued"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
2018-05-09 12:01:36 +05:30
|
|
|
<detail-row
|
|
|
|
class="js-job-timeout"
|
|
|
|
v-if="hasTimeout"
|
|
|
|
title="Timeout"
|
|
|
|
:help-url="runnerHelpUrl"
|
|
|
|
:value="timeout"
|
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
<detail-row
|
|
|
|
class="js-job-runner"
|
|
|
|
v-if="job.runner"
|
|
|
|
title="Runner"
|
|
|
|
:value="runnerId"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
<detail-row
|
|
|
|
class="js-job-coverage"
|
|
|
|
v-if="job.coverage"
|
|
|
|
title="Coverage"
|
|
|
|
:value="coverage"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
<p
|
|
|
|
class="build-detail-row js-job-tags"
|
2018-03-17 18:26:18 +05:30
|
|
|
v-if="job.tags.length"
|
|
|
|
>
|
|
|
|
<span class="build-light-text">
|
2017-09-10 17:25:29 +05:30
|
|
|
Tags:
|
|
|
|
</span>
|
|
|
|
<span
|
2018-03-17 18:26:18 +05:30
|
|
|
v-for="(tag, i) in job.tags"
|
|
|
|
:key="i"
|
2017-09-10 17:25:29 +05:30
|
|
|
class="label label-primary">
|
2018-03-17 18:26:18 +05:30
|
|
|
{{ tag }}
|
2017-09-10 17:25:29 +05:30
|
|
|
</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div
|
|
|
|
v-if="job.cancel_path"
|
|
|
|
class="btn-group prepend-top-5"
|
|
|
|
role="group">
|
|
|
|
<a
|
|
|
|
class="js-cancel-job btn btn-sm btn-default"
|
|
|
|
:href="job.cancel_path"
|
|
|
|
data-method="post"
|
2018-03-17 18:26:18 +05:30
|
|
|
rel="nofollow"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
Cancel
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<loading-icon
|
|
|
|
class="prepend-top-10"
|
|
|
|
v-if="isLoading"
|
|
|
|
size="2"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
</div>
|
|
|
|
</template>
|