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!

✨ Implements ability to hide items (#1854)

Alicia Sykes228de780475b
diff --git a/docs/configuring.md b/docs/configuring.md
index 3231fa6e..4b4d2b11 100644
--- a/docs/configuring.md
+++ b/docs/configuring.md
@@ -288,6 +288,7 @@ For more info, see the **[Authentication Docs](/docs/authentication.md)**
**`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`
+**`hideFromHomepage`** | `boolean` | _Optional_ | If `true`, item is hidden from the home and minimal views until matched by a search. Still visible in workspace, edit mode and single-section view. Defaults to `false`
**[⬆️ Back to Top](#configuring)**
diff --git a/docs/searching.md b/docs/searching.md
index 0cbb61c7..7dd10e5d 100644
--- a/docs/searching.md
+++ b/docs/searching.md
@@ -33,6 +33,20 @@ By default, when searching items are filtered by the `title`, (as well as the `u
In the above example, Plex will be visible when searching for 'movies', and FreshRSS with 'news'
+## Hiding Items From The Homepage
+
+You can hide a rarely-used item from the main view but still have it surface when you search for it. Set `displayData.hideFromHomepage: true` on the item.
+
+```yaml
+- title: MXToolbox
+ url: https://mxtoolbox.com
+ tags: [dns, mail, debug]
+ displayData:
+ hideFromHomepage: true
+```
+
+The item still shows up in search results, and stays visible in the workspace view, in edit mode, and when you navigate into its parent section directly.
+
## Custom Hotkeys
For apps that you use regularly, you can set a custom keybinding. Use the `hotkey` parameter on a certain item to specify a numeric key, between `0 - 9`. You can then launch that app, by just pressing that key, which is much quicker than searching for it, if it's an app you use frequently.
diff --git a/src/mixins/HomeMixin.js b/src/mixins/HomeMixin.js
index 09ea0115..9ecf24b4 100644
--- a/src/mixins/HomeMixin.js
+++ b/src/mixins/HomeMixin.js
@@ -88,12 +88,14 @@ const HomeMixin = {
return (sections && sections.length >= 1) || (localSections && localSections.length >= 1);
},
/* Returns only the tiles that match the users search query */
- filterTiles(allTiles, sectionName) {
+ filterTiles(allTiles, sectionName, opts = {}) {
if (!allTiles) return [];
const currentUser = getCurrentUser();
const isGuest = isLoggedInAsGuest();
+ const showHidden = !!opts.showHidden;
const visibleTiles = allTiles.filter(
- (tile) => isVisibleToUser(tile.displayData || {}, currentUser, isGuest),
+ (tile) => isVisibleToUser(tile.displayData || {}, currentUser, isGuest)
+ && (showHidden || !tile.displayData?.hideFromHomepage),
);
return searchTiles(visibleTiles, this.searchValue, sectionName || '');
},
diff --git a/src/utils/config/ConfigSchema.json b/src/utils/config/ConfigSchema.json
index 5fed30fe..d6ed991d 100644
--- a/src/utils/config/ConfigSchema.json
+++ b/src/utils/config/ConfigSchema.json
@@ -1106,6 +1106,12 @@
"type": "boolean",
"default": false,
"description": "If set to true, item will be visible in the default view but not in the Workspace view sidebar"
+ },
+ "hideFromHomepage": {
+ "title": "Hide from Homepage",
+ "type": "boolean",
+ "default": false,
+ "description": "If set to true, item is hidden from the home and minimal views until matched by a search. Still visible in workspace, edit mode and single-section view"
}
}
},
diff --git a/src/views/Home.vue b/src/views/Home.vue
index 7133ef74..500b0e3f 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -110,9 +110,10 @@ export default {
/* Return sections with filtered items, that match users search term */
filteredSections() {
const sections = this.singleSectionView || this.sections;
+ const showHidden = this.isEditMode || !!this.searchValue || !!this.singleSectionView;
return sections.map((section) => ({
...section,
- filteredItems: this.filterTiles(section.items, section.name),
+ filteredItems: this.filterTiles(section.items, section.name, { showHidden }),
}));
},
/* Updates layout (when button clicked), and saves in local storage */
diff --git a/src/views/Minimal.vue b/src/views/Minimal.vue
index 46b8364c..8b118115 100644
--- a/src/views/Minimal.vue
+++ b/src/views/Minimal.vue
@@ -103,9 +103,10 @@ export default {
computed: {
/* Just the items to display, filtered by search term */
filteredSections() {
+ const showHidden = this.isEditMode || !!this.searchValue;
return (this.sections || []).map((section) => ({
...section,
- filteredItems: this.filterTiles(section.items, section.name),
+ filteredItems: this.filterTiles(section.items, section.name, { showHidden }),
}));
},
},