2018-11-20 20:47:30 +05:30
|
|
|
<script>
|
2020-10-24 23:57:45 +05:30
|
|
|
import { GlAlert, GlBadge, GlLink } from '@gitlab/ui';
|
|
|
|
import { s__ } from '../../locale';
|
2018-11-20 20:47:30 +05:30
|
|
|
/**
|
|
|
|
* Renders Stuck Runners block for job's view.
|
|
|
|
*/
|
|
|
|
export default {
|
2018-12-13 13:39:08 +05:30
|
|
|
components: {
|
2020-10-24 23:57:45 +05:30
|
|
|
GlAlert,
|
|
|
|
GlBadge,
|
2018-12-13 13:39:08 +05:30
|
|
|
GlLink,
|
|
|
|
},
|
2018-11-20 20:47:30 +05:30
|
|
|
props: {
|
|
|
|
hasNoRunnersForProject: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
tags: {
|
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
runnersPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2020-10-24 23:57:45 +05:30
|
|
|
computed: {
|
|
|
|
hasNoRunnersWithCorrespondingTags() {
|
|
|
|
return this.tags.length > 0;
|
|
|
|
},
|
|
|
|
stuckData() {
|
|
|
|
if (this.hasNoRunnersWithCorrespondingTags) {
|
|
|
|
return {
|
|
|
|
text: s__(`Job|This job is stuck because you don't have
|
|
|
|
any active runners online or available with any of these tags assigned to them:`),
|
|
|
|
dataTestId: 'job-stuck-with-tags',
|
|
|
|
showTags: true,
|
|
|
|
};
|
|
|
|
} else if (this.hasNoRunnersForProject) {
|
|
|
|
return {
|
|
|
|
text: s__(`Job|This job is stuck because the project
|
|
|
|
doesn't have any runners online assigned to it.`),
|
|
|
|
dataTestId: 'job-stuck-no-runners',
|
|
|
|
showTags: false,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
text: s__(`Job|This job is stuck because you don't
|
|
|
|
have any active runners that can run this job.`),
|
|
|
|
dataTestId: 'job-stuck-no-active-runners',
|
|
|
|
showTags: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
2018-11-20 20:47:30 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
2020-10-24 23:57:45 +05:30
|
|
|
<gl-alert variant="warning" :dismissible="false">
|
|
|
|
<p class="gl-mb-0" :data-testid="stuckData.dataTestId">
|
|
|
|
{{ stuckData.text }}
|
|
|
|
<template v-if="stuckData.showTags">
|
|
|
|
<gl-badge v-for="tag in tags" :key="tag" variant="info">
|
|
|
|
{{ tag }}
|
|
|
|
</gl-badge>
|
|
|
|
</template>
|
2018-11-20 20:47:30 +05:30
|
|
|
</p>
|
2020-06-23 00:09:42 +05:30
|
|
|
{{ __('Go to project') }}
|
2020-10-24 23:57:45 +05:30
|
|
|
<gl-link v-if="runnersPath" :href="runnersPath">
|
2020-06-23 00:09:42 +05:30
|
|
|
{{ __('CI settings') }}
|
2018-12-13 13:39:08 +05:30
|
|
|
</gl-link>
|
2020-10-24 23:57:45 +05:30
|
|
|
</gl-alert>
|
2018-11-20 20:47:30 +05:30
|
|
|
</template>
|