Skip to content

Commit 7f555ee

Browse files
authored
🔀 Merge pull request #271 from Lissy93/ARCH/implement-vuex-state
[ARCH] Implement VueX State Management
2 parents 1f80d99 + e1b812c commit 7f555ee

37 files changed

+408
-216
lines changed

.github/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## ⚡️ 1.8.6 - Implementation of VueX [PR: #271](https://github.com/Lissy93/dashy/pull/271)
4+
- New state management pattern, which should lead to a more organized code base long term, and will also make building out the new UI editor significantly easier to do in a clean and reliable way
5+
36
## 💄 1.8.5 - Lots of Requested UI Improvements [PR #261](https://github.com/Lissy93/dashy/pull/261)
47
- Adds an option for landing URL in workspace, Re: #255
58
- Switches to a new API for generative icons, Re: #163

.github/pr-badge.yml

+61-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Config file for pull-request-badge. See: https://pullrequestbadge.com/
2-
# Enables badges to be inserted into the PR description, based on certain conditions
1+
# Config file for pull-request-badge. See: https://pullrequestbadge.com/ by @stefanbuck
2+
# Dynamically inserts status badges into PR description, based on certain conditions
33

44
# Checks if the required sections are missing
55
- label: "⚠️Missing"
@@ -23,21 +23,43 @@
2323
color: "#f25265"
2424
when: "$labels.length == 0"
2525

26-
# Show note when in draft mode
26+
# Show note when task list has unfinished items
27+
- label: "⚠️Notice"
28+
message: "Unchecked Tasks"
29+
when: "$payload.pull_request.body.includes('- [ ] ')"
30+
color: "#f25265"
31+
32+
# Show badge indicating PR status
2733
- label: "Status"
28-
message: "Draft"
34+
message: "✏️ Draft"
2935
when: "$isDraft"
3036
color: "#ffa933"
37+
- label: "Status"
38+
message: "🧱 Work in Progress"
39+
when: "$payload.pull_request.title.includes('WIP')"
40+
color: "#29e3f4"
41+
- label: "Status"
42+
message: "✅ Ready"
43+
color: "#3ef963"
44+
when: "$labels.includes('🔀 Ready for Merge')"
3145

3246
# Add size label based on very large or tiny PRs
47+
- label: "PR Size"
48+
message: "Extra Large"
49+
color: "#f9833e"
50+
when: "$additions > 1000"
3351
- label: "PR Size"
3452
message: "Large"
35-
color: "#f79c47"
36-
when: "$additions > 600"
53+
color: "#f4b546"
54+
when: "$additions > 500 && $additions < 1000"
55+
- label: "PR Size"
56+
message: "Medium"
57+
color: "#f3ff59"
58+
when: "$additions > 10 && $additions < 500"
3759
- label: "PR Size"
3860
message: "Quick"
3961
color: "#3eef8b"
40-
when: "$additions < 5"
62+
when: "$additions < 10"
4163

4264
# Show PR number, to destination and from destination
4365
- label: "#$prNumber"
@@ -57,7 +79,7 @@
5779
when: "$payload.pull_request.author_association !== 'OWNER'"
5880
url: "https://github.com/$payload.pull_request.user.login"
5981

60-
# Show a badge indicating the PR category
82+
# Show a badge indicating the PR category, based on tag
6183
- label: "Type"
6284
message: "✨ Feature"
6385
color: "#39b0fd"
@@ -90,3 +112,34 @@
90112
message: "🌟 Showcase Addition"
91113
color: "#39b0fd"
92114
when: "$labels.includes('💯 Showcase')"
115+
- label: "Type"
116+
message: "🏗️ Architecture"
117+
color: "#39b0fd"
118+
when: "$labels.includes('🏗️ Architectural Changes')"
119+
- label: "Type"
120+
message: "🤖 Auto Submission"
121+
color: "#39b0fd"
122+
when: "$labels.includes('🤖 Auto')"
123+
- label: "Type"
124+
message: "🌐 Language Update"
125+
color: "#39b0fd"
126+
when: "$labels.includes('🌐 Language')"
127+
128+
# Show warning, when certain tags are applied
129+
- label: "Warning"
130+
message: "⛔ Do Not Merge"
131+
color: "#f25265"
132+
when: "$labels.includes('⛔ Don't Merge')"
133+
- label: "Warning"
134+
message: "🚫 Merge Conflicts"
135+
color: "#f25265"
136+
when: "$labels.includes('🚫 Merge Conflicts')"
137+
- label: "Warning"
138+
message: "🕸️ Inactive"
139+
color: "#f25265"
140+
when: "$labels.includes('🕸️ Inactive')"
141+
- label: "Warning"
142+
message: "💀 Spam"
143+
color: "#f25265"
144+
when: "$labels.includes('💀 Spam')"
145+

.github/pr-branch-labeler.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# PR labels and the branch patterns they should be auto-assigned to
2-
3-
🦋 Bug Fix: ['FIX/*', 'HOT-FIX/*', 'BUG-FIX/*']
4-
✨ New Feature: ['FEATURE/*']
2+
✨ New Feature: ['FEATURE/*', 'FEAT/*']
53
🚚 Refactor: ['IMPROVMENTS/*', 'REFACTOR/*']
6-
💯 Showcase: ['SHOWCASE/*']
7-
💄 Stylistic Changes: ['STYLES/*', 'THEME/*']
8-
🛠️ Build Changes: ['ARCH/*', 'ARCHITECTURE/*', 'DOCKER/*', 'BUILD/*']
4+
🦋 Bug Fix: ['FIX/*', 'HOT-FIX/*', 'BUG-FIX/*']
5+
💯 Showcase: ['SHOWCASE/*', 'SHOWCASE_SUBMISSION/*']
6+
💄 Stylistic Changes: ['STYLES/*', 'THEME/*', 'UI/*']
7+
🏗️ Architectural Changes: ['ARCH/*', 'ARCHITECTURE/*']
8+
🛠️ Build Changes: ['DOCKER/*', 'BUILD/*', 'CI/*', 'ACTIONS/*']
9+
🌐 Language: ['LANG/*', 'INTERNATIONALIZATION/*', 'I18N/*', 'TEXT-UPDATE/*']
910
🤖 Auto: ['AUTO/*', 'BOT/*', 'snyk-upgrade-*', 'snyk-fix-*']
1011
⛔ Don't Merge: ['WEBSITE/*', 'EXPERIMENT/*', 'DEPLOY/*', 'deploy_*', 'gh-pages', 'dev-demo']

.github/workflows/docs-link-checker.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
repository_dispatch:
55
workflow_dispatch:
66
schedule:
7-
- cron: '0 1 * * 0' # At 01:00 on Sunday.
7+
- cron: '0 1 1 * *' # Run monthly
88
jobs:
99
link-checker:
1010
runs-on: ubuntu-latest
@@ -14,7 +14,7 @@ jobs:
1414
- name: Check for Broken Links
1515
uses: lycheeverse/[email protected]
1616
with:
17-
args: --verbose --no-progress **/*.md **/*.html
17+
args: --verbose -a 200,302,304,429 --no-progress **/*.md **/*.html
1818
env:
1919
GITHUB_TOKEN: ${{secrets.BOT_GITHUB_TOKEN}}
2020
LYCHEE_OUT: .github/broken-link-report.md

.github/workflows/manage-pending-labels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
add-awaiting-author:
2121
runs-on: ubuntu-latest
22-
if: ${{ github.event.comment.author_association != 'COLLABORATOR' && github.event.comment.author_association != 'OWNER' }}
22+
if: ${{ !github.event.issue.pull_request && github.event.comment.author_association != 'COLLABORATOR' && github.event.comment.author_association != 'OWNER' }}
2323
steps:
2424
- name: Add Awaiting Author labels when Updated
2525
uses: actions-cool/issues-helper@v2

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Dashy",
3-
"version": "1.8.5",
3+
"version": "1.8.6",
44
"license": "MIT",
55
"main": "server",
66
"scripts": {
@@ -39,7 +39,8 @@
3939
"vue-router": "^3.0.3",
4040
"vue-select": "^3.12.1",
4141
"vue-swatches": "^2.1.1",
42-
"vue-toasted": "^1.1.28"
42+
"vue-toasted": "^1.1.28",
43+
"vuex": "^3.6.2"
4344
},
4445
"devDependencies": {
4546
"@architect/sandbox": "^3.7.4",

src/App.vue

+20-14
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,26 @@
1111
import Header from '@/components/PageStrcture/Header.vue';
1212
import Footer from '@/components/PageStrcture/Footer.vue';
1313
import LoadingScreen from '@/components/PageStrcture/LoadingScreen.vue';
14-
import { componentVisibility } from '@/utils/ConfigHelpers';
15-
import ConfigAccumulator from '@/utils/ConfigAccumalator';
1614
import { welcomeMsg } from '@/utils/CoolConsole';
1715
import ErrorHandler from '@/utils/ErrorHandler';
16+
import Keys from '@/utils/StoreMutations';
1817
import {
1918
localStorageKeys,
2019
splashScreenTime,
2120
visibleComponents as defaultVisibleComponents,
2221
language as defaultLanguage,
2322
} from '@/utils/defaults';
2423
25-
const Accumulator = new ConfigAccumulator();
26-
const config = Accumulator.config();
27-
const visibleComponents = componentVisibility(config.appConfig) || defaultVisibleComponents;
28-
2924
export default {
3025
name: 'app',
3126
components: {
3227
Header,
3328
Footer,
3429
LoadingScreen,
3530
},
36-
provide: {
37-
config,
38-
visibleComponents,
39-
},
4031
data() {
4132
return {
4233
isLoading: true, // Set to false after mount complete
43-
showFooter: visibleComponents.footer,
44-
appConfig: Accumulator.appConfig(),
45-
pageInfo: Accumulator.pageInfo(),
46-
visibleComponents,
4734
};
4835
},
4936
computed: {
@@ -55,6 +42,24 @@ export default {
5542
shouldShowSplash() {
5643
return (this.visibleComponents || defaultVisibleComponents).splashScreen;
5744
},
45+
config() {
46+
return this.$store.state.config;
47+
},
48+
appConfig() {
49+
return this.$store.getters.appConfig;
50+
},
51+
pageInfo() {
52+
return this.$store.getters.pageInfo;
53+
},
54+
sections() {
55+
return this.$store.getters.pageInfo;
56+
},
57+
visibleComponents() {
58+
return this.$store.getters.visibleComponents;
59+
},
60+
},
61+
created() {
62+
this.$store.dispatch('initializeConfig');
5863
},
5964
methods: {
6065
/* Injects the users custom CSS as a style tag */
@@ -103,6 +108,7 @@ export default {
103108
/* Fetch or detect users language, then apply it */
104109
applyLanguage() {
105110
const language = this.getLanguage();
111+
this.$store.commit(Keys.SET_LANGUAGE, language);
106112
this.$i18n.locale = language;
107113
document.getElementsByTagName('html')[0].setAttribute('lang', language);
108114
},

src/components/Configuration/AppVersion.vue

+6-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ import ErrorHandler from '@/utils/ErrorHandler';
3636
3737
export default {
3838
name: 'AppInfoModal',
39-
inject: ['config'],
39+
computed: {
40+
appConfig() {
41+
return this.$store.getters.appConfig;
42+
},
43+
},
4044
data() {
4145
return {
4246
appVersion: process.env.VUE_APP_VERSION, // Current version, from package.json
@@ -50,8 +54,7 @@ export default {
5054
};
5155
},
5256
mounted() {
53-
const appConfig = this.config.appConfig || {};
54-
if (!this.appVersion || (appConfig && appConfig.disableUpdateChecks)) {
57+
if (!this.appVersion || (this.appConfig && this.appConfig.disableUpdateChecks)) {
5558
// Either current version isn't found, or user disabled checks
5659
this.checksEnabled = false;
5760
} else {

src/components/Configuration/RebuildApp.vue

+7-7
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ import { modalNames, serviceEndpoints } from '@/utils/defaults';
5555
5656
export default {
5757
name: 'RebuildApp',
58-
inject: ['config'],
58+
computed: {
59+
appConfig() {
60+
return this.$store.getters.appConfig;
61+
},
62+
},
5963
components: {
6064
Button,
6165
RebuildIcon,
@@ -112,12 +116,8 @@ export default {
112116
},
113117
},
114118
mounted() {
115-
if (this.config) {
116-
if (this.config.appConfig) {
117-
if (this.config.appConfig.allowConfigEdit === false) {
118-
this.allowRebuild = false;
119-
}
120-
}
119+
if (this.appConfig.allowConfigEdit === false) {
120+
this.allowRebuild = false;
121121
}
122122
},
123123
};

src/components/LinkItems/ContextMenu.vue

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<transition name="slide">
3-
<div class="context-menu" v-if="show && menuEnabled"
3+
<div class="context-menu" v-if="show && !isMenuDisabled()"
44
:style="posX && posY ? `top:${posY}px;left:${posX}px;` : ''">
55
<ul>
66
<li @click="launch('sametab')">
@@ -33,7 +33,6 @@ import WorkspaceOpenIcon from '@/assets/interface-icons/open-workspace.svg';
3333
3434
export default {
3535
name: 'ContextMenu',
36-
inject: ['config'],
3736
components: {
3837
SameTabOpenIcon,
3938
NewTabOpenIcon,
@@ -45,10 +44,10 @@ export default {
4544
posY: Number, // The Y coordinate for positioning
4645
show: Boolean, // Should show or hide the menu
4746
},
48-
data() {
49-
return {
50-
menuEnabled: !this.isMenuDisabled(), // Specifies if the context menu should be used
51-
};
47+
computed: {
48+
appConfig() {
49+
return this.$store.getters.appConfig;
50+
},
5251
},
5352
methods: {
5453
/* Called on item click, emits an event up to Item */
@@ -58,10 +57,7 @@ export default {
5857
},
5958
/* Checks if the user as disabled context menu in config */
6059
isMenuDisabled() {
61-
if (this.config && this.config.appConfig) {
62-
return !!this.config.appConfig.disableContextMenu;
63-
}
64-
return false;
60+
return !!this.appConfig.disableContextMenu;
6561
},
6662
},
6763
};

src/components/LinkItems/IframeModal.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
</template>
1010

1111
<script>
12+
import Keys from '@/utils/StoreMutations';
13+
1214
export default {
1315
name: 'IframeModal',
1416
props: {
@@ -21,13 +23,13 @@ export default {
2123
show(url) {
2224
this.url = url;
2325
this.$modal.show(this.name);
24-
this.$emit('modalChanged', true);
26+
this.$store.commit(Keys.SET_MODAL_OPEN, true);
2527
},
2628
hide() {
2729
this.$modal.hide(this.name);
2830
},
2931
modalClosed() {
30-
this.$emit('modalChanged', false);
32+
this.$store.commit(Keys.SET_MODAL_OPEN, false);
3133
},
3234
},
3335
};

src/components/LinkItems/Item.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import { localStorageKeys, serviceEndpoints } from '@/utils/defaults';
5353
5454
export default {
5555
name: 'Item',
56-
inject: ['config'],
5756
props: {
5857
id: String, // The unique ID of a tile (e.g. 001)
5958
title: String, // The main text of tile, required
@@ -77,6 +76,11 @@ export default {
7776
statusCheckInterval: Number,
7877
statusCheckAllowInsecure: Boolean,
7978
},
79+
computed: {
80+
appConfig() {
81+
return this.$store.getters.appConfig;
82+
},
83+
},
8084
data() {
8185
return {
8286
contextMenuOpen: false,
@@ -110,7 +114,7 @@ export default {
110114
this.$emit('itemClicked');
111115
}
112116
// Update the most/ last used ledger, for smart-sorting
113-
if (!this.config.appConfig.disableSmartSort) {
117+
if (!this.appConfig.disableSmartSort) {
114118
this.incrementMostUsedCount(this.id);
115119
this.incrementLastUsedCount(this.id);
116120
}

0 commit comments

Comments
 (0)