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

issue_popover.vue « components « popover « issuable « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0cafaa1e500225b612887a769d3653a11bb75045 (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
<script>
import { GlPopover, GlSkeletonLoader } from '@gitlab/ui';
import StatusBox from '~/issuable/components/status_box.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
import query from '../queries/issue.query.graphql';

export default {
  components: {
    GlPopover,
    GlSkeletonLoader,
    StatusBox,
  },
  mixins: [timeagoMixin],
  props: {
    target: {
      type: HTMLAnchorElement,
      required: true,
    },
    projectPath: {
      type: String,
      required: true,
    },
    iid: {
      type: String,
      required: true,
    },
    cachedTitle: {
      type: String,
      required: true,
    },
  },
  data() {
    return {
      issue: {},
    };
  },
  computed: {
    formattedTime() {
      return this.timeFormatted(this.issue.createdAt);
    },
    title() {
      return this.issue?.title || this.cachedTitle;
    },
    showDetails() {
      return Object.keys(this.issue).length > 0;
    },
  },
  apollo: {
    issue: {
      query,
      update: (data) => data.project.issue,
      variables() {
        const { projectPath, iid } = this;

        return {
          projectPath,
          iid,
        };
      },
    },
  },
};
</script>

<template>
  <gl-popover :target="target" boundary="viewport" placement="top" show>
    <gl-skeleton-loader v-if="$apollo.queries.issue.loading" :height="15">
      <rect width="250" height="15" rx="4" />
    </gl-skeleton-loader>
    <div v-else-if="showDetails" class="gl-display-flex gl-align-items-center">
      <status-box issuable-type="issue" :initial-state="issue.state" />
      <span class="gl-text-secondary">
        {{ __('Opened') }} <time :datetime="issue.createdAt">{{ formattedTime }}</time>
      </span>
    </div>
    <h5 v-if="!$apollo.queries.issue.loading" class="gl-my-3">{{ title }}</h5>
    <!-- eslint-disable @gitlab/vue-require-i18n-strings -->
    <div class="gl-text-secondary">
      {{ `${projectPath}#${iid}` }}
    </div>
    <!-- eslint-enable @gitlab/vue-require-i18n-strings -->
  </gl-popover>
</template>