Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issue_header.vue « components « show « issues « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 211f3217ddc21fab13116477b32134127bf7fb7e (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<script>
import { GlLink, GlSprintf } from '@gitlab/ui';
import { STATUS_OPEN, STATUS_REOPENED, WORKSPACE_PROJECT } from '~/issues/constants';
import { __, s__ } from '~/locale';
import IssuableHeader from '~/vue_shared/issuable/show/components/issuable_header.vue';

export default {
  WORKSPACE_PROJECT,
  components: {
    GlLink,
    GlSprintf,
    IssuableHeader,
  },
  props: {
    author: {
      type: Object,
      required: true,
    },
    confidential: {
      type: Boolean,
      required: true,
    },
    createdAt: {
      type: String,
      required: true,
    },
    duplicatedToIssueUrl: {
      type: String,
      required: true,
    },
    isFirstContribution: {
      type: Boolean,
      required: true,
    },
    isHidden: {
      type: Boolean,
      required: true,
    },
    isLocked: {
      type: Boolean,
      required: true,
    },
    issuableState: {
      type: String,
      required: true,
    },
    issuableType: {
      type: String,
      required: true,
    },
    movedToIssueUrl: {
      type: String,
      required: true,
    },
    promotedToEpicUrl: {
      type: String,
      required: true,
    },
    serviceDeskReplyTo: {
      type: String,
      required: false,
      default: '',
    },
  },
  computed: {
    closedStatusLink() {
      return this.duplicatedToIssueUrl || this.movedToIssueUrl || this.promotedToEpicUrl;
    },
    closedStatusText() {
      if (this.duplicatedToIssueUrl) {
        return s__('IssuableStatus|duplicated');
      }
      if (this.movedToIssueUrl) {
        return s__('IssuableStatus|moved');
      }
      if (this.promotedToEpicUrl) {
        return s__('IssuableStatus|promoted');
      }
      return '';
    },
    isOpen() {
      return this.issuableState === STATUS_OPEN || this.issuableState === STATUS_REOPENED;
    },
    statusIcon() {
      return this.isOpen ? 'issues' : 'issue-closed';
    },
    statusText() {
      if (this.isOpen) {
        return __('Open');
      }
      if (this.closedStatusLink) {
        return s__('IssuableStatus|Closed (%{link})');
      }
      return s__('IssuableStatus|Closed');
    },
  },
};
</script>

<template>
  <issuable-header
    :author="author"
    :blocked="isLocked"
    :confidential="confidential"
    :created-at="createdAt"
    :is-first-contribution="isFirstContribution"
    :is-hidden="isHidden"
    :issuable-state="issuableState"
    :issuable-type="issuableType"
    :service-desk-reply-to="serviceDeskReplyTo"
    show-work-item-type-icon
    :status-icon="statusIcon"
    :workspace-type="$options.WORKSPACE_PROJECT"
  >
    <template #status-badge>
      <gl-sprintf v-if="closedStatusLink" :message="statusText">
        <template #link>
          <gl-link
            class="gl-reset-color! gl-reset-font-size gl-text-decoration-underline"
            :href="closedStatusLink"
            >{{ closedStatusText }}</gl-link
          >
        </template>
      </gl-sprintf>
      <template v-else>{{ statusText }}</template>
    </template>
  </issuable-header>
</template>