[release-2.14] fix: the details of the attachment may be empty (#5774)

* fix: the details of the attachment may be empty

* fix: the details of the attachment may be empty

---------

Co-authored-by: LIlGG <1103069291@qq.com>
pull/5775/head
Halo Dev Bot 2024-04-23 14:40:53 +08:00 committed by GitHub
parent 8de668bb1a
commit 4eb205ba66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 18 deletions

View File

@ -166,6 +166,7 @@ const onDetailModalClose = () => {
selectedAttachment.value = undefined; selectedAttachment.value = undefined;
nameQuery.value = undefined; nameQuery.value = undefined;
nameQueryAttachment.value = undefined; nameQueryAttachment.value = undefined;
detailVisible.value = false;
handleFetchAttachments(); handleFetchAttachments();
}; };
@ -230,7 +231,7 @@ onMounted(() => {
</script> </script>
<template> <template>
<AttachmentDetailModal <AttachmentDetailModal
v-model:visible="detailVisible" v-if="detailVisible"
:attachment="selectedAttachment || nameQueryAttachment" :attachment="selectedAttachment || nameQueryAttachment"
@close="onDetailModalClose" @close="onDetailModalClose"
> >

View File

@ -19,19 +19,16 @@ import AttachmentPermalinkList from "./AttachmentPermalinkList.vue";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
visible: boolean;
attachment: Attachment | undefined; attachment: Attachment | undefined;
mountToBody?: boolean; mountToBody?: boolean;
}>(), }>(),
{ {
visible: false,
attachment: undefined, attachment: undefined,
mountToBody: false, mountToBody: false,
} }
); );
const emit = defineEmits<{ const emit = defineEmits<{
(event: "update:visible", visible: boolean): void;
(event: "close"): void; (event: "close"): void;
}>(); }>();
@ -64,17 +61,6 @@ const getGroupName = (name: string | undefined) => {
const group = groups.value?.find((group) => group.metadata.name === name); const group = groups.value?.find((group) => group.metadata.name === name);
return group?.spec.displayName || name; return group?.spec.displayName || name;
}; };
const onVisibleChange = (visible: boolean) => {
emit("update:visible", visible);
if (!visible) {
onlyPreview.value = false;
setTimeout(() => {
emit("close");
}, 200);
}
};
</script> </script>
<template> <template>
<VModal <VModal
@ -83,13 +69,12 @@ const onVisibleChange = (visible: boolean) => {
display_name: attachment?.spec.displayName || '', display_name: attachment?.spec.displayName || '',
}) })
" "
:visible="visible"
:width="1000" :width="1000"
:mount-to-body="mountToBody" :mount-to-body="mountToBody"
:layer-closable="true" :layer-closable="true"
height="calc(100vh - 20px)" height="calc(100vh - 20px)"
:body-class="['!p-0']" :body-class="['!p-0']"
@update:visible="onVisibleChange" @close="emit('close')"
> >
<template #actions> <template #actions>
<slot name="actions"></slot> <slot name="actions"></slot>
@ -198,7 +183,7 @@ const onVisibleChange = (visible: boolean) => {
</div> </div>
<template #footer> <template #footer>
<VSpace> <VSpace>
<VButton type="default" @click="onVisibleChange(false)"> <VButton type="default" @click="emit('close')">
{{ $t("core.common.buttons.close_and_shortcut") }} {{ $t("core.common.buttons.close_and_shortcut") }}
</VButton> </VButton>
<slot name="footer" /> <slot name="footer" />