Welcome to mirror list, hosted at ThFree Co, Russian Federation.

empty_state.vue « components « job_details « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ac4f9c0c7fb11c18763ec0006c9f778485c5b8ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<script>
import { GlButton } from '@gitlab/ui';
import ManualVariablesForm from '~/ci/job_details/components/manual_variables_form.vue';

export default {
  components: {
    GlButton,
    ManualVariablesForm,
  },
  props: {
    illustrationPath: {
      type: String,
      required: true,
    },
    illustrationSizeClass: {
      type: String,
      required: true,
    },
    isRetryable: {
      type: Boolean,
      required: true,
    },
    jobId: {
      type: Number,
      required: true,
    },
    title: {
      type: String,
      required: true,
    },
    content: {
      type: String,
      required: false,
      default: null,
    },
    playable: {
      type: Boolean,
      required: true,
      default: false,
    },
    scheduled: {
      type: Boolean,
      required: false,
      default: false,
    },
    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'))
        );
      },
    },
  },
  computed: {
    shouldRenderManualVariables() {
      return this.playable && !this.scheduled;
    },
  },
};
</script>
<template>
  <div class="gl-display-flex gl-empty-state gl-text-center gl-flex-direction-column">
    <div :class="illustrationSizeClass" class="gl-max-w-full">
      <!-- eslint-disable @gitlab/vue-require-i18n-attribute-strings -->
      <img alt="" class="gl-max-w-full" :src="illustrationPath" />
    </div>
    <div class="gl-empty-state-content gl-mx-auto gl-my-0 gl-m-auto gl-p-5">
      <h1
        class="gl-font-size-h-display gl-line-height-36 gl-mt-0 gl-mb-0"
        data-testid="job-empty-state-title"
      >
        {{ title }}
      </h1>
      <p v-if="content" class="gl-mt-4 gl-mb-0" data-testid="job-empty-state-content">
        {{ content }}
      </p>
      <manual-variables-form
        v-if="shouldRenderManualVariables"
        :is-retryable="isRetryable"
        :job-id="jobId"
        @hideManualVariablesForm="$emit('hideManualVariablesForm')"
      />
      <div
        v-if="action && !shouldRenderManualVariables"
        class="gl-display-flex gl-flex-wrap gl-mt-5 gl-justify-content-center"
      >
        <gl-button
          :href="action.path"
          :data-method="action.method"
          variant="confirm"
          data-testid="job-empty-state-action"
          >{{ action.button_title }}</gl-button
        >
      </div>
    </div>
  </div>
</template>