mirror of
https://github.com/Lissy93/dashy.git
synced 2026-03-29 09:03:15 +02:00
🔀 Merge branch 'master' of github.com:lissy93/dashy
This commit is contained in:
commit
762d60e44c
5 changed files with 45 additions and 19 deletions
|
|
@ -281,6 +281,7 @@ For more info, see the **[Authentication Docs](/docs/authentication.md)**
|
|||
**`hideForGuests`** | `boolean` | _Optional_ | Current item will be visible for logged in users, but not for guests (see `appConfig.enableGuestAccess`). Defaults to `false`
|
||||
**`hideForKeycloakUsers`** | `object` | _Optional_ | Current item will be visible to all keycloak users, except for those configured via these groups and roles. See `hideForKeycloakUsers`
|
||||
**`showForKeycloakUsers`** | `object` | _Optional_ | Current item will be hidden from all keycloak users, except for those configured via these groups and roles. See `showForKeycloakUsers`
|
||||
**`hideFromWorkspace`** | `boolean` | _Optional_ | Current item will be visible in the default view but not in the Workspace view sidebar. Defaults to `false`
|
||||
|
||||
**[⬆️ Back to Top](#configuring)**
|
||||
|
||||
|
|
@ -318,6 +319,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)**
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "dashy",
|
||||
"version": "3.1.9",
|
||||
"version": "3.1.10",
|
||||
"license": "MIT",
|
||||
"main": "server",
|
||||
"author": "Alicia Sykes <alicia@omg.lol> (https://aliciasykes.com)",
|
||||
|
|
|
|||
|
|
@ -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,27 @@ 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) => !section.displayData?.hideFromWorkspace);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
/* Update isOpen array when filtered sections change */
|
||||
filteredSections(newSections) {
|
||||
// Resize isOpen array if needed
|
||||
const currentLength = this.isOpen.length;
|
||||
const newLength = newSections.length;
|
||||
if (newLength !== currentLength) {
|
||||
this.isOpen = new Array(newLength).fill(false);
|
||||
}
|
||||
},
|
||||
},
|
||||
components: {
|
||||
SideBarItem,
|
||||
SideBarSection,
|
||||
|
|
@ -59,7 +77,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 +88,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
|
||||
|
|
@ -83,11 +101,14 @@ export default {
|
|||
if (!allTiles) {
|
||||
return [];
|
||||
}
|
||||
return allTiles.filter((tile) => checkItemVisibility(tile));
|
||||
return allTiles.filter((tile) => checkItemVisibility(tile)
|
||||
&& !tile.displayData?.hideFromWorkspace);
|
||||
},
|
||||
},
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ import Defaults, { localStorageKeys, iconCdns } from '@/utils/defaults';
|
|||
import Keys from '@/utils/StoreMutations';
|
||||
import { searchTiles } from '@/utils/Search';
|
||||
import { checkItemVisibility } from '@/utils/CheckItemVisibility';
|
||||
import ThemingMixin from '@/mixins/ThemingMixin';
|
||||
|
||||
const HomeMixin = {
|
||||
mixins: [ThemingMixin],
|
||||
props: {
|
||||
subPageInfo: Object,
|
||||
},
|
||||
|
|
@ -63,19 +65,8 @@ const HomeMixin = {
|
|||
const subPageName = isSubPage ? pagePath.split('/').pop() : null;
|
||||
return subPageName;
|
||||
},
|
||||
/* TEMPORARY: If on sub-page, check if custom theme is set and return it */
|
||||
getSubPageTheme() {
|
||||
if (!this.pageId || this.pageId === 'home') {
|
||||
return null;
|
||||
} else {
|
||||
const themeStoreKey = `${localStorageKeys.THEME}-${this.pageId}`;
|
||||
return localStorage[themeStoreKey] || null;
|
||||
}
|
||||
},
|
||||
setTheme() {
|
||||
// const theme = this.getSubPageTheme() || GetTheme();
|
||||
// ApplyLocalTheme(theme);
|
||||
// ApplyCustomVariables(theme);
|
||||
this.initializeTheme();
|
||||
},
|
||||
updateModalVisibility(modalState) {
|
||||
this.$store.commit('SET_MODAL_OPEN', modalState);
|
||||
|
|
|
|||
|
|
@ -931,6 +931,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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -1048,6 +1054,12 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"hideFromWorkspace": {
|
||||
"title": "Hide from Workspace",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "If set to true, item will be visible in the default view but not in the Workspace view sidebar"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue