From 22562e325cae89e69d41ccbe18257c18f24f45e3 Mon Sep 17 00:00:00 2001 From: yonkov Date: Tue, 15 Nov 2022 15:38:24 +0200 Subject: [PATCH] Add option to hide namespace sidebar --- client/web/compose/src/views/Layout.vue | 17 +++++++++++ .../web/compose/src/views/Namespace/Edit.vue | 29 ++++++++++++++++++- .../web/compose/src/views/Namespace/View.vue | 2 ++ lib/js/src/compose/types/namespace.ts | 2 +- .../src/components/navigation/CSidebar.vue | 26 ++++++++++++----- .../en/corteza-webapp-compose/namespace.yaml | 6 +++- 6 files changed, 71 insertions(+), 11 deletions(-) diff --git a/client/web/compose/src/views/Layout.vue b/client/web/compose/src/views/Layout.vue index c18fad564..cfdf41090 100644 --- a/client/web/compose/src/views/Layout.vue +++ b/client/web/compose/src/views/Layout.vue @@ -178,14 +178,31 @@ export default { */ this.$root.$on('alert', ({ message, ...params }) => this.toast(message, params)) this.$root.$on('reminder.show', this.showReminder) + + this.$root.$on('check-namespace-sidebar', this.checkNamespaceSidebar) }, beforeDestroy () { this.$root.$off('alert') this.$root.$off('reminder.show', this.showReminder) + this.$root.$off('check-namespace-sidebar', this.checkNamespaceSidebar) }, methods: { + checkNamespaceSidebar (showSidebar) { + const defaultDisabledRoutes = [ + 'namespaces', + 'namespace.list', + 'namespace.edit', + 'namespace.create', + 'namespace.clone', + 'namespace.manage', + ] + const namespaceRoutes = ['page', 'pages', 'page.record', 'page.record.create', 'page.record.edit'] + + this.disabledRoutes = [...defaultDisabledRoutes, ...(showSidebar ? [] : namespaceRoutes)] + }, + removeToast (reminderID) { const i = this.toasts.findIndex(r => r.reminderID === reminderID) if (i > -1) { diff --git a/client/web/compose/src/views/Namespace/Edit.vue b/client/web/compose/src/views/Namespace/Edit.vue index 20c0ed26d..b86ea58cf 100644 --- a/client/web/compose/src/views/Namespace/Edit.vue +++ b/client/web/compose/src/views/Namespace/Edit.vue @@ -22,6 +22,19 @@ > {{ $t('visit') }} + + + +
+ + + + {{ $t('sidebar.hide') }} + +