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

97 lines
2.3 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';
2019-10-12 21:52:04 +05:30
import ManualVariablesForm from './manual_variables_form.vue';
2018-12-13 13:39:08 +05:30
export default {
components: {
GlLink,
2019-10-12 21:52:04 +05:30
ManualVariablesForm,
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,
},
variablesSettingsUrl: {
type: String,
required: false,
default: null,
},
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: {
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>
<manual-variables-form
v-if="shouldRenderManualVariables"
:action="action"
:variables-settings-url="variablesSettingsUrl"
/>
<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>