summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/environments/components/empty_state.vue
blob: 3ac32f0d045a1fd29021936c96b7a9a73a47dbbe (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
<script>
import { GlButton, GlEmptyState, GlLink, GlSprintf } from '@gitlab/ui';
import { s__ } from '~/locale';

export default {
  components: {
    GlButton,
    GlEmptyState,
    GlLink,
    GlSprintf,
  },
  inject: ['newEnvironmentPath'],
  props: {
    helpPath: {
      type: String,
      required: true,
    },
    hasTerm: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  computed: {
    title() {
      return this.hasTerm ? this.$options.i18n.searchingTitle : this.$options.i18n.title;
    },
    content() {
      return this.hasTerm ? this.$options.i18n.searchingContent : this.$options.i18n.content;
    },
  },
  i18n: {
    searchingTitle: s__('Environments|No results found'),
    title: s__('Environments|Get started with environments'),
    searchingContent: s__('Environments|Edit your search and try again'),
    content: s__(
      'Environments|Environments are places where code gets deployed, such as staging or production. You can create an environment in the UI or in your .gitlab-ci.yml file. You can also enable review apps, which assist with providing an environment to showcase product changes. %{linkStart}Learn more%{linkEnd} about environments.',
    ),
    newEnvironmentButtonLabel: s__('Environments|Create an environment'),
    enablingReviewButtonLabel: s__('Environments|Enable review apps'),
  },
};
</script>
<template>
  <gl-empty-state class="gl-layout-w-limited" :title="title">
    <template #description>
      <gl-sprintf :message="content">
        <template #link="{ content: contentToDisplay }">
          <gl-link :href="helpPath">{{ contentToDisplay }}</gl-link>
        </template>
      </gl-sprintf>
    </template>
    <template v-if="!hasTerm" #actions>
      <gl-button :href="newEnvironmentPath" variant="confirm">
        {{ $options.i18n.newEnvironmentButtonLabel }}
      </gl-button>
      <gl-button @click="$emit('enable-review')">
        {{ $options.i18n.enablingReviewButtonLabel }}
      </gl-button>
    </template>
  </gl-empty-state>
</template>