diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-03 12:10:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-03 12:10:48 +0300 |
commit | f6a4346585dcc6cc564cb4974a0ea49d2ac0531d (patch) | |
tree | 9e9109c2442dbac93c7a38d60c093b56be9e0fa4 /app/assets/javascripts/packages_and_registries/package_registry/pages/details.vue | |
parent | bdfa808bfa4983d67a1ff54e4a3b7070be4d13eb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/packages_and_registries/package_registry/pages/details.vue')
-rw-r--r-- | app/assets/javascripts/packages_and_registries/package_registry/pages/details.vue | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/app/assets/javascripts/packages_and_registries/package_registry/pages/details.vue b/app/assets/javascripts/packages_and_registries/package_registry/pages/details.vue index 1ce2140894e..0f1c63a04ad 100644 --- a/app/assets/javascripts/packages_and_registries/package_registry/pages/details.vue +++ b/app/assets/javascripts/packages_and_registries/package_registry/pages/details.vue @@ -54,6 +54,7 @@ import { import destroyPackageFilesMutation from '~/packages_and_registries/package_registry/graphql/mutations/destroy_package_files.mutation.graphql'; import getPackageDetails from '~/packages_and_registries/package_registry/graphql/queries/get_package_details.query.graphql'; +import getPackageVersionsQuery from '~/packages_and_registries/package_registry/graphql/queries/get_package_versions.query.graphql'; import Tracking from '~/tracking'; export default { @@ -135,7 +136,6 @@ export default { queryVariables() { return { id: convertToGraphQLId(TYPENAME_PACKAGES_PACKAGE, this.packageId), - first: GRAPHQL_PAGE_SIZE, }; }, packageFiles() { @@ -147,9 +147,6 @@ export default { isLoading() { return this.$apollo.queries.packageEntity.loading; }, - isVersionsLoading() { - return this.isLoading || this.versionsMutationLoading; - }, packageFilesLoading() { return this.isLoading || this.mutationLoading; }, @@ -161,12 +158,12 @@ export default { category: packageTypeToTrackCategory(this.packageType), }; }, - versionPageInfo() { - return this.packageEntity?.versions?.pageInfo ?? {}; - }, packageDependencies() { return this.packageEntity.dependencyLinks?.nodes || []; }, + packageVersionsCount() { + return this.packageEntity.versions?.count ?? 0; + }, showDependencies() { return this.packageType === PACKAGE_TYPE_NUGET; }, @@ -190,6 +187,17 @@ export default { }, ]; }, + refetchVersionsQueryData() { + return [ + { + query: getPackageVersionsQuery, + variables: { + id: this.queryVariables.id, + first: GRAPHQL_PAGE_SIZE, + }, + }, + ]; + }, }, methods: { formatSize(size) { @@ -274,34 +282,6 @@ export default { resetDeleteModalContent() { this.deletePackageModalContent = DELETE_MODAL_CONTENT; }, - updateQuery(_, { fetchMoreResult }) { - return fetchMoreResult; - }, - fetchPreviousVersionsPage() { - const variables = { - ...this.queryVariables, - first: null, - last: GRAPHQL_PAGE_SIZE, - before: this.versionPageInfo?.startCursor, - }; - this.$apollo.queries.packageEntity.fetchMore({ - variables, - updateQuery: this.updateQuery, - }); - }, - fetchNextVersionsPage() { - const variables = { - ...this.queryVariables, - first: GRAPHQL_PAGE_SIZE, - last: null, - after: this.versionPageInfo?.endCursor, - }; - - this.$apollo.queries.packageEntity.fetchMore({ - variables, - updateQuery: this.updateQuery, - }); - }, }, i18n: { DELETE_MODAL_TITLE, @@ -403,12 +383,12 @@ export default { <template #title> <span>{{ $options.i18n.otherVersionsTabTitle }}</span> <gl-badge size="sm" class="gl-tab-counter-badge" data-testid="other-versions-badge">{{ - packageEntity.versions.count + packageVersionsCount }}</gl-badge> </template> <delete-packages - :refetch-queries="refetchQueriesData" + :refetch-queries="refetchVersionsQueryData" show-success-alert @start="versionsMutationLoading = true" @end="versionsMutationLoading = false" @@ -416,12 +396,10 @@ export default { <template #default="{ deletePackages }"> <package-versions-list :can-destroy="packageEntity.canDestroy" - :is-loading="isVersionsLoading" - :page-info="versionPageInfo" - :versions="packageEntity.versions.nodes" + :count="packageVersionsCount" + :is-mutation-loading="versionsMutationLoading" + :package-id="packageEntity.id" @delete="deletePackages" - @prev-page="fetchPreviousVersionsPage" - @next-page="fetchNextVersionsPage" > <template #empty-state> <p class="gl-mt-3" data-testid="no-versions-message"> |