Replace native Modbus confirmation dialog

This commit is contained in:
Andrei Smaliak 2026-10-25 10:17:48 +01:00
parent a1750061d9
commit 5486a4985e
3 changed files with 25 additions and 5 deletions

View File

@ -38,6 +38,18 @@ class ModbusSessionFrontendContractTest(unittest.TestCase):
self.assertNotIn("__modbusSetToggle('restartItscreen'", body) self.assertNotIn("__modbusSetToggle('restartItscreen'", body)
self.assertIn("automatically pauses production polling", body) self.assertIn("automatically pauses production polling", body)
def test_running_itscreen_uses_the_centered_platform_confirmation(self):
ensure_session = re.search(
r"async function modbusEnsureSession\(options = \{\}\) \{(?P<body>.*?)\n \}",
SOURCE,
re.S,
)
self.assertIsNotNone(ensure_session)
body = ensure_session.group("body")
self.assertIn("const confirmed = await confirmAction(", body)
self.assertIn('t("Temporarily stop it-screen?")', body)
self.assertNotIn("window.confirm", body)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View File

@ -102,7 +102,8 @@
"Restart it-screen on release": "Перезапускать it-screen после освобождения порта", "Restart it-screen on release": "Перезапускать it-screen после освобождения порта",
"it-screen service was stopped temporarily for Modbus scanning and writing.": "Сервис it-screen был временно остановлен для сканирования и записи Modbus.", "it-screen service was stopped temporarily for Modbus scanning and writing.": "Сервис it-screen был временно остановлен для сканирования и записи Modbus.",
"it-screen service was restarted after the Modbus session.": "Сервис it-screen был перезапущен после Modbus-сеанса.", "it-screen service was restarted after the Modbus session.": "Сервис it-screen был перезапущен после Modbus-сеанса.",
"it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.\n\nContinue?": "it-screen сейчас работает на этом последовательном порту. Для действия «{action}» сервис it-screen будет временно остановлен, потому что результаты сканирования и записи ненадёжны, пока it-screen активен.\n\nПродолжить?", "Temporarily stop it-screen?": "Временно остановить it-screen?",
"it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.": "it-screen сейчас работает на этом последовательном порту. Для действия «{action}» сервис it-screen будет временно остановлен, потому что результаты сканирования и записи ненадёжны, пока it-screen активен.",
"{action} was cancelled because it-screen is still running.": "Действие «{action}» отменено, потому что it-screen всё ещё запущен.", "{action} was cancelled because it-screen is still running.": "Действие «{action}» отменено, потому что it-screen всё ещё запущен.",
"it-screen did not stop in time for {action}.": "Сервис it-screen не остановился вовремя для действия «{action}».", "it-screen did not stop in time for {action}.": "Сервис it-screen не остановился вовремя для действия «{action}».",
"Not available": "Недоступно", "Not available": "Недоступно",
@ -626,7 +627,8 @@
"Restart it-screen on release": "Uruchom ponownie it-screen po zwolnieniu portu", "Restart it-screen on release": "Uruchom ponownie it-screen po zwolnieniu portu",
"it-screen service was stopped temporarily for Modbus scanning and writing.": "Usługa it-screen została tymczasowo zatrzymana na czas skanowania i zapisu Modbus.", "it-screen service was stopped temporarily for Modbus scanning and writing.": "Usługa it-screen została tymczasowo zatrzymana na czas skanowania i zapisu Modbus.",
"it-screen service was restarted after the Modbus session.": "Usługa it-screen została ponownie uruchomiona po sesji Modbus.", "it-screen service was restarted after the Modbus session.": "Usługa it-screen została ponownie uruchomiona po sesji Modbus.",
"it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.\n\nContinue?": "it-screen działa obecnie na tej ścieżce szeregowej. Operacja „{action}” tymczasowo zatrzyma it-screen, ponieważ wyniki skanowania i zapisu są niewiarygodne, gdy it-screen jest aktywny.\n\nKontynuować?", "Temporarily stop it-screen?": "Tymczasowo zatrzymać it-screen?",
"it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.": "it-screen działa obecnie na tej ścieżce szeregowej. Operacja „{action}” tymczasowo zatrzyma it-screen, ponieważ wyniki skanowania i zapisu są niewiarygodne, gdy it-screen jest aktywny.",
"{action} was cancelled because it-screen is still running.": "Operacja „{action}” została anulowana, ponieważ it-screen nadal działa.", "{action} was cancelled because it-screen is still running.": "Operacja „{action}” została anulowana, ponieważ it-screen nadal działa.",
"it-screen did not stop in time for {action}.": "Usługa it-screen nie zatrzymała się na czas dla operacji „{action}”.", "it-screen did not stop in time for {action}.": "Usługa it-screen nie zatrzymała się na czas dla operacji „{action}”.",
"Not available": "Niedostępne", "Not available": "Niedostępne",
@ -1081,7 +1083,8 @@
"Restart it-screen on release": "أعد تشغيل it-screen بعد تحرير المنفذ", "Restart it-screen on release": "أعد تشغيل it-screen بعد تحرير المنفذ",
"it-screen service was stopped temporarily for Modbus scanning and writing.": "تم إيقاف خدمة it-screen مؤقتًا أثناء فحص وكتابة Modbus.", "it-screen service was stopped temporarily for Modbus scanning and writing.": "تم إيقاف خدمة it-screen مؤقتًا أثناء فحص وكتابة Modbus.",
"it-screen service was restarted after the Modbus session.": "تمت إعادة تشغيل خدمة it-screen بعد جلسة Modbus.", "it-screen service was restarted after the Modbus session.": "تمت إعادة تشغيل خدمة it-screen بعد جلسة Modbus.",
"it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.\n\nContinue?": "خدمة it-screen تعمل حاليًا على هذا المسار التسلسلي. سيؤدي الإجراء \"{action}\" إلى إيقاف it-screen مؤقتًا لأن نتائج الفحص والكتابة تكون غير موثوقة أثناء نشاط it-screen.\n\nهل تريد المتابعة؟", "Temporarily stop it-screen?": "هل تريد إيقاف it-screen مؤقتًا؟",
"it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.": "خدمة it-screen تعمل حاليًا على هذا المسار التسلسلي. سيؤدي الإجراء \"{action}\" إلى إيقاف it-screen مؤقتًا لأن نتائج الفحص والكتابة تكون غير موثوقة أثناء نشاط it-screen.",
"{action} was cancelled because it-screen is still running.": "تم إلغاء الإجراء \"{action}\" لأن خدمة it-screen ما زالت قيد التشغيل.", "{action} was cancelled because it-screen is still running.": "تم إلغاء الإجراء \"{action}\" لأن خدمة it-screen ما زالت قيد التشغيل.",
"it-screen did not stop in time for {action}.": "لم تتوقف خدمة it-screen في الوقت المناسب لتنفيذ الإجراء \"{action}\".", "it-screen did not stop in time for {action}.": "لم تتوقف خدمة it-screen في الوقت المناسب لتنفيذ الإجراء \"{action}\".",
"Not available": "غير متاح", "Not available": "غير متاح",
@ -1541,7 +1544,8 @@
"Restart it-screen on release": "रिलीज़ के बाद it-screen फिर से चालू करें", "Restart it-screen on release": "रिलीज़ के बाद it-screen फिर से चालू करें",
"it-screen service was stopped temporarily for Modbus scanning and writing.": "Modbus स्कैनिंग और लिखने के लिए it-screen सेवा अस्थायी रूप से रोकी गई थी।", "it-screen service was stopped temporarily for Modbus scanning and writing.": "Modbus स्कैनिंग और लिखने के लिए it-screen सेवा अस्थायी रूप से रोकी गई थी।",
"it-screen service was restarted after the Modbus session.": "Modbus सत्र के बाद it-screen सेवा फिर से शुरू की गई।", "it-screen service was restarted after the Modbus session.": "Modbus सत्र के बाद it-screen सेवा फिर से शुरू की गई।",
"it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.\n\nContinue?": "इस serial path पर it-screen अभी चल रहा है। \"{action}\" के लिए it-screen को अस्थायी रूप से रोका जाएगा, क्योंकि it-screen सक्रिय रहने पर scan और write के परिणाम भरोसेमंद नहीं होते।\n\nक्या जारी रखें?", "Temporarily stop it-screen?": "क्या it-screen को अस्थायी रूप से रोकें?",
"it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.": "इस serial path पर it-screen अभी चल रहा है। \"{action}\" के लिए it-screen को अस्थायी रूप से रोका जाएगा, क्योंकि it-screen सक्रिय रहने पर scan और write के परिणाम भरोसेमंद नहीं होते।",
"{action} was cancelled because it-screen is still running.": "\"{action}\" रद्द कर दिया गया क्योंकि it-screen अभी भी चल रहा है।", "{action} was cancelled because it-screen is still running.": "\"{action}\" रद्द कर दिया गया क्योंकि it-screen अभी भी चल रहा है।",
"it-screen did not stop in time for {action}.": "\"{action}\" के लिए it-screen सेवा समय पर बंद नहीं हुई।", "it-screen did not stop in time for {action}.": "\"{action}\" के लिए it-screen सेवा समय पर बंद नहीं हुई।",
"Not available": "उपलब्ध नहीं", "Not available": "उपलब्ध नहीं",

View File

@ -4073,7 +4073,11 @@
const currentPortInfo = modbusSelectedPortStatus() || {}; const currentPortInfo = modbusSelectedPortStatus() || {};
const itscreenConflict = !!(currentPortInfo.itscreen_running && String(log.port || "").endsWith("ttyS3")); const itscreenConflict = !!(currentPortInfo.itscreen_running && String(log.port || "").endsWith("ttyS3"));
if (itscreenConflict) { if (itscreenConflict) {
const confirmed = window.confirm(t("it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.\n\nContinue?", { action: actionLabel })); const confirmed = await confirmAction(
t("Temporarily stop it-screen?"),
t("it-screen is running on this serial path. {action} will stop it-screen temporarily because scan and write results are unreliable while it-screen is active.", { action: actionLabel }),
t("Continue")
);
if (!confirmed) { if (!confirmed) {
appendModbusLog(t("{action} was cancelled because it-screen is still running.", { action: actionLabel }), "warn"); appendModbusLog(t("{action} was cancelled because it-screen is still running.", { action: actionLabel }), "warn");
return false; return false;