diff --git a/src/components/TheEditor.vue b/src/components/TheEditor.vue index e6ec42b30..63463ab87 100644 --- a/src/components/TheEditor.vue +++ b/src/components/TheEditor.vue @@ -239,25 +239,33 @@ export default class TheEditor extends Mixins(BaseMixin) { if (!this.isWriteable) return null if (['printing', 'paused'].includes(this.printer_state)) return null + // check for generic services .conf (like moonraker.conf, crowsnest.conf, sonar.conf) if (this.availableServices.includes(this.filenameWithoutExtension) && this.fileExtension === 'conf') return this.filenameWithoutExtension + + // old webcam service DEPRECATED if (this.filename.startsWith('webcam') && ['conf', 'txt'].includes(this.fileExtension)) return 'webcamd' + + // check for mooncord config files if (this.filename.startsWith('mooncord') && this.fileExtension === 'json') return 'mooncord' - if (this.filename === 'moonraker.conf') return this.moonrakerRestartInstance ?? 'moonraker' + // fallback for moonraker with multi instances + if (this.filename === 'moonraker.conf') return 'moonraker' + + // all .cfg files will be klipper config files if (this.fileExtension === 'cfg') return 'klipper' return null } get restartServiceNameExists() { - if (!this.restartServiceName) return true + // hide the button, if there is no service found + if (this.restartServiceName === null) return false - return this.availableServices.includes(this.restartServiceName) - } + // klipper and moonraker uses specific api calls instead of generic service restart + if (['klipper', 'moonraker'].includes(this.restartServiceName)) return true - get moonrakerRestartInstance() { - return this.$store.state.gui.editor.moonrakerRestartInstance + return this.availableServices.includes(this.restartServiceName) } get confirmUnsavedChanges() { diff --git a/src/components/settings/SettingsEditorTab.vue b/src/components/settings/SettingsEditorTab.vue index 5b83a3911..f4b507eda 100644 --- a/src/components/settings/SettingsEditorTab.vue +++ b/src/components/settings/SettingsEditorTab.vue @@ -6,25 +6,23 @@ :title="$t('Settings.EditorTab.UseEscToClose')" :sub-title="$t('Settings.EditorTab.UseEscToCloseDescription')" :dynamic-slot-width="true"> - + - + - + - - + - + - - + @@ -34,23 +32,8 @@ hide-details outlined dense - attached> + attached /> - - @@ -115,19 +98,5 @@ export default class SettingsEditorTab extends Mixins(BaseMixin) { set klipperRestartMethod(newVal) { this.$store.dispatch('gui/saveSetting', { name: 'editor.klipperRestartMethod', value: newVal }) } - - get moonrakerRestartInstance() { - return this.$store.state.gui.editor.moonrakerRestartInstance - } - - set moonrakerRestartInstance(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'editor.moonrakerRestartInstance', value: newVal }) - } - - get availableMoonrakerInstances() { - const available_instances = this.$store.state.server.system_info?.available_services ?? [] - - return available_instances.filter((name: string) => name.startsWith('moonraker')).sort() - } } diff --git a/src/locales/cz.json b/src/locales/cz.json index 0b4c8e992..9b4165176 100644 --- a/src/locales/cz.json +++ b/src/locales/cz.json @@ -794,8 +794,6 @@ "Editor": "Editor", "KlipperRestartMethod": "Metoda restartu Klipperu", "KlipperRestartMethodDescription": "Vyberte metodu restartu, která se použije při editaci konfiguračních souborů Klipperu v \"Uložit a restartovat\".", - "MoonrakerRestartInstance": "Restart instance Moonrakeru", - "MoonrakerRestartInstanceDescription": "Vyberte, která služba Moonrakeru se restartuje v \"Uložit a restartovat\", když se editují konfigurační soubory Moonrakeru.", "UseEscToClose": "Použít ESC pro zavření editoru", "UseEscToCloseDescription": "Umožňuje použití klávesy ESC k zavření editoru" }, diff --git a/src/locales/da.json b/src/locales/da.json index fcc163a76..1dad1e719 100644 --- a/src/locales/da.json +++ b/src/locales/da.json @@ -793,8 +793,6 @@ "Editor": "Editor", "KlipperRestartMethod": "Metode for genstart af Klipper", "KlipperRestartMethodDescription": "Vælg hvilken metode der skal bruges ved brug af 'Gem & Genstart' når der redigeres i Klipper config filer.", - "MoonrakerRestartInstance": "Genstart Moonraker instans", - "MoonrakerRestartInstanceDescription": "Vælg hvilken instans af Moonraker servicen der skal genstartes ved brug af 'Gem & Genstart' når der redigeres i Moonraker config filer.", "UseEscToClose": "Tryk ESC for at lukke Editor.", "UseEscToCloseDescription": "Tillader at ESC lukker Editor" }, diff --git a/src/locales/de.json b/src/locales/de.json index 6d03a5568..eb3a1aec2 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -833,8 +833,6 @@ "Editor": "Editor", "KlipperRestartMethod": "Klipper Neustartmethode", "KlipperRestartMethodDescription": "Wähle aus, welche Neustartmethode verwendet werden soll wenn 'Speichern & Neustarten' geklickt wir im Editor.", - "MoonrakerRestartInstance": "Moonraker Neustartinstanz", - "MoonrakerRestartInstanceDescription": "Wähle aus, welche Moonrakerinstanz neu gestartet werden soll wenn 'Speichern & Neustarten' im Editor geklickt wird.", "UseEscToClose": "ESC drücken um Editor zu schließen", "UseEscToCloseDescription": "Erlaubt es den Editor mit ESC zu schließen.", "TabSize": "TAB Größe", diff --git a/src/locales/en.json b/src/locales/en.json index 9bdd6b0a9..86d442965 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -833,8 +833,6 @@ "Editor": "Editor", "KlipperRestartMethod": "Klipper restart method", "KlipperRestartMethodDescription": "Select which restart method will be used on 'Save & Restart' when editing Klipper config files.", - "MoonrakerRestartInstance": "Moonraker restart instance", - "MoonrakerRestartInstanceDescription": "Select which Moonraker service will restart on 'Save & Restart' when editing Moonraker config files.", "UseEscToClose": "Use ESC to close editor", "UseEscToCloseDescription": "Allows the ESC key to close the editor", "TabSize": "TAB Size", diff --git a/src/locales/es.json b/src/locales/es.json index 20867b237..c91fedeea 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -723,8 +723,6 @@ "Editor": "Editor", "KlipperRestartMethod": "Metodo de reinicio de klipper", "KlipperRestartMethodDescription": "Elija metodo de reinicio que sera usado cuando editamos configuracion de klipper y presionamos \"Guardar y Reiniciar\"", - "MoonrakerRestartInstance": "Instancia de Moonraker a reinicar", - "MoonrakerRestartInstanceDescription": "Elija que instacia de moonrker se reiniciara cuando editando configuracionde monnraker presionemos \"Guardar y reiniciar\" ", "UseEscToClose": "Use ESC para cerrar", "UseEscToCloseDescription": "Permite que la tecla ESC cierre el editor" }, diff --git a/src/locales/fr.json b/src/locales/fr.json index d34b8a059..f50745167 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -777,8 +777,6 @@ "Editor": "Editeur", "KlipperRestartMethod": "Méthode de redémarrage de Klipper", "KlipperRestartMethodDescription": "Choisissez la méthode utilisée pour redémarrer Klipper lors d'un appui sur 'Save & Restart' après édition des fichiers de configuration.", - "MoonrakerRestartInstance": "Redémarrage Moonraker", - "MoonrakerRestartInstanceDescription": "Choisissez quel service Moonraker doit redémarrer lors d'un appui sur 'Save & Restart' après édition des fichiers de configuration.", "UseEscToClose": "Utiliser la touche \"esc\" pour fermer l'éditeur", "UseEscToCloseDescription": "Autoriser la touche \"esc\" de fermer l'éditeur." }, diff --git a/src/locales/hu.json b/src/locales/hu.json index 6b45a7d02..ae1fad5c5 100644 --- a/src/locales/hu.json +++ b/src/locales/hu.json @@ -722,8 +722,6 @@ "Editor": "Szerkesztő", "KlipperRestartMethod": "Klipper újraindítási mód", "KlipperRestartMethodDescription": "Válaszd ki milyen újraindítási módot használjunk a 'Ment és Újraindít' esetén, amikor a klipper konfig fájlait szerkeszted.", - "MoonrakerRestartInstance": "Moonraker példány Újraindítása", - "MoonrakerRestartInstanceDescription": "Válaszd ki melyik Moonraker szolgáltatást indítsuk újra a 'Ment és Újraindít' esetén, amikor a Moonraker konfig fájlait szerkeszted.", "UseEscToClose": "Kilépéshez nyomd meg az ESC gombot", "UseEscToCloseDescription": "Az ESC gomb megnyomása bezárja a szerkesztőt", "TabSize": "TAB Méret", diff --git a/src/locales/ja.json b/src/locales/ja.json index 2542b8d7d..8747f4a2d 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -794,8 +794,6 @@ "Editor": "エディター", "KlipperRestartMethod": "Klipper再始動の方法", "KlipperRestartMethodDescription": "Klipperの設定ファイルを編集する際に'保存して再始動'での再始動方法を選択してください。", - "MoonrakerRestartInstance": "Moonraker インスタンスの再始動", - "MoonrakerRestartInstanceDescription": "Moonrakerの設定ファイルを編集する際に'保存して再始動'で、どのMoonrakerサービスを再始動するか選択してください。", "UseEscToClose": "ESCキーでエディターを終了します。", "UseEscToCloseDescription": "ESCキーでエディターを終了できます。" }, diff --git a/src/locales/ko.json b/src/locales/ko.json index 64588313f..db66d0fb4 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -801,8 +801,6 @@ "Editor": "파일 편집기", "KlipperRestartMethod": "클리퍼 재시작 방법", "KlipperRestartMethodDescription": "printer.cfg 파일을 수정 후, '저장 및 다시 시작'을 클릭할 때 사용할 다시 시작 방법을 선택합니다", - "MoonrakerRestartInstance": "문래커 재시작 방법", - "MoonrakerRestartInstanceDescription": "moonraker.conf 파일을 수정할 때 '저장 및 다시 시작'을 클릭할 때 사용할 문래커 서비스를 선택합니다", "UseEscToClose": "ESC키를 눌러 종료", "UseEscToCloseDescription": "ESC 키를 눌렀을 때 파일 편집기를 종료하며 만약 비활성화 했을 경우 ESC 키를 누르는 즉시 기존 입력 값은 모두 취소됩니다" }, diff --git a/src/locales/nl.json b/src/locales/nl.json index 6c78544e0..264072fec 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -799,8 +799,6 @@ "Editor": "Editor", "KlipperRestartMethod": "Klipper restart methode", "KlipperRestartMethodDescription": "Selecteerd welke herstart methode gebruikt wordt bij 'Save & Restart' na het bewerken van de Klipper config files.", - "MoonrakerRestartInstance": "Moonraker instantie herstarten", - "MoonrakerRestartInstanceDescription": "Selecteer welke Moonraker service herstart na 'Save & Restart' bij het bewerken van Moonraker config bestanden.", "UseEscToClose": "Gebruik ESC om de editor te sluiten", "UseEscToCloseDescription": "Laat de ESC toets de editor sluiten" }, diff --git a/src/locales/pl.json b/src/locales/pl.json index 53c8fa13d..eb9192091 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -792,8 +792,6 @@ "Editor": "Edytor", "KlipperRestartMethod": "Metoda restartu Klippera", "KlipperRestartMethodDescription": "Wybierz która metoda ponownego uruchomienia ma być używana podczas 'Zapisz i Uruchom ponownie' podczas edytowania plików konfiguracyjnych Klippera.", - "MoonrakerRestartInstance": "Ponowne uruchomienie instancji Moonrakera", - "MoonrakerRestartInstanceDescription": "Wybierz która metoda ponownego uruchomienia ma być używana podczas 'Zapisz i Uruchom ponownie' podczas edytowania plików konfiguracyjnych Moonrakera.", "UseEscToClose": "Naciśnij ESC, aby wyjść z edytora", "UseEscToCloseDescription": "Umożliwia zamknięcie edytora za pomocą klawisza ESC", "TabSize": "Rozmiar tabulacji", diff --git a/src/locales/pt.json b/src/locales/pt.json index 06784c61a..290597e79 100644 --- a/src/locales/pt.json +++ b/src/locales/pt.json @@ -807,8 +807,6 @@ "Editor": "Editor", "KlipperRestartMethod": "Método para reiniciar Klipper", "KlipperRestartMethodDescription": "Selecione o método de reinicialização que será usado em 'Salvar e Reiniciar' ao editar arquivos de configuração do Klipper.", - "MoonrakerRestartInstance": "Reiniciar a instância do Moonraker", - "MoonrakerRestartInstanceDescription": "Selecione qual serviço do Moonraker será reiniciado em 'Salvar e Reiniciar' ao editar arquivos de configuração do Moonraker.", "Spaces": "Espaços: {count}", "TabSize": "Tamanho TAB", "TabSizeDescription": "Ajusta quantos espaços devem ser usados para a indentação de TAB.", diff --git a/src/locales/ru.json b/src/locales/ru.json index 6458e58de..d66c97f1b 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -801,8 +801,6 @@ "Editor": "Редактор", "KlipperRestartMethod": "Способ перезапуска Klipper", "KlipperRestartMethodDescription": "Выберите какой способ перезапуска Klipper будет использоваться, после нажатия 'СОХРАНИТЬ И ПЕРЕЗАПУСТИТЬ' при редактировании конфигурационных файлов Klipper.", - "MoonrakerRestartInstance": "Способ перезапуска Moonraker", - "MoonrakerRestartInstanceDescription": "Выберите какой способ перезапуска Moonraker будет использоваться, после нажатия 'СОХРАНИТЬ И ПЕРЕЗАПУСТИТЬ' при редактировании конфигурационных файлов Moonraker.", "UseEscToClose": "Использование клавиши ESC", "UseEscToCloseDescription": "Позволяет использовать клавишу ESC для закрытия редактора", "TabSize": "Размер табуляции", diff --git a/src/locales/sv.json b/src/locales/sv.json index 97af8c162..b73a32519 100644 --- a/src/locales/sv.json +++ b/src/locales/sv.json @@ -620,8 +620,6 @@ "Editor": "Redigerare", "KlipperRestartMethod": "Klipper omstartsmetod", "KlipperRestartMethodDescription": "Välj vilken omstartsmetod som ska användas på 'Spara och starta om' vid redigering av Klipper-konfigurationsfiler.", - "MoonrakerRestartInstance": "Starta om Moonraker instans", - "MoonrakerRestartInstanceDescription": "Välj vilken Moonraker-tjänst som ska startas om under \"Spara och starta om\" när du redigerar Moonraker-konfigurationsfiler.", "UseEscToClose": "Använd ESC för att stänga redigeringsprogrammet", "UseEscToCloseDescription": "Tillåter att ESC-tangenten stänger redigeraren" }, diff --git a/src/locales/tr.json b/src/locales/tr.json index f520a8ecd..d8675198a 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -833,8 +833,6 @@ "Editor": "Editör", "KlipperRestartMethod": "Klipper yeniden başlatma yöntemi", "KlipperRestartMethodDescription": "Klipper yapılandırma dosyalarını düzenlerken 'Kaydet ve Yeniden Başlat' seçildiğinde hangi yeniden başlatma yönteminin kullanılacağını seçin.", - "MoonrakerRestartInstance": "Moonraker örnek yeniden başlatma", - "MoonrakerRestartInstanceDescription": "Moonraker yapılandırma dosyalarını düzenlerken 'Kaydet ve Yeniden Başlat' seçildiğinde hangi Moonraker hizmetinin yeniden başlayacağını seçin.", "UseEscToClose": "Editörü kapatmak için ESC tuşunu kullan", "UseEscToCloseDescription": "ESC tuşunun editörü kapatmasına izin verir", "TabSize": "TAB Boyutu", diff --git a/src/locales/uk.json b/src/locales/uk.json index 50d90f509..10d1e5993 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -735,8 +735,6 @@ "Editor": "Редактор", "KlipperRestartMethod": "Метод перезапуску Klipper", "KlipperRestartMethodDescription": "Виберіть, який метод перезавантаження буде використовуватися на 'Зберегти та перезапустити' під час редагування файлів конфігурації Klipper..", - "MoonrakerRestartInstance": "Інстанція перезапуску Moonraker", - "MoonrakerRestartInstanceDescription": "Виберіть, яка послуга Moonraker перезапуститься на 'Зберегти та перезапустити' під час редагування файлів конфігурації Moonraker.", "UseEscToClose": "Використовуйте ESC для закриття редактора", "UseEscToCloseDescription": "Дозволяє клавішу ESC закрити редактор" }, diff --git a/src/locales/zh.json b/src/locales/zh.json index 933c5dbef..c10a12961 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -809,8 +809,6 @@ "Editor": "编辑器", "KlipperRestartMethod": "Klipper重启方法", "KlipperRestartMethodDescription": "编辑完Klipper配置文件并按下\"保存并重启\"按钮后,使用哪种重启方法。", - "MoonrakerRestartInstance": "重启Moonraker实例", - "MoonrakerRestartInstanceDescription": "编辑完Moonraker配置文件并按下\"保存并重启\"按钮后,重启哪个Moonraker服务。", "UseEscToClose": "使用ESC关闭编辑器", "UseEscToCloseDescription": "允许使用ESC键关闭编辑器", "TabSize": "TAB长度", diff --git a/src/locales/zh_TW.json b/src/locales/zh_TW.json index 7cb8cf995..6a386fc9c 100644 --- a/src/locales/zh_TW.json +++ b/src/locales/zh_TW.json @@ -773,8 +773,6 @@ "Editor": "編輯器", "KlipperRestartMethod": "Klipper重新啟動方法", "KlipperRestartMethodDescription": "編輯完Klipper設定檔案並按下\"儲存並重新啟動\"按鈕後,使用哪種重新啟動方法。", - "MoonrakerRestartInstance": "重新啟動Moonraker", - "MoonrakerRestartInstanceDescription": "編輯完Moonraker設定檔案並按下\"儲存並重新啟動\"按鈕後,重新啟動哪個Moonraker服務。", "Spaces": "空間: {count}", "TabSize": "標籤大小", "UseEscToClose": "使用 ESC 關閉編輯器", diff --git a/src/store/editor/actions.ts b/src/store/editor/actions.ts index 2ea3b7849..c5112a90f 100644 --- a/src/store/editor/actions.ts +++ b/src/store/editor/actions.ts @@ -127,11 +127,9 @@ export const actions: ActionTree = { Vue.$toast.success(i18n.t('Editor.SuccessfullySaved', { filename: data.item.path }).toString()) if (payload.restartServiceName === 'klipper') { const klipperRestartMethod = getters['getKlipperRestartMethod'] - //dispatch('server/addEvent', { message: 'FIRMWARE_RESTART', type: 'command' }) Vue.$socket.emit('printer.gcode.script', { script: klipperRestartMethod }) } else if (payload.restartServiceName === 'moonraker') { - const moonrakerRestartInstance = getters['getMoonrakerRestartInstance'] - Vue.$socket.emit('machine.services.restart', { service: moonrakerRestartInstance }) + Vue.$socket.emit('server.restart', {}) } else if (payload.restartServiceName !== null) { Vue.$socket.emit('machine.services.restart', { service: payload.restartServiceName }) } diff --git a/src/store/editor/getters.ts b/src/store/editor/getters.ts index 0e0da0cf9..59ab41323 100644 --- a/src/store/editor/getters.ts +++ b/src/store/editor/getters.ts @@ -5,13 +5,4 @@ export const getters: GetterTree = { getKlipperRestartMethod: (state, getters, rootState) => { return rootState.gui.editor?.klipperRestartMethod ?? 'FIRMWARE_RESTART' }, - - getMoonrakerRestartInstance: (state, getters, rootState) => { - const available_services = rootState.server?.system_info?.available_services ?? [] - const setting = rootState.gui.editor?.moonrakerRestartInstance ?? 'moonraker' - - if (available_services.includes(setting)) return setting - - return 'moonraker' - }, } diff --git a/src/store/gui/index.ts b/src/store/gui/index.ts index 248b2220c..9b5022215 100644 --- a/src/store/gui/index.ts +++ b/src/store/gui/index.ts @@ -112,7 +112,6 @@ export const getDefaultState = (): GuiState => { confirmUnsavedChanges: true, klipperRestartMethod: 'FIRMWARE_RESTART', tabSize: 2, - moonrakerRestartInstance: null, }, gcodeViewer: { extruderColors: ['#E76F51FF', '#F4A261FF', '#E9C46AFF', '#2A9D8FFF', '#264653FF'], diff --git a/src/store/gui/types.ts b/src/store/gui/types.ts index e9a8e2bc5..dff97411c 100644 --- a/src/store/gui/types.ts +++ b/src/store/gui/types.ts @@ -60,7 +60,6 @@ export interface GuiState { confirmUnsavedChanges: boolean klipperRestartMethod: 'FIRMWARE_RESTART' | 'RESTART' tabSize: number - moonrakerRestartInstance: string | null } gcodeViewer: { extruderColors: string[]