mirror of https://github.com/Lissy93/dashy.git
♻️ Refactor key names to use contstants
This commit is contained in:
parent
7e6cce8828
commit
c991a46298
|
@ -68,7 +68,7 @@ import Input from '@/components/FormElements/Input';
|
||||||
import StoreKeys from '@/utils/StoreMutations';
|
import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { backup, update, restore } from '@/utils/CloudBackup';
|
import { backup, update, restore } from '@/utils/CloudBackup';
|
||||||
import { localStorageKeys } from '@/utils/defaults';
|
import { localStorageKeys } from '@/utils/defaults';
|
||||||
import { InfoHandler, WarningInfoHandler } from '@/utils/ErrorHandler';
|
import { InfoHandler, WarningInfoHandler, InfoKeys } from '@/utils/ErrorHandler';
|
||||||
// Import Icons
|
// Import Icons
|
||||||
import IconBackup from '@/assets/interface-icons/config-backup.svg';
|
import IconBackup from '@/assets/interface-icons/config-backup.svg';
|
||||||
import IconRestore from '@/assets/interface-icons/config-restore.svg';
|
import IconRestore from '@/assets/interface-icons/config-restore.svg';
|
||||||
|
@ -179,12 +179,12 @@ export default {
|
||||||
},
|
},
|
||||||
/* If the server returns a warning, then show to user and log it */
|
/* If the server returns a warning, then show to user and log it */
|
||||||
showErrorMsg(errorMsg) {
|
showErrorMsg(errorMsg) {
|
||||||
WarningInfoHandler(errorMsg, 'Cloud Backup');
|
WarningInfoHandler(errorMsg, InfoKeys.CLOUD_BACKUP);
|
||||||
this.$toasted.show(errorMsg, { className: 'toast-error' });
|
this.$toasted.show(errorMsg, { className: 'toast-error' });
|
||||||
},
|
},
|
||||||
/* When server returns success message, then show to user and log it */
|
/* When server returns success message, then show to user and log it */
|
||||||
showSuccessMsg(msg) {
|
showSuccessMsg(msg) {
|
||||||
InfoHandler(msg, 'Cloud Backup');
|
InfoHandler(msg, InfoKeys.CLOUD_BACKUP);
|
||||||
this.$toasted.show(msg, { className: 'toast-success' });
|
this.$toasted.show(msg, { className: 'toast-success' });
|
||||||
},
|
},
|
||||||
/* Call to hash function, to hash the users chosen/ entered password */
|
/* Call to hash function, to hash the users chosen/ entered password */
|
||||||
|
|
|
@ -36,7 +36,7 @@ import StoreKeys from '@/utils/StoreMutations';
|
||||||
import { modalNames } from '@/utils/defaults';
|
import { modalNames } from '@/utils/defaults';
|
||||||
import DownloadConfigIcon from '@/assets/interface-icons/config-download-file.svg';
|
import DownloadConfigIcon from '@/assets/interface-icons/config-download-file.svg';
|
||||||
import CopyConfigIcon from '@/assets/interface-icons/interactive-editor-copy-clipboard.svg';
|
import CopyConfigIcon from '@/assets/interface-icons/interactive-editor-copy-clipboard.svg';
|
||||||
import { InfoHandler } from '@/utils/ErrorHandler';
|
import { InfoHandler, InfoKeys } from '@/utils/ErrorHandler';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ExportConfigMenu',
|
name: 'ExportConfigMenu',
|
||||||
|
@ -70,13 +70,13 @@ export default {
|
||||||
document.body.appendChild(element);
|
document.body.appendChild(element);
|
||||||
element.click();
|
element.click();
|
||||||
document.body.removeChild(element);
|
document.body.removeChild(element);
|
||||||
InfoHandler('Config downloaded as YAML file', 'Interactive Editor');
|
InfoHandler('Config downloaded as YAML file', InfoKeys.EDITOR);
|
||||||
},
|
},
|
||||||
copyConfigToClipboard() {
|
copyConfigToClipboard() {
|
||||||
const config = this.convertJsonToYaml();
|
const config = this.convertJsonToYaml();
|
||||||
navigator.clipboard.writeText(config);
|
navigator.clipboard.writeText(config);
|
||||||
this.$toasted.show(this.$t('config.data-copied-msg'));
|
this.$toasted.show(this.$t('config.data-copied-msg'));
|
||||||
InfoHandler('Config copied to clipboard', 'Interactive Editor');
|
InfoHandler('Config copied to clipboard', InfoKeys.EDITOR);
|
||||||
},
|
},
|
||||||
modalClosed() {
|
modalClosed() {
|
||||||
this.$store.commit(StoreKeys.SET_MODAL_OPEN, false);
|
this.$store.commit(StoreKeys.SET_MODAL_OPEN, false);
|
||||||
|
|
|
@ -988,25 +988,32 @@ html[data-theme="oblivion-scotch"] {
|
||||||
}
|
}
|
||||||
|
|
||||||
html[data-theme="dashy-docs"] {
|
html[data-theme="dashy-docs"] {
|
||||||
|
// Base
|
||||||
--primary: #f5f6f7;
|
--primary: #f5f6f7;
|
||||||
--background: #202020;
|
--background: #202020;
|
||||||
--background-darker: #121212;
|
--background-darker: #121212;
|
||||||
|
// Items
|
||||||
|
--item-background: var(--background);
|
||||||
|
--item-background-hover: var(--background);
|
||||||
|
--item-text-color: var(--primary);
|
||||||
|
// Sections
|
||||||
--item-group-background: none;
|
--item-group-background: none;
|
||||||
--item-group-outer-background: var(--background-darker);
|
--item-group-outer-background: var(--background-darker);
|
||||||
--item-group-heading-text-color: var(--background);
|
--item-group-heading-text-color: var(--background);
|
||||||
--item-group-heading-text-color-hover: var(--background);
|
--item-group-heading-text-color-hover: var(--background);
|
||||||
--item-background: var(--background);
|
// Misc
|
||||||
--item-background-hover: var(--background);
|
|
||||||
--item-text-color: var(--primary);
|
|
||||||
--minimal-view-section-heading-color: var(--background);
|
|
||||||
--item-group-padding: 0;
|
--item-group-padding: 0;
|
||||||
--curve-factor: 3px;
|
--curve-factor: 3px;
|
||||||
--curve-factor-navbar: 6px;
|
--curve-factor-navbar: 6px;
|
||||||
--item-shadow: 4px 4px 6px #00000080, -2px -2px 4px rgb(0 0 0 / 40%);
|
--item-shadow: 4px 4px 6px #00000080, -2px -2px 4px rgb(0 0 0 / 40%);
|
||||||
--item-group-shadow: 0px 3px 2px #222222, 0px 0px 2px #3e3e3e;
|
--item-group-shadow: 0px 3px 2px #222222, 0px 0px 2px #3e3e3e;
|
||||||
--font-headings: 'PTMono', 'Courier New', monospace;
|
--font-headings: 'PTMono', 'Courier New', monospace;
|
||||||
|
--minimal-view-section-heading-color: var(--background);
|
||||||
|
// Navbar Links
|
||||||
--nav-link-background-color-hover: none;
|
--nav-link-background-color-hover: none;
|
||||||
--nav-link-border-color-hover: none;
|
--nav-link-border-color-hover: none;
|
||||||
|
--nav-link-text-color: var(--background);
|
||||||
|
--nav-link-text-color-hover: var(--background-darker);
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
box-shadow: 0 -3px 4px #010101;
|
box-shadow: 0 -3px 4px #010101;
|
||||||
|
@ -1095,10 +1102,10 @@ html[data-theme="dashy-docs"] {
|
||||||
color: var(--background);
|
color: var(--background);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
svg path { fill: var(--background); }
|
svg path { fill: var(--background); }
|
||||||
&:nth-child(1n) { @include make-colors(#db78fc, #b83ddd); }
|
&:nth-child(4n + 1) { @include make-colors(#db78fc, #b83ddd); }
|
||||||
&:nth-child(2n) { @include make-colors(#41ef90, #1e9554); }
|
&:nth-child(4n + 2) { @include make-colors(#41ef90, #1e9554); }
|
||||||
&:nth-child(3n) { @include make-colors(#5c85f7, #3d48dd); }
|
&:nth-child(4n + 3) { @include make-colors(#5c85f7, #3d48dd); }
|
||||||
&:nth-child(4n) { @include make-colors(#dcff5a, #ceb73f); }
|
&:nth-child(4n + 4) { @include make-colors(#dcff5a, #ceb73f); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ export const WarningInfoHandler = (msg, title, log) => {
|
||||||
|
|
||||||
/* Titles for info logging */
|
/* Titles for info logging */
|
||||||
export const InfoKeys = {
|
export const InfoKeys = {
|
||||||
|
AUTH: 'Authentication',
|
||||||
|
CLOUD_BACKUP: 'Cloud Backup & Restore',
|
||||||
EDITOR: 'Interactive Editor',
|
EDITOR: 'Interactive Editor',
|
||||||
RAW_EDITOR: 'Raw Config Editor',
|
RAW_EDITOR: 'Raw Config Editor',
|
||||||
VISUAL: 'Layout & Styles',
|
VISUAL: 'Layout & Styles',
|
||||||
|
|
|
@ -76,7 +76,7 @@ import router from '@/router';
|
||||||
import Button from '@/components/FormElements/Button';
|
import Button from '@/components/FormElements/Button';
|
||||||
import Input from '@/components/FormElements/Input';
|
import Input from '@/components/FormElements/Input';
|
||||||
import Defaults, { localStorageKeys } from '@/utils/defaults';
|
import Defaults, { localStorageKeys } from '@/utils/defaults';
|
||||||
import { InfoHandler, WarningInfoHandler } from '@/utils/ErrorHandler';
|
import { InfoHandler, WarningInfoHandler, InfoKeys } from '@/utils/ErrorHandler';
|
||||||
import {
|
import {
|
||||||
checkCredentials,
|
checkCredentials,
|
||||||
login,
|
login,
|
||||||
|
@ -158,9 +158,9 @@ export default {
|
||||||
if (response.correct) { // Yay, credentials were correct :)
|
if (response.correct) { // Yay, credentials were correct :)
|
||||||
login(this.username, this.password, timeout); // Login, to set the cookie
|
login(this.username, this.password, timeout); // Login, to set the cookie
|
||||||
this.goHome();
|
this.goHome();
|
||||||
InfoHandler(`Succesfully signed in as ${this.username}`, 'Authentication');
|
InfoHandler(`Succesfully signed in as ${this.username}`, InfoKeys.AUTH);
|
||||||
} else {
|
} else {
|
||||||
WarningInfoHandler('Unable to Sign In', 'Authentication', this.message);
|
WarningInfoHandler('Unable to Sign In', InfoKeys.AUTH, this.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* Calls function to double-check guest access enabled, then log in as guest */
|
/* Calls function to double-check guest access enabled, then log in as guest */
|
||||||
|
@ -168,11 +168,11 @@ export default {
|
||||||
const isAllowed = this.isGuestAccessEnabled;
|
const isAllowed = this.isGuestAccessEnabled;
|
||||||
if (isAllowed) {
|
if (isAllowed) {
|
||||||
this.$toasted.show('Logged in as Guest, Redirecting...', { className: 'toast-success' });
|
this.$toasted.show('Logged in as Guest, Redirecting...', { className: 'toast-success' });
|
||||||
InfoHandler('Logged in as Guest', 'Authentication');
|
InfoHandler('Logged in as Guest', InfoKeys.AUTH);
|
||||||
this.goHome();
|
this.goHome();
|
||||||
} else {
|
} else {
|
||||||
this.$toasted.show('Guest Access Not Allowed', { className: 'toast-error' });
|
this.$toasted.show('Guest Access Not Allowed', { className: 'toast-error' });
|
||||||
WarningInfoHandler('Guest Access Not Allowed', 'Authentication');
|
WarningInfoHandler('Guest Access Not Allowed', InfoKeys.AUTH);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* Calls logout, shows status message, and refreshed page */
|
/* Calls logout, shows status message, and refreshed page */
|
||||||
|
|
Loading…
Reference in New Issue