Skip to content

Commit edd431a

Browse files
authored
Merge branch 'develop' into develop
2 parents 851028f + 6a54f3c commit edd431a

File tree

7 files changed

+30
-15
lines changed

7 files changed

+30
-15
lines changed

src/components/widgets/filesystem/setupMonaco.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import themeDark from '@/monaco/theme/editor.dark.theme.json'
1010
import themeLight from '@/monaco/theme/editor.light.theme.json'
1111

1212
import { MonacoLanguageImports } from '@/dynamicImports'
13+
import type { KlippyApp } from '@/store/printer/types'
1314

1415
type ReduceState<T> = {
1516
current?: T,
@@ -99,7 +100,7 @@ async function setupMonaco () {
99100

100101
monaco.editor.registerCommand('fluidd_open_docs', (_, service: CodeLensSupportedService, hash: string) => {
101102
const serviceKey = service.replace(/-/g, '_')
102-
const klippyApp = app.$store.getters['printer/getKlippyApp']
103+
const klippyApp = app.$store.getters['printer/getKlippyApp'] as KlippyApp
103104

104105
const url = app.$t(`app.file_system.url.${serviceKey}_config`, {
105106
hash,

src/components/widgets/macros/MacroBtn.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ import StateMixin from '@/mixins/state'
9090
import type { Macro } from '@/store/macros/types'
9191
import gcodeMacroParams from '@/util/gcode-macro-params'
9292
import { gcodeCommandBuilder, isBasicGcodeCommand, getParamNameForRawGcodeCommand } from '@/util/gcode-helpers'
93+
import type { KlippyApp } from '@/store/printer/types'
9394
9495
type MacroParameter = {
9596
value: string | number
@@ -140,8 +141,8 @@ export default class MacroBtn extends Mixins(StateMixin) {
140141
return ''
141142
}
142143
143-
get klippyApp () {
144-
return this.$store.getters['printer/getKlippyApp']
144+
get klippyApp (): KlippyApp {
145+
return this.$store.getters['printer/getKlippyApp'] as KlippyApp
145146
}
146147
147148
get supportsPythonGcodeMacros () {

src/globals.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ export const Globals = Object.freeze({
186186
LOCAL_CARDSTATE_STORAGE_KEY: 'cardState', // collapsed or not
187187
LOCAL_CARDLAYOUT_STORAGE_KEY: 'cardLayout2', // Specific layout / enabled / disabled
188188
LOCAL_INSTANCES_STORAGE_KEY: 'appInstances',
189-
KLIPPER_MIN_VERSION: 'v0.11.0-257',
190189
MOONRAKER_MIN_VERSION: 'v0.8.0-309',
191190
MOONRAKER_DB: {
192191
fluidd: {
@@ -233,13 +232,16 @@ export const Globals = Object.freeze({
233232
SUPPORTED_SERVICES: {
234233
klipper: {
235234
klipper: {
236-
domain: 'https://www.klipper3d.org'
235+
domain: 'https://www.klipper3d.org',
236+
minVersion: 'v0.11.0-257'
237237
},
238238
kalico: {
239-
domain: 'https://docs.kalico.gg'
239+
domain: 'https://docs.kalico.gg',
240+
minVersion: 'v0.11.0-257'
240241
},
241242
'danger-klipper': {
242-
domain: 'https://dangerklipper.io'
243+
domain: 'https://dangerklipper.io',
244+
minVersion: 'v0.11.0-257'
243245
}
244246
}
245247
},

src/store/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { RootState } from './types'
33
import { SocketActions } from '@/api/socketActions'
44
import type { AppPushNotification } from './notifications/types'
55
import i18n from '@/plugins/i18n'
6+
import type { KlippyApp } from './printer/types'
67

78
export const handleTrinamicDriversChange = (payload: any, state: RootState, dispatch: Dispatch, getters: any) => {
89
for (const item in payload) {
@@ -15,7 +16,7 @@ export const handleTrinamicDriversChange = (payload: any, state: RootState, disp
1516
) {
1617
const name = nameFromSplit ?? item
1718

18-
const klippyApp = getters.getKlippyApp
19+
const klippyApp = getters.getKlippyApp as KlippyApp
1920

2021
const notification: AppPushNotification = {
2122
id: `${item}-otpw`,

src/store/printer/actions.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ActionTree } from 'vuex'
2-
import type { PrinterState } from './types'
2+
import type { KlippyApp, PrinterState } from './types'
33
import type { RootState } from '../types'
44
import { handlePrintStateChange, handleCurrentFileChange, handleExcludeObjectChange, handleTrinamicDriversChange } from '../helpers'
55
import { handleAddChartEntry, handleSystemStatsChange, handleMcuStatsChange } from '../chart_helpers'
@@ -37,22 +37,24 @@ export const actions: ActionTree<PrinterState, RootState> = {
3737
commit('setForceMoveEnabled', payload)
3838
},
3939

40-
async checkKlipperMinVersion ({ state, dispatch }) {
40+
async checkKlipperMinVersion ({ state, rootGetters, dispatch }) {
4141
const klipperVersion = state.info.software_version ?? '?'
4242

4343
const fullKlipperVersion = klipperVersion.includes('-')
4444
? klipperVersion
4545
: `${klipperVersion}-0`
4646

47+
const klippyApp = rootGetters['printer/getKlippyApp'] as KlippyApp
48+
4749
if (
4850
valid(klipperVersion) &&
49-
valid(Globals.KLIPPER_MIN_VERSION) &&
50-
!gte(fullKlipperVersion, Globals.KLIPPER_MIN_VERSION)
51+
valid(klippyApp.minVersion) &&
52+
!gte(fullKlipperVersion, klippyApp.minVersion)
5153
) {
5254
dispatch('notifications/pushNotification', {
5355
id: `old-klipper-${klipperVersion}`,
5456
title: 'Klipper',
55-
description: i18n.t('app.version.label.old_component_version', { name: 'Klipper', version: Globals.KLIPPER_MIN_VERSION }),
57+
description: i18n.t('app.version.label.old_component_version', { name: 'Klipper', version: klippyApp.minVersion }),
5658
to: '/settings#versions',
5759
btnText: i18n.t('app.version.btn.view_versions'),
5860
type: 'warning',

src/store/printer/getters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Vue from 'vue'
22
import type { GetterTree } from 'vuex'
33
import type { RootState } from '../types'
4-
import type { PrinterState, Heater, Fan, Led, OutputPin, Sensor, RunoutSensor, KnownExtruder, MCU, Endstop, Probe, ExtruderStepper, Extruder, ExtruderConfig, ProbeName, Stepper, ScrewsTiltAdjustScrew, ScrewsTiltAdjust, BedScrews, BedSize, GcodeCommands, TimeEstimates, BeaconState } from './types'
4+
import type { PrinterState, Heater, Fan, Led, OutputPin, Sensor, RunoutSensor, KnownExtruder, MCU, Endstop, Probe, ExtruderStepper, Extruder, ExtruderConfig, ProbeName, Stepper, ScrewsTiltAdjustScrew, ScrewsTiltAdjust, BedScrews, BedSize, GcodeCommands, TimeEstimates, BeaconState, KlippyApp } from './types'
55
import { get } from 'lodash-es'
66
import getKlipperType from '@/util/get-klipper-type'
77
import i18n from '@/plugins/i18n'
@@ -58,7 +58,7 @@ export const getters: GetterTree<PrinterState, RootState> = {
5858
return 'Unknown'
5959
},
6060

61-
getKlippyApp: (state) => {
61+
getKlippyApp: (state): KlippyApp => {
6262
const app = state.info.app?.toLowerCase()
6363

6464
const klippyApp = app && isKeyOf(app, Globals.SUPPORTED_SERVICES.klipper)

src/store/printer/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { Globals } from '@/globals'
2+
13
export interface PrinterState {
24
info: PrinterInfo;
35
manualProbeDialogOpen: boolean;
@@ -296,3 +298,9 @@ export interface BeaconModel {
296298
name: string;
297299
active: boolean;
298300
}
301+
302+
export interface KlippyApp {
303+
name: keyof typeof Globals.SUPPORTED_SERVICES.klipper;
304+
domain: string;
305+
minVersion: string;
306+
}

0 commit comments

Comments
 (0)