Formatting was done.

This commit is contained in:
Owaise Imdad committed 2025-06-17 00:17:46 +05:30
1 parent e9e509ab04
commit 11212c7371
3 files changed
+33 -33

No files matched your search

@@ -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
+28 -28
View File
@@ -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 {
+4 -4
View File
@@ -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"
}
}