π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
:zap: Adds info log for interactive-editor to store
Alicia Sykes08072f1fb6bb
diff --git a/src/components/InteractiveEditor/ExportConfigMenu.vue b/src/components/InteractiveEditor/ExportConfigMenu.vueindex d30bbcdf..9737ed91 100644--- a/src/components/InteractiveEditor/ExportConfigMenu.vue+++ b/src/components/InteractiveEditor/ExportConfigMenu.vue@@ -34,9 +34,9 @@ import JsYaml from 'js-yaml';import Button from '@/components/FormElements/Button';import StoreKeys from '@/utils/StoreMutations';import { modalNames } from '@/utils/defaults';-import DownloadConfigIcon from '@/assets/interface-icons/config-download-file.svg';import CopyConfigIcon from '@/assets/interface-icons/interactive-editor-copy-clipboard.svg';+import { InfoHandler } from '@/utils/ErrorHandler';export default {name: 'ExportConfigMenu',@@ -70,11 +70,13 @@ export default {document.body.appendChild(element);element.click();document.body.removeChild(element);+ InfoHandler('Config downloaded as YAML file', 'Interactive Editor');},copyConfigToClipboard() {const config = this.convertJsonToYaml();navigator.clipboard.writeText(config);this.$toasted.show(this.$t('config.data-copied-msg'));+ InfoHandler('Config copied to clipboard', 'Interactive Editor');},modalClosed() {this.$store.commit(StoreKeys.SET_MODAL_OPEN, false);diff --git a/src/store.js b/src/store.jsindex b89e0122..2eae4ef1 100644--- a/src/store.js+++ b/src/store.js@@ -6,6 +6,7 @@ import ConfigAccumulator from '@/utils/ConfigAccumalator';import { componentVisibility } from '@/utils/ConfigHelpers';import { applyItemId } from '@/utils/MiscHelpers';import filterUserSections from '@/utils/CheckSectionVisibility';+import { InfoHandler, InfoKeys } from '@/utils/ErrorHandler';Vue.use(Vuex);@@ -27,6 +28,10 @@ const {INSERT_ITEM,} = Keys;+const editorLog = (logMessage) => {+ InfoHandler(logMessage, InfoKeys.EDITOR);+};+const store = new Vuex.Store({state: {config: {},@@ -87,7 +92,10 @@ const store = new Vuex.Store({state.modalOpen = modalOpen;},[SET_EDIT_MODE](state, editMode) {- state.editMode = editMode;+ if (editMode !== state.editMode) {+ editorLog(editMode ? 'Edit session started' : 'Edit session ended');+ state.editMode = editMode;+ }},[UPDATE_ITEM](state, payload) {const { itemId, newItem } = payload;@@ -96,6 +104,7 @@ const store = new Vuex.Store({section.items.forEach((item, itemIndex) => {if (item.id === itemId) {newConfig.sections[secIndex].items[itemIndex] = newItem;+ editorLog('Item updated');}});});@@ -105,23 +114,27 @@ const store = new Vuex.Store({const newConfig = state.config;newConfig.pageInfo = newPageInfo;state.config = newConfig;+ editorLog('Page info updated');},[UPDATE_APP_CONFIG](state, newAppConfig) {const newConfig = state.config;newConfig.appConfig = newAppConfig;state.config = newConfig;+ editorLog('App config updated');},[UPDATE_SECTION](state, payload) {const { sectionIndex, sectionData } = payload;const newConfig = { ...state.config };newConfig.sections[sectionIndex] = sectionData;state.config = newConfig;+ editorLog('Section updated');},[REMOVE_SECTION](state, payload) {const { sectionIndex, sectionName } = payload;const newConfig = { ...state.config };if (newConfig.sections[sectionIndex].name === sectionName) {newConfig.sections.splice(sectionIndex, 1);+ editorLog('Section removed');}state.config = newConfig;},@@ -131,6 +144,7 @@ const store = new Vuex.Store({config.sections.forEach((section) => {if (section.name === targetSection) {section.items.push(newItem);+ editorLog('New item added');}});config.sections = applyItemId(config.sections);@@ -147,6 +161,7 @@ const store = new Vuex.Store({} else {section.items.push(newItem);}+ editorLog('Item copied');}});config.sections = applyItemId(config.sections);@@ -160,6 +175,7 @@ const store = new Vuex.Store({section.items.forEach((item, index) => {if (item.id === itemId) {section.items.splice(index, 1);+ editorLog('Item removed');}});}diff --git a/src/utils/ErrorHandler.js b/src/utils/ErrorHandler.jsindex 1d253281..4ef180dd 100644--- a/src/utils/ErrorHandler.js+++ b/src/utils/ErrorHandler.js@@ -38,4 +38,9 @@ export const WarningInfoHandler = (msg, title, log) => {statusErrorMsg(title || 'Warning', msg, log);};+/* Titles for info logging */+export const InfoKeys = {+ EDITOR: 'Interactive Editor',+};+export default ErrorHandler;