diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/assets/javascripts/registry/explorer | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) | |
download | gitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/assets/javascripts/registry/explorer')
6 files changed, 56 insertions, 16 deletions
diff --git a/app/assets/javascripts/registry/explorer/components/details_page/delete_modal.vue b/app/assets/javascripts/registry/explorer/components/details_page/delete_modal.vue index 0432cf1123c..f857c96c9d1 100644 --- a/app/assets/javascripts/registry/explorer/components/details_page/delete_modal.vue +++ b/app/assets/javascripts/registry/explorer/components/details_page/delete_modal.vue @@ -1,5 +1,5 @@ <script> -import { GlModal, GlSprintf } from '@gitlab/ui'; +import { GlModal, GlSprintf, GlFormInput } from '@gitlab/ui'; import { n__ } from '~/locale'; import { REMOVE_TAG_CONFIRMATION_TEXT, @@ -12,6 +12,7 @@ export default { components: { GlModal, GlSprintf, + GlFormInput, }, props: { itemsToBeDeleted: { @@ -25,7 +26,15 @@ export default { required: false, }, }, + data() { + return { + projectPath: '', + }; + }, computed: { + imageProjectPath() { + return this.itemsToBeDeleted[0]?.project?.path; + }, modalTitle() { if (this.deleteImage) { return DELETE_IMAGE_CONFIRMATION_TITLE; @@ -40,6 +49,7 @@ export default { if (this.deleteImage) { return { message: DELETE_IMAGE_CONFIRMATION_TEXT, + item: this.imageProjectPath, }; } if (this.itemsToBeDeleted.length > 1) { @@ -55,6 +65,9 @@ export default { item: first?.path, }; }, + disablePrimaryButton() { + return this.deleteImage && this.projectPath !== this.imageProjectPath; + }, }, methods: { show() { @@ -69,10 +82,14 @@ export default { ref="deleteModal" modal-id="delete-tag-modal" ok-variant="danger" - :action-primary="{ text: __('Confirm'), attributes: { variant: 'danger' } }" + :action-primary="{ + text: __('Delete'), + attributes: [{ variant: 'danger' }, { disabled: disablePrimaryButton }], + }" :action-cancel="{ text: __('Cancel') }" @primary="$emit('confirmDelete')" @cancel="$emit('cancelDelete')" + @change="projectPath = ''" > <template #modal-title>{{ modalTitle }}</template> <p v-if="modalDescription" data-testid="description"> @@ -80,7 +97,13 @@ export default { <template #item> <b>{{ modalDescription.item }}</b> </template> + <template #code> + <code>{{ modalDescription.item }}</code> + </template> </gl-sprintf> </p> + <div v-if="deleteImage"> + <gl-form-input v-model="projectPath" /> + </div> </gl-modal> </template> diff --git a/app/assets/javascripts/registry/explorer/components/details_page/details_header.vue b/app/assets/javascripts/registry/explorer/components/details_page/details_header.vue index 80ed9a32039..e9e36151fe6 100644 --- a/app/assets/javascripts/registry/explorer/components/details_page/details_header.vue +++ b/app/assets/javascripts/registry/explorer/components/details_page/details_header.vue @@ -1,5 +1,5 @@ <script> -import { GlButton, GlIcon, GlTooltipDirective } from '@gitlab/ui'; +import { GlIcon, GlTooltipDirective, GlDropdown, GlDropdownItem } from '@gitlab/ui'; import { sprintf, n__, s__ } from '~/locale'; import MetadataItem from '~/vue_shared/components/registry/metadata_item.vue'; import TitleArea from '~/vue_shared/components/registry/title_area.vue'; @@ -27,7 +27,7 @@ import getContainerRepositoryTagsCountQuery from '../../graphql/queries/get_cont export default { name: 'DetailsHeader', - components: { GlButton, GlIcon, TitleArea, MetadataItem }, + components: { GlIcon, TitleArea, MetadataItem, GlDropdown, GlDropdownItem }, directives: { GlTooltip: GlTooltipDirective, }, @@ -143,9 +143,22 @@ export default { /> </template> <template #right-actions> - <gl-button variant="danger" :disabled="deleteButtonDisabled" @click="$emit('delete')"> - {{ __('Delete image repository') }} - </gl-button> + <gl-dropdown + icon="ellipsis_v" + text="More actions" + :text-sr-only="true" + category="tertiary" + no-caret + right + > + <gl-dropdown-item + variant="danger" + :disabled="deleteButtonDisabled" + @click="$emit('delete')" + > + {{ __('Delete image repository') }} + </gl-dropdown-item> + </gl-dropdown> </template> </title-area> </template> diff --git a/app/assets/javascripts/registry/explorer/components/list_page/cleanup_status.vue b/app/assets/javascripts/registry/explorer/components/list_page/cleanup_status.vue index 8d9e221af4c..1f52e319ad0 100644 --- a/app/assets/javascripts/registry/explorer/components/list_page/cleanup_status.vue +++ b/app/assets/javascripts/registry/explorer/components/list_page/cleanup_status.vue @@ -1,7 +1,7 @@ <script> import { GlTooltipDirective, GlIcon } from '@gitlab/ui'; import { - ASYNC_DELETE_IMAGE_ERROR_MESSAGE, + CLEANUP_TIMED_OUT_ERROR_MESSAGE, CLEANUP_STATUS_SCHEDULED, CLEANUP_STATUS_ONGOING, CLEANUP_STATUS_UNFINISHED, @@ -34,7 +34,7 @@ export default { CLEANUP_STATUS_SCHEDULED, CLEANUP_STATUS_ONGOING, CLEANUP_STATUS_UNFINISHED, - ASYNC_DELETE_IMAGE_ERROR_MESSAGE, + CLEANUP_TIMED_OUT_ERROR_MESSAGE, }, computed: { showStatus() { @@ -61,7 +61,7 @@ export default { </span> <gl-icon v-if="failedDelete" - v-gl-tooltip="{ title: $options.i18n.ASYNC_DELETE_IMAGE_ERROR_MESSAGE }" + v-gl-tooltip="{ title: $options.i18n.CLEANUP_TIMED_OUT_ERROR_MESSAGE }" :size="14" class="gl-text-black-normal" data-testid="extra-info" diff --git a/app/assets/javascripts/registry/explorer/constants/details.js b/app/assets/javascripts/registry/explorer/constants/details.js index 9b4c06349e2..0836260b71e 100644 --- a/app/assets/javascripts/registry/explorer/constants/details.js +++ b/app/assets/javascripts/registry/explorer/constants/details.js @@ -99,7 +99,7 @@ export const DETAILS_DELETE_IMAGE_ERROR_MESSAGE = s__( export const DELETE_IMAGE_CONFIRMATION_TITLE = s__('ContainerRegistry|Delete image repository?'); export const DELETE_IMAGE_CONFIRMATION_TEXT = s__( - 'ContainerRegistry|Deleting the image repository will delete all images and tags inside. This action cannot be undone.', + 'ContainerRegistry|Deleting the image repository will delete all images and tags inside. This action cannot be undone. Please type the following to confirm: %{code}', ); export const SCHEDULED_FOR_DELETION_STATUS_TITLE = s__( @@ -162,6 +162,9 @@ export const IMAGE_STATUS_ALERT_TYPE = { [DELETE_FAILED]: 'warning', }; -export const PACKAGE_DELETE_HELP_PAGE_PATH = helpPagePath('user/packages/container_registry', { - anchor: 'delete-images', -}); +export const PACKAGE_DELETE_HELP_PAGE_PATH = helpPagePath( + 'user/packages/container_registry/index', + { + anchor: 'delete-images', + }, +); diff --git a/app/assets/javascripts/registry/explorer/graphql/queries/get_container_repository_details.query.graphql b/app/assets/javascripts/registry/explorer/graphql/queries/get_container_repository_details.query.graphql index 88c2e667afd..b5a99fd9ac1 100644 --- a/app/assets/javascripts/registry/explorer/graphql/queries/get_container_repository_details.query.graphql +++ b/app/assets/javascripts/registry/explorer/graphql/queries/get_container_repository_details.query.graphql @@ -12,6 +12,7 @@ query getContainerRepositoryDetails($id: ID!) { expirationPolicyCleanupStatus project { visibility + path containerExpirationPolicy { enabled nextRunAt diff --git a/app/assets/javascripts/registry/explorer/pages/details.vue b/app/assets/javascripts/registry/explorer/pages/details.vue index 34ec3b085a5..feabc4f770b 100644 --- a/app/assets/javascripts/registry/explorer/pages/details.vue +++ b/app/assets/javascripts/registry/explorer/pages/details.vue @@ -161,7 +161,7 @@ export default { }, deleteImage() { this.deleteImageAlert = true; - this.itemsToBeDeleted = [{ path: this.containerRepository.path }]; + this.itemsToBeDeleted = [{ ...this.containerRepository }]; this.$refs.deleteModal.show(); }, deleteImageError() { @@ -188,7 +188,7 @@ export default { <partial-cleanup-alert v-if="showPartialCleanupWarning" :run-cleanup-policies-help-page-path="config.runCleanupPoliciesHelpPagePath" - :cleanup-policies-help-page-path="config.cleanupPoliciesHelpPagePath" + :cleanup-policies-help-page-path="config.expirationPolicyHelpPagePath" @dismiss="dismissPartialCleanupWarning" /> |