Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

feat: add query attachments by ungrouped parameter support #706

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@formkit/themes": "^1.0.0-beta.11",
"@formkit/vue": "^1.0.0-beta.11",
"@formkit/utils": "^1.0.0-beta.11",
"@halo-dev/api-client": "^0.0.50",
"@halo-dev/api-client": "^0.0.51",
"@halo-dev/components": "workspace:*",
"@halo-dev/console-shared": "workspace:*",
"@halo-dev/richtext-editor": "^0.0.0-alpha.11",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/modules/contents/attachments/AttachmentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,16 @@ const onDetailModalClose = () => {
selectedAttachment.value = undefined;
nameQuery.value = undefined;
nameQueryAttachment.value = undefined;
handleFetchAttachments();
setTimeout(() => {
handleFetchAttachments();
}, 200);
};

const onUploadModalClose = () => {
routeQueryAction.value = undefined;
handleFetchAttachments();
setTimeout(() => {
handleFetchAttachments();
}, 200);
};

const onGroupChange = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const defaultGroups: Group[] = [
apiVersion: "",
kind: "",
metadata: {
name: "none",
name: "ungrouped",
},
},
];
Expand All @@ -68,7 +68,7 @@ const groupToUpdate = ref<Group | null>(null);
const loading = ref<boolean>(false);
const editingModal = ref(false);

const routeQuery = useRouteQuery("group");
const routeQuery = useRouteQuery<string>("group");

const handleSelectGroup = (group: Group) => {
emit("update:selectedGroup", group);
Expand Down Expand Up @@ -166,7 +166,8 @@ const handleDeleteWithAttachments = (group: Group) => {
watch(
() => groups.value.length,
() => {
const groupIndex = groups.value.findIndex(
const allGroups = [...defaultGroups, ...groups.value];
const groupIndex = allGroups.findIndex(
(group) => group.metadata.name === routeQuery.value
);

Expand All @@ -186,8 +187,8 @@ onMounted(async () => {
);
if (group) {
handleSelectGroup(group);
return;
}
return;
}

handleSelectGroup(defaultGroups[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function useAttachmentControl(filterOptions?: {
policy: policy?.value?.metadata.name,
displayName: keyword?.value,
group: group?.value?.metadata.name,
ungrouped: group?.value?.metadata.name === "ungrouped",
uploadedBy: user?.value?.metadata.name,
page: attachments.value.page,
size: attachments.value.size,
Expand Down