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.

Fixes and improvments

Smaug673997a7babcaad7
diff --git a/frontend/pages/dashboard/categories/_components/WorkspaceTree.vue b/frontend/pages/dashboard/categories/_components/WorkspaceTree.vue
index 5f0ae046..de5aea7c 100644
--- a/frontend/pages/dashboard/categories/_components/WorkspaceTree.vue
+++ b/frontend/pages/dashboard/categories/_components/WorkspaceTree.vue
@@ -6,8 +6,8 @@
<span>{{ node.title }}</span>
</div>
<div class="tree-actions">
- <span style="padding: 2px" @click="$emit('edit', node)" title="Editer"><Icon name="edit" style="display: inline" /></span>
- <span style="padding: 2px" @click="$emit('delete', node)" title="Supprimer"><Icon name="delete" style="display: inline" /></span>
+ <span style="padding: 2px" @click="$emit('edit', node)" title="Edit"><Icon name="edit" style="display: inline" /></span>
+ <span style="padding: 2px" @click="$emit('delete', node)" title="Delete"><Icon name="delete" style="display: inline" /></span>
</div>
</div>
@@ -64,9 +64,9 @@ defineEmits(['edit', 'delete']);
display: flex;
}
-.tree-actions button {
- border: none;
- background: none;
+.tree-actions span {
+ border-radius: 4px;
cursor: pointer;
+ margin: 0 2.5px;
}
</style>
diff --git a/frontend/pages/dashboard/categories/_modals/CreateCategoryModal.vue b/frontend/pages/dashboard/categories/_modals/CreateCategoryModal.vue
index eeb94e1e..d578871e 100644
--- a/frontend/pages/dashboard/categories/_modals/CreateCategoryModal.vue
+++ b/frontend/pages/dashboard/categories/_modals/CreateCategoryModal.vue
@@ -1,18 +1,16 @@
<template>
<div class="modal">
<h2>Create a new {{ role == 1 ? 'category' : 'workspace' }}</h2>
- <form>
- <label for="name">Name</label>
- <input type="text" v-model="category.name" required />
- <label for="icon">Icon <AppHint text="SVG supported" /></label>
- <input type="text" v-model="category.icon" id="icon" />
- <label for="parent">Parent</label>
- <div>
- <AppSelect v-model="category.parent_id" :items="categoriesItem" placeholder="Select a category parent" />
- </div>
- <label for="order">Order <AppHint text="Order of the category in the sidebar" /></label>
- <input type="number" v-model.number="category.order" id="order" />
- </form>
+ <label>Name</label>
+ <input type="text" v-model="category.name" required />
+ <label>Icon <AppHint text="SVG supported" /></label>
+ <input type="text" v-model="category.icon" id="icon" />
+ <label>Parent</label>
+ <div>
+ <AppSelect v-model="category.parent_id" :items="categoriesItem" placeholder="Select a category parent" />
+ </div>
+ <label>Order <AppHint text="Order of the category in the sidebar" /></label>
+ <input type="number" v-model.number="category.order" id="order" />
<div class="footer">
<AppButton @click="emit('close')" type="secondary">Cancel</AppButton>
<AppButton type="primary" @click="createCategory">Create</AppButton>
@@ -43,7 +41,7 @@ const createCategory = () => {
emit('close');
})
.catch(e => {
- useNotifications().add({ title: 'Error: ' + e, message: '', type: 'error', timeout: 3000 });
+ useNotifications().add({ title: 'Error during creation ', message: e, type: 'error', timeout: 3000 });
});
};
</script>
@@ -52,4 +50,7 @@ const createCategory = () => {
.modal {
min-width: 700px;
}
+label {
+ margin: 5px 0;
+}
</style>
diff --git a/frontend/pages/dashboard/categories/_modals/DeleteCategoryModal.vue b/frontend/pages/dashboard/categories/_modals/DeleteCategoryModal.vue
index 6d720113..0ab29c9f 100644
--- a/frontend/pages/dashboard/categories/_modals/DeleteCategoryModal.vue
+++ b/frontend/pages/dashboard/categories/_modals/DeleteCategoryModal.vue
@@ -17,12 +17,11 @@ const deleteDoc = () => {
useCategoriesStore()
.delete(props.categoryId)
.then(() => {
- useNotifications().add({ title: 'Success:', message: 'Category deleted', type: 'success', timeout: 3000 });
+ useNotifications().add({ title: 'Category successfully deleted', message: '', type: 'success', timeout: 3000 });
emit('close');
- useRouter().push('/dashboard');
})
.catch(e => {
- useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 3000 });
+ useNotifications().add({ title: 'Error during deletion', message: e, type: 'error', timeout: 3000 });
});
};
const emit = defineEmits(['close']);
diff --git a/frontend/pages/dashboard/categories/index.vue b/frontend/pages/dashboard/categories/index.vue
index 8792c8ac..76bbf440 100644
--- a/frontend/pages/dashboard/categories/index.vue
+++ b/frontend/pages/dashboard/categories/index.vue
@@ -9,7 +9,7 @@
</div>
</header>
<div style="padding: 10px 0; border-top: 1px solid #ddd; display: flex; justify-content: space-between; align-items: center">
- <input placeholder="Search category..." style="width: 50%; padding: 8px; border: 1px solid #ccc; border-radius: 4px" />
+ <input placeholder="Search for workspace..." v-model="filter" style="width: 50%; padding: 8px; border: 1px solid var(--border-color); border-radius: 4px" />
</div>
<div v-if="tree.length" class="workspace" v-for="workspace in tree" :key="workspace.id">
<h3 class="wp-name">{{ workspace.title }}</h3>
@@ -22,20 +22,22 @@
<script setup lang="ts">
import CreateCategoryModal from './_modals/CreateCategoryModal.vue';
+import DeleteCategoryModal from './_modals/DeleteCategoryModal.vue';
import WorkspaceTree from './_components/WorkspaceTree.vue';
import type { Category } from '~/stores';
-const tree = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2) as Item<Category>[];
+const filter = ref('');
+const tree = computed(() => new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2 && i.data.name.toLowerCase().includes(filter.value.toLowerCase())) as Item<Category>[]);
const createWorkspace = () => useModal().add(new Modal(shallowRef(CreateCategoryModal), { role: 2 }));
const createCategory = () => useModal().add(new Modal(shallowRef(CreateCategoryModal), { role: 1 }));
function editNode(node: Item) {
- // ouvrir modal ou formulaire d'édition
+ useRouter().push('/dashboard/categories/' + node.id + '/edit');
}
function deleteNode(node: Item) {
- // confirmation + suppression
+ useModal().add(new Modal(shallowRef(DeleteCategoryModal), { categoryId: node.id }));
}
</script>