Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

Add hideFromWorkspace support at section level in ConfigSchema and SideBar component

copilot-swe-agent[bot]4bde34c3b125
diff --git a/docs/configuring.md b/docs/configuring.md
index b15fbd1f..6ab3c91f 100644
--- a/docs/configuring.md
+++ b/docs/configuring.md
@@ -318,6 +318,7 @@ For more info, see the **[Authentication Docs](/docs/authentication.md)**
**`hideForGuests`** | `boolean` | _Optional_ | Current section will be visible for logged in users, but not for guests (see `appConfig.enableGuestAccess`). Defaults to `false`
**`hideForKeycloakUsers`** | `object` | _Optional_ | Current section will be visible to all keycloak users, except for those configured via these groups and roles. See `hideForKeycloakUsers`
**`showForKeycloakUsers`** | `object` | _Optional_ | Current section will be hidden from all keycloak users, except for those configured via these groups and roles. See `showForKeycloakUsers`
+**`hideFromWorkspace`** | `boolean` | _Optional_ | Current section will be visible in the default view but not in the Workspace view sidebar. Defaults to `false`
**[⬆️ Back to Top](#configuring)**
diff --git a/src/components/Workspace/SideBar.vue b/src/components/Workspace/SideBar.vue
index f4fa261e..213c447c 100644
--- a/src/components/Workspace/SideBar.vue
+++ b/src/components/Workspace/SideBar.vue
@@ -1,6 +1,6 @@
<template>
<nav class="side-bar">
- <div v-for="(section, index) in sections" :key="index" class="side-bar-section">
+ <div v-for="(section, index) in filteredSections" :key="index" class="side-bar-section">
<!-- Section button -->
<div @click="openSection(index)" class="side-bar-item-container">
<SideBarItem
@@ -46,9 +46,19 @@ export default {
},
data() {
return {
- isOpen: new Array(this.sections.length).fill(false),
+ isOpen: [],
};
},
+ computed: {
+ /* Return a list of sections that should be visible in workspace */
+ filteredSections() {
+ if (!this.sections) return [];
+ return this.sections.filter((section) => {
+ const hideFromWorkspace = section.displayData?.hideFromWorkspace || false;
+ return !hideFromWorkspace;
+ });
+ },
+ },
components: {
SideBarItem,
SideBarSection,
@@ -59,7 +69,7 @@ export default {
/* Toggles the section clicked, and closes all other sections */
openSection(index) {
this.isOpen = this.isOpen.map((val, ind) => (ind !== index ? false : !val));
- if (this.sections[index].widgets) this.$emit('launch-widget', this.sections[index].widgets);
+ if (this.filteredSections[index].widgets) this.$emit('launch-widget', this.filteredSections[index].widgets);
},
/* When item clicked, emit a launch event */
launchApp(options) {
@@ -70,7 +80,7 @@ export default {
if (!this.initUrl) return;
const process = (url) => (url ? url.replace(/[^\w\s]/gi, '').toLowerCase() : undefined);
const compare = (item) => (process(item.url) === process(this.initUrl));
- this.sections.forEach((section, secIndx) => {
+ this.filteredSections.forEach((section, secIndx) => {
if (!section.items) return; // Cancel if no items
if (section.items.findIndex(compare) !== -1) this.openSection(secIndx);
section.items.forEach((item) => { // Do the same for sub-items, if set
@@ -92,7 +102,9 @@ export default {
},
},
mounted() {
- if (this.sections.length === 1) { // If only 1 section, go ahead and open it
+ // Initialize isOpen array based on filteredSections length
+ this.isOpen = new Array(this.filteredSections.length).fill(false);
+ if (this.filteredSections.length === 1) { // If only 1 section, go ahead and open it
this.openSection(0);
} else { // Otherwise, see if user set a default section, and open that
this.openDefaultSection();
diff --git a/src/utils/ConfigSchema.json b/src/utils/ConfigSchema.json
index 7e28b505..d57cf896 100644
--- a/src/utils/ConfigSchema.json
+++ b/src/utils/ConfigSchema.json
@@ -924,6 +924,12 @@
}
}
}
+ },
+ "hideFromWorkspace": {
+ "title": "Hide from Workspace",
+ "type": "boolean",
+ "default": false,
+ "description": "If set to true, section will be visible in the default view but not in the Workspace view sidebar"
}
}
},