Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): show each container the restart stops as a name
Yudhi Armyndharis8c3df9a46a6d
diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.jsonindex 8ff156e87..d9c1cbf73 100644--- a/dashboard/src/i18n/locales/ar.json+++ b/dashboard/src/i18n/locales/ar.json@@ -1248,7 +1248,7 @@"successTitle": "✅ الخادم جاهز","errorTitle": "❌ فشلت إعادة التشغيل","idleDesc": "تم حفظ الإعدادات في <code>.env.generated</code>.<br/>يلزم إعادة تشغيل الخادم لتطبيق التغييرات.",- "stopsContainers": "ستوقف إعادة التشغيل أيضًا هذه الحاويات المدمجة: {{names}}. تبقى محفوظة مع بياناتها ولا تُحذف.",+ "stopsContainers": "ستوقف إعادة التشغيل أيضًا هذه الحاويات المدمجة، وتبقى محفوظة مع بياناتها ولا تُحذف:","later": "إعادة التشغيل لاحقاً","now": "إعادة التشغيل الآن","restartingMsg": "جارٍ إعادة تشغيل الخادم... {{count}} ثانية",diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.jsonindex 06c135752..22f92c84c 100644--- a/dashboard/src/i18n/locales/de.json+++ b/dashboard/src/i18n/locales/de.json@@ -1233,7 +1233,7 @@"successTitle": "Server bereit","errorTitle": "Neustart fehlgeschlagen","idleDesc": "Die Konfiguration wurde in <code>.env.generated</code> gespeichert.<br/>Ein Serverneustart ist erforderlich, um die Änderungen anzuwenden.",- "stopsContainers": "Der Neustart stoppt außerdem diese integrierten Container: {{names}}. Sie bleiben mit ihren Daten erhalten und werden nicht gelöscht.",+ "stopsContainers": "Der Neustart stoppt außerdem diese integrierten Container, die mit ihren Daten erhalten bleiben und nicht gelöscht werden:","later": "Später neu starten","now": "Jetzt neu starten","restartingMsg": "Server wird neu gestartet... {{count}} s",diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.jsonindex 33f41bd21..a3ffc45dc 100644--- a/dashboard/src/i18n/locales/en.json+++ b/dashboard/src/i18n/locales/en.json@@ -1233,7 +1233,7 @@"successTitle": "Server ready","errorTitle": "Restart failed","idleDesc": "Configuration has been saved to <code>.env.generated</code>.<br/>A server restart is required to apply the changes.",- "stopsContainers": "The restart also stops these built-in containers: {{names}}. They are kept with their data, not deleted.",+ "stopsContainers": "The restart also stops these built-in containers, which keep their data and are not deleted:","later": "Restart Later","now": "Restart Now","restartingMsg": "Server restarting... {{count}}s",diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.jsonindex 6b2c88137..f0000acf3 100644--- a/dashboard/src/i18n/locales/es.json+++ b/dashboard/src/i18n/locales/es.json@@ -1220,7 +1220,7 @@"successTitle": "✅ Servidor listo","errorTitle": "❌ Error al reiniciar","idleDesc": "La configuración se ha guardado en <code>.env.generated</code>.<br/>Es necesario reiniciar el servidor para aplicar los cambios.",- "stopsContainers": "El reinicio también detendrá estos contenedores integrados: {{names}}. Se conservan con sus datos; no se eliminan.",+ "stopsContainers": "El reinicio también detendrá estos contenedores integrados, que conservan sus datos y no se eliminan:","later": "Reiniciar más tarde","now": "Reiniciar ahora","restartingMsg": "Reiniciando servidor... {{count}}s",diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.jsonindex ba6008a9b..6d393f5d1 100644--- a/dashboard/src/i18n/locales/fr.json+++ b/dashboard/src/i18n/locales/fr.json@@ -1220,7 +1220,7 @@"successTitle": "✅ Serveur prêt","errorTitle": "❌ Échec du redémarrage","idleDesc": "La configuration a été enregistrée dans <code>.env.generated</code>.<br/>Un redémarrage du serveur est nécessaire pour appliquer les modifications.",- "stopsContainers": "Le redémarrage arrêtera aussi ces conteneurs intégrés : {{names}}. Ils sont conservés avec leurs données, pas supprimés.",+ "stopsContainers": "Le redémarrage arrêtera aussi ces conteneurs intégrés, qui gardent leurs données et ne sont pas supprimés :","later": "Redémarrer plus tard","now": "Redémarrer maintenant","restartingMsg": "Redémarrage du serveur... {{count}}s",diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.jsonindex b9113d461..a78adee59 100644--- a/dashboard/src/i18n/locales/he.json+++ b/dashboard/src/i18n/locales/he.json@@ -1230,7 +1230,7 @@"successTitle": "✅ השרת מוכן","errorTitle": "❌ האתחול נכשל","idleDesc": "התצורה נשמרה ל-<code>.env.generated</code>.<br/>נדרש אתחול שרת כדי להחיל את השינויים.",- "stopsContainers": "האתחול יעצור גם את הקונטיינרים המובנים האלה: {{names}}. הם נשמרים עם הנתונים שלהם ואינם נמחקים.",+ "stopsContainers": "האתחול יעצור גם את הקונטיינרים המובנים האלה, שנשמרים עם הנתונים שלהם ואינם נמחקים:","later": "אתחול מאוחר יותר","now": "אתחול עכשיו","restartingMsg": "השרת מתאתחל... {{count}} שניות",diff --git a/dashboard/src/i18n/locales/hi.json b/dashboard/src/i18n/locales/hi.jsonindex 4c60388aa..b672b9f5d 100644--- a/dashboard/src/i18n/locales/hi.json+++ b/dashboard/src/i18n/locales/hi.json@@ -1233,7 +1233,7 @@"successTitle": "सर्वर तैयार है","errorTitle": "पुनरारंभ विफल","idleDesc": "कॉन्फ़िगरेशन <code>.env.generated</code> में सहेज लिया गया है।<br/>परिवर्तनों को लागू करने के लिए एक सर्वर पुनरारंभ आवश्यक है।",- "stopsContainers": "पुनरारंभ इन अंतर्निहित कंटेनरों को भी रोक देगा: {{names}}। वे अपने डेटा के साथ रखे जाते हैं, हटाए नहीं जाते।",+ "stopsContainers": "पुनरारंभ इन अंतर्निहित कंटेनरों को भी रोक देगा, जो अपने डेटा के साथ रखे जाते हैं और हटाए नहीं जाते:","later": "बाद में पुनरारंभ करें","now": "अभी पुनरारंभ करें","restartingMsg": "सर्वर पुनरारंभ हो रहा है... {{count}}s",diff --git a/dashboard/src/i18n/locales/id.json b/dashboard/src/i18n/locales/id.jsonindex 24d025b8b..4979e3c53 100644--- a/dashboard/src/i18n/locales/id.json+++ b/dashboard/src/i18n/locales/id.json@@ -1233,7 +1233,7 @@"successTitle": "Server siap","errorTitle": "Restart gagal","idleDesc": "Konfigurasi telah disimpan ke <code>.env.generated</code>.<br/>Restart server diperlukan untuk menerapkan perubahan.",- "stopsContainers": "Restart juga akan menghentikan container bawaan berikut: {{names}}. Container tetap disimpan beserta datanya, tidak dihapus.",+ "stopsContainers": "Restart juga akan menghentikan container bawaan berikut, yang tetap menyimpan datanya dan tidak dihapus:","later": "Restart Nanti","now": "Restart Sekarang","restartingMsg": "Me-restart server... {{count}}d",diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.jsonindex 5c94d202a..cfe77e1fd 100644--- a/dashboard/src/i18n/locales/it.json+++ b/dashboard/src/i18n/locales/it.json@@ -1220,7 +1220,7 @@"successTitle": "✅ Server Pronto","errorTitle": "❌ Riavvio Fallito","idleDesc": "La configurazione è stata salvata in <code>.env.generated</code>.<br/>È richiesto un riavvio del server per applicare le modifiche.",- "stopsContainers": "Il riavvio arresterà anche questi container integrati: {{names}}. Vengono conservati con i loro dati, non eliminati.",+ "stopsContainers": "Il riavvio arresterà anche questi container integrati, che conservano i loro dati e non vengono eliminati:","later": "Riavvia Più Tardi","now": "Riavvia Ora","restartingMsg": "Riavvio del server... {{count}}s",diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.jsonindex 0688bbb57..d5911a3d0 100644--- a/dashboard/src/i18n/locales/ko.json+++ b/dashboard/src/i18n/locales/ko.json@@ -1233,7 +1233,7 @@"successTitle": "서버 준비 완료","errorTitle": "재시작 실패","idleDesc": "설정이 <code>.env.generated</code>에 저장되었습니다.<br/>변경 사항을 적용하려면 서버를 재시작해야 합니다.",- "stopsContainers": "재시작하면 다음 내장 컨테이너도 중지됩니다: {{names}}. 컨테이너는 데이터와 함께 보존되며 삭제되지 않습니다.",+ "stopsContainers": "재시작하면 다음 내장 컨테이너도 중지됩니다. 데이터와 함께 보존되며 삭제되지 않습니다:","later": "나중에 재시작","now": "지금 재시작","restartingMsg": "서버를 재시작하는 중... {{count}}초",diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.jsonindex d2452f6f4..03c82af21 100644--- a/dashboard/src/i18n/locales/pt-BR.json+++ b/dashboard/src/i18n/locales/pt-BR.json@@ -1220,7 +1220,7 @@"successTitle": "✅ Servidor pronto","errorTitle": "❌ Erro ao reiniciar","idleDesc": "A configuração foi salva em <code>.env.generated</code>.<br/>É necessário reiniciar o servidor para aplicar as alterações.",- "stopsContainers": "A reinicialização também vai parar estes contêineres integrados: {{names}}. Eles são mantidos com seus dados, não excluídos.",+ "stopsContainers": "A reinicialização também vai parar estes contêineres integrados, que mantêm seus dados e não são excluídos:","later": "Reiniciar depois","now": "Reiniciar agora","restartingMsg": "Reiniciando servidor... {{count}}s",diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.jsonindex 3012e1706..9574c8c84 100644--- a/dashboard/src/i18n/locales/te.json+++ b/dashboard/src/i18n/locales/te.json@@ -1211,7 +1211,7 @@"successTitle": "✅ సర్వర్ సిద్ధంగా ఉంది","errorTitle": "❌ రీస్టార్ట్ విఫలమైంది","idleDesc": "కాన్ఫిగరేషన్ <code>.env.generated</code> కు సేవ్ చేయబడింది.<br/>మార్పులను వర్తింపజేయడానికి సర్వర్ రీస్టార్ట్ అవసరం.",- "stopsContainers": "రీస్టార్ట్ ఈ ఇన్-బిల్ట్ కంటైనర్లను కూడా ఆపుతుంది: {{names}}. అవి వాటి డేటాతో అలాగే ఉంచబడతాయి, తొలగించబడవు.",+ "stopsContainers": "రీస్టార్ట్ ఈ ఇన్-బిల్ట్ కంటైనర్లను కూడా ఆపుతుంది, అవి వాటి డేటాతో అలాగే ఉంచబడతాయి, తొలగించబడవు:","later": "తర్వాత రీస్టార్ట్ చేయి","now": "ఇప్పుడే రీస్టార్ట్ చేయి","restartingMsg": "సర్వర్ రీస్టార్ట్ అవుతోంది... {{count}}సెకన్లు",diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.jsonindex 7c25efc76..3dea7c908 100644--- a/dashboard/src/i18n/locales/tr.json+++ b/dashboard/src/i18n/locales/tr.json@@ -1233,7 +1233,7 @@"successTitle": "Sunucu hazır","errorTitle": "Yeniden başlatma başarısız","idleDesc": "Yapılandırma <code>.env.generated</code> dosyasına kaydedildi.<br/>Değişikliklerin uygulanması için sunucunun yeniden başlatılması gerekir.",- "stopsContainers": "Yeniden başlatma şu dahili konteynerleri de durdurur: {{names}}. Verileriyle birlikte saklanırlar, silinmezler.",+ "stopsContainers": "Yeniden başlatma şu dahili konteynerleri de durdurur; verileriyle birlikte saklanırlar ve silinmezler:","later": "Daha Sonra Yeniden Başlat","now": "Şimdi Yeniden Başlat","restartingMsg": "Sunucu yeniden başlatılıyor... {{count}}s",diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.jsonindex 4f012a4dc..b3719d796 100644--- a/dashboard/src/i18n/locales/zh-CN.json+++ b/dashboard/src/i18n/locales/zh-CN.json@@ -1211,7 +1211,7 @@"successTitle": "✅ 服务器就绪","errorTitle": "❌ 重启失败","idleDesc": "配置已保存到 <code>.env.generated</code>。<br/>需要重启服务器才能应用更改。",- "stopsContainers": "重启还会停止以下内置容器:{{names}}。它们会连同数据一起保留,不会被删除。",+ "stopsContainers": "重启还会停止以下内置容器,它们会连同数据一起保留,不会被删除:","later": "稍后重启","now": "立即重启","restartingMsg": "服务器正在重启... {{count}} 秒",diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.jsonindex f450c300a..219a389cd 100644--- a/dashboard/src/i18n/locales/zh-HK.json+++ b/dashboard/src/i18n/locales/zh-HK.json@@ -1211,7 +1211,7 @@"successTitle": "✅ 伺服器就緒","errorTitle": "❌ 重新啟動失敗","idleDesc": "設定已儲存到 <code>.env.generated</code>。<br/>需要重新啟動伺服器才能套用變更。",- "stopsContainers": "重新啟動亦會停止以下內置容器:{{names}}。它們會連同數據一併保留,不會被刪除。",+ "stopsContainers": "重新啟動亦會停止以下內置容器,它們會連同數據一併保留,不會被刪除:","later": "稍後重新啟動","now": "立即重新啟動","restartingMsg": "伺服器正在重新啟動... {{count}} 秒",diff --git a/dashboard/src/pages/Infrastructure.css b/dashboard/src/pages/Infrastructure.cssindex 099e4e070..7367fa581 100644--- a/dashboard/src/pages/Infrastructure.css+++ b/dashboard/src/pages/Infrastructure.css@@ -712,6 +712,10 @@margin-bottom: 1.5rem;}+.infrastructure-page .restart-stop-name {+ white-space: nowrap;+}+.infrastructure-page .restart-actions {display: flex;gap: 1rem;diff --git a/dashboard/src/pages/Infrastructure.test.ts b/dashboard/src/pages/Infrastructure.test.tsindex 3d5dd0abe..d434d2088 100644--- a/dashboard/src/pages/Infrastructure.test.ts+++ b/dashboard/src/pages/Infrastructure.test.ts@@ -822,7 +822,8 @@ test('a switch from bundled to external services is warned of and stops the bund};assert.deepEqual([body.database?.builtIn, body.redis?.builtIn, body.storage?.builtIn], [false, false, false]);- within(dialog).getByText(STOPS_ALL_THREE);+ within(dialog).getByText(STOPS_SENTENCE, { exact: false });+ assert.deepEqual(stopNames(dialog), ALL_THREE);fireEvent.click(within(dialog).getByRole('button', { name: 'Restart Now' }));await waitFor(() => assert.ok(findFetchCall('POST', '/api/infra/restart'), 'expected the restart POST'));assert.deepEqual(findFetchCall('POST', '/api/infra/restart')!.body, {@@ -831,8 +832,13 @@ test('a switch from bundled to external services is warned of and stops the bund});});-const STOPS_ALL_THREE =- 'The restart also stops these built-in containers: openwa-postgres, openwa-redis, openwa-minio. They are kept with their data, not deleted.';+const STOPS_SENTENCE = 'The restart also stops these built-in containers, which keep their data and are not deleted:';+const ALL_THREE = ['openwa-postgres', 'openwa-redis', 'openwa-minio'];++// The containers the restart dialog names, one chip each.+function stopNames(dialog: HTMLElement): string[] {+ return Array.from(dialog.querySelectorAll('.restart-stop-name')).map(chip => chip.textContent ?? '');+}const PENDING_BUILT_IN_NOTE ='Saved, but not applied yet: the server runs with an external service now, and a restart switches it to the built-in container.';@@ -1893,7 +1899,7 @@ test('turning a running built-in Redis off asks the restart to stop its containefireEvent.click(screen.getByRole('button', { name: 'Save Configuration' }));const dialog = await screen.findByRole('dialog');- within(dialog).getByText(/stops these built-in containers: openwa-redis\./);+ assert.deepEqual(stopNames(dialog), ['openwa-redis']);fireEvent.click(within(dialog).getByRole('button', { name: 'Restart Now' }));await waitFor(() => assert.ok(findFetchCall('POST', '/api/infra/restart'), 'expected the restart POST'));@@ -2034,7 +2040,7 @@ const PINNED_AWAY_SAVED: SavedConfig = {},};-async function saveAndRestart(): Promise<{ dialogText: string; body: unknown }> {+async function saveAndRestart(): Promise<{ dialogText: string; names: string[]; body: unknown }> {const { screen, waitFor, fireEvent, within } = rtl;const { container } = renderInfrastructure();await screen.findByText('Database Configuration');@@ -2043,18 +2049,20 @@ async function saveAndRestart(): Promise<{ dialogText: string; body: unknown }>fireEvent.click(screen.getByRole('button', { name: 'Save Configuration' }));const dialog = await screen.findByRole('dialog');const dialogText = dialog.textContent ?? '';+ const names = stopNames(dialog);fireEvent.click(within(dialog).getByRole('button', { name: 'Restart Now' }));await waitFor(() => assert.ok(findFetchCall('POST', '/api/infra/restart'), 'expected the restart POST'));- return { dialogText, body: findFetchCall('POST', '/api/infra/restart')!.body };+ return { dialogText, names, body: findFetchCall('POST', '/api/infra/restart')!.body };}test('a bundled container OpenWA created whose host the environment pins elsewhere is stopped and named', async () => {resetFetchCalls();overrides = { status: PINNED_AWAY, saved: PINNED_AWAY_SAVED, saveProfiles: ['postgres', 'redis', 'minio'] };- const { dialogText, body } = await saveAndRestart();+ const { dialogText, names, body } = await saveAndRestart();- assert.ok(dialogText.includes(STOPS_ALL_THREE), dialogText);+ assert.ok(dialogText.includes(STOPS_SENTENCE), dialogText);+ assert.deepEqual(names, ALL_THREE);assert.deepEqual(body, { profiles: [], profilesToRemove: ['postgres', 'redis', 'minio'] });});@@ -2068,9 +2076,10 @@ test('a configuration that cannot be read back after the save still opens the resavedAfterSaveFails: true,};- const { dialogText, body } = await saveAndRestart();+ const { dialogText, names, body } = await saveAndRestart();- assert.ok(dialogText.includes(STOPS_ALL_THREE), dialogText);+ assert.ok(dialogText.includes(STOPS_SENTENCE), dialogText);+ assert.deepEqual(names, ALL_THREE);assert.deepEqual(body, { profiles: [], profilesToRemove: ['postgres', 'redis', 'minio'] });});@@ -2084,8 +2093,9 @@ test('a bundled container Docker Compose created is left alone under a host pinn};overrides = { status: compose, saved: PINNED_AWAY_SAVED, saveProfiles: ['postgres', 'redis', 'minio'] };- const { dialogText, body } = await saveAndRestart();+ const { dialogText, names, body } = await saveAndRestart();+ assert.deepEqual(names, []);assert.doesNotMatch(dialogText, /openwa-/);assert.deepEqual(body, { profiles: ['postgres', 'redis', 'minio'], profilesToRemove: [] });});@@ -2096,9 +2106,9 @@ test('a host pinned to the container name still reaches the container, which isconst saved = { ...PINNED_AWAY_SAVED, database: { ...PINNED_AWAY_SAVED.database, host: 'OpenWA-Postgres' } };overrides = { status, saved, saveProfiles: ['postgres', 'redis', 'minio'] };- const { dialogText, body } = await saveAndRestart();+ const { names, body } = await saveAndRestart();- assert.ok(dialogText.includes('stops these built-in containers: openwa-redis, openwa-minio.'), dialogText);+ assert.deepEqual(names, ['openwa-redis', 'openwa-minio']);assert.deepEqual(body, { profiles: ['postgres'], profilesToRemove: ['redis', 'minio'] });});diff --git a/dashboard/src/pages/Infrastructure.tsx b/dashboard/src/pages/Infrastructure.tsxindex 5e7e84a9e..1d5cad10c 100644--- a/dashboard/src/pages/Infrastructure.tsx+++ b/dashboard/src/pages/Infrastructure.tsx@@ -1,4 +1,4 @@-import { useState, useEffect, useRef } from 'react';+import { Fragment, useState, useEffect, useRef } from 'react';import { useQueryClient } from '@tanstack/react-query';import { Trans, useTranslation } from 'react-i18next';import {@@ -962,9 +962,16 @@ export function Infrastructure() {{/* Without `running` Docker did not answer the status, and the server stops nothing then. */}{infraStatus.database.running !== undefined && restartFlow.profilesToRemove.length > 0 && (<p className="restart-idle-desc">- {t('infrastructure.restart.stopsContainers', {- names: restartFlow.profilesToRemove.map(p => CONTAINER_OF[p] ?? p).join(', '),- })}+ {t('infrastructure.restart.stopsContainers')}+ {/* One left-to-right chip per container, kept whole: a name is what the operator types into docker. */}+ {restartFlow.profilesToRemove.map(p => (+ <Fragment key={p}>+ {' '}+ <code dir="ltr" className="restart-stop-name">+ {CONTAINER_OF[p] ?? p}+ </code>+ </Fragment>+ ))}</p>)}{(restartFlow.dbSwitch || restartFlow.storageSwitch) && (