From 11212c73717e431c62c8138a7d9d9932a270dba9 Mon Sep 17 00:00:00 2001 From: Owaise Imdad Date: Tue, 17 Jun 2025 00:17:46 +0530 Subject: [PATCH] Formatting was done. --- .../Components/MonitorCreateHeader/index.jsx | 2 +- client/src/Hooks/monitorHooks.js | 56 +++++++++---------- client/src/locales/en.json | 8 +-- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/client/src/Components/MonitorCreateHeader/index.jsx b/client/src/Components/MonitorCreateHeader/index.jsx index 7a4d75226..a62123531 100644 --- a/client/src/Components/MonitorCreateHeader/index.jsx +++ b/client/src/Components/MonitorCreateHeader/index.jsx @@ -9,7 +9,7 @@ const CreateMonitorHeader = ({ isAdmin, label, isLoading = true, path, bulkPath const navigate = useNavigate(); const { t } = useTranslation(); const theme = useTheme(); - const [exportMonitors, isExporting] = useExportMonitors() + const [exportMonitors, isExporting] = useExportMonitors(); // Use the provided label or fall back to the translated default diff --git a/client/src/Hooks/monitorHooks.js b/client/src/Hooks/monitorHooks.js index b3e4a9478..d7c8e4287 100644 --- a/client/src/Hooks/monitorHooks.js +++ b/client/src/Hooks/monitorHooks.js @@ -454,36 +454,36 @@ const useCreateBulkMonitors = () => { }; const useExportMonitors = () => { - const [isLoading, setIsLoading] = useState(false); - const { t } = useTranslation(); + const [isLoading, setIsLoading] = useState(false); + const { t } = useTranslation(); - const exportMonitors = async () => { - setIsLoading(true); - try { - const blob = await networkService.exportMonitors(); - - // Create a download link - const url = window.URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.setAttribute('download', 'monitors.csv'); - document.body.appendChild(link); - link.click(); - link.remove(); - window.URL.revokeObjectURL(url); - - createToast({ body: t('export.success') }); - return [true, null]; - } catch (err) { - const errorMessage = err?.response?.data?.msg || err.message; - createToast({ body: errorMessage || t('export.failed') }); - return [false, errorMessage]; - } finally { - setIsLoading(false); - } - }; + const exportMonitors = async () => { + setIsLoading(true); + try { + const blob = await networkService.exportMonitors(); - return [exportMonitors, isLoading]; + // Create a download link + const url = window.URL.createObjectURL(blob); + const link = document.createElement("a"); + link.href = url; + link.setAttribute("download", "monitors.csv"); + document.body.appendChild(link); + link.click(); + link.remove(); + window.URL.revokeObjectURL(url); + + createToast({ body: t("export.success") }); + return [true, null]; + } catch (err) { + const errorMessage = err?.response?.data?.msg || err.message; + createToast({ body: errorMessage || t("export.failed") }); + return [false, errorMessage]; + } finally { + setIsLoading(false); + } + }; + + return [exportMonitors, isLoading]; }; export { diff --git a/client/src/locales/en.json b/client/src/locales/en.json index d71cf3212..d13d44f7f 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -741,8 +741,8 @@ "port": "Enter the URL or IP of the server, the port number and a clear display name that appears on the dashboard." }, "export": { - "title": "Export Monitors", - "success": "Monitors exported successfully!", - "failed": "Failed to export monitors" - } + "title": "Export Monitors", + "success": "Monitors exported successfully!", + "failed": "Failed to export monitors" + } }