Skip to content

Commit 30530cb

Browse files
authored
🔀 Merge pull request gchq#319 from Lissy93/FIX/ui-editor-improvments
[FIX] UI Bug Fixes for Interactive Editor + Style Refactor Fixes gchq#301 Fixes gchq#310 Fixes gchq#311 Fixes gchq#312
2 parents ba69614 + 63af8b4 commit 30530cb

File tree

16 files changed

+518
-254
lines changed

16 files changed

+518
-254
lines changed

.github/.lycheeexclude

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Ignore list, for automated broken link checking
2+
3+
https://fonts.gstatic.com/**
4+
https://metager.org/meta/**
5+
https://developers.cloudflare.com/**
6+
7+
http://localhost**
8+
https://localhost**
9+
http://192.168**
10+
https://192.168**
11+
file:///github/**
12+
http://[dashy-location]**
13+
https://[dashy-location]**
14+
**.local/**

.github/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 💄 1.9.1 - Editor and Theming Fixes and Improvements [PR #319](https://github.com/Lissy93/dashy/pull/319)
4+
- Bug fixes for interactive editor: #310, #311, #312
5+
- Adds option to modify text font through the UI
6+
- Adds two new themes: One Dark and Adventure
7+
- Theming stylesheet refactor, better inheritance
8+
39
## 🐳 1.9.0 - Alpha of Dashy-Lite Docker Container [PR #306](https://github.com/Lissy93/dashy/pull/306)
410
- Create an Alpine-based container, that serves the built app up with plain NGINX, instead of Node.
511
- This is much lighter, but doesn't currently support any of the server-side actions (like status-checks, and writing changes to disk)

.github/pr-badge.yml

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,6 @@
11
# Config file for pull-request-badge. See: https://pullrequestbadge.com/ by @stefanbuck
22
# Dynamically inserts status badges into PR description, based on certain conditions
33

4-
# Checks if the required sections are missing
5-
- label: ⚠️Missing
6-
message: Category
7-
color: '#f25265'
8-
when: $payload.pull_request.body.includes('Category') === false
9-
- label: ⚠️Missing
10-
message: Overview
11-
color: '#f25265'
12-
when: $payload.pull_request.body.includes('Overview') === false
13-
- label: ⚠️Missing
14-
message: Quality Checklist
15-
color: '#f25265'
16-
when: $payload.pull_request.body.includes('Code Quality Checklist') === false
17-
- label: ⚠️Description
18-
message: Incomplete
19-
color: '#f25265'
20-
when: $payload.pull_request.body.length < 25
21-
- label: ⚠️Missing
22-
message: Label
23-
color: '#f25265'
24-
when: $labels.length == 0
25-
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
33-
- label: Status
34-
message: ✏️ Draft
35-
when: $isDraft
36-
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')
45-
46-
# 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'
51-
- label: PR Size
52-
message: Large
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'
59-
- label: PR Size
60-
message: Quick
61-
color: '#3eef8b'
62-
when: '$additions < 10'
63-
64-
# Show PR number, to destination and from destination
65-
- label: '#$prNumber'
66-
message: '$payload.pull_request.user.login /$payload.pull_request.head.ref → $payload.repository.full_name'
67-
color: '#ab5afc'
68-
url: 'https://github.com/$slug/tree/$branchName'
69-
70-
# Show total code added minus deleted
71-
- label: New Code
72-
message: 'Commits: $payload.pull_request.commits | Files Changed: $payload.pull_request.changed_files | Additions: $payload.pull_request.additions-$payload.pull_request.deletions'
73-
color: '#dddd00'
74-
754
# Show submitting user's username and profile link
765
- label: 💕 Submitted by
776
message: $payload.pull_request.user.login
@@ -125,6 +54,77 @@
12554
color: '#39b0fd'
12655
when: $labels.includes('🌐 Language')
12756

57+
# Add size label based on very large or tiny PRs
58+
- label: PR Size
59+
message: Extra Large
60+
color: '#f9833e'
61+
when: '$additions > 1000'
62+
- label: PR Size
63+
message: Large
64+
color: '#f4b546'
65+
when: '$additions > 500 && $additions < 1000'
66+
- label: PR Size
67+
message: Medium
68+
color: '#f3ff59'
69+
when: '$additions > 10 && $additions < 500'
70+
- label: PR Size
71+
message: Quick
72+
color: '#3eef8b'
73+
when: '$additions < 10'
74+
75+
# Show badge indicating PR status
76+
- label: Status
77+
message: ✏️ Draft
78+
when: $isDraft
79+
color: '#ffa933'
80+
- label: Status
81+
message: 🧱 Work in Progress
82+
when: $payload.pull_request.title.includes('WIP')
83+
color: '#29e3f4'
84+
- label: Status
85+
message: ✅ Ready
86+
color: '#3ef963'
87+
when: $labels.includes('🔀 Ready for Merge')
88+
89+
# Show PR number, to destination and from destination
90+
- label: '#$prNumber'
91+
message: '$payload.pull_request.user.login /$payload.pull_request.head.ref → $payload.repository.full_name'
92+
color: '#ab5afc'
93+
url: 'https://github.com/$slug/tree/$branchName'
94+
95+
# Show total code added minus deleted
96+
- label: New Code
97+
message: 'Commits: $payload.pull_request.commits | Files Changed: $payload.pull_request.changed_files | Additions: $payload.pull_request.additions-$payload.pull_request.deletions'
98+
color: '#dddd00'
99+
100+
# Checks if the required sections are missing
101+
- label: ⚠️Missing
102+
message: Category
103+
color: '#f25265'
104+
when: $payload.pull_request.body.includes('Category') === false
105+
- label: ⚠️Missing
106+
message: Overview
107+
color: '#f25265'
108+
when: $payload.pull_request.body.includes('Overview') === false
109+
- label: ⚠️Missing
110+
message: Quality Checklist
111+
color: '#f25265'
112+
when: $payload.pull_request.body.includes('Code Quality Checklist') === false
113+
- label: ⚠️Description
114+
message: Incomplete
115+
color: '#f25265'
116+
when: $payload.pull_request.body.length < 25
117+
- label: ⚠️Missing
118+
message: Label
119+
color: '#f25265'
120+
when: $labels.length == 0
121+
122+
# Show note when task list has unfinished items
123+
- label: ⚠️Notice
124+
message: Unchecked Tasks
125+
when: $payload.pull_request.body.includes('- [ ] ')
126+
color: '#f25265'
127+
128128
# Show warning, when certain tags are applied
129129
- label: Warning
130130
message: ⛔ Do Not Merge

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v2
1313

14+
- name: Load Excludes
15+
run: |
16+
LYCHEE_EXCLUDE=$(sed -e :a -e 'N;s/\n/ /;ta' .github/.lycheeexclude)
17+
echo "LYCHEE_EXCLUDE=$LYCHEE_EXCLUDE" >> $GITHUB_ENV
18+
1419
- name: Check for Broken Links
1520
uses: lycheeverse/[email protected]
1621
with:
17-
args: --verbose -a 200,302,304,429 --no-progress **/*.md **/*.html
22+
args: --verbose -a 200,302,304,429 --exclude ${{ env.LYCHEE_EXCLUDE }} --exclude-mail --no-progress **/*.md
1823
env:
1924
GITHUB_TOKEN: ${{secrets.BOT_GITHUB_TOKEN}}
2025
LYCHEE_OUT: .github/broken-link-report.md

docs/status-indicators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ If the status is always returning an error, despite the service being online, th
6565
If your service requires requests to include any authorization in the headers, then use the `statusCheckHeaders` property, as described above.
6666
If you are still having issues, it may be because your target application is blocking requests from Dashy's IP. This is a [CORS error](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and can be fixed by setting the headers on your target app, to include:
6767
```
68-
Access-Control-Allow-Origin: https://location-of-dashy/
68+
Access-Control-Allow-Origin: https://[dashy-location]/
6969
Vary: Origin
7070
```
7171
If the URL you are checking is not using HTTPS, then you may need to disable the rejection of insecure requests. This can be done by setting `statusCheckAllowInsecure` to true for a given item.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "Dashy",
3-
"version": "1.9.0",
3+
"version": "1.9.1",
44
"license": "MIT",
55
"main": "server",
6+
"author": "Alicia Sykes <[email protected]> (https://aliciasykes.com)",
67
"scripts": {
78
"start": "node server",
89
"dev": "vue-cli-service serve",

src/assets/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"export-button": "Export Custom Variables",
102102
"reset-button": "Reset Styles for",
103103
"show-all-button": "Show All Variables",
104+
"change-fonts-button": "Change Fonts",
104105
"save-button": "Save",
105106
"cancel-button": "Cancel",
106107
"saved-toast": "{theme} Updated Successfully",

src/components/InteractiveEditor/EditModeSaveMenu.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export default {
152152
}
153153
InfoHandler('Config has succesfully been saved in browser storage', 'Config Update');
154154
this.showToast(this.$t('config-editor.success-msg-local'), true);
155+
this.$store.commit(StoreKeys.SET_EDIT_MODE, false);
155156
},
156157
writeToDisk() {
157158
// 1. Convert JSON into YAML
@@ -211,7 +212,7 @@ div.edit-mode-bottom-banner {
211212
/* Main sections */
212213
.edit-banner-section {
213214
padding: 0.5rem;
214-
height: 100%;
215+
height: 90%;
215216
/* Section sub-titles */
216217
p.section-sub-title {
217218
margin: 0;
@@ -234,7 +235,7 @@ div.edit-mode-bottom-banner {
234235
grid-template-columns: repeat(2, 1fr);
235236
button {
236237
margin: 0.25rem;
237-
height: fit-content;
238+
height: stretch;
238239
}
239240
p.section-sub-title {
240241
grid-column-start: span 2;

src/components/LinkItems/Collapsable.vue

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<div
3-
:class="`collapsable ${checkSpanNum(cols, 'col')} ${checkSpanNum(rows, 'row')}`"
3+
:class="`collapsable ${rowColSpanClass} ${collapseClass}`"
44
:style="`${color ? 'background: '+color : ''}; ${sanitizeCustomStyles(customStyles)};`"
55
>
66
<input
77
:id="sectionKey"
88
class="toggle"
99
type="checkbox"
10-
:checked="getCollapseState()"
10+
:checked="isExpanded"
1111
@change="collapseChanged"
1212
tabIndex="-1"
1313
>
@@ -56,6 +56,19 @@ export default {
5656
if (this.isEditMode) return undefined;
5757
return `collapsible-${this.uniqueKey}`;
5858
},
59+
collapseClass() {
60+
return !this.isExpanded ? ' is-collapsed' : 'is-open';
61+
},
62+
rowColSpanClass() {
63+
const { rows, cols, checkSpanNum } = this;
64+
return `${checkSpanNum(cols, 'col')} ${checkSpanNum(rows, 'row')}`;
65+
},
66+
},
67+
data: () => ({
68+
isExpanded: false,
69+
}),
70+
mounted() {
71+
this.isExpanded = this.getCollapseState();
5972
},
6073
methods: {
6174
/* Check that row & column span is valid, and not over the max */
@@ -69,29 +82,28 @@ export default {
6982
sanitizeCustomStyles(userCss) {
7083
return userCss ? userCss.replace(/[^a-zA-Z0-9- :;.]/g, '') : '';
7184
},
72-
/* If not already done, then add object structure to local storage */
85+
/* Returns local storage collapse state data, and if not yet set then initialized is */
7386
initialiseStorage() {
87+
const storageKey = localStorageKeys.COLLAPSE_STATE;
7488
/* Initialize function will create and set a blank object to storage */
75-
const initStorage = () => localStorage.setItem(
76-
localStorageKeys.COLLAPSE_STATE, JSON.stringify({}),
77-
);
78-
if (!localStorage[localStorageKeys.COLLAPSE_STATE]) initStorage(); // Initialise if not set
79-
try { // Check storage is valid JSON, and has not been corrupted
80-
JSON.parse(localStorage[localStorageKeys.COLLAPSE_STATE]);
81-
} catch {
89+
const initStorage = () => localStorage.setItem(storageKey, JSON.stringify({}));
90+
// If not yet set, then call initialize
91+
if (!localStorage[storageKey]) {
8292
initStorage();
93+
return {};
8394
}
84-
return JSON.parse(localStorage[localStorageKeys.COLLAPSE_STATE]);
95+
// Otherwise, return value of local storage
96+
return JSON.parse(localStorage[storageKey]);
8597
},
86-
/* If not specified by user, get last state from local storage */
98+
/* If specified by user, return conf collapse state, otherwise check local storage */
8799
getCollapseState() {
88-
if (this.collapsed !== undefined) return !this.collapsed;
89-
const collapseStateObject = this.initialiseStorage();
90-
let collapseState = !this.collapsed;
100+
if (this.collapsed !== undefined) return !this.collapsed; // Check users config
101+
const collapseStateObject = this.initialiseStorage(); // Check local storage
91102
if (collapseStateObject[this.uniqueKey] !== undefined) {
92-
collapseState = collapseStateObject[this.uniqueKey];
103+
return collapseStateObject[this.uniqueKey];
93104
}
94-
return collapseState;
105+
// Nothing specified, return Open
106+
return true;
95107
},
96108
/* When section collapsed, update local storage, to remember for next time */
97109
setCollapseState(id, newState) {
@@ -104,9 +116,10 @@ export default {
104116
},
105117
/* Called when collapse state changes, trigger local storage update if needed */
106118
collapseChanged(whatChanged) {
119+
this.isExpanded = whatChanged.srcElement.checked;
107120
if (this.collapseState === undefined) { // Only run, if user hasn't manually set prop
108121
this.initialiseStorage();
109-
this.setCollapseState(this.uniqueKey.toString(), whatChanged.srcElement.checked);
122+
this.setCollapseState(this.uniqueKey.toString(), this.isExpanded);
110123
}
111124
},
112125
openEditModal() {

0 commit comments

Comments
 (0)