2018-08-09 10:44:47 -04:00
|
|
|
<script>
|
2020-08-05 17:09:40 -04:00
|
|
|
import { GlAlert, GlBadge, GlLink } from '@gitlab/ui';
|
|
|
|
import { s__ } from '../../locale';
|
2018-08-09 10:44:47 -04:00
|
|
|
/**
|
|
|
|
* Renders Stuck Runners block for job's view.
|
|
|
|
*/
|
|
|
|
export default {
|
2018-11-02 13:15:56 -04:00
|
|
|
components: {
|
2020-08-05 17:09:40 -04:00
|
|
|
GlAlert,
|
|
|
|
GlBadge,
|
2018-11-02 13:15:56 -04:00
|
|
|
GlLink,
|
|
|
|
},
|
2018-08-09 10:44:47 -04:00
|
|
|
props: {
|
|
|
|
hasNoRunnersForProject: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
tags: {
|
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
runnersPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2020-08-05 17:09:40 -04:00
|
|
|
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-08-09 10:44:47 -04:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
2020-08-05 17:09:40 -04:00
|
|
|
<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-08-09 10:44:47 -04:00
|
|
|
</p>
|
2020-06-02 11:08:24 -04:00
|
|
|
{{ __('Go to project') }}
|
2020-07-21 17:09:12 -04:00
|
|
|
<gl-link v-if="runnersPath" :href="runnersPath">
|
2020-06-02 11:08:24 -04:00
|
|
|
{{ __('CI settings') }}
|
2018-11-02 13:15:56 -04:00
|
|
|
</gl-link>
|
2020-08-05 17:09:40 -04:00
|
|
|
</gl-alert>
|
2018-08-09 10:44:47 -04:00
|
|
|
</template>
|