summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipelines/components/pipelines_list/empty_state.vue
blob: ee26ea2f007e0b9b7197e674a04dca730a8e8235 (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 { isExperimentEnabled } from '~/lib/utils/experimentation';
import { s__ } from '~/locale';
import Tracking from '~/tracking';

export default {
  i18n: {
    control: {
      infoMessage: s__(`Pipelines|Continuous Integration can help
        catch bugs by running your tests automatically,
        while Continuous Deployment can help you deliver
        code to your product environment.`),
      buttonMessage: s__('Pipelines|Get started with Pipelines'),
    },
    experiment: {
      infoMessage: s__(`Pipelines|GitLab CI/CD can automatically build,
          test, and deploy your code. Let GitLab take care of time
          consuming tasks, so you can spend more time creating.`),
      buttonMessage: s__('Pipelines|Get started with CI/CD'),
    },
  },
  name: 'PipelinesEmptyState',
  components: {
    GlButton,
  },
  props: {
    helpPagePath: {
      type: String,
      required: true,
    },
    emptyStateSvgPath: {
      type: String,
      required: true,
    },
    canSetCi: {
      type: Boolean,
      required: true,
    },
  },
  mounted() {
    this.track('viewed');
  },
  methods: {
    track(action) {
      if (!gon.tracking_data) {
        return;
      }

      const { category, value, label, property } = gon.tracking_data;

      Tracking.event(category, action, { value, label, property });
    },
    isExperimentEnabled() {
      return isExperimentEnabled('pipelinesEmptyState');
    },
  },
};
</script>
<template>
  <div class="row empty-state js-empty-state">
    <div class="col-12">
      <div class="svg-content svg-250"><img :src="emptyStateSvgPath" /></div>
    </div>

    <div class="col-12">
      <div class="text-content">
        <template v-if="canSetCi">
          <h4 data-testid="header-text" class="gl-text-center">
            {{ s__('Pipelines|Build with confidence') }}
          </h4>
          <p data-testid="info-text">
            {{
              isExperimentEnabled()
                ? $options.i18n.experiment.infoMessage
                : $options.i18n.control.infoMessage
            }}
          </p>

          <div class="gl-text-center">
            <gl-button
              :href="helpPagePath"
              variant="info"
              category="primary"
              data-testid="get-started-pipelines"
              @click="track('documentation_clicked')"
            >
              {{
                isExperimentEnabled()
                  ? $options.i18n.experiment.buttonMessage
                  : $options.i18n.control.buttonMessage
              }}
            </gl-button>
          </div>
        </template>

        <p v-else class="gl-text-center">
          {{ s__('Pipelines|This project is not currently set up to run pipelines.') }}
        </p>
      </div>
    </div>
  </div>
</template>