From 6a4146eb4c837eea1808b1496894b6b26c8cbdbd Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 3 Oct 2021 22:41:30 +0100 Subject: [PATCH 01/20] :building_construction: Ignore 429 status codes in link-checker action --- .github/workflows/docs-link-checker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-link-checker.yml b/.github/workflows/docs-link-checker.yml index 023bc5a9..527b5af9 100644 --- a/.github/workflows/docs-link-checker.yml +++ b/.github/workflows/docs-link-checker.yml @@ -4,7 +4,7 @@ on: repository_dispatch: workflow_dispatch: schedule: - - cron: '0 1 * * 0' # At 01:00 on Sunday. + - cron: '0 1 1 * *' # Run monthly jobs: link-checker: runs-on: ubuntu-latest @@ -14,7 +14,7 @@ jobs: - name: Check for Broken Links uses: lycheeverse/lychee-action@v1.0.8 with: - args: --verbose --no-progress **/*.md **/*.html + args: --verbose -a 200,302,304,429 --no-progress **/*.md **/*.html env: GITHUB_TOKEN: ${{secrets.BOT_GITHUB_TOKEN}} LYCHEE_OUT: .github/broken-link-report.md From 362db365bbde2c90cbfe9f68177252e7a652efa5 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 3 Oct 2021 22:42:40 +0100 Subject: [PATCH 02/20] =?UTF-8?q?=E2=9E=95=20Adds=20VueX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +++-- yarn.lock | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dfa86226..cbbf243f 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "vue-router": "^3.0.3", "vue-select": "^3.12.1", "vue-swatches": "^2.1.1", - "vue-toasted": "^1.1.28" + "vue-toasted": "^1.1.28", + "vuex": "^3.6.2" }, "devDependencies": { "@architect/sandbox": "^3.7.4", @@ -92,4 +93,4 @@ "> 1%", "last 2 versions" ] -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index edca2bb2..fbd2289f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9866,6 +9866,11 @@ vue@^2.6.10: resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235" integrity sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ== +vuex@^3.6.2: + version "3.6.2" + resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.6.2.tgz#236bc086a870c3ae79946f107f16de59d5895e71" + integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw== + watchpack-chokidar2@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz#38500072ee6ece66f3769936950ea1771be1c957" From 41682c8914e0a517825fccb1faa17463d0a84474 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Tue, 5 Oct 2021 20:24:51 +0100 Subject: [PATCH 03/20] :sparkles: Implementing VueX --- src/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index a5d4c764..cae12b4f 100644 --- a/src/main.js +++ b/src/main.js @@ -14,6 +14,7 @@ import Toasted from 'vue-toasted'; // Toast component, used to show confirm // Import base Dashy components and utils import Dashy from '@/App.vue'; // Main Dashy Vue app import router from '@/router'; // Router, for navigation +import store from '@/store'; // Store, for local state management import serviceWorker from '@/utils/InitServiceWorker'; // Service worker initialization import clickOutside from '@/utils/ClickOutside'; // Directive for closing popups, modals, etc import { messages } from '@/utils/languages'; // Language texts @@ -63,7 +64,9 @@ if (!isKeycloakEnabled()) { window.location.reload(); } else { // Yay - user successfully authenticated with Keycloak, render the app! - new Vue({ router, render, i18n }).$mount('#app'); + new Vue({ + router, store, render, i18n, + }).$mount('#app'); } }); } From 2946412b4c7da84583575cf4d7e1b737c55dc121 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Tue, 5 Oct 2021 20:25:10 +0100 Subject: [PATCH 04/20] :construction: WIP, working on VueX store --- src/store.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/store.js diff --git a/src/store.js b/src/store.js new file mode 100644 index 00000000..1ee854ac --- /dev/null +++ b/src/store.js @@ -0,0 +1,17 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; + +Vue.use(Vuex); + +const store = new Vuex.Store({ + state: { + count: 0, + }, + mutations: { + increment(state) { + state.count++; + }, + }, +}); + +export default store; From c2e70dc07e83fd5df548adbed186a4b114a1647a Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 9 Oct 2021 18:30:47 +0100 Subject: [PATCH 05/20] :zap: Adds VueX store into main Vue entry point --- src/main.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.js b/src/main.js index cae12b4f..280aad5c 100644 --- a/src/main.js +++ b/src/main.js @@ -49,9 +49,14 @@ ErrorReporting(Vue, router); // Render function const render = (awesome) => awesome(Dashy); +// Mount the app, with router, store i18n and render func +const mount = () => new Vue({ + router, render, i18n, store, +}).$mount('#app'); + // If Keycloak not enabled, then proceed straight to the app if (!isKeycloakEnabled()) { - new Vue({ router, render, i18n }).$mount('#app'); + mount(); } else { // Keycloak is enabled, redirect to KC login page const { serverUrl, realm, clientId } = getKeycloakConfig(); const initOptions = { @@ -64,9 +69,7 @@ if (!isKeycloakEnabled()) { window.location.reload(); } else { // Yay - user successfully authenticated with Keycloak, render the app! - new Vue({ - router, store, render, i18n, - }).$mount('#app'); + mount(); } }); } From 8a8166bb47db03652e7c994e1d562467a3a0c875 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 9 Oct 2021 18:31:10 +0100 Subject: [PATCH 06/20] :zap: Implements a very very basic config store --- src/App.vue | 26 ++++++++++++++++++++------ src/store.js | 35 +++++++++++++++++++++++++++++++---- src/utils/StoreMutations.js | 9 +++++++++ 3 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 src/utils/StoreMutations.js diff --git a/src/App.vue b/src/App.vue index cb34b125..cd30bed1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,7 +11,7 @@ import Header from '@/components/PageStrcture/Header.vue'; import Footer from '@/components/PageStrcture/Footer.vue'; import LoadingScreen from '@/components/PageStrcture/LoadingScreen.vue'; -import { componentVisibility } from '@/utils/ConfigHelpers'; +// import { componentVisibility } from '@/utils/ConfigHelpers'; import ConfigAccumulator from '@/utils/ConfigAccumalator'; import { welcomeMsg } from '@/utils/CoolConsole'; import ErrorHandler from '@/utils/ErrorHandler'; @@ -23,8 +23,9 @@ import { } from '@/utils/defaults'; const Accumulator = new ConfigAccumulator(); -const config = Accumulator.config(); -const visibleComponents = componentVisibility(config.appConfig) || defaultVisibleComponents; +const config2 = Accumulator.config(); +// const visibleComponents = componentVisibility(config.appConfig) || defaultVisibleComponents; +const visibleComponents = defaultVisibleComponents; export default { name: 'app', @@ -34,15 +35,13 @@ export default { LoadingScreen, }, provide: { - config, + config: config2, visibleComponents, }, data() { return { isLoading: true, // Set to false after mount complete showFooter: visibleComponents.footer, - appConfig: Accumulator.appConfig(), - pageInfo: Accumulator.pageInfo(), visibleComponents, }; }, @@ -55,6 +54,21 @@ export default { shouldShowSplash() { return (this.visibleComponents || defaultVisibleComponents).splashScreen; }, + config() { + return this.$store.state.config; + }, + appConfig() { + return this.$store.getters.appConfig; + }, + pageInfo() { + return this.$store.getters.pageInfo; + }, + sections() { + return this.$store.getters.pageInfo; + }, + }, + created() { + this.$store.dispatch('initializeConfig'); }, methods: { /* Injects the users custom CSS as a style tag */ diff --git a/src/store.js b/src/store.js index 1ee854ac..880207e2 100644 --- a/src/store.js +++ b/src/store.js @@ -1,17 +1,44 @@ +/* eslint-disable no-param-reassign */ import Vue from 'vue'; import Vuex from 'vuex'; +import Keys from '@/utils/StoreMutations'; +import ConfigAccumulator from '@/utils/ConfigAccumalator'; Vue.use(Vuex); +const { UPDATE_CONFIG } = Keys; + const store = new Vuex.Store({ state: { - count: 0, + config: {}, }, - mutations: { - increment(state) { - state.count++; + getters: { + config(state) { + return state.config; + }, + pageInfo(state) { + return state.config.pageInfo || {}; + }, + appConfig(state) { + return state.config.appConfig || {}; + }, + sections(state) { + return state.config.sections || []; }, }, + mutations: { + [UPDATE_CONFIG](state, config) { + state.config = config; + }, + }, + actions: { + initializeConfig({ commit }) { + const Accumulator = new ConfigAccumulator(); + const config = Accumulator.config(); + commit(UPDATE_CONFIG, config); + }, + }, + modules: {}, }); export default store; diff --git a/src/utils/StoreMutations.js b/src/utils/StoreMutations.js new file mode 100644 index 00000000..1348ca81 --- /dev/null +++ b/src/utils/StoreMutations.js @@ -0,0 +1,9 @@ +// A list of mutation names +const KEY_NAMES = [ + 'UPDATE_CONFIG', +]; + +// Convert array of key names into an object, and export +const MUTATIONS = {}; +KEY_NAMES.forEach((key) => { MUTATIONS[key] = key; }); +export default MUTATIONS; From b55f96c839391951a713ecba5136e918f96efc19 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 9 Oct 2021 19:24:51 +0100 Subject: [PATCH 07/20] :zap: Remove all instances of inject, replace with VueX store --- src/components/Configuration/AppVersion.vue | 9 ++-- src/components/Configuration/RebuildApp.vue | 14 +++--- src/components/LinkItems/ContextMenu.vue | 16 +++---- src/components/LinkItems/Item.vue | 8 +++- src/components/LinkItems/ItemIcon.vue | 9 ++-- src/components/LinkItems/Section.vue | 10 +++-- src/components/MinimalView/MinimalSearch.vue | 12 +++--- src/components/MinimalView/MinimalSection.vue | 10 +++-- src/components/PageStrcture/Header.vue | 21 ++++----- src/components/Settings/LanguageSwitcher.vue | 7 ++- src/components/Settings/SearchBar.vue | 3 +- src/components/Settings/SettingsContainer.vue | 43 ++++++++++--------- src/components/Workspace/SideBar.vue | 1 - src/components/Workspace/SideBarItem.vue | 1 - src/components/Workspace/SideBarSection.vue | 1 - src/store.js | 7 +++ 16 files changed, 97 insertions(+), 75 deletions(-) diff --git a/src/components/Configuration/AppVersion.vue b/src/components/Configuration/AppVersion.vue index 973cbb4f..c0c8f0de 100644 --- a/src/components/Configuration/AppVersion.vue +++ b/src/components/Configuration/AppVersion.vue @@ -36,7 +36,11 @@ import ErrorHandler from '@/utils/ErrorHandler'; export default { name: 'AppInfoModal', - inject: ['config'], + computed: { + appConfig() { + return this.$store.getters.appConfig; + }, + }, data() { return { appVersion: process.env.VUE_APP_VERSION, // Current version, from package.json @@ -50,8 +54,7 @@ export default { }; }, mounted() { - const appConfig = this.config.appConfig || {}; - if (!this.appVersion || (appConfig && appConfig.disableUpdateChecks)) { + if (!this.appVersion || (this.appConfig && this.appConfig.disableUpdateChecks)) { // Either current version isn't found, or user disabled checks this.checksEnabled = false; } else { diff --git a/src/components/Configuration/RebuildApp.vue b/src/components/Configuration/RebuildApp.vue index 5bcefdf0..725ee091 100644 --- a/src/components/Configuration/RebuildApp.vue +++ b/src/components/Configuration/RebuildApp.vue @@ -55,7 +55,11 @@ import { modalNames, serviceEndpoints } from '@/utils/defaults'; export default { name: 'RebuildApp', - inject: ['config'], + computed: { + appConfig() { + return this.$store.getters.appConfig; + }, + }, components: { Button, RebuildIcon, @@ -112,12 +116,8 @@ export default { }, }, mounted() { - if (this.config) { - if (this.config.appConfig) { - if (this.config.appConfig.allowConfigEdit === false) { - this.allowRebuild = false; - } - } + if (this.appConfig.allowConfigEdit === false) { + this.allowRebuild = false; } }, }; diff --git a/src/components/LinkItems/ContextMenu.vue b/src/components/LinkItems/ContextMenu.vue index 68349c24..4d66e2e3 100644 --- a/src/components/LinkItems/ContextMenu.vue +++ b/src/components/LinkItems/ContextMenu.vue @@ -1,6 +1,6 @@