From 24b1984919d59213e31be8af4c27d4466fd88c6f Mon Sep 17 00:00:00 2001 From: Nicolas Giard Date: Sat, 12 Nov 2022 05:53:17 +0000 Subject: [PATCH] feat: file manager (wip) --- server/graph/resolvers/page.js | 2 +- ux/public/_assets/icons/color-document.svg | 1 + ux/public/_assets/icons/color-pdf.svg | 1 + ux/public/_assets/icons/fluent-folder.svg | 1 + ux/public/_assets/icons/fluent-spring.svg | 1 + ux/src/components/FileManager.vue | 169 +++++++++++++++++++++ ux/src/components/HeaderNav.vue | 22 ++- ux/src/components/PageNewMenu.vue | 8 +- ux/src/components/PageRelationDialog.vue | 2 +- ux/src/components/PageScriptsDialog.vue | 151 ++++++++++-------- ux/src/i18n/locales/en.json | 49 +++--- ux/src/layouts/AdminLayout.vue | 4 + ux/src/layouts/MainLayout.vue | 42 +++++ ux/src/pages/AdminIcons.vue | 116 ++++++++++++++ ux/src/router/routes.js | 1 + ux/src/stores/site.js | 5 +- 16 files changed, 483 insertions(+), 92 deletions(-) create mode 100644 ux/public/_assets/icons/color-document.svg create mode 100644 ux/public/_assets/icons/color-pdf.svg create mode 100644 ux/public/_assets/icons/fluent-folder.svg create mode 100644 ux/public/_assets/icons/fluent-spring.svg create mode 100644 ux/src/components/FileManager.vue create mode 100644 ux/src/pages/AdminIcons.vue diff --git a/server/graph/resolvers/page.js b/server/graph/resolvers/page.js index c94cdd26..1011f905 100644 --- a/server/graph/resolvers/page.js +++ b/server/graph/resolvers/page.js @@ -618,7 +618,7 @@ module.exports = { return obj.icon || 'las la-file-alt' }, password (obj) { - return obj ? '********' : '' + return obj.password ? '********' : '' }, async tags (obj) { return WIKI.db.pages.relatedQuery('tags').for(obj.id) diff --git a/ux/public/_assets/icons/color-document.svg b/ux/public/_assets/icons/color-document.svg new file mode 100644 index 00000000..069015ba --- /dev/null +++ b/ux/public/_assets/icons/color-document.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ux/public/_assets/icons/color-pdf.svg b/ux/public/_assets/icons/color-pdf.svg new file mode 100644 index 00000000..3c22eb0c --- /dev/null +++ b/ux/public/_assets/icons/color-pdf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ux/public/_assets/icons/fluent-folder.svg b/ux/public/_assets/icons/fluent-folder.svg new file mode 100644 index 00000000..e899ab93 --- /dev/null +++ b/ux/public/_assets/icons/fluent-folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ux/public/_assets/icons/fluent-spring.svg b/ux/public/_assets/icons/fluent-spring.svg new file mode 100644 index 00000000..52e0f030 --- /dev/null +++ b/ux/public/_assets/icons/fluent-spring.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ux/src/components/FileManager.vue b/ux/src/components/FileManager.vue new file mode 100644 index 00000000..820ca5f6 --- /dev/null +++ b/ux/src/components/FileManager.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/ux/src/components/HeaderNav.vue b/ux/src/components/HeaderNav.vue index 8a51d3a0..170448b1 100644 --- a/ux/src/components/HeaderNav.vue +++ b/ux/src/components/HeaderNav.vue @@ -80,12 +80,22 @@ q-header.bg-header.text-white.site-header( flat round dense - icon='las la-tools' + icon='las la-folder-open' color='positive' + aria-label='File Manager' + @click='toggleFileManager' + ) + q-tooltip File Manager + q-btn.q-ml-md( + flat + round + dense + icon='las la-tools' + color='pink' to='/_admin' - aria-label='Administration' + :aria-label='t(`common.header.admin`)' ) - q-tooltip Administration + q-tooltip {{ t('common.header.admin') }} account-menu @@ -116,6 +126,12 @@ const { t } = useI18n() const state = reactive({ search: '' }) + +// METHODS + +function toggleFileManager () { + siteStore.overlay = 'FileManager' +} diff --git a/ux/src/router/routes.js b/ux/src/router/routes.js index 06a582f9..74a60f91 100644 --- a/ux/src/router/routes.js +++ b/ux/src/router/routes.js @@ -48,6 +48,7 @@ const routes = [ // -> System { path: 'api', component: () => import('pages/AdminApi.vue') }, { path: 'extensions', component: () => import('pages/AdminExtensions.vue') }, + { path: 'icons', component: () => import('pages/AdminIcons.vue') }, { path: 'instances', component: () => import('pages/AdminInstances.vue') }, { path: 'mail', component: () => import('pages/AdminMail.vue') }, // { path: 'rendering', component: () => import('pages/AdminRendering.vue') }, diff --git a/ux/src/stores/site.js b/ux/src/stores/site.js index c9a2e631..a3f58c39 100644 --- a/ux/src/stores/site.js +++ b/ux/src/stores/site.js @@ -25,6 +25,7 @@ export const useSiteStore = defineStore('site', { pageDataTemplates: [], showSideNav: true, showSidebar: true, + overlay: 'FileManager', theme: { dark: false, injectCSS: '', @@ -54,7 +55,9 @@ export const useSiteStore = defineStore('site', { }, docsBase: 'https://next.js.wiki/docs' }), - getters: {}, + getters: { + overlayIsShown: (state) => Boolean(state.overlay) + }, actions: { async loadSite (hostname) { try {