diff --git a/client/src/Hooks/UseToast.ts b/client/src/Hooks/UseToast.ts index 72e7b18c9..a0da495bc 100644 --- a/client/src/Hooks/UseToast.ts +++ b/client/src/Hooks/UseToast.ts @@ -20,6 +20,8 @@ export const useToast = () => { showToast(msg, { ...opts, type: "error" }); const toastInfo = (msg: string, opts?: ToastOptions) => showToast(msg, { ...opts, type: "info" }); + const toastWarning = (msg: string, opts?: ToastOptions) => + showToast(msg, { ...opts, type: "warning" }); - return { showToast, toastSuccess, toastError, toastInfo }; + return { showToast, toastSuccess, toastError, toastInfo, toastWarning }; }; diff --git a/client/src/Hooks/useBulkMonitorActions.ts b/client/src/Hooks/useBulkMonitorActions.ts index 268137392..64f87a5eb 100644 --- a/client/src/Hooks/useBulkMonitorActions.ts +++ b/client/src/Hooks/useBulkMonitorActions.ts @@ -9,7 +9,10 @@ import type { Monitor } from "@/Types/Monitor"; interface ApiResponse { success: boolean; msg: string; - data: Monitor[]; + data: { + monitors: Monitor[]; + failedCount: number; + }; } interface UseBulkMonitorActionsReturn { @@ -25,7 +28,7 @@ export const useBulkMonitorActions = ( page?: number ): UseBulkMonitorActionsReturn => { const [selectedRows, setSelectedRows] = useState([]); - const { toastSuccess, toastError, toastInfo } = useToast(); + const { toastSuccess, toastError, toastInfo, toastWarning } = useToast(); const { t } = useTranslation(); // Clear selection when page changes @@ -40,13 +43,21 @@ export const useBulkMonitorActions = ( pause, }); - const affectedCount = res.data?.data?.length ?? 0; + const affectedCount = res.data?.data?.monitors?.length ?? 0; + const failedCount = res.data?.data?.failedCount ?? 0; if (affectedCount === 0) { const key = pause ? "pages.common.monitors.bulkPause.alreadyPaused" : "pages.common.monitors.bulkPause.alreadyRunning"; toastInfo(t(key, { count: selectedRows.length })); + } else if (failedCount > 0) { + toastWarning( + t("pages.common.monitors.bulkPause.partialFailure", { + successCount: affectedCount, + failedCount, + }) + ); } else { const key = pause ? "pages.common.monitors.bulkPause.paused" diff --git a/client/src/locales/ar.json b/client/src/locales/ar.json index 9df395661..504fa5b49 100644 --- a/client/src/locales/ar.json +++ b/client/src/locales/ar.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "الشاشة المحددة متوقفة مؤقتاً بالفعل", "alreadyPaused_other": "جميع الشاشات المحددة متوقفة مؤقتاً بالفعل", "alreadyRunning_one": "الشاشة المحددة قيد التشغيل بالفعل", - "alreadyRunning_other": "جميع الشاشات المحددة قيد التشغيل بالفعل" + "alreadyRunning_other": "جميع الشاشات المحددة قيد التشغيل بالفعل", + "partialFailure": "تم تحديث {{successCount}} من أجهزة المراقبة، ولكن فشلت مزامنة {{failedCount}} مع قائمة انتظار الوظائف" } } }, diff --git a/client/src/locales/ca.json b/client/src/locales/ca.json index 259acf0ab..9760e7157 100644 --- a/client/src/locales/ca.json +++ b/client/src/locales/ca.json @@ -476,7 +476,8 @@ "paused_one": "{{count}} monitor pausat", "paused_other": "{{count}} monitors pausats", "resumed_one": "{{count}} monitor reprès", - "resumed_other": "{{count}} monitors represos" + "resumed_other": "{{count}} monitors represos", + "partialFailure": "S'han actualitzat {{successCount}} monitors, però {{failedCount}} han fallat en sincronitzar-se amb la cua de tasques" } } }, diff --git a/client/src/locales/cs.json b/client/src/locales/cs.json index 79969899c..9f7ba63d5 100644 --- a/client/src/locales/cs.json +++ b/client/src/locales/cs.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "Vybraný monitor je již pozastaven", "alreadyPaused_other": "Všechny vybrané monitory jsou již pozastaveny", "alreadyRunning_one": "Vybraný monitor již běží", - "alreadyRunning_other": "Všechny vybrané monitory již běží" + "alreadyRunning_other": "Všechny vybrané monitory již běží", + "partialFailure": "Bylo aktualizováno {{successCount}} monitorů, ale u {{failedCount}} se nezdařila synchronizace s frontou úloh" } } }, diff --git a/client/src/locales/de.json b/client/src/locales/de.json index 09f644cd2..2c6a33ae4 100644 --- a/client/src/locales/de.json +++ b/client/src/locales/de.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "Der ausgewählte Monitor ist bereits pausiert", "alreadyPaused_other": "Alle ausgewählten Monitore sind bereits pausiert", "alreadyRunning_one": "Der ausgewählte Monitor wird bereits ausgeführt", - "alreadyRunning_other": "Alle ausgewählten Monitore werden bereits ausgeführt" + "alreadyRunning_other": "Alle ausgewählten Monitore werden bereits ausgeführt", + "partialFailure": "{{successCount}} Monitore aktualisiert, aber {{failedCount}} konnten nicht mit der Job-Warteschlange synchronisiert werden" } } }, diff --git a/client/src/locales/en.json b/client/src/locales/en.json index 14b19851b..fc1e7ea7d 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -450,7 +450,8 @@ "paused_one": "{{count}} monitor paused", "paused_other": "{{count}} monitors paused", "resumed_one": "{{count}} monitor resumed", - "resumed_other": "{{count}} monitors resumed" + "resumed_other": "{{count}} monitors resumed", + "partialFailure": "{{successCount}} monitors updated, but {{failedCount}} failed to sync with the job queue" }, "statBoxes": { "activeFor": "Active for", diff --git a/client/src/locales/es.json b/client/src/locales/es.json index 67e2b0dcd..70dd557d0 100644 --- a/client/src/locales/es.json +++ b/client/src/locales/es.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "El monitor seleccionado ya está pausado", "alreadyPaused_other": "Todos los monitores seleccionados ya están pausados", "alreadyRunning_one": "El monitor seleccionado ya se está ejecutando", - "alreadyRunning_other": "Todos los monitores seleccionados ya se están ejecutando" + "alreadyRunning_other": "Todos los monitores seleccionados ya se están ejecutando", + "partialFailure": "Se actualizaron {{successCount}} monitores, pero {{failedCount}} fallaron al sincronizarse con la cola de trabajos" } } }, diff --git a/client/src/locales/fi.json b/client/src/locales/fi.json index f7e69775b..3c34577a2 100644 --- a/client/src/locales/fi.json +++ b/client/src/locales/fi.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "Valittu näyttö on jo keskeytetty", "alreadyPaused_other": "Kaikki valitut näytöt on jo keskeytetty", "alreadyRunning_one": "Valittu näyttö on jo käynnissä", - "alreadyRunning_other": "Kaikki valitut näytöt ovat jo käynnissä" + "alreadyRunning_other": "Kaikki valitut näytöt ovat jo käynnissä", + "partialFailure": "{{successCount}} monitoria päivitettiin, mutta {{failedCount}} epäonnistui synkronoinnissa työjonon kanssa" } } }, diff --git a/client/src/locales/fr.json b/client/src/locales/fr.json index d398864e2..49e7e94bc 100644 --- a/client/src/locales/fr.json +++ b/client/src/locales/fr.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "Le moniteur sélectionné est déjà en pause", "alreadyPaused_other": "Tous les moniteurs sélectionnés sont déjà en pause", "alreadyRunning_one": "Le moniteur sélectionné est déjà en cours d'exécution", - "alreadyRunning_other": "Tous les moniteurs sélectionnés sont déjà en cours d'exécution" + "alreadyRunning_other": "Tous les moniteurs sélectionnés sont déjà en cours d'exécution", + "partialFailure": "{{successCount}} moniteurs mis à jour, mais {{failedCount}} n'ont pas pu se synchroniser avec la file d'attente des tâches" } } }, diff --git a/client/src/locales/ja.json b/client/src/locales/ja.json index af53ce232..eb97dc105 100644 --- a/client/src/locales/ja.json +++ b/client/src/locales/ja.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "選択したモニターはすでに一時停止されています", "alreadyPaused_other": "選択したすべてのモニターはすでに一時停止されています", "alreadyRunning_one": "選択したモニターはすでに実行中です", - "alreadyRunning_other": "選択したすべてのモニターはすでに実行中です" + "alreadyRunning_other": "選択したすべてのモニターはすでに実行中です", + "partialFailure": "{{successCount}} 個のモニターが更新されましたが、{{failedCount}} 個はジョブキューとの同期に失敗しました" } } }, diff --git a/client/src/locales/pt-BR.json b/client/src/locales/pt-BR.json index 1ab833c0c..39cbf4577 100644 --- a/client/src/locales/pt-BR.json +++ b/client/src/locales/pt-BR.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "O monitor selecionado já está pausado", "alreadyPaused_other": "Todos os monitores selecionados já estão pausados", "alreadyRunning_one": "O monitor selecionado já está em execução", - "alreadyRunning_other": "Todos os monitores selecionados já estão em execução" + "alreadyRunning_other": "Todos os monitores selecionados já estão em execução", + "partialFailure": "{{successCount}} monitores atualizados, mas {{failedCount}} falharam ao sincronizar com a fila de trabalhos" } } }, diff --git a/client/src/locales/ru.json b/client/src/locales/ru.json index c6f247ba8..9bfd20481 100644 --- a/client/src/locales/ru.json +++ b/client/src/locales/ru.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "Выбранный монитор уже приостановлен", "alreadyPaused_other": "Все выбранные мониторы уже приостановлены", "alreadyRunning_one": "Выбранный монитор уже запущен", - "alreadyRunning_other": "Все выбранные мониторы уже запущены" + "alreadyRunning_other": "Все выбранные мониторы уже запущены", + "partialFailure": "Обновлено {{successCount}} мониторов, но {{failedCount}} не удалось синхронизировать с очередью задач" } } }, diff --git a/client/src/locales/th.json b/client/src/locales/th.json index 34a0755fc..5873b65d4 100644 --- a/client/src/locales/th.json +++ b/client/src/locales/th.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "จอภาพที่เลือกถูกหยุดชั่วคราวแล้ว", "alreadyPaused_other": "จอภาพที่เลือกทั้งหมดถูกหยุดชั่วคราวแล้ว", "alreadyRunning_one": "จอภาพที่เลือกกำลังทำงานอยู่แล้ว", - "alreadyRunning_other": "จอภาพที่เลือกทั้งหมดกำลังทำงานอยู่แล้ว" + "alreadyRunning_other": "จอภาพที่เลือกทั้งหมดกำลังทำงานอยู่แล้ว", + "partialFailure": "อัปเดตมอนิเตอร์ {{successCount}} รายการแล้ว แต่ {{failedCount}} รายการไม่สามารถซิงค์กับคิวงานได้" } } }, diff --git a/client/src/locales/tr.json b/client/src/locales/tr.json index fdb9506e2..2d6deaa97 100644 --- a/client/src/locales/tr.json +++ b/client/src/locales/tr.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "Seçili monitör zaten duraklatıldı", "alreadyPaused_other": "Seçili tüm monitörler zaten duraklatıldı", "alreadyRunning_one": "Seçili monitör zaten çalışıyor", - "alreadyRunning_other": "Seçili tüm monitörler zaten çalışıyor" + "alreadyRunning_other": "Seçili tüm monitörler zaten çalışıyor", + "partialFailure": "{{successCount}} monitör güncellendi, ancak {{failedCount}} tanesi iş kuyruğuyla senkronize edilemedi" } } }, diff --git a/client/src/locales/uk.json b/client/src/locales/uk.json index c036318b7..de40bbf05 100644 --- a/client/src/locales/uk.json +++ b/client/src/locales/uk.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "Вибраний монітор уже призупинено", "alreadyPaused_other": "Всі вибрані монітори уже призупинено", "alreadyRunning_one": "Вибраний монітор уже запущено", - "alreadyRunning_other": "Всі вибрані монітори уже запущено" + "alreadyRunning_other": "Всі вибрані монітори уже запущено", + "partialFailure": "Оновлено {{successCount}} моніторів, але {{failedCount}} не вдалося синхронізувати з чергою завдань" } } }, diff --git a/client/src/locales/vi.json b/client/src/locales/vi.json index 15665bb91..13907f21b 100644 --- a/client/src/locales/vi.json +++ b/client/src/locales/vi.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "Màn hình đã chọn đã được tạm dừng", "alreadyPaused_other": "Tất cả các màn hình đã chọn đã được tạm dừng", "alreadyRunning_one": "Màn hình đã chọn đã đang chạy", - "alreadyRunning_other": "Tất cả các màn hình đã chọn đã đang chạy" + "alreadyRunning_other": "Tất cả các màn hình đã chọn đã đang chạy", + "partialFailure": "Đã cập nhật {{successCount}} trình giám sát, nhưng {{failedCount}} trình giám sát không thể đồng bộ hóa với hàng đợi công việc" } } }, diff --git a/client/src/locales/zh-CN.json b/client/src/locales/zh-CN.json index 08259e06f..a7166e6c2 100644 --- a/client/src/locales/zh-CN.json +++ b/client/src/locales/zh-CN.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "所选监视器已暂停", "alreadyPaused_other": "所有选定的监视器均已暂停", "alreadyRunning_one": "所选监视器已经在运行", - "alreadyRunning_other": "所有选定的监视器均已在运行" + "alreadyRunning_other": "所有选定的监视器均已在运行", + "partialFailure": "已更新 {{successCount}} 个监控,但有 {{failedCount}} 个无法与任务队列同步" } } }, diff --git a/client/src/locales/zh-TW.json b/client/src/locales/zh-TW.json index b05ef5deb..ba599bb4f 100644 --- a/client/src/locales/zh-TW.json +++ b/client/src/locales/zh-TW.json @@ -476,7 +476,8 @@ "alreadyPaused_one": "所選監視器已暫停", "alreadyPaused_other": "所有選定的監視器均已暫停", "alreadyRunning_one": "所選監視器已經在運行", - "alreadyRunning_other": "所有選定的監視器均已在運行" + "alreadyRunning_other": "所有選定的監視器均已在運行", + "partialFailure": "已更新 {{successCount}} 個監控,但有 {{failedCount}} 個無法與工作佇列同步" } } },