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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

90 lines
2.4 KiB
Vue
Raw Normal View History

2018-11-20 20:47:30 +05:30
<script>
2022-07-23 23:45:48 +05:30
import { GlAlert, GlBadge, GlLink, GlSprintf } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
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,
2022-07-23 23:45:48 +05:30
GlSprintf,
2018-12-13 13:39:08 +05:30
},
2018-11-20 20:47:30 +05:30
props: {
2022-07-16 23:28:13 +05:30
hasOfflineRunnersForProject: {
2018-11-20 20:47:30 +05:30
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;
},
2022-07-23 23:45:48 +05:30
protectedBranchSettingsDocsLink() {
return 'https://docs.gitlab.com/runner/security/index.html#reduce-the-security-risk-of-using-privileged-containers';
},
2020-10-24 23:57:45 +05:30
stuckData() {
if (this.hasNoRunnersWithCorrespondingTags) {
return {
2022-07-23 23:45:48 +05:30
text: s__(
`Job|This job is stuck because of one of the following problems. There are no active runners online, no runners for the %{linkStart}protected branch%{linkEnd}, or no runners that match all of the job's tags:`,
),
2020-10-24 23:57:45 +05:30
dataTestId: 'job-stuck-with-tags',
showTags: true,
};
2022-07-16 23:28:13 +05:30
} else if (this.hasOfflineRunnersForProject) {
2020-10-24 23:57:45 +05:30
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">
2022-07-23 23:45:48 +05:30
<gl-sprintf :message="stuckData.text">
<template #link="{ content }">
<a
class="gl-display-inline-block"
:href="protectedBranchSettingsDocsLink"
target="_blank"
>
{{ content }}
</a>
</template>
</gl-sprintf>
2020-10-24 23:57:45 +05:30
<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>