Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Remove old resources management functions in frontend

Smaug673913e8d9e0dcd9
diff --git a/frontend/app/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue b/frontend/app/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue
index 14ff26f7..24d35d8c 100644
--- a/frontend/app/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue
+++ b/frontend/app/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue
@@ -19,7 +19,7 @@
const props = defineProps<{ ressources: string[] }>();
const emit = defineEmits(['close']);
const deleteRessource = async () => {
- await useRessourcesStore()
+ await useNodesStore()
.bulkDelete(props.ressources)
.then(() => {
emit('close');
diff --git a/frontend/app/stores/resources.store.ts b/frontend/app/stores/resources.store.ts
index 7f8e862b..bdfdf637 100644
--- a/frontend/app/stores/resources.store.ts
+++ b/frontend/app/stores/resources.store.ts
@@ -16,41 +16,5 @@ export const useRessourcesStore = defineStore('ressources', {
return request.result as { original_path: string; content_compiled: string };
} else throw request.message;
},
- async update(ressource: Node): Promise<Node | string> {
- const request = await makeRequest(`ressources/${ressource.id}`, 'PUT', ressource);
- if (request.status == 'success') {
- useNodesStore().nodes.set(ressource.id, ressource as Node);
- return request.result as Node;
- } else throw request.message;
- },
- async delete(id: string) {
- const request = await makeRequest(`ressources/${id}`, 'DELETE', {});
- if (request.status == 'success') return useNodesStore().nodes.delete(id); // Remove the node from the cache
- else throw request.message;
- },
- // Loop through ids and delete them one by one
- // Only update the store after all deletions are successful
- // Return the list of deleted ids and failed ids
- async bulkDelete(ids: string[]) {
- const deletedIds: string[] = [];
- const failedIds: { id: string; message: string }[] = [];
- for (const id of ids) {
- try {
- const request = await makeRequest(`nodes/${id}`, 'DELETE', {});
- if (request.status === 'success') {
- deletedIds.push(id);
- } else {
- failedIds.push({ id, message: request.message || 'Unknown error' });
- }
- } catch (error) {
- failedIds.push({ id, message: (error as Error).message });
- }
- }
- // Update store
- deletedIds.forEach(id => {
- useNodesStore().nodes.delete(id);
- });
- return { deletedIds, failedIds };
- },
},
});