summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue
blob: 9942861d9e4648374be2f9b61afbe6b16499394d (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
<script>
import { GlLink, GlSprintf } from '@gitlab/ui';
import MrWidgetIcon from './mr_widget_icon.vue';
import PipelineTourState from './states/mr_widget_pipeline_tour.vue';

export default {
  name: 'MRWidgetSuggestPipeline',
  iconName: 'status_notfound',
  popoverTarget: 'suggest-popover',
  popoverContainer: 'suggest-pipeline',
  trackLabel: 'no_pipeline_noticed',
  linkTrackValue: 30,
  linkTrackEvent: 'click_link',
  components: {
    GlLink,
    GlSprintf,
    MrWidgetIcon,
    PipelineTourState,
  },
  props: {
    pipelinePath: {
      type: String,
      required: true,
    },
    pipelineSvgPath: {
      type: String,
      required: true,
    },
    humanAccess: {
      type: String,
      required: true,
    },
  },
};
</script>
<template>
  <div :id="$options.popoverContainer" class="d-flex mr-pipeline-suggest append-bottom-default">
    <mr-widget-icon :name="$options.iconName" />
    <div :id="$options.popoverTarget">
      <gl-sprintf
        :message="
          s__(`mrWidget|%{prefixToLinkStart}No pipeline%{prefixToLinkEnd}
          %{addPipelineLinkStart}Add the .gitlab-ci.yml file%{addPipelineLinkEnd}
          to create one.`)
        "
      >
        <template #prefixToLink="{content}">
          <strong>
            {{ content }}
          </strong>
        </template>
        <template #addPipelineLink="{content}">
          <gl-link
            :href="pipelinePath"
            class="ml-2 js-add-pipeline-path"
            :data-track-property="humanAccess"
            :data-track-value="$options.linkTrackValue"
            :data-track-event="$options.linkTrackEvent"
            :data-track-label="$options.trackLabel"
          >
            {{ content }}
          </gl-link>
        </template>
      </gl-sprintf>
      <pipeline-tour-state
        :pipeline-path="pipelinePath"
        :pipeline-svg-path="pipelineSvgPath"
        :human-access="humanAccess"
        :popover-target="$options.popoverTarget"
        :popover-container="$options.popoverContainer"
        :track-label="$options.trackLabel"
      />
    </div>
  </div>
</template>