Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: editor safe & restart with multi instances #925

Merged
merged 2 commits into from
Jun 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
}
Expand Down