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.

Update, bugs fixes, improvments

Smaug67392888bc34d0a1
diff --git a/frontend/components/DataTable.vue b/frontend/components/DataTable.vue
index 4f7cfb62..daa2c247 100644
--- a/frontend/components/DataTable.vue
+++ b/frontend/components/DataTable.vue
@@ -129,7 +129,6 @@ td {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
- max-width: 200px;
}
td > span {
display: flex;
diff --git a/frontend/composables/useSidebarTree.ts b/frontend/composables/useSidebarTree.ts
index e07b2690..fa19536c 100644
--- a/frontend/composables/useSidebarTree.ts
+++ b/frontend/composables/useSidebarTree.ts
@@ -39,13 +39,13 @@ export function useSidebarTree() {
if (!preferencesStore.get('hideSidebarRessources'))
return ressourcesStore.getAll
.filter(res => res.parent_id)
- .map(cat => ({
- id: cat.id,
- parent_id: cat.parent_id || '',
- label: cat.filename,
- route: `/dashboard/cdn/${cat.id}/preview`,
- icon: 'image',
- data: cat,
+ .map(res => ({
+ id: res.id,
+ parent_id: res.parent_id || '',
+ label: res.filename,
+ route: `/dashboard/cdn/${res.id}/preview`,
+ icon: res.filetype == 'application/pdf' ? 'pdf' : 'image',
+ data: res,
show: ref(true),
}));
return [];
diff --git a/frontend/helpers/icons.ts b/frontend/helpers/icons.ts
index 53dfcc84..ae575635 100644
--- a/frontend/helpers/icons.ts
+++ b/frontend/helpers/icons.ts
@@ -17,7 +17,7 @@ const icons = {
image: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>`,
import: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m720-80 120-120-28-28-72 72v-164h-40v164l-72-72-28 28L720-80ZM480-800 243-663l237 137 237-137-237-137ZM120-321v-318q0-22 10.5-40t29.5-29l280-161q10-5 19.5-8t20.5-3q11 0 21 3t19 8l280 161q19 11 29.5 29t10.5 40v159h-80v-116L479-434 200-596v274l240 139v92L160-252q-19-11-29.5-29T120-321ZM720 0q-83 0-141.5-58.5T520-200q0-83 58.5-141.5T720-400q83 0 141.5 58.5T920-200q0 83-58.5 141.5T720 0ZM480-491Z"/></svg>`,
logout: `<svg xmlns="http://www.w3.org/2000/svg" style="fill:var(--font-color);" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h280v80H200Zm440-160-55-58 102-102H360v-80h327L585-622l55-58 200 200-200 200Z"/></svg>`,
- pdf: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M360-460h40v-80h40q17 0 28.5-11.5T480-580v-40q0-17-11.5-28.5T440-660h-80v200Zm40-120v-40h40v40h-40Zm120 120h80q17 0 28.5-11.5T640-500v-120q0-17-11.5-28.5T600-660h-80v200Zm40-40v-120h40v120h-40Zm120 40h40v-80h40v-40h-40v-40h40v-40h-80v200ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>`,
+ pdf: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M280-280h280v-80H280v80Zm0-160h400v-80H280v80Zm0-160h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>`,
plus: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"/></svg>`,
profil: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M234-276q51-39 114-61.5T480-360q69 0 132 22.5T726-276q35-41 54.5-93T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 59 19.5 111t54.5 93Zm246-164q-59 0-99.5-40.5T340-580q0-59 40.5-99.5T480-720q59 0 99.5 40.5T620-580q0 59-40.5 99.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q53 0 100-15.5t86-44.5q-39-29-86-44.5T480-280q-53 0-100 15.5T294-220q39 29 86 44.5T480-160Zm0-360q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm0-60Zm0 360Z"/></svg>`,
search: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"class="mr-2 h-4 w-4 shrink-0 opacity-50"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.3-4.3"></path></svg>`,
diff --git a/frontend/pages/dashboard/categories/index.vue b/frontend/pages/dashboard/categories/index.vue
index 0084624e..519bba78 100644
--- a/frontend/pages/dashboard/categories/index.vue
+++ b/frontend/pages/dashboard/categories/index.vue
@@ -1,5 +1,5 @@
<template>
- <div style="padding: 24px; gap: 16px" class="card-component">
+ <div class="card-component">
<header>
<h1 style="font-size: 20px">Workspaces & Categories <tag class="blue">New</tag></h1>
<div style="display: flex; gap: 8px">
diff --git a/frontend/pages/dashboard/cdn/[id]/index.vue b/frontend/pages/dashboard/cdn/[id]/index.vue
index 1ab1d604..d87c0583 100644
--- a/frontend/pages/dashboard/cdn/[id]/index.vue
+++ b/frontend/pages/dashboard/cdn/[id]/index.vue
@@ -1,5 +1,5 @@
<template>
- <div style="padding: 24px; gap: 16px" class="card-component">
+ <div class="card-component">
<header>
<h3>Update ressource&nbsp;<tag blue>New</tag></h3>
Manage ressources and files on the server. You can edit metadata and delete file from the server.
@@ -36,11 +36,18 @@
<img v-if="ressource.filetype.startsWith('image/')" :src="`${CDN}/${ressource.author_id}/${ressource.transformed_path || ressource.original_path}`" alt="Preview" />
<p v-else>Preview not available for this file type.</p>
</div>
+ <h4>Danger</h4>
+ <p style="color: #dc3545">Deleting a ressource will remove it from the server. This action is irreversible.</p>
+ <div style="display: flex; justify-content: flex-end">
+ <AppButton type="danger" @click="showDeleteModal">Delete</AppButton>
+ </div>
</form>
</div>
</template>
<script lang="ts" setup>
+import DeleteRessourceModal from '../_modals/DeleteRessourceModal.vue';
+definePageMeta({ breadcrumb: 'Edit' });
const ressourcesStore = useRessourcesStore();
const route = useRoute();
const ressource = computed(() => ressourcesStore.getById(route.params.id as string));
@@ -52,8 +59,6 @@ const defaultItem: ANode = {
};
const tree = computed(() => [defaultItem, ...useSidebarTree().tree.value]);
-definePageMeta({ breadcrumb: 'Edit' });
-
const updateCategory = async () => {
if (ressource.value)
ressourcesStore
@@ -64,6 +69,9 @@ const updateCategory = async () => {
})
.catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e }));
};
+const showDeleteModal = () => {
+ useModal().add(new Modal(shallowRef(DeleteRessourceModal), { ressourceId: ressource.value?.id }));
+};
</script>
<style scoped lang="scss">
@@ -73,11 +81,7 @@ h2 {
label {
margin-top: 10px;
}
-.card-component {
- display: block;
- margin: 2px 0;
- width: 100%;
-}
+
input,
textarea,
select {
diff --git a/frontend/pages/dashboard/cdn/[id]/preview.vue b/frontend/pages/dashboard/cdn/[id]/preview.vue
index 4ac91aa5..d19e6bd9 100644
--- a/frontend/pages/dashboard/cdn/[id]/preview.vue
+++ b/frontend/pages/dashboard/cdn/[id]/preview.vue
@@ -1,7 +1,13 @@
<template>
- <div style="padding: 24px; gap: 16px" class="card-component">
+ <div class="card-component">
<div v-if="ressource">
- <h2>Preview <tag blue>New</tag></h2>
+ <header style="display: flex; justify-content: space-between; align-items: center">
+ <h2>Preview <tag blue>New</tag></h2>
+ <div style="display: flex">
+ <NuxtLink :to="`/dashboard/cdn/${ressource.id}`"><AppButton type="primary">Edit</AppButton></NuxtLink>
+ <AppButton type="secondary" @click="copyLink">Copy link</AppButton>
+ </div>
+ </header>
Name: <strong>{{ ressource.filename }}</strong>
<p>
Type: <strong>{{ ressource.filetype }}</strong>
@@ -20,14 +26,15 @@
</template>
<script setup lang="ts">
+definePageMeta({ breadcrumb: 'Preview' });
const ressource = useRessourcesStore().getById(useRoute().params.id as string);
+
+const copyLink = () => {
+ const link = `${CDN}/${ressource?.author_id}/${ressource?.transformed_path || ressource?.original_path}`;
+ navigator.clipboard.writeText(link);
+};
</script>
<style lang="scss">
-.card-component {
- display: block;
- margin: 2px 0;
- width: 100%;
-}
.preview {
display: flex;
justify-content: center;
diff --git a/frontend/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue b/frontend/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue
index 7128b0ef..7e9cb05c 100644
--- a/frontend/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue
+++ b/frontend/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue
@@ -19,6 +19,7 @@ const deleteRessource = async () => {
.then(() => {
useNotifications().add({ type: 'success', title: 'Ressource deleted successfully' });
emit('close');
+ useRouter().push('/dashboard/cdn');
})
.catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e }));
};
diff --git a/frontend/pages/dashboard/cdn/index.vue b/frontend/pages/dashboard/cdn/index.vue
index ed46f5b9..a65a25d0 100644
--- a/frontend/pages/dashboard/cdn/index.vue
+++ b/frontend/pages/dashboard/cdn/index.vue
@@ -94,6 +94,11 @@ const deleteRessource = async (id: string) => {
</script>
<style scoped lang="scss">
+.card-component {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
.dropzone {
display: flex;
align-items: center;
diff --git a/frontend/pages/dashboard/docs/index.vue b/frontend/pages/dashboard/docs/index.vue
index b8f293ca..93687fd6 100644
--- a/frontend/pages/dashboard/docs/index.vue
+++ b/frontend/pages/dashboard/docs/index.vue
@@ -1,11 +1,13 @@
<template>
- <h2 style="text-align: center">Search documents</h2>
- <DataTable :headers="headers" :rows="rows">
- <template #actions="{ cell }">
- <NuxtLink :to="`/dashboard/docs/${cell?.data.id}`"><Icon name="view" /></NuxtLink>
- <NuxtLink :to="`/dashboard/docs/edit/${cell?.data.id}`"><Icon name="edit" /></NuxtLink>
- </template>
- </DataTable>
+ <div class="card-component">
+ <h2 style="text-align: center">Search documents</h2>
+ <DataTable :headers="headers" :rows="rows">
+ <template #actions="{ cell }">
+ <NuxtLink :to="`/dashboard/docs/${cell?.data.id}`"><Icon name="view" /></NuxtLink>
+ <NuxtLink :to="`/dashboard/docs/edit/${cell?.data.id}`"><Icon name="edit" /></NuxtLink>
+ </template>
+ </DataTable>
+ </div>
</template>
<script setup lang="ts">
diff --git a/frontend/pages/dashboard/import.vue b/frontend/pages/dashboard/import.vue
index 4a111289..ce03ab2e 100644
--- a/frontend/pages/dashboard/import.vue
+++ b/frontend/pages/dashboard/import.vue
@@ -1,8 +1,7 @@
<template>
- <div style="padding: 24px; gap: 16px" class="card-component">
+ <div class="card-component">
<header>
<h1 style="font-size: 20px">Import documents <tag class="yellow">Beta</tag></h1>
-
<p>You can import documents from a previous export. If you don't have export, you can create a new one from the <NuxtLink to="/dashboard/settings?p=backup">settings</NuxtLink> page.</p>
</header>
<div class="dropzone" :class="{ 'drag-over': isDragOver }" @dragover.prevent @drop.prevent="handleFileDrop" @dragenter.prevent="dragEnter" @dragleave.prevent="dragLeave">
@@ -107,11 +106,6 @@ header {
color: $primary-color;
}
}
-.card-component {
- display: block;
- margin: 2px 0;
- width: 100%;
-}
.dropzone {
display: flex;
diff --git a/frontend/styles/components.scss b/frontend/styles/components.scss
index 10b93449..d18147ca 100644
--- a/frontend/styles/components.scss
+++ b/frontend/styles/components.scss
@@ -9,6 +9,16 @@
}
}
+.card-component {
+ display: block;
+ margin: 2px 0;
+ width: 100%;
+ gap: 16px;
+ padding: 24px;
+ border-radius: 8px;
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
+}
+
tag {
padding: 2px 4px;
border-radius: 6px;
diff --git a/frontend/styles/main.scss b/frontend/styles/main.scss
index 471dfedd..6c0cbfb1 100644
--- a/frontend/styles/main.scss
+++ b/frontend/styles/main.scss
@@ -69,15 +69,7 @@ body {
--padding: calc((100vw - 1700px) / 2);
}
-.card-component {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 1.5rem;
- padding: 1rem;
- border-radius: 8px;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
-}
+
@media screen and (min-width: 768px) {
.card-component {