summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/clusters_list/components/clusters_empty_state.vue
blob: 76bec05cfc75c20bd5f9357e6ebfa90238eb7a65 (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
<script>
import { GlEmptyState, GlButton, GlLink, GlSprintf, GlAlert } from '@gitlab/ui';
import { mapState } from 'vuex';
import { helpPagePath } from '~/helpers/help_page_helper';
import { I18N_CLUSTERS_EMPTY_STATE } from '../constants';

export default {
  i18n: I18N_CLUSTERS_EMPTY_STATE,
  components: {
    GlEmptyState,
    GlButton,
    GlLink,
    GlSprintf,
    GlAlert,
  },
  inject: ['emptyStateHelpText', 'clustersEmptyStateImage', 'addClusterPath'],
  props: {
    isChildComponent: {
      default: false,
      required: false,
      type: Boolean,
    },
  },
  clustersHelpUrl: helpPagePath('user/infrastructure/clusters/index', {
    anchor: 'certificate-based-kubernetes-integration-deprecated',
  }),
  blogPostUrl:
    'https://about.gitlab.com/blog/2021/11/15/deprecating-the-cert-based-kubernetes-integration/',
  computed: {
    ...mapState(['canAddCluster']),
  },
};
</script>

<template>
  <div>
    <gl-empty-state :svg-path="clustersEmptyStateImage" title="">
      <template #description>
        <p class="gl-text-left">
          <gl-sprintf :message="$options.i18n.introText">
            <template #link="{ content }">
              <gl-link :href="$options.clustersHelpUrl">{{ content }}</gl-link>
            </template>
          </gl-sprintf>
        </p>

        <p v-if="emptyStateHelpText" data-testid="clusters-empty-state-text">
          {{ emptyStateHelpText }}
        </p>
      </template>

      <template #actions>
        <gl-button
          v-if="!isChildComponent"
          data-testid="integration-primary-button"
          data-qa-selector="add_kubernetes_cluster_link"
          category="primary"
          variant="confirm"
          :disabled="!canAddCluster"
          :href="addClusterPath"
        >
          {{ $options.i18n.buttonText }}
        </gl-button>
      </template>
    </gl-empty-state>

    <gl-alert variant="warning" :dismissible="false">
      <gl-sprintf :message="$options.i18n.alertText">
        <template #link="{ content }">
          <gl-link :href="$options.blogPostUrl" target="_blank">
            {{ content }}
          </gl-link>
        </template>
      </gl-sprintf>
    </gl-alert>
  </div>
</template>