refactor: group change

pull/878/head
Ryan Wang 2023-02-23 11:08:57 +08:00
parent a67e84ac88
commit 2a6e50ab49
3 changed files with 3 additions and 12 deletions

View File

@ -220,11 +220,6 @@ const onUploadModalClose = () => {
handleFetchAttachments(); handleFetchAttachments();
}; };
const onGroupChange = () => {
handleReset();
handleFetchAttachments();
};
const getPolicyName = (name: string | undefined) => { const getPolicyName = (name: string | undefined) => {
const policy = policies.value?.find((p) => p.metadata.name === name); const policy = policies.value?.find((p) => p.metadata.name === name);
return policy?.spec.displayName; return policy?.spec.displayName;
@ -565,7 +560,7 @@ onMounted(() => {
<div :style="`${viewType === 'list' ? 'padding:12px 16px 0' : ''}`"> <div :style="`${viewType === 'list' ? 'padding:12px 16px 0' : ''}`">
<AttachmentGroupList <AttachmentGroupList
v-model:selected-group="selectedGroup" v-model:selected-group="selectedGroup"
@select="onGroupChange" @select="handleReset"
@update="handleFetchGroups" @update="handleFetchGroups"
@reload-attachments="handleFetchAttachments" @reload-attachments="handleFetchAttachments"
/> />

View File

@ -177,6 +177,7 @@ watch(
); );
onMounted(async () => { onMounted(async () => {
await handleFetchGroups();
if (routeQuery.value && !props.readonly) { if (routeQuery.value && !props.readonly) {
const allGroups = [...defaultGroups, ...(groups.value || [])]; const allGroups = [...defaultGroups, ...(groups.value || [])];
const group = allGroups.find( const group = allGroups.find(

View File

@ -66,17 +66,12 @@ const handleOpenDetail = (attachment: Attachment) => {
selectedAttachment.value = attachment; selectedAttachment.value = attachment;
detailVisible.value = true; detailVisible.value = true;
}; };
const onGroupChange = () => {
handleReset();
handleFetchAttachments();
};
</script> </script>
<template> <template>
<AttachmentGroupList <AttachmentGroupList
v-model:selected-group="selectedGroup" v-model:selected-group="selectedGroup"
readonly readonly
@select="onGroupChange" @select="handleReset"
/> />
<div v-if="attachments?.length" class="mb-5"> <div v-if="attachments?.length" class="mb-5">
<VButton @click="uploadVisible = true"> <VButton @click="uploadVisible = true">