Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Section Height (colourful theme) #462

Merged
merged 9 commits into from
Feb 1, 2022
7 changes: 7 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 🐛 2.0.1 - Fixes Section Height [PR #462](https://github.com/Lissy93/dashy/pull/462)
- Adds `cutToHeight` to config schema (Re: #461)
- Removes the full-height CSS from colorful theme
- Improved config validation warnings in JSON editor
- Removes empty Keycloak block from appConfig editor
- Adds typechecking to search and clear search for Safari

## ⚡️ 2.0.0 - Small Fixes and Docker Multi-Arch Build [PR #451](https://github.com/Lissy93/dashy/pull/451)
- Fixes full-height sections for mobile and Safari (Re: #432, #442)
- Fixes empty section visible in search (Re: #447)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dashy",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",
"main": "server",
"author": "Alicia Sykes <[email protected]> (https://aliciasykes.com)",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Configuration/JsonEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export default {
errorMessages.push({
type: 'validation',
msg: `${this.$t('config-editor.warning-msg-validation')}: `
+ `${error.error.keyword} ${error.error.message}`,
+ `${(error.error || error).dataPath} ${(error.error || error).message}`,
});
break;
case 'error':
Expand Down
11 changes: 9 additions & 2 deletions src/components/InteractiveEditor/EditAppConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ export default {
/* Remove any attribute which has an undefined value before saving */
removeUndefinedValues(rawAppConfig) {
const raw = rawAppConfig;
const isEmpty = (value) => (value === undefined);
Object.keys(raw).forEach(key => isEmpty(raw[key]) && delete raw[key]);
const isEmptyObject = (obj) => (typeof obj === 'object' && Object.keys(obj).length === 0);
const isEmpty = (value) => (value === undefined || isEmptyObject(value));
// Delete empty values
Object.keys(raw).forEach(key => {
if (isEmpty(raw[key])) delete raw[key];
});
// If KC config empty, delete it
const kcConfig = raw.auth.keycloak;
if (!kcConfig.clientId && !kcConfig.realm && !kcConfig.serverUrl) delete raw.auth.keycloak;
return raw;
},
},
Expand Down
6 changes: 5 additions & 1 deletion src/components/Settings/SettingsContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ export default {
this.settingsVisible = this.getSettingsVisibility();
},
methods: {
/* Emit event to begin/ continue searching */
userIsTypingSomething(something) {
this.$emit('user-is-searchin', something);
},
/* Call function to clear search field, remove focus and reset results */
clearFilterInput() {
this.$refs.SearchBar.clearFilterInput();
if (this.$refs.SearchBar) this.$refs.SearchBar.clearFilterInput();
},
getInitialTheme() {
return this.appConfig.theme || '';
Expand All @@ -115,10 +117,12 @@ export default {
if (typeof userThemes === 'string') return [userThemes];
return userThemes;
},
/* Show / hide settings */
toggleSettingsVisibility() {
this.settingsVisible = !this.settingsVisible;
localStorage.setItem(localStorageKeys.HIDE_SETTINGS, this.settingsVisible);
},
/* Get initial settings visibility, either from appConfig, local storage or browser type */
getSettingsVisibility() {
const screenWidth = document.body.clientWidth;
if (screenWidth && screenWidth < 600) return false;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Workspace/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ export default {
/* If an initial URL is specified, then open relevant section */
openDefaultSection() {
if (!this.initUrl) return;
const process = (url) => url.replace(/[^\w\s]/gi, '').toLowerCase();
const process = (url) => (url ? url.replace(/[^\w\s]/gi, '').toLowerCase() : undefined);
const compare = (item) => (process(item.url) === process(this.initUrl));
this.sections.forEach((section, sectionIndex) => {
if (section.items.findIndex(compare) !== -1) this.openSection(sectionIndex);
this.sections.forEach((section, secIndex) => {
if (section.items && section.items.findIndex(compare) !== -1) this.openSection(secIndex);
});
},
},
Expand Down
3 changes: 0 additions & 3 deletions src/styles/color-themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,6 @@ html[data-theme='colorful'] {
div.context-menu {
border-color: var(--primary);
}
.collapsable.is-open {
height: -webkit-fill-available;
}
}

html[data-theme='minimal-light'], html[data-theme='minimal-dark'], html[data-theme='vaporware'] {
Expand Down
6 changes: 6 additions & 0 deletions src/utils/ConfigSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@
"default": false,
"description": "If true, section needs to be clicked to open"
},
"cutToHeight": {
"title": "Cut to Height",
"type": "boolean",
"default": false,
"description": "By default, sections will fill available space. Set this option to true to match section height with content height"
},
"color": {
"title": "Color",
"type": "string",
Expand Down