π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Bugs fixes and improve user interface with new nodes
Smaug673968e24602ee00
diff --git a/backend/services/node.service.go b/backend/services/node.service.goindex 3413b055..52e8f648 100644--- a/backend/services/node.service.go+++ b/backend/services/node.service.go@@ -277,7 +277,7 @@ func (s *Service) GetNode(nodeId types.Snowflake) (*models.Node, error) {}func (s *Service) CreateNode(node *models.Node) error {- _, err := s.db.Exec("INSERT INTO nodes (`id`, `user_id`, `parent_id`, `name`, `description`, `tags`, `role`, `color`, `icon`, `thumbnail`, `theme`, `accessibility`, `access`, `display`, `order`, `content`, `content_compiled`, `size`, `metadata`, `created_timestamp`, `updated_timestamp`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",+ _, err := s.db.Exec("INSERT INTO nodes (`id`, `user_id`, `parent_id`, `name`, `description`, `tags`, `role`, `color`, `icon`, `thumbnail`, `theme`, `accessibility`, `access`, `display`, `order`, `content`, `content_compiled`, `size`, `metadata`, `created_timestamp`, `updated_timestamp`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",node.Id,node.UserId,node.ParentId,diff --git a/frontend/app/components/MarkdownEditor/Toolbar.vue b/frontend/app/components/MarkdownEditor/Toolbar.vueindex 265aff48..727dc3fa 100644--- a/frontend/app/components/MarkdownEditor/Toolbar.vue+++ b/frontend/app/components/MarkdownEditor/Toolbar.vue@@ -5,7 +5,6 @@<Icon :name="item.icon" :big="true" fill="var(--font-color)" /></button><VoiceRecognition @transcription="handleTranscription" />- <AppSelect v-if="!minimal" v-model="localValue.accessibility" :items="DOCUMENT_ACCESSIBILITIES" placeholder="Access" size="100px" class="entry" /><AppSelect v-if="!minimal" v-model="localValue.parent_id" :items="categories" placeholder="Select category" size="300px" class="entry" /><div class="help">diff --git a/frontend/app/components/Node/NodeMetadata.modal.vue b/frontend/app/components/Node/NodeMetadata.modal.vuenew file mode 100644index 00000000..fee8eaaf--- /dev/null+++ b/frontend/app/components/Node/NodeMetadata.modal.vue@@ -0,0 +1,75 @@+<!-- This components is a modal for advanced editing document metadata -->+<template>+ <div class="modal-content">+ <h2>Document Metadata <tag yellow>Beta</tag></h2>+ <form @submit.prevent>+ <label for="category">Theme</label>+ <AppSelect v-model="node.theme" :items="DOCUMENT_THEMES" placeholder="Select theme" />++ <label for="icon">Emoji or icon <AppHint text="SVG or emojis supported" /></label>+ <textarea id="icon" v-model="node.icon"></textarea>+ <label for="thumbnail">Thumbnail <AppHint text="SVG supported" /></label>+ <textarea id="thumbnail" v-model="node.thumbnail"></textarea>+ <div style="display: flex; align-items: center; gap: 10px">+ <label for="pinned">Pinned</label>+ <AppToggle id="pinned" v-model="pinnedToggle" />+ </div>++ <label for="parent">Parent</label>+ <AppSelect+ v-model="node.parent_id"+ :items="parentsTree"+ placeholder="Select a parent"+ :nullable="true"+ :disabled="(i) => i.id == node.id || nodeStore.isDescendant(node, (i as Item).id)"+ />+ <div style="display: flex; align-items: center; gap: 10px">+ <label for="accessibility">Color</label>+ <AppColorPicker v-model="node.color" :nullable="true" />+ </div>+ </form>+ </div>+</template>++<script setup lang="ts">+import type { Node } from '@/stores';++const nodeStore = useNodesStore();++const props = defineProps<{ doc: Node }>();+const node = ref<Node>(props.doc);+const pinnedToggle = ref(node.value.order == -1);+const parentsTree = computed(() => new TreeStructure(useSidebarTree().nodes.value.filter(n => n.data.role <= 3)).generateTree().filter(i => i.data.role === 1));++watch(pinnedToggle, val => (node.value.order = val ? -1 : 0));+watch(+ node.value,+ debounce(() => nodeStore.update(node.value), 500),+);+</script>++<style scoped>+.modal-content {+ display: flex;+ flex-direction: column;+}++form {+ padding: 0 5px 25px;+ flex: 1;+ overflow-y: auto;+}++label {+ display: flex;+ align-items: center;+}++textarea {+ height: 50px;+ min-height: 50px;+ max-height: 50px;+ font-size: 14px;+ resize: none;+}+</style>diff --git a/frontend/app/components/Node/NodePermissions.vue b/frontend/app/components/Node/NodePermissions.modal.vuesimilarity index 98%rename from frontend/app/components/Node/NodePermissions.vuerename to frontend/app/components/Node/NodePermissions.modal.vueindex 1e91b63e..fe848891 100644--- a/frontend/app/components/Node/NodePermissions.vue+++ b/frontend/app/components/Node/NodePermissions.modal.vue@@ -15,7 +15,7 @@></p><div class="access">- <label for="access">Default permission for new users</label>+ <p for="access">Default permission for new users</p><AppSelect v-model="node.access" :items="DOCUMENT_GENERAL_ACCESS" :searchable="false" size="150px" placeholder="Default" /></div></div>diff --git a/frontend/app/composables/useNodesTree.ts b/frontend/app/composables/useNodesTree.tsindex 020c6017..ec962863 100644--- a/frontend/app/composables/useNodesTree.ts+++ b/frontend/app/composables/useNodesTree.ts@@ -76,7 +76,7 @@ function useSidebarTree() {);}- const groupedByWorkspace = () => {+ const groupedByWorkspace = (roles = [1, 2, 3]) => {const workspaces: Item<Node>[] = [...nodesStore.getAll.filter(c => c.role === 1)@@ -92,6 +92,7 @@ function useSidebarTree() {];tree.value.forEach(item => {+ if (!roles.includes(item.data.role)) return;const workspaceId = item.parent_id;const existing = workspaces.find(w => w.id === workspaceId);if (!existing) workspaces.push(item);diff --git a/frontend/app/pages/dashboard/categories/[id]/edit.vue b/frontend/app/pages/dashboard/categories/[id]/edit.vueindex 22c0636d..cafdd95a 100644--- a/frontend/app/pages/dashboard/categories/[id]/edit.vue+++ b/frontend/app/pages/dashboard/categories/[id]/edit.vue@@ -21,7 +21,7 @@v-model="category.parent_id":items="categoriesItem"placeholder="Select a category parent"- :disabled="(i) => i.id == category!.id || nodesStore.hasDescendant(category!, (i as Item).id)"+ :disabled="(i) => i.id == category!.id || nodesStore.isDescendant(category!, (i as Item).id)"/></div><div class="form-column">diff --git a/frontend/app/pages/dashboard/docs/_components/DocumentCardHeader.vue b/frontend/app/pages/dashboard/docs/_components/DocumentCardHeader.vueindex a9089bf7..b4026e45 100644--- a/frontend/app/pages/dashboard/docs/_components/DocumentCardHeader.vue+++ b/frontend/app/pages/dashboard/docs/_components/DocumentCardHeader.vue@@ -10,7 +10,7 @@><img v-if="user" :src="useAvatar(user)" class="avatar" /><span style="color: var(--font-color-light); font-size: 18px">{{ user?.username }}</span></span>- <DocumentCardHeaderActionRow v-if="!public" :doc="doc" class="no-print" />+ <DocumentCardHeaderActionRow :doc="doc" class="no-print" /></p><NuxtLink class="category" :to="`/dashboard/categories/${category?.id}`">{{ category?.name || 'Uncategorized' }}</NuxtLink><h1 class="title" :class="{ public: public }">{{ doc?.name }}</h1>diff --git a/frontend/app/pages/dashboard/docs/_components/DocumentCardHeaderActionRow.vue b/frontend/app/pages/dashboard/docs/_components/DocumentCardHeaderActionRow.vueindex ee5c8d60..95f161de 100644--- a/frontend/app/pages/dashboard/docs/_components/DocumentCardHeaderActionRow.vue+++ b/frontend/app/pages/dashboard/docs/_components/DocumentCardHeaderActionRow.vue@@ -38,8 +38,8 @@<script setup lang="ts">import DeleteDocumentModal from '../_modals/DeleteDocumentModal.vue';-import DocumentMeta from '../_modals/DocumentMeta.vue';-import NodePermissions from '@/components/Node/NodePermissions.vue';+import DocumentMeta from '@/components/Node/NodeMetadata.modal.vue';+import NodePermissions from '@/components/Node/NodePermissions.modal.vue';import type { Node } from '~/stores';const nodeStore = useNodesStore();diff --git a/frontend/app/pages/dashboard/docs/_modals/DocumentMeta.vue b/frontend/app/pages/dashboard/docs/_modals/DocumentMeta.vuedeleted file mode 100644index 13e033d5..00000000--- a/frontend/app/pages/dashboard/docs/_modals/DocumentMeta.vue+++ /dev/null@@ -1,104 +0,0 @@-<!-- This components is a modal for advanced editing document metadata -->-<template>- <div class="modal-content">- <h2>Document Metadata <tag yellow>Beta</tag></h2>- <form @submit.prevent>- <label for="category">Theme</label>- <AppSelect v-model="document.theme" :items="DOCUMENT_THEMES" placeholder="Select theme" />-- <label for="icon">Icon <AppHint text="SVG or emojis supported" /></label>- <textarea id="icon" v-model="document.icon"></textarea>- <label for="thumbnail">Thumbnail <AppHint text="SVG supported" /></label>- <textarea id="thumbnail" v-model="document.thumbnail"></textarea>- <label for="accessibility">Accessibility</label>- <AppRadio v-model="document.accessibility" :items="DOCUMENT_ACCESSIBILITIES" placeholder="Accessibility" />- <!-- Accessibility 3: Public document -->- <div v-if="document.accessibility === 3" class="public-info">- <p class="info-text">This document will be publicly accessible via a unique URL.</p>- <p class="info-text">- Share this link to allow anyone to view the document without needing an account:- <br />- <a :href="link" target="_blank" rel="noopener noreferrer" class="public-link"- ><Icon name="new_tab" :small="true" fill="var(--font-color-light)" /><span>{{ link }}</span></a- >- </p>- </div>- <div style="display: flex; align-items: center; gap: 10px">- <label for="pinned">Pinned</label>- <AppToggle id="pinned" v-model="pinnedToggle" />- </div>-- <label for="parent">Parent</label>- <AppSelect v-model="document.parent_id" :items="documentsTree" placeholder="Select a document parent" :nullable="true" />- <div style="display: flex; align-items: center; gap: 10px">- <label for="accessibility">Color</label>- <AppColorPicker v-model="document.color" :nullable="true" />- </div>- </form>- </div>-</template>--<script setup lang="ts">-import type { Node } from '@/stores';--const store = useNodesStore();--const props = defineProps<{ doc: Node }>();-const document = ref<Node>(props.doc);-const pinnedToggle = ref(document.value.order == -1);-const link = computed(() => `${window.location.origin}/doc/${document.value.id}`);-const documentsTree = computed(() => useSidebarTree().groupedByWorkspace());--watch(pinnedToggle, val => (document.value.order = val ? -1 : 0));-watch(- document.value,- debounce(() => store.update(document.value), 500),-);-</script>--<style scoped>-.modal-content {- display: flex;- flex-direction: column;-}--form {- padding: 0 5px 25px;- flex: 1;- overflow-y: auto;-}--label {- display: flex;- align-items: center;-}--textarea {- height: 50px;- min-height: 50px;- max-height: 50px;- font-size: 14px;- resize: none;-}--.public-info {- padding: 0 5px;- border-radius: 7px;- margin-bottom: 10px;-}--.info-text {- margin: 5px 0;- font-size: 14px;- color: var(--font-color-light);-}--.public-link {- display: flex;- color: var(--primary);- align-items: flex-end;- gap: 2px;- text-decoration: underline;- word-break: break-all;-}-</style>diff --git a/frontend/app/stores/db_strustures.d.ts b/frontend/app/stores/db_strustures.d.tsindex 36d7afbc..b11aeabb 100644--- a/frontend/app/stores/db_strustures.d.ts+++ b/frontend/app/stores/db_strustures.d.ts@@ -35,7 +35,7 @@ export interface DB_Node {thumbnail?: string;theme?: string;accessibility?: number; // 1 Visible; 2 Draft; 3 Archived;- access?: number; // 1 Viewer; 2 Editor;+ access: number; // 1 Viewer; 2 Editor;display?: number; // 1 List; 2 Grid;order?: number; // -1 for pinned and -2 for bookmarkcontent?: string;diff --git a/frontend/app/stores/nodes.store.ts b/frontend/app/stores/nodes.store.tsindex ddab6093..a2ac894c 100644--- a/frontend/app/stores/nodes.store.ts+++ b/frontend/app/stores/nodes.store.ts@@ -27,7 +27,7 @@ export const useNodesStore = defineStore('nodes', {categories: state => state.nodes.filter(d => d.role === 1 || d.role === 2),documents: state => state.nodes.filter(d => d.role === 3),ressources: state => state.nodes.filter(d => d.role === 4),- hasDescendant:+ isDescendant:state =>(node: Node, descendantId: string): boolean => {const checkDescendants = (currentNode: Node): boolean => {@@ -127,6 +127,7 @@ export const useNodesStore = defineStore('nodes', {// Case 3: A parent node has a permission entry for this node (inherited permissions)const userStore = useUserStore();if (node.user_id === userStore.user?.id) return true;+ if (node.accessibility === 3 && level <= node.access) return true;let permission = node.permissions.find(p => p.user_id === userStore.user?.id)?.permission || 0;let currentNode = node;while (permission < level && currentNode.parent_id) {