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

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

100 lines
2.6 KiB
Vue
Raw Normal View History

2018-11-20 20:47:30 +05:30
<script>
2019-02-15 15:39:39 +05:30
import { GlLink } from '@gitlab/ui';
2022-10-11 01:57:18 +05:30
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import LegacyManualVariablesForm from '~/jobs/components/job/legacy_manual_variables_form.vue';
import ManualVariablesForm from '~/jobs/components/job/manual_variables_form.vue';
2018-12-13 13:39:08 +05:30
export default {
components: {
GlLink,
2022-10-11 01:57:18 +05:30
LegacyManualVariablesForm,
2019-10-12 21:52:04 +05:30
ManualVariablesForm,
2018-12-13 13:39:08 +05:30
},
2022-10-11 01:57:18 +05:30
mixins: [glFeatureFlagsMixin()],
2018-12-13 13:39:08 +05:30
props: {
illustrationPath: {
type: String,
required: true,
},
illustrationSizeClass: {
type: String,
required: true,
},
title: {
type: String,
required: true,
},
content: {
type: String,
required: false,
default: null,
},
2019-10-12 21:52:04 +05:30
playable: {
type: Boolean,
required: true,
default: false,
},
scheduled: {
type: Boolean,
required: false,
default: false,
},
2018-12-13 13:39:08 +05:30
action: {
type: Object,
required: false,
default: null,
validator(value) {
return (
value === null ||
(Object.prototype.hasOwnProperty.call(value, 'path') &&
Object.prototype.hasOwnProperty.call(value, 'method') &&
Object.prototype.hasOwnProperty.call(value, 'button_title'))
);
2018-11-20 20:47:30 +05:30
},
},
2018-12-13 13:39:08 +05:30
},
2019-10-12 21:52:04 +05:30
computed: {
2022-10-11 01:57:18 +05:30
isGraphQL() {
return this.glFeatures?.graphqlJobApp;
},
2019-10-12 21:52:04 +05:30
shouldRenderManualVariables() {
return this.playable && !this.scheduled;
},
},
2018-12-13 13:39:08 +05:30
};
2018-11-20 20:47:30 +05:30
</script>
<template>
<div class="row empty-state">
<div class="col-12">
2019-10-12 21:52:04 +05:30
<div :class="illustrationSizeClass" class="svg-content">
<img :src="illustrationPath" />
</div>
2018-11-20 20:47:30 +05:30
</div>
<div class="col-12">
<div class="text-content">
2020-10-24 23:57:45 +05:30
<h4 class="text-center" data-testid="job-empty-state-title">{{ title }}</h4>
2018-11-20 20:47:30 +05:30
2020-10-24 23:57:45 +05:30
<p v-if="content" data-testid="job-empty-state-content">{{ content }}</p>
2019-10-12 21:52:04 +05:30
</div>
2022-10-11 01:57:18 +05:30
<template v-if="isGraphQL">
<manual-variables-form v-if="shouldRenderManualVariables" :action="action" />
</template>
<template v-else>
<legacy-manual-variables-form v-if="shouldRenderManualVariables" :action="action" />
</template>
2019-10-12 21:52:04 +05:30
<div class="text-content">
<div v-if="action && !shouldRenderManualVariables" class="text-center">
2018-12-13 13:39:08 +05:30
<gl-link
2018-12-05 23:21:45 +05:30
:href="action.path"
2018-11-20 20:47:30 +05:30
:data-method="action.method"
2021-03-11 19:13:27 +05:30
class="btn gl-button btn-confirm gl-text-decoration-none!"
2020-10-24 23:57:45 +05:30
data-testid="job-empty-state-action"
2019-10-12 21:52:04 +05:30
>{{ action.button_title }}</gl-link
2018-11-20 20:47:30 +05:30
>
</div>
</div>
</div>
</div>
</template>