From b55f96c839391951a713ecba5136e918f96efc19 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 9 Oct 2021 19:24:51 +0100 Subject: [PATCH] :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 @@