summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue
blob: 227e9b85f9da52e4566eb660a15675c647761de4 (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
<script>
import { sprintf, s__ } from '~/locale';
import tooltip from '~/vue_shared/directives/tooltip';
import statusIcon from '../mr_widget_status_icon.vue';
import mrWidgetMergeHelp from '../../components/mr_widget_merge_help.vue';

export default {
  name: 'MRWidgetMissingBranch',
  directives: {
    tooltip,
  },
  components: {
    mrWidgetMergeHelp,
    statusIcon,
  },
  props: {
    mr: {
      type: Object,
      required: true,
    },
  },
  computed: {
    missingBranchName() {
      return this.mr.sourceBranchRemoved ? 'source' : 'target';
    },
    missingBranchNameMessage() {
      return sprintf(
        s__('mrWidget| Please restore it or use a different %{missingBranchName} branch'),
        {
          missingBranchName: this.missingBranchName,
        },
      );
    },
    message() {
      return sprintf(
        s__(
          'mrWidget|If the %{missingBranchName} branch exists in your local repository, you can merge this merge request manually using the command line',
        ),
        {
          missingBranchName: this.missingBranchName,
        },
      );
    },
  },
};
</script>
<template>
  <div class="mr-widget-body media">
    <status-icon
      :show-disabled-button="true"
      status="warning"
    />

    <div class="media-body space-children">
      <span class="bold js-branch-text">
        <span class="capitalize">
          {{ missingBranchName }}
        </span> {{ s__("mrWidget|branch does not exist.") }}
        {{ missingBranchNameMessage }}
        <i
          v-tooltip
          :title="message"
          :aria-label="message"
          class="fa fa-question-circle"
        >
        </i>
      </span>
    </div>
  </div>
</template>