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

ci_resource_header.vue « details « components « catalog « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 29009c14e1bbba1fc0a5685b6f5ad421df357df9 (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
129
<script>
import { GlAvatar, GlAvatarLink, GlBadge } from '@gitlab/ui';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import { isNumeric } from '~/lib/utils/number_utils';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import CiResourceAbout from './ci_resource_about.vue';
import CiResourceHeaderSkeletonLoader from './ci_resource_header_skeleton_loader.vue';

export default {
  components: {
    CiIcon,
    CiResourceAbout,
    CiResourceHeaderSkeletonLoader,
    GlAvatar,
    GlAvatarLink,
    GlBadge,
  },
  props: {
    isLoadingDetails: {
      type: Boolean,
      required: true,
    },
    isLoadingSharedData: {
      type: Boolean,
      required: true,
    },
    openIssuesCount: {
      type: Number,
      required: false,
      default: 0,
    },
    openMergeRequestsCount: {
      type: Number,
      required: false,
      default: 0,
    },
    pipelineStatus: {
      type: Object,
      required: false,
      default: () => ({}),
    },
    resource: {
      type: Object,
      required: true,
    },
  },
  computed: {
    entityId() {
      return getIdFromGraphQLId(this.resource.id);
    },
    fullPath() {
      return `${this.rootNamespace.fullPath}/${this.rootNamespace.name}`;
    },
    hasLatestVersion() {
      return this.latestVersion?.tagName;
    },
    hasPipelineStatus() {
      return this.pipelineStatus?.text;
    },
    latestVersion() {
      return this.resource.latestVersion;
    },
    rootNamespace() {
      return this.resource.rootNamespace;
    },
    versionBadgeText() {
      return isNumeric(this.latestVersion.tagName)
        ? `v${this.latestVersion.tagName}`
        : this.latestVersion.tagName;
    },
  },
};
</script>
<template>
  <div>
    <ci-resource-header-skeleton-loader v-if="isLoadingSharedData" class="gl-py-5" />
    <div v-else class="gl-display-flex gl-py-5">
      <gl-avatar-link :href="resource.webPath">
        <gl-avatar
          class="gl-mr-4"
          :entity-id="entityId"
          :entity-name="resource.name"
          shape="rect"
          :size="64"
          :src="resource.icon"
        />
      </gl-avatar-link>
      <div
        class="gl-display-flex gl-flex-direction-column gl-align-items-flex-start gl-justify-content-center"
      >
        <div class="gl-font-sm gl-text-secondary">
          {{ fullPath }}
        </div>
        <span class="gl-display-flex">
          <div class="gl-font-lg gl-font-weight-bold">{{ resource.name }}</div>
          <gl-badge
            v-if="hasLatestVersion"
            size="sm"
            class="gl-ml-3 gl-my-1"
            :href="latestVersion.tagPath"
          >
            {{ versionBadgeText }}
          </gl-badge>
        </span>
        <ci-icon
          v-if="hasPipelineStatus"
          :status="pipelineStatus"
          show-status-text
          class="gl-mt-2"
        />
      </div>
    </div>
    <ci-resource-about
      :is-loading-details="isLoadingDetails"
      :is-loading-shared-data="isLoadingSharedData"
      :open-issues-count="openIssuesCount"
      :open-merge-requests-count="openMergeRequestsCount"
      :latest-version="latestVersion"
      :web-path="resource.webPath"
    />
    <div
      v-if="isLoadingSharedData"
      class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-3 gl-max-w-20!"
    ></div>
    <p v-else class="gl-mt-3">
      {{ resource.description }}
    </p>
  </div>
</template>