fix: editor safe & restart with multi instances (#925)

This commit is contained in:
Stefan Dej authored and GitHub committed 2022-06-21 21:41:29 +02:00
1 parent 38d2c883b1
commit dfc91df681
1 file changed
+9 -1
+9 -1
View File
@@ -112,7 +112,7 @@
<v-btn text color="primary" @click="save">
{{ $t('Editor.SaveClose') }}
</v-btn>
<template v-if="restartServiceName != null">
<template v-if="restartServiceNameExists">
<v-btn text color="primary" @click="save(restartServiceName)">
{{ $t('Editor.SaveRestart') }}
</v-btn>
@@ -246,15 +246,23 @@ export default class TheEditor extends Mixins(BaseMixin) {
return this.filenameWithoutExtension
if (this.filename.startsWith('webcam') && ['conf', 'txt'].includes(this.fileExtension)) return 'webcamd'
if (this.filename.startsWith('mooncord') && this.fileExtension === 'json') return 'mooncord'
if (this.filename === 'moonraker.conf') return this.moonrakerRestartInstance ?? 'moonraker'
if (this.fileExtension === 'cfg') return 'klipper'
return null
}
get restartServiceNameExists() {
if (this.restartServiceName) return true
return this.availableServices.includes(this.restartServiceName)
}
get moonrakerRestartInstance() {
return this.$store.state.gui.editor.moonrakerRestartInstance
}
get confirmUnsavedChanges() {
return this.$store.state.gui.editor.confirmUnsavedChanges ?? false
}