diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /app/assets/javascripts/packages/list | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-056d9df33865790d1b3c10f77912e00f61193000.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'app/assets/javascripts/packages/list')
5 files changed, 6 insertions, 158 deletions
diff --git a/app/assets/javascripts/packages/list/components/package_search.vue b/app/assets/javascripts/packages/list/components/package_search.vue deleted file mode 100644 index 869a2c2f641..00000000000 --- a/app/assets/javascripts/packages/list/components/package_search.vue +++ /dev/null @@ -1,57 +0,0 @@ -<script> -import { mapState, mapActions } from 'vuex'; -import { s__ } from '~/locale'; -import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants'; -import RegistrySearch from '~/vue_shared/components/registry/registry_search.vue'; -import UrlSync from '~/vue_shared/components/url_sync.vue'; -import { sortableFields } from '../utils'; -import PackageTypeToken from './tokens/package_type_token.vue'; - -export default { - tokens: [ - { - type: 'type', - icon: 'package', - title: s__('PackageRegistry|Type'), - unique: true, - token: PackageTypeToken, - operators: OPERATOR_IS_ONLY, - }, - ], - components: { RegistrySearch, UrlSync }, - computed: { - ...mapState({ - isGroupPage: (state) => state.config.isGroupPage, - sorting: (state) => state.sorting, - filter: (state) => state.filter, - }), - sortableFields() { - return sortableFields(this.isGroupPage); - }, - }, - methods: { - ...mapActions(['setSorting', 'setFilter']), - updateSorting(newValue) { - this.setSorting(newValue); - this.$emit('update'); - }, - }, -}; -</script> - -<template> - <url-sync> - <template #default="{ updateQuery }"> - <registry-search - :filter="filter" - :sorting="sorting" - :tokens="$options.tokens" - :sortable-fields="sortableFields" - @sorting:changed="updateSorting" - @filter:changed="setFilter" - @filter:submit="$emit('update')" - @query:changed="updateQuery" - /> - </template> - </url-sync> -</template> diff --git a/app/assets/javascripts/packages/list/components/package_title.vue b/app/assets/javascripts/packages/list/components/package_title.vue deleted file mode 100644 index 426ad150ea9..00000000000 --- a/app/assets/javascripts/packages/list/components/package_title.vue +++ /dev/null @@ -1,47 +0,0 @@ -<script> -import { n__ } from '~/locale'; -import MetadataItem from '~/vue_shared/components/registry/metadata_item.vue'; -import TitleArea from '~/vue_shared/components/registry/title_area.vue'; -import { LIST_INTRO_TEXT, LIST_TITLE_TEXT } from '../constants'; - -export default { - name: 'PackageTitle', - components: { - TitleArea, - MetadataItem, - }, - props: { - count: { - type: Number, - required: false, - default: null, - }, - helpUrl: { - type: String, - required: true, - }, - }, - computed: { - showPackageCount() { - return Number.isInteger(this.count); - }, - packageAmountText() { - return n__(`%d Package`, `%d Packages`, this.count); - }, - infoMessages() { - return [{ text: LIST_INTRO_TEXT, link: this.helpUrl }]; - }, - }, - i18n: { - LIST_TITLE_TEXT, - }, -}; -</script> - -<template> - <title-area :title="$options.i18n.LIST_TITLE_TEXT" :info-messages="infoMessages"> - <template #metadata-amount> - <metadata-item v-if="showPackageCount" icon="package" :text="packageAmountText" /> - </template> - </title-area> -</template> diff --git a/app/assets/javascripts/packages/list/components/packages_list_app.vue b/app/assets/javascripts/packages/list/components/packages_list_app.vue index 4c5fb0ee7c9..31d90fa4dee 100644 --- a/app/assets/javascripts/packages/list/components/packages_list_app.vue +++ b/app/assets/javascripts/packages/list/components/packages_list_app.vue @@ -7,6 +7,8 @@ import { s__ } from '~/locale'; import { SHOW_DELETE_SUCCESS_ALERT } from '~/packages/shared/constants'; import { FILTERED_SEARCH_TERM } from '~/packages_and_registries/shared/constants'; import { getQueryParams, extractFilterAndSorting } from '~/packages_and_registries/shared/utils'; +import InfrastructureTitle from '~/packages_and_registries/infrastructure_registry/components/infrastructure_title.vue'; +import InfrastructureSearch from '~/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue'; import { DELETE_PACKAGE_SUCCESS_MESSAGE } from '../constants'; import PackageList from './packages_list.vue'; @@ -16,28 +18,10 @@ export default { GlLink, GlSprintf, PackageList, - PackageTitle: () => - import(/* webpackChunkName: 'package_registry_components' */ './package_title.vue'), - PackageSearch: () => - import(/* webpackChunkName: 'package_registry_components' */ './package_search.vue'), - InfrastructureTitle: () => - import( - /* webpackChunkName: 'infrastructure_registry_components' */ '~/packages_and_registries/infrastructure_registry/components/infrastructure_title.vue' - ), - InfrastructureSearch: () => - import( - /* webpackChunkName: 'infrastructure_registry_components' */ '~/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue' - ), + InfrastructureTitle, + InfrastructureSearch, }, inject: { - titleComponent: { - from: 'titleComponent', - default: 'PackageTitle', - }, - searchComponent: { - from: 'searchComponent', - default: 'PackageSearch', - }, emptyPageTitle: { from: 'emptyPageTitle', default: s__('PackageRegistry|There are no packages yet'), @@ -111,8 +95,8 @@ export default { <template> <div> - <component :is="titleComponent" :help-url="packageHelpUrl" :count="packagesCount" /> - <component :is="searchComponent" @update="requestPackagesList" /> + <infrastructure-title :help-url="packageHelpUrl" :count="packagesCount" /> + <infrastructure-search @update="requestPackagesList" /> <package-list @page:changed="onPageChanged" @package:delete="onPackageDeleteRequest"> <template #empty-state> diff --git a/app/assets/javascripts/packages/list/components/tokens/package_type_token.vue b/app/assets/javascripts/packages/list/components/tokens/package_type_token.vue deleted file mode 100644 index 74b6774712e..00000000000 --- a/app/assets/javascripts/packages/list/components/tokens/package_type_token.vue +++ /dev/null @@ -1,26 +0,0 @@ -<script> -import { GlFilteredSearchToken, GlFilteredSearchSuggestion } from '@gitlab/ui'; -import { PACKAGE_TYPES } from '../../constants'; - -export default { - components: { - GlFilteredSearchToken, - GlFilteredSearchSuggestion, - }, - PACKAGE_TYPES, -}; -</script> - -<template> - <gl-filtered-search-token v-bind="{ ...$attrs }" v-on="$listeners"> - <template #suggestions> - <gl-filtered-search-suggestion - v-for="(type, index) in $options.PACKAGE_TYPES" - :key="index" - :value="type.type" - > - {{ type.title }} - </gl-filtered-search-suggestion> - </template> - </gl-filtered-search-token> -</template> diff --git a/app/assets/javascripts/packages/list/constants.js b/app/assets/javascripts/packages/list/constants.js index 2c6fd94024e..4f5071e784b 100644 --- a/app/assets/javascripts/packages/list/constants.js +++ b/app/assets/javascripts/packages/list/constants.js @@ -96,10 +96,4 @@ export const PACKAGE_TYPES = [ }, ]; -export const LIST_TITLE_TEXT = s__('PackageRegistry|Package Registry'); - -export const LIST_INTRO_TEXT = s__( - 'PackageRegistry|Publish and share packages for a variety of common package managers. %{docLinkStart}More information%{docLinkEnd}', -); - export const TERRAFORM_SEARCH_TYPE = Object.freeze({ value: { data: 'terraform_module' } }); |