Skip to content

Commit 3892e6d

Browse files
committed
refactor: introduces $typedCommit and $typedDispatch
Signed-off-by: Pedro Lamas <[email protected]>
1 parent 0b58cce commit 3892e6d

File tree

110 files changed

+379
-335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+379
-335
lines changed

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,11 @@ export default class App extends Mixins(StateMixin, FilesMixin, BrowserMixin) {
425425
426426
const wait = `${this.$waits.onFileSystem}/${pathWithRoot}/`
427427
428-
this.$store.dispatch('wait/addWait', wait)
428+
this.$typedDispatch('wait/addWait', wait)
429429
430430
await this.uploadFiles(files, path, root, false)
431431
432-
this.$store.dispatch('wait/removeWait', wait)
432+
this.$typedDispatch('wait/removeWait', wait)
433433
}
434434
}
435435
}

src/components/common/CollapsableCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export default class CollapsableCard extends Vue {
320320
const value = this.layout
321321
if (value && this._layoutPath) {
322322
value.collapsed = collapsed
323-
this.$store.dispatch('layout/onUpdateConfig', { name: this._layoutPath.name, value })
323+
this.$typedDispatch('layout/onUpdateConfig', { name: this._layoutPath.name, value })
324324
}
325325
}
326326
@@ -343,7 +343,7 @@ export default class CollapsableCard extends Vue {
343343
const value = this.layout
344344
if (value && this._layoutPath) {
345345
value.enabled = enabled
346-
this.$store.dispatch('layout/onUpdateConfig', { name: this._layoutPath.name, value })
346+
this.$typedDispatch('layout/onUpdateConfig', { name: this._layoutPath.name, value })
347347
}
348348
}
349349

src/components/common/ScrewsTiltAdjustDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default class ScrewsTiltAdjustDialog extends Mixins(StateMixin, ToolheadM
9898
@Watch('screwsTiltAdjustDialogOpen')
9999
onScrewsTiltAdjustDialogOpen (value: boolean) {
100100
if (!value) {
101-
this.$store.commit('printer/setClearScrewsTiltAdjust')
101+
this.$typedCommit('printer/setClearScrewsTiltAdjust')
102102
}
103103
}
104104

src/components/common/SystemLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default class SystemLayout extends Mixins(StateMixin) {
3434
}
3535
3636
set layoutMode (val: boolean) {
37-
this.$store.commit('config/setLayoutMode', val)
37+
this.$typedCommit('config/setLayoutMode', val)
3838
this.close()
3939
}
4040

src/components/common/SystemPrinters.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default class SystemPrinters extends Mixins(StateMixin) {
8383
)
8484
8585
if (result) {
86-
this.$store.dispatch('config/removeInstance', instance)
86+
this.$typedDispatch('config/removeInstance', instance)
8787
}
8888
}
8989

src/components/common/UpdatingDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default class UpdatingDialog extends Mixins(StateMixin, BrowserMixin) {
5959
set open (value: boolean) {
6060
if (!value) {
6161
this.invokedDialog = false
62-
this.$store.commit('version/setClearUpdateResponse')
62+
this.$typedCommit('version/setClearUpdateResponse')
6363
}
6464
}
6565

src/components/layout/AppBar.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ export default class AppBar extends Mixins(StateMixin, ServicesMixin, FilesMixin
391391
}
392392
393393
handleExitLayout () {
394-
this.$store.commit('config/setLayoutMode', false)
394+
this.$typedCommit('config/setLayoutMode', false)
395395
}
396396
397397
get isDashboard () {
@@ -408,11 +408,11 @@ export default class AppBar extends Mixins(StateMixin, ServicesMixin, FilesMixin
408408
: undefined
409409
const layoutDefaultState = pathLayout
410410
? defaultState().layouts[pathLayout]
411-
: this.$typedGetters['layout/getLayout']('dashboard')
411+
: this.$typedGetters['layout/getLayout']('dashboard')!
412412
413413
const toReset = pathLayout ?? this.$typedGetters['layout/getSpecificLayoutName']
414414
415-
this.$store.dispatch('layout/onLayoutChange', {
415+
this.$typedDispatch('layout/onLayoutChange', {
416416
name: toReset,
417417
value: layoutDefaultState
418418
})
@@ -431,14 +431,14 @@ export default class AppBar extends Mixins(StateMixin, ServicesMixin, FilesMixin
431431
}
432432
433433
handleSetDefaultLayout () {
434-
this.$store.dispatch('layout/onLayoutChange', {
434+
this.$typedDispatch('layout/onLayoutChange', {
435435
name: 'dashboard',
436-
value: this.$typedGetters['layout/getLayout'](this.currentLayoutName)
436+
value: this.$typedGetters['layout/getLayout'](this.currentLayoutName)!
437437
})
438438
}
439439
440440
handleResetDefaultLayout () {
441-
this.$store.dispatch('layout/onLayoutChange', {
441+
this.$typedDispatch('layout/onLayoutChange', {
442442
name: 'dashboard',
443443
value: defaultState().layouts.dashboard
444444
})

src/components/layout/AppNavDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default class AppNavDrawer extends Mixins(StateMixin, BrowserMixin) {
186186
}
187187
188188
set layoutMode (val: boolean) {
189-
this.$store.commit('config/setLayoutMode', val)
189+
this.$typedCommit('config/setLayoutMode', val)
190190
}
191191
}
192192
</script>

src/components/layout/AppNotificationMenu.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,16 @@ export default class AppNotificationMenu extends Mixins(BrowserMixin) {
228228
}
229229
230230
handleClear (n: AppNotification) {
231-
this.$store.dispatch('notifications/clearNotification', n)
231+
this.$typedDispatch('notifications/clearNotification', n)
232232
}
233233
234234
handleClearAll () {
235-
this.$store.dispatch('notifications/clearAll')
235+
this.$typedDispatch('notifications/clearAll')
236236
}
237237
238238
handleAnnouncementDismiss (n: AppNotification, wake_time: number) {
239239
if (n && wake_time) {
240-
this.$store.dispatch('announcements/dismiss', {
240+
this.$typedDispatch('announcements/dismiss', {
241241
entry_id: n.id,
242242
wake_time
243243
})

src/components/layout/AppUserMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export default class AppNotificationMenu extends Vue {
115115
}
116116
117117
async handleLogout () {
118-
await this.$store.dispatch('auth/checkTrust')
118+
await this.$typedDispatch('auth/checkTrust')
119119
}
120120
}
121121
</script>

src/components/settings/FileBrowserSettings.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default class FileEditorSettings extends Vue {
4444
}
4545
4646
set textSortOrder (value: TextSortOrder) {
47-
this.$store.dispatch('config/saveByPath', {
47+
this.$typedDispatch('config/saveByPath', {
4848
path: 'uiSettings.general.textSortOrder',
4949
value,
5050
server: true
@@ -73,7 +73,7 @@ export default class FileEditorSettings extends Vue {
7373
}
7474
7575
set filesAndFoldersDragAndDrop (value: boolean) {
76-
this.$store.dispatch('config/saveByPath', {
76+
this.$typedDispatch('config/saveByPath', {
7777
path: 'uiSettings.general.filesAndFoldersDragAndDrop',
7878
value,
7979
server: true

src/components/settings/FileEditorSettings.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default class FileEditorSettings extends Mixins(StateMixin) {
9191
}
9292
9393
set confirmDirtyEditorClose (value: boolean) {
94-
this.$store.dispatch('config/saveByPath', {
94+
this.$typedDispatch('config/saveByPath', {
9595
path: 'uiSettings.editor.confirmDirtyEditorClose',
9696
value,
9797
server: true
@@ -103,7 +103,7 @@ export default class FileEditorSettings extends Mixins(StateMixin) {
103103
}
104104
105105
set autoEditExtensions (value: string[]) {
106-
this.$store.dispatch('config/saveByPath', {
106+
this.$typedDispatch('config/saveByPath', {
107107
path: 'uiSettings.editor.autoEditExtensions',
108108
value: [
109109
...new Set(value.map(ext => ext.startsWith('.') ? ext : `.${ext}`))
@@ -117,7 +117,7 @@ export default class FileEditorSettings extends Mixins(StateMixin) {
117117
}
118118
119119
set restoreViewState (value: RestoreViewState) {
120-
this.$store.dispatch('config/saveByPath', {
120+
this.$typedDispatch('config/saveByPath', {
121121
path: 'uiSettings.editor.restoreViewState',
122122
value,
123123
server: true
@@ -146,15 +146,15 @@ export default class FileEditorSettings extends Mixins(StateMixin) {
146146
}
147147
148148
set codeLens (value: boolean) {
149-
this.$store.dispatch('config/saveByPath', {
149+
this.$typedDispatch('config/saveByPath', {
150150
path: 'uiSettings.editor.codeLens',
151151
value,
152152
server: true
153153
})
154154
}
155155
156156
handleReset () {
157-
this.$store.dispatch('config/saveByPath', {
157+
this.$typedDispatch('config/saveByPath', {
158158
path: 'uiSettings.editor',
159159
value: defaultState().uiSettings.editor,
160160
server: true

src/components/settings/GcodePreviewSettings.vue

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export default class GcodePreviewSettings extends Vue {
203203
}
204204
205205
setExtrusionLineWidth (value: number) {
206-
this.$store.dispatch('config/saveByPath', {
206+
this.$typedDispatch('config/saveByPath', {
207207
path: 'uiSettings.gcodePreview.extrusionLineWidth',
208208
value: +value,
209209
server: true
@@ -215,7 +215,7 @@ export default class GcodePreviewSettings extends Vue {
215215
}
216216
217217
setMoveLineWidth (value: number) {
218-
this.$store.dispatch('config/saveByPath', {
218+
this.$typedDispatch('config/saveByPath', {
219219
path: 'uiSettings.gcodePreview.moveLineWidth',
220220
value: +value,
221221
server: true
@@ -227,7 +227,7 @@ export default class GcodePreviewSettings extends Vue {
227227
}
228228
229229
setRetractionIconSize (value: number) {
230-
this.$store.dispatch('config/saveByPath', {
230+
this.$typedDispatch('config/saveByPath', {
231231
path: 'uiSettings.gcodePreview.retractionIconSize',
232232
value: +value,
233233
server: true
@@ -239,7 +239,7 @@ export default class GcodePreviewSettings extends Vue {
239239
}
240240
241241
set flipHorizontal (value: boolean) {
242-
this.$store.dispatch('config/saveByPath', {
242+
this.$typedDispatch('config/saveByPath', {
243243
path: 'uiSettings.gcodePreview.flip.horizontal',
244244
value,
245245
server: true
@@ -251,7 +251,7 @@ export default class GcodePreviewSettings extends Vue {
251251
}
252252
253253
set flipVertical (value: boolean) {
254-
this.$store.dispatch('config/saveByPath', {
254+
this.$typedDispatch('config/saveByPath', {
255255
path: 'uiSettings.gcodePreview.flip.vertical',
256256
value,
257257
server: true
@@ -263,7 +263,7 @@ export default class GcodePreviewSettings extends Vue {
263263
}
264264
265265
set drawOrigin (value: boolean) {
266-
this.$store.dispatch('config/saveByPath', {
266+
this.$typedDispatch('config/saveByPath', {
267267
path: 'uiSettings.gcodePreview.drawOrigin',
268268
value,
269269
server: true
@@ -275,7 +275,7 @@ export default class GcodePreviewSettings extends Vue {
275275
}
276276
277277
set drawBackground (value: boolean) {
278-
this.$store.dispatch('config/saveByPath', {
278+
this.$typedDispatch('config/saveByPath', {
279279
path: 'uiSettings.gcodePreview.drawBackground',
280280
value,
281281
server: true
@@ -287,7 +287,7 @@ export default class GcodePreviewSettings extends Vue {
287287
}
288288
289289
set showAnimations (value: boolean) {
290-
this.$store.dispatch('config/saveByPath', {
290+
this.$typedDispatch('config/saveByPath', {
291291
path: 'uiSettings.gcodePreview.showAnimations',
292292
value,
293293
server: true
@@ -299,7 +299,7 @@ export default class GcodePreviewSettings extends Vue {
299299
}
300300
301301
setMinLayerHeight (value: number) {
302-
this.$store.dispatch('config/saveByPath', {
302+
this.$typedDispatch('config/saveByPath', {
303303
path: 'uiSettings.gcodePreview.minLayerHeight',
304304
value: +value,
305305
server: true
@@ -311,7 +311,7 @@ export default class GcodePreviewSettings extends Vue {
311311
}
312312
313313
set autoLoadOnPrintStart (value: boolean) {
314-
this.$store.dispatch('config/saveByPath', {
314+
this.$typedDispatch('config/saveByPath', {
315315
path: 'uiSettings.gcodePreview.autoLoadOnPrintStart',
316316
value,
317317
server: true
@@ -327,7 +327,7 @@ export default class GcodePreviewSettings extends Vue {
327327
}
328328
329329
set autoLoadMobileOnPrintStart (value: boolean) {
330-
this.$store.dispatch('config/saveByPath', {
330+
this.$typedDispatch('config/saveByPath', {
331331
path: 'uiSettings.gcodePreview.autoLoadMobileOnPrintStart',
332332
value,
333333
server: true
@@ -339,7 +339,7 @@ export default class GcodePreviewSettings extends Vue {
339339
}
340340
341341
set autoFollowOnFileLoad (value: boolean) {
342-
this.$store.dispatch('config/saveByPath', {
342+
this.$typedDispatch('config/saveByPath', {
343343
path: 'uiSettings.gcodePreview.autoFollowOnFileLoad',
344344
value,
345345
server: true
@@ -351,15 +351,15 @@ export default class GcodePreviewSettings extends Vue {
351351
}
352352
353353
set hideSinglePartBoundingBox (value: boolean) {
354-
this.$store.dispatch('config/saveByPath', {
354+
this.$typedDispatch('config/saveByPath', {
355355
path: 'uiSettings.gcodePreview.hideSinglePartBoundingBox',
356356
value,
357357
server: true
358358
})
359359
}
360360
361361
handleReset () {
362-
this.$store.dispatch('config/saveByPath', {
362+
this.$typedDispatch('config/saveByPath', {
363363
path: 'uiSettings.gcodePreview',
364364
value: defaultState().uiSettings.gcodePreview,
365365
server: true

0 commit comments

Comments
 (0)