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

runner_list_empty_state.vue « components « runner « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d2836962a97fab198663a5e4f8f19f1278b6c4fc (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<script>
import EMPTY_STATE_SVG_URL from '@gitlab/svgs/dist/illustrations/empty-state/empty-pipeline-md.svg?url';
import FILTERED_SVG_URL from '@gitlab/svgs/dist/illustrations/empty-state/empty-search-md.svg?url';

import { GlEmptyState, GlLink, GlSprintf, GlModalDirective } from '@gitlab/ui';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import RunnerInstructionsModal from '~/vue_shared/components/runner_instructions/runner_instructions_modal.vue';
import {
  I18N_GET_STARTED,
  I18N_RUNNERS_ARE_AGENTS,
  I18N_CREATE_RUNNER_LINK,
  I18N_STILL_USING_REGISTRATION_TOKENS,
  I18N_CONTACT_ADMIN_TO_REGISTER,
  I18N_FOLLOW_REGISTRATION_INSTRUCTIONS,
  I18N_NO_RESULTS,
  I18N_EDIT_YOUR_SEARCH,
} from '~/ci/runner/constants';

export default {
  components: {
    GlEmptyState,
    GlLink,
    GlSprintf,
    RunnerInstructionsModal,
  },
  directives: {
    GlModal: GlModalDirective,
  },
  mixins: [glFeatureFlagMixin()],
  props: {
    isSearchFiltered: {
      type: Boolean,
      required: false,
      default: false,
    },
    registrationToken: {
      type: String,
      required: false,
      default: null,
    },
    newRunnerPath: {
      type: String,
      required: false,
      default: null,
    },
  },
  computed: {
    shouldShowCreateRunnerWorkflow() {
      // create_runner_workflow_for_admin or create_runner_workflow_for_namespace
      return (
        this.glFeatures?.createRunnerWorkflowForAdmin ||
        this.glFeatures?.createRunnerWorkflowForNamespace
      );
    },
  },
  modalId: 'runners-empty-state-instructions-modal',
  svgHeight: 145,
  EMPTY_STATE_SVG_URL,
  FILTERED_SVG_URL,

  I18N_GET_STARTED,
  I18N_RUNNERS_ARE_AGENTS,
  I18N_CREATE_RUNNER_LINK,
  I18N_STILL_USING_REGISTRATION_TOKENS,
  I18N_CONTACT_ADMIN_TO_REGISTER,
  I18N_FOLLOW_REGISTRATION_INSTRUCTIONS,
  I18N_NO_RESULTS,
  I18N_EDIT_YOUR_SEARCH,
};
</script>

<template>
  <gl-empty-state
    v-if="isSearchFiltered"
    :title="$options.I18N_NO_RESULTS"
    :svg-path="$options.FILTERED_SVG_URL"
    :svg-height="$options.svgHeight"
    :description="$options.I18N_EDIT_YOUR_SEARCH"
  />
  <gl-empty-state
    v-else
    :title="$options.I18N_GET_STARTED"
    :svg-path="$options.EMPTY_STATE_SVG_URL"
    :svg-height="$options.svgHeight"
  >
    <template #description>
      {{ $options.I18N_RUNNERS_ARE_AGENTS }}
      <template v-if="shouldShowCreateRunnerWorkflow">
        <gl-sprintf v-if="newRunnerPath" :message="$options.I18N_CREATE_RUNNER_LINK">
          <template #link="{ content }">
            <gl-link :href="newRunnerPath">{{ content }}</gl-link>
          </template>
        </gl-sprintf>
        <template v-if="registrationToken">
          <br />
          <gl-link v-gl-modal="$options.modalId">{{
            $options.I18N_STILL_USING_REGISTRATION_TOKENS
          }}</gl-link>
          <runner-instructions-modal
            :modal-id="$options.modalId"
            :registration-token="registrationToken"
          />
        </template>
        <template v-if="!newRunnerPath && !registrationToken">
          {{ $options.I18N_CONTACT_ADMIN_TO_REGISTER }}
        </template>
      </template>
      <gl-sprintf
        v-else-if="registrationToken"
        :message="$options.I18N_FOLLOW_REGISTRATION_INSTRUCTIONS"
      >
        <template #link="{ content }">
          <gl-link v-gl-modal="$options.modalId">{{ content }}</gl-link>
          <runner-instructions-modal
            :modal-id="$options.modalId"
            :registration-token="registrationToken"
          />
        </template>
      </gl-sprintf>
      <template v-else>
        {{ $options.I18N_CONTACT_ADMIN_TO_REGISTER }}
      </template>
    </template>
  </gl-empty-state>
</template>