summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/packages/shared/components
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-20 13:37:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-20 13:37:47 +0000
commitaee0a117a889461ce8ced6fcf73207fe017f1d99 (patch)
tree891d9ef189227a8445d83f35c1b0fc99573f4380 /app/assets/javascripts/packages/shared/components
parent8d46af3258650d305f53b819eabf7ab18d22f59e (diff)
downloadgitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'app/assets/javascripts/packages/shared/components')
-rw-r--r--app/assets/javascripts/packages/shared/components/package_icon_and_name.vue17
-rw-r--r--app/assets/javascripts/packages/shared/components/package_list_row.vue174
-rw-r--r--app/assets/javascripts/packages/shared/components/package_path.vue86
-rw-r--r--app/assets/javascripts/packages/shared/components/package_tags.vue110
-rw-r--r--app/assets/javascripts/packages/shared/components/packages_list_loader.vue60
-rw-r--r--app/assets/javascripts/packages/shared/components/publish_method.vue64
6 files changed, 0 insertions, 511 deletions
diff --git a/app/assets/javascripts/packages/shared/components/package_icon_and_name.vue b/app/assets/javascripts/packages/shared/components/package_icon_and_name.vue
deleted file mode 100644
index 105f7bbe132..00000000000
--- a/app/assets/javascripts/packages/shared/components/package_icon_and_name.vue
+++ /dev/null
@@ -1,17 +0,0 @@
-<script>
-import { GlIcon } from '@gitlab/ui';
-
-export default {
- name: 'PackageIconAndName',
- components: {
- GlIcon,
- },
-};
-</script>
-
-<template>
- <div class="gl-display-flex gl-align-items-center">
- <gl-icon name="package" class="gl-ml-3 gl-mr-2" />
- <span><slot></slot></span>
- </div>
-</template>
diff --git a/app/assets/javascripts/packages/shared/components/package_list_row.vue b/app/assets/javascripts/packages/shared/components/package_list_row.vue
deleted file mode 100644
index eee0e470c7b..00000000000
--- a/app/assets/javascripts/packages/shared/components/package_list_row.vue
+++ /dev/null
@@ -1,174 +0,0 @@
-<script>
-import { GlButton, GlLink, GlSprintf, GlTooltipDirective, GlTruncate } from '@gitlab/ui';
-import { s__ } from '~/locale';
-import ListItem from '~/vue_shared/components/registry/list_item.vue';
-import timeagoMixin from '~/vue_shared/mixins/timeago';
-import { PACKAGE_ERROR_STATUS, PACKAGE_DEFAULT_STATUS } from '../constants';
-import { getPackageTypeLabel } from '../utils';
-import PackagePath from './package_path.vue';
-import PackageTags from './package_tags.vue';
-import PublishMethod from './publish_method.vue';
-
-export default {
- name: 'PackageListRow',
- components: {
- GlButton,
- GlLink,
- GlSprintf,
- GlTruncate,
- PackageTags,
- PackagePath,
- PublishMethod,
- ListItem,
- PackageIconAndName: () =>
- import(/* webpackChunkName: 'package_registry_components' */ './package_icon_and_name.vue'),
- InfrastructureIconAndName: () =>
- import(
- /* webpackChunkName: 'infrastructure_registry_components' */ '~/packages_and_registries/infrastructure_registry/components/infrastructure_icon_and_name.vue'
- ),
- },
- directives: {
- GlTooltip: GlTooltipDirective,
- },
- mixins: [timeagoMixin],
- inject: {
- iconComponent: {
- from: 'iconComponent',
- default: 'PackageIconAndName',
- },
- },
- props: {
- packageEntity: {
- type: Object,
- required: true,
- },
- packageLink: {
- type: String,
- required: true,
- },
- disableDelete: {
- type: Boolean,
- default: false,
- required: false,
- },
- isGroup: {
- type: Boolean,
- default: false,
- required: false,
- },
- showPackageType: {
- type: Boolean,
- default: true,
- required: false,
- },
- },
- computed: {
- packageType() {
- return getPackageTypeLabel(this.packageEntity.package_type);
- },
- hasPipeline() {
- return Boolean(this.packageEntity.pipeline);
- },
- hasProjectLink() {
- return Boolean(this.packageEntity.project_path);
- },
- showWarningIcon() {
- return this.packageEntity.status === PACKAGE_ERROR_STATUS;
- },
- disabledRow() {
- return this.packageEntity.status && this.packageEntity.status !== PACKAGE_DEFAULT_STATUS;
- },
- disabledDeleteButton() {
- return this.disabledRow || !this.packageEntity._links.delete_api_path;
- },
- },
- i18n: {
- erroredPackageText: s__('PackageRegistry|Invalid Package: failed metadata extraction'),
- },
-};
-</script>
-
-<template>
- <list-item data-qa-selector="package_row" :disabled="disabledRow">
- <template #left-primary>
- <div class="gl-display-flex gl-align-items-center gl-mr-3 gl-min-w-0">
- <gl-link
- :href="packageLink"
- class="gl-text-body gl-min-w-0"
- data-qa-selector="package_link"
- :disabled="disabledRow"
- >
- <gl-truncate :text="packageEntity.name" />
- </gl-link>
-
- <gl-button
- v-if="showWarningIcon"
- v-gl-tooltip="{ title: $options.i18n.erroredPackageText }"
- class="gl-hover-bg-transparent!"
- icon="warning"
- category="tertiary"
- data-testid="warning-icon"
- :aria-label="__('Warning')"
- />
-
- <package-tags
- v-if="packageEntity.tags && packageEntity.tags.length"
- class="gl-ml-3"
- :tags="packageEntity.tags"
- hide-label
- :tag-display-limit="1"
- />
- </div>
- </template>
- <template #left-secondary>
- <div class="gl-display-flex">
- <span>{{ packageEntity.version }}</span>
-
- <div v-if="hasPipeline" class="gl-display-none gl-sm-display-flex gl-ml-2">
- <gl-sprintf :message="s__('PackageRegistry|published by %{author}')">
- <template #author>{{ packageEntity.pipeline.user.name }}</template>
- </gl-sprintf>
- </div>
-
- <component :is="iconComponent" v-if="showPackageType">
- {{ packageType }}
- </component>
-
- <package-path
- v-if="hasProjectLink"
- :path="packageEntity.project_path"
- :disabled="disabledRow"
- />
- </div>
- </template>
-
- <template #right-primary>
- <publish-method :package-entity="packageEntity" :is-group="isGroup" />
- </template>
-
- <template #right-secondary>
- <span>
- <gl-sprintf :message="__('Created %{timestamp}')">
- <template #timestamp>
- <span v-gl-tooltip :title="tooltipTitle(packageEntity.created_at)">
- {{ timeFormatted(packageEntity.created_at) }}
- </span>
- </template>
- </gl-sprintf>
- </span>
- </template>
-
- <template v-if="!disableDelete" #right-action>
- <gl-button
- data-testid="action-delete"
- icon="remove"
- category="secondary"
- variant="danger"
- :title="s__('PackageRegistry|Remove package')"
- :aria-label="s__('PackageRegistry|Remove package')"
- :disabled="disabledDeleteButton"
- @click="$emit('packageToDelete', packageEntity)"
- />
- </template>
- </list-item>
-</template>
diff --git a/app/assets/javascripts/packages/shared/components/package_path.vue b/app/assets/javascripts/packages/shared/components/package_path.vue
deleted file mode 100644
index 6fb001e5e92..00000000000
--- a/app/assets/javascripts/packages/shared/components/package_path.vue
+++ /dev/null
@@ -1,86 +0,0 @@
-<script>
-import { GlIcon, GlLink, GlTooltipDirective } from '@gitlab/ui';
-import { joinPaths } from '~/lib/utils/url_utility';
-
-export default {
- name: 'PackagePath',
- components: {
- GlIcon,
- GlLink,
- },
- directives: {
- GlTooltip: GlTooltipDirective,
- },
- props: {
- path: {
- type: String,
- required: true,
- },
- disabled: {
- type: Boolean,
- required: false,
- default: false,
- },
- },
- computed: {
- pathPieces() {
- return this.path.split('/');
- },
- root() {
- // we skip the first part of the path since is the 'base' group
- return this.pathPieces[1];
- },
- rootLink() {
- return joinPaths(this.pathPieces[0], this.root);
- },
- leaf() {
- return this.pathPieces[this.pathPieces.length - 1];
- },
- deeplyNested() {
- return this.pathPieces.length > 3;
- },
- hasGroup() {
- return this.root !== this.leaf;
- },
- },
-};
-</script>
-
-<template>
- <div data-qa-selector="package-path" class="gl-display-flex gl-align-items-center">
- <gl-icon data-testid="base-icon" name="project" class="gl-mx-3 gl-min-w-0" />
-
- <gl-link
- data-testid="root-link"
- class="gl-text-gray-500 gl-min-w-0"
- :href="`/${rootLink}`"
- :disabled="disabled"
- >
- {{ root }}
- </gl-link>
-
- <template v-if="hasGroup">
- <gl-icon data-testid="root-chevron" name="chevron-right" class="gl-mx-2 gl-min-w-0" />
-
- <template v-if="deeplyNested">
- <span
- v-gl-tooltip="{ title: path }"
- data-testid="ellipsis-icon"
- class="gl-inset-border-1-gray-200 gl-rounded-base gl-px-2 gl-min-w-0"
- >
- <gl-icon name="ellipsis_h" />
- </span>
- <gl-icon data-testid="ellipsis-chevron" name="chevron-right" class="gl-mx-2 gl-min-w-0" />
- </template>
-
- <gl-link
- data-testid="leaf-link"
- class="gl-text-gray-500 gl-min-w-0"
- :href="`/${path}`"
- :disabled="disabled"
- >
- {{ leaf }}
- </gl-link>
- </template>
- </div>
-</template>
diff --git a/app/assets/javascripts/packages/shared/components/package_tags.vue b/app/assets/javascripts/packages/shared/components/package_tags.vue
deleted file mode 100644
index 5ec950e4d45..00000000000
--- a/app/assets/javascripts/packages/shared/components/package_tags.vue
+++ /dev/null
@@ -1,110 +0,0 @@
-<script>
-import { GlBadge, GlIcon, GlSprintf, GlTooltipDirective } from '@gitlab/ui';
-import { n__ } from '~/locale';
-
-export default {
- name: 'PackageTags',
- components: {
- GlBadge,
- GlIcon,
- GlSprintf,
- },
- directives: {
- GlTooltip: GlTooltipDirective,
- },
- props: {
- tagDisplayLimit: {
- type: Number,
- required: false,
- default: 2,
- },
- tags: {
- type: Array,
- required: true,
- default: () => [],
- },
- hideLabel: {
- type: Boolean,
- required: false,
- default: false,
- },
- },
- computed: {
- tagCount() {
- return this.tags.length;
- },
- tagsToRender() {
- return this.tags.slice(0, this.tagDisplayLimit);
- },
- moreTagsDisplay() {
- return Math.max(0, this.tags.length - this.tagDisplayLimit);
- },
- moreTagsTooltip() {
- if (this.moreTagsDisplay) {
- return this.tags
- .slice(this.tagDisplayLimit)
- .map((x) => x.name)
- .join(', ');
- }
-
- return '';
- },
- tagsDisplay() {
- return n__('%d tag', '%d tags', this.tagCount);
- },
- },
- methods: {
- tagBadgeClass(index) {
- return {
- 'gl-display-none': true,
- 'gl-display-flex': this.tagCount === 1,
- 'd-md-flex': this.tagCount > 1,
- 'gl-mr-2': index !== this.tagsToRender.length - 1,
- 'gl-ml-3': !this.hideLabel && index === 0,
- };
- },
- },
-};
-</script>
-
-<template>
- <div class="gl-display-flex gl-align-items-center">
- <div v-if="!hideLabel" data-testid="tagLabel" class="gl-display-flex gl-align-items-center">
- <gl-icon name="labels" class="gl-text-gray-500 gl-mr-3" />
- <span class="gl-font-weight-bold">{{ tagsDisplay }}</span>
- </div>
-
- <gl-badge
- v-for="(tag, index) in tagsToRender"
- :key="index"
- data-testid="tagBadge"
- :class="tagBadgeClass(index)"
- variant="info"
- size="sm"
- >{{ tag.name }}</gl-badge
- >
-
- <gl-badge
- v-if="moreTagsDisplay"
- v-gl-tooltip
- data-testid="moreBadge"
- variant="muted"
- :title="moreTagsTooltip"
- size="sm"
- class="gl-display-none gl-md-display-flex gl-ml-2"
- ><gl-sprintf :message="__('+%{tags} more')">
- <template #tags>
- {{ moreTagsDisplay }}
- </template>
- </gl-sprintf></gl-badge
- >
-
- <gl-badge
- v-if="moreTagsDisplay && hideLabel"
- data-testid="moreBadge"
- variant="muted"
- class="gl-md-display-none gl-ml-2"
- >{{ tagsDisplay }}</gl-badge
- >
- </div>
-</template>
diff --git a/app/assets/javascripts/packages/shared/components/packages_list_loader.vue b/app/assets/javascripts/packages/shared/components/packages_list_loader.vue
deleted file mode 100644
index cf555f46f8c..00000000000
--- a/app/assets/javascripts/packages/shared/components/packages_list_loader.vue
+++ /dev/null
@@ -1,60 +0,0 @@
-<script>
-import { GlSkeletonLoader } from '@gitlab/ui';
-
-export default {
- components: {
- GlSkeletonLoader,
- },
- shapes: [
- { type: 'rect', width: '220', height: '10', x: '0', y: '20' },
- { type: 'rect', width: '60', height: '10', x: '305', y: '20' },
- { type: 'rect', width: '60', height: '10', x: '535', y: '20' },
- { type: 'rect', width: '100', height: '10', x: '760', y: '20' },
- { type: 'rect', width: '30', height: '30', x: '970', y: '10', ref: 'button-loader' },
- ],
- rowsToRender: {
- mobile: 5,
- desktop: 20,
- },
-};
-</script>
-
-<template>
- <div>
- <div class="gl-flex-direction-column gl-sm-display-none" data-testid="mobile-loader">
- <gl-skeleton-loader
- v-for="index in $options.rowsToRender.mobile"
- :key="index"
- :width="500"
- :height="170"
- preserve-aspect-ratio="xMinYMax meet"
- >
- <rect width="500" height="10" x="0" y="15" rx="4" />
- <rect width="500" height="10" x="0" y="45" rx="4" />
- <rect width="500" height="10" x="0" y="75" rx="4" />
- <rect width="500" height="10" x="0" y="105" rx="4" />
- <rect width="500" height="10" x="0" y="135" rx="4" />
- </gl-skeleton-loader>
- </div>
- <div
- class="gl-display-none gl-sm-display-flex gl-flex-direction-column"
- data-testid="desktop-loader"
- >
- <gl-skeleton-loader
- v-for="index in $options.rowsToRender.desktop"
- :key="index"
- :width="1000"
- :height="54"
- preserve-aspect-ratio="xMinYMax meet"
- >
- <component
- :is="r.type"
- v-for="(r, rIndex) in $options.shapes"
- :key="rIndex"
- rx="4"
- v-bind="r"
- />
- </gl-skeleton-loader>
- </div>
- </div>
-</template>
diff --git a/app/assets/javascripts/packages/shared/components/publish_method.vue b/app/assets/javascripts/packages/shared/components/publish_method.vue
deleted file mode 100644
index 8a66a33f2ab..00000000000
--- a/app/assets/javascripts/packages/shared/components/publish_method.vue
+++ /dev/null
@@ -1,64 +0,0 @@
-<script>
-import { GlIcon, GlLink } from '@gitlab/ui';
-import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
-import { getCommitLink } from '../utils';
-
-export default {
- name: 'PublishMethod',
- components: {
- ClipboardButton,
- GlIcon,
- GlLink,
- },
- props: {
- packageEntity: {
- type: Object,
- required: true,
- },
- isGroup: {
- type: Boolean,
- required: false,
- default: false,
- },
- },
- computed: {
- hasPipeline() {
- return Boolean(this.packageEntity.pipeline);
- },
- packageShaShort() {
- return this.packageEntity.pipeline?.sha.substring(0, 8);
- },
- linkToCommit() {
- return getCommitLink(this.packageEntity, this.isGroup);
- },
- },
-};
-</script>
-
-<template>
- <div class="gl-display-flex gl-align-items-center">
- <template v-if="hasPipeline">
- <gl-icon name="git-merge" class="gl-mr-2" />
- <span data-testid="pipeline-ref" class="gl-mr-2">{{ packageEntity.pipeline.ref }}</span>
-
- <gl-icon name="commit" class="gl-mr-2" />
- <gl-link data-testid="pipeline-sha" :href="linkToCommit" class="gl-mr-2">{{
- packageShaShort
- }}</gl-link>
-
- <clipboard-button
- :text="packageEntity.pipeline.sha"
- :title="__('Copy commit SHA')"
- category="tertiary"
- size="small"
- />
- </template>
-
- <template v-else>
- <gl-icon name="upload" class="gl-mr-2" />
- <span data-testid="manually-published">
- {{ s__('PackageRegistry|Manually Published') }}
- </span>
- </template>
- </div>
-</template>