@@ -206,37 +201,6 @@ export const ComponentsSelector = ({ selectedComponents, onComponentsChange, onC
)}
-
-
-
Quick Add Templates
-
- {componentTypes.map((type) => {
- const Icon = type.icon;
- return (
- {
- const component: Partial = {
- name: type.label,
- description: `Monitor ${type.label.toLowerCase()}`,
- service_id: '',
- server_id: '',
- display_order: selectedComponents.length + 1,
- operational_status_id: '',
- };
- onComponentsChange([...selectedComponents, component]);
- }}
- className="justify-start"
- >
-
- {type.label}
-
- );
- })}
-
-
);
diff --git a/application/src/components/operational-page/CreateOperationalPageDialog.tsx b/application/src/components/operational-page/CreateOperationalPageDialog.tsx
index 4f9f17c..4d3c321 100644
--- a/application/src/components/operational-page/CreateOperationalPageDialog.tsx
+++ b/application/src/components/operational-page/CreateOperationalPageDialog.tsx
@@ -67,13 +67,13 @@ export const CreateOperationalPageDialog = () => {
page_style: data.page_style || '',
};
- console.log('Creating operational page with payload:', payload);
+ // console.log('Creating operational page with payload:', payload);
const createdPage = await createMutation.mutateAsync(payload);
- console.log('Created page:', createdPage);
+ // console.log('Created page:', createdPage);
// Create components after page is created
if (selectedComponents.length > 0) {
- console.log('Creating components for page:', createdPage.id);
+ // console.log('Creating components for page:', createdPage.id);
for (const component of selectedComponents) {
const componentPayload = {
operational_status_id: createdPage.id,
@@ -84,7 +84,7 @@ export const CreateOperationalPageDialog = () => {
display_order: component.display_order || 1,
};
- console.log('Creating component with payload:', componentPayload);
+ // console.log('Creating component with payload:', componentPayload);
await createComponentMutation.mutateAsync(componentPayload);
}
}
@@ -93,7 +93,7 @@ export const CreateOperationalPageDialog = () => {
form.reset();
setSelectedComponents([]);
} catch (error) {
- console.error('Error creating operational page:', error);
+ // console.error('Error creating operational page:', error);
}
};
diff --git a/application/src/components/operational-page/OperationalPageCard.tsx b/application/src/components/operational-page/OperationalPageCard.tsx
index 8c8949d..8c11dfd 100644
--- a/application/src/components/operational-page/OperationalPageCard.tsx
+++ b/application/src/components/operational-page/OperationalPageCard.tsx
@@ -41,11 +41,11 @@ export const OperationalPageCard = ({ page, onEdit, onView, onDelete }: Operatio
Updated:
diff --git a/application/src/components/public/PublicStatusPage.tsx b/application/src/components/public/PublicStatusPage.tsx
index 8f775f0..d6f7bc5 100644
--- a/application/src/components/public/PublicStatusPage.tsx
+++ b/application/src/components/public/PublicStatusPage.tsx
@@ -12,7 +12,7 @@ import { PublicStatusPageFooter } from './PublicStatusPageFooter';
export const PublicStatusPage = () => {
const { slug } = useParams<{ slug: string }>();
- console.log('PublicStatusPage - slug from params:', slug);
+// console.log('PublicStatusPage - slug from params:', slug);
const { page, components, services, uptimeData, loading, error } = usePublicStatusPageData(slug);
const [lastUpdated, setLastUpdated] = useState(new Date());
@@ -51,7 +51,7 @@ export const PublicStatusPage = () => {
};
}, [page?.theme]);
- console.log('PublicStatusPage state:', { loading, error, page: !!page, components: components.length, services: services.length });
+ // console.log('PublicStatusPage state:', { loading, error, page: !!page, components: components.length, services: services.length });
if (loading) {
return (
diff --git a/application/src/components/public/hooks/usePublicStatusPageData.ts b/application/src/components/public/hooks/usePublicStatusPageData.ts
index 75983ac..a92e85b 100644
--- a/application/src/components/public/hooks/usePublicStatusPageData.ts
+++ b/application/src/components/public/hooks/usePublicStatusPageData.ts
@@ -19,61 +19,61 @@ export const usePublicStatusPageData = (slug: string | undefined) => {
useEffect(() => {
const fetchPublicPage = async () => {
if (!slug) {
- console.log('No slug provided');
+ // console.log('No slug provided');
setError('No status page slug provided');
setLoading(false);
return;
}
try {
- console.log('Fetching public status page for slug:', slug);
+ // console.log('Fetching public status page for slug:', slug);
setLoading(true);
setError(null);
// Fetch operational page
- console.log('Fetching operational pages...');
+ // console.log('Fetching operational pages...');
const pages = await operationalPageService.getOperationalPages();
- console.log('All pages:', pages);
+ // console.log('All pages:', pages);
const foundPage = pages.find(p => p.slug === slug && p.is_public === 'true');
- console.log('Found page:', foundPage);
+ // console.log('Found page:', foundPage);
if (!foundPage) {
- console.log('Page not found or not public');
+ // console.log('Page not found or not public');
setError('Status page not found or not public');
setLoading(false);
return;
}
setPage(foundPage);
- console.log('Page set successfully');
+ // console.log('Page set successfully');
// Fetch components for this page
- console.log('Fetching components for page:', foundPage.id);
+ // console.log('Fetching components for page:', foundPage.id);
const pageComponents = await statusPageComponentsService.getStatusPageComponentsByOperationalId(foundPage.id);
- console.log('Components found:', pageComponents);
+ // console.log('Components found:', pageComponents);
setComponents(pageComponents);
// Fetch all services
- console.log('Fetching all services...');
+ // console.log('Fetching all services...');
const allServices = await serviceService.getServices();
- console.log('Services found:', allServices);
+ // console.log('Services found:', allServices);
setServices(allServices);
// Fetch uptime data for each component that has a service
- console.log('Fetching uptime data...');
+ // console.log('Fetching uptime data...');
const uptimePromises = pageComponents
.filter(component => component.service_id)
.map(async (component) => {
try {
- console.log('Fetching uptime for service:', component.service_id);
+ // console.log('Fetching uptime for service:', component.service_id);
const endDate = new Date();
const startDate = new Date(Date.now() - 90 * 24 * 60 * 60 * 1000); // Last 90 days
const history = await uptimeService.getUptimeHistory(component.service_id, 2000, startDate, endDate);
- console.log(`Uptime history for ${component.service_id}:`, history.length, 'records');
+ // console.log(`Uptime history for ${component.service_id}:`, history.length, 'records');
return { serviceId: component.service_id, history };
} catch (error) {
- console.error(`Error fetching uptime for service ${component.service_id}:`, error);
+ // console.error(`Error fetching uptime for service ${component.service_id}:`, error);
return { serviceId: component.service_id, history: [] };
}
});
@@ -84,12 +84,12 @@ export const usePublicStatusPageData = (slug: string | undefined) => {
uptimeMap[result.serviceId] = result.history;
});
setUptimeData(uptimeMap);
- console.log('Uptime data set successfully');
+ // console.log('Uptime data set successfully');
- console.log('All data fetched successfully');
+ // console.log('All data fetched successfully');
} catch (err) {
- console.error('Error fetching public page:', err);
+ // console.error('Error fetching public page:', err);
setError(`Failed to load status page: ${err}`);
} finally {
setLoading(false);
diff --git a/application/src/components/servers/ServerTable.tsx b/application/src/components/servers/ServerTable.tsx
index 89c948f..afea63c 100644
--- a/application/src/components/servers/ServerTable.tsx
+++ b/application/src/components/servers/ServerTable.tsx
@@ -269,7 +269,11 @@ export const ServerTable = ({ servers, isLoading, onRefresh }: ServerTableProps)
const isProcessing = pausingServers.has(server.id);
return (
-
+ handleViewDetails(server.id)}
+ >
{server.name}
@@ -325,7 +329,7 @@ export const ServerTable = ({ servers, isLoading, onRefresh }: ServerTableProps)
{new Date(server.last_checked).toLocaleString()}
-
+ e.stopPropagation()}>
@@ -338,19 +342,19 @@ export const ServerTable = ({ servers, isLoading, onRefresh }: ServerTableProps)
- handleViewDetails(server.id)}>
+ { e.stopPropagation(); handleViewDetails(server.id); }}>
View Server Detail
{server.docker === 'true' && (
- handleViewContainers(server.id)}>
+ { e.stopPropagation(); handleViewContainers(server.id); }}>
Container Monitoring
)}
handlePauseResume(server)}
+ onClick={(e) => { e.stopPropagation(); handlePauseResume(server); }}
disabled={isProcessing}
>
{isPaused ? (
@@ -366,12 +370,12 @@ export const ServerTable = ({ servers, isLoading, onRefresh }: ServerTableProps)
)}
- handleEdit(server)}>
+ { e.stopPropagation(); handleEdit(server); }}>
Edit Server
handleDelete(server)}
+ onClick={(e) => { e.stopPropagation(); handleDelete(server); }}
className="text-red-600 focus:text-red-600"
>
@@ -427,4 +431,4 @@ export const ServerTable = ({ servers, isLoading, onRefresh }: ServerTableProps)
>
);
-};
\ No newline at end of file
+};
diff --git a/application/src/components/services/add-service/ServiceForm.tsx b/application/src/components/services/add-service/ServiceForm.tsx
index 28ba8e9..a888b11 100644
--- a/application/src/components/services/add-service/ServiceForm.tsx
+++ b/application/src/components/services/add-service/ServiceForm.tsx
@@ -70,10 +70,10 @@ export function ServiceForm({
if (onSubmitStart) onSubmitStart();
try {
- console.log("Form data being submitted:", data);
+ // console.log("Form data being submitted:", data);
const serviceData = mapFormDataToServiceData(data);
- console.log("Service data being sent:", serviceData);
+ // console.log("Service data being sent:", serviceData);
if (isEdit && initialData) {
// Update existing service
diff --git a/application/src/components/services/add-service/ServiceUrlField.tsx b/application/src/components/services/add-service/ServiceUrlField.tsx
index 0284f35..f8419c4 100644
--- a/application/src/components/services/add-service/ServiceUrlField.tsx
+++ b/application/src/components/services/add-service/ServiceUrlField.tsx
@@ -67,7 +67,7 @@ export function ServiceUrlField({ form }: ServiceUrlFieldProps) {
placeholder={getPlaceholder()}
{...field}
onChange={(e) => {
- console.log(`${serviceType === "dns" ? "Domain" : serviceType === "tcp" ? "Host" : "URL"} field changed:`, e.target.value);
+ // console.log(`${serviceType === "dns" ? "Domain" : serviceType === "tcp" ? "Host" : "URL"} field changed:`, e.target.value);
field.onChange(e);
}}
/>
@@ -93,7 +93,7 @@ export function ServiceUrlField({ form }: ServiceUrlFieldProps) {
type="number"
{...field}
onChange={(e) => {
- console.log("Port field changed:", e.target.value);
+ // console.log("Port field changed:", e.target.value);
field.onChange(e);
}}
/>
diff --git a/application/src/components/settings/about-system/AboutSystem.tsx b/application/src/components/settings/about-system/AboutSystem.tsx
index b06e7d8..677d2dd 100644
--- a/application/src/components/settings/about-system/AboutSystem.tsx
+++ b/application/src/components/settings/about-system/AboutSystem.tsx
@@ -95,7 +95,7 @@ export const AboutSystem: React.FC = () => {
{t('viewDocumentation')}
- window.open("https://x.com/tlengoss", "_blank")}>
+ window.open("https://x.com/checkcle_oss", "_blank")}>
{t('followOnX')}
diff --git a/application/src/components/settings/notification-settings/NotificationChannelDialog.tsx b/application/src/components/settings/notification-settings/NotificationChannelDialog.tsx
index bf84cae..ad820f5 100644
--- a/application/src/components/settings/notification-settings/NotificationChannelDialog.tsx
+++ b/application/src/components/settings/notification-settings/NotificationChannelDialog.tsx
@@ -1,5 +1,5 @@
-import React, { useEffect } from "react";
+import React, { useEffect, useState } from "react";
import {
Dialog,
DialogContent,
@@ -24,7 +24,9 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Switch } from "@/components/ui/switch";
-import { Loader2 } from "lucide-react";
+import { Loader2, MessageSquare } from "lucide-react";
+import TestWecomDialog from "./TestWecomDialog";
+import { useLanguage } from "@/contexts/LanguageContext";
interface NotificationChannelDialogProps {
open: boolean;
@@ -34,7 +36,7 @@ interface NotificationChannelDialogProps {
const baseSchema = z.object({
notify_name: z.string().min(1, "Name is required"),
- notification_type: z.enum(["telegram", "discord", "slack", "signal", "email"]),
+ notification_type: z.enum(["telegram", "discord", "slack", "signal", "email", "wecom"]),
enabled: z.boolean().default(true),
service_id: z.string().default("global"), // Assuming global for now, could be linked to specific services
template_id: z.string().optional(),
@@ -66,12 +68,18 @@ const emailSchema = baseSchema.extend({
// Email specific fields could be added here
});
+const wecomSchema = baseSchema.extend({
+ notification_type: z.literal("wecom"),
+ wecom_webhook_url: z.string().url("Must be a valid URL"),
+});
+
const formSchema = z.discriminatedUnion("notification_type", [
telegramSchema,
discordSchema,
slackSchema,
signalSchema,
- emailSchema
+ emailSchema,
+ wecomSchema
]);
type FormValues = z.infer;
@@ -96,6 +104,8 @@ export const NotificationChannelDialog = ({
const { watch, reset } = form;
const notificationType = watch("notification_type");
const [isSubmitting, setIsSubmitting] = React.useState(false);
+ const [showTestWecomDialog, setShowTestWecomDialog] = useState(false);
+ const { language } = useLanguage();
useEffect(() => {
if (editingConfig) {
@@ -224,6 +234,14 @@ export const NotificationChannelDialog = ({
Email
+
+
+
+
+
+ {language === "zh-CN" ? "企业微信" : "Wecom"}
+
+
@@ -311,6 +329,38 @@ export const NotificationChannelDialog = ({
/>
)}
+ {notificationType === "wecom" && (
+ <>
+ (
+
+ Webhook URL
+
+
+
+
+ {language === "zh-CN" ? "在企业微信群聊中添加机器人,获取Webhook URL" : "Add a bot in Wecom group chat to get the Webhook URL"}
+
+
+
+ )}
+ />
+ {isEditing && editingConfig && editingConfig.wecom_webhook_url && (
+ setShowTestWecomDialog(true)}
+ >
+
+ {language === "zh-CN" ? "发送测试消息" : "Send Test Message"}
+
+ )}
+ >
+ )}
+
+
+ {/* 测试企业微信通知对话框 */}
+
);
};
diff --git a/application/src/components/settings/notification-settings/NotificationChannelList.tsx b/application/src/components/settings/notification-settings/NotificationChannelList.tsx
index 539805f..4710f71 100644
--- a/application/src/components/settings/notification-settings/NotificationChannelList.tsx
+++ b/application/src/components/settings/notification-settings/NotificationChannelList.tsx
@@ -13,6 +13,7 @@ import { Switch } from "@/components/ui/switch";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { alertConfigService } from "@/services/alertConfigService";
+import { useLanguage } from "@/contexts/LanguageContext";
interface NotificationChannelListProps {
channels: AlertConfiguration[];
@@ -25,6 +26,7 @@ export const NotificationChannelList = ({
onEdit,
onDelete
}: NotificationChannelListProps) => {
+ const { language } = useLanguage();
const toggleEnabled = async (config: AlertConfiguration) => {
if (!config.id) return;
@@ -43,6 +45,7 @@ export const NotificationChannelList = ({
case "slack": return "Slack";
case "signal": return "Signal";
case "email": return "Email";
+ case "wecom": return language === "zh-CN" ? "企业微信" : "Wecom";
default: return type;
}
};
diff --git a/application/src/components/settings/notification-settings/NotificationSettings.tsx b/application/src/components/settings/notification-settings/NotificationSettings.tsx
index 22d7949..5e1a47c 100644
--- a/application/src/components/settings/notification-settings/NotificationSettings.tsx
+++ b/application/src/components/settings/notification-settings/NotificationSettings.tsx
@@ -7,6 +7,7 @@ import { Plus, Loader2 } from "lucide-react";
import { AlertConfiguration, alertConfigService } from "@/services/alertConfigService";
import { NotificationChannelDialog } from "./NotificationChannelDialog";
import { NotificationChannelList } from "./NotificationChannelList";
+import { useLanguage } from "@/contexts/LanguageContext";
const NotificationSettings = () => {
const [isLoading, setIsLoading] = useState(true);
@@ -14,6 +15,7 @@ const NotificationSettings = () => {
const [dialogOpen, setDialogOpen] = useState(false);
const [currentTab, setCurrentTab] = useState("all");
const [editingConfig, setEditingConfig] = useState(null);
+ const { language } = useLanguage();
const fetchAlertConfigurations = async () => {
setIsLoading(true);
@@ -87,6 +89,7 @@ const NotificationSettings = () => {
Slack
Signal
Email
+ {language === "zh-CN" ? "企业微信" : "Wecom"}
diff --git a/application/src/components/settings/notification-settings/TestWecomDialog.tsx b/application/src/components/settings/notification-settings/TestWecomDialog.tsx
new file mode 100644
index 0000000..bbe8d94
--- /dev/null
+++ b/application/src/components/settings/notification-settings/TestWecomDialog.tsx
@@ -0,0 +1,190 @@
+import React, { useState } from 'react';
+import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { X, AlertCircle, CheckCircle, Loader2, MessageSquare } from "lucide-react";
+import { toast } from "@/hooks/use-toast";
+import { Alert, AlertDescription } from "@/components/ui/alert";
+import { AlertConfiguration } from "@/services/alertConfigService";
+import { testSendWecomMessage } from "@/services/notification/wecomService";
+import { useLanguage } from "@/contexts/LanguageContext";
+
+interface TestWecomDialogProps {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ config: AlertConfiguration | null;
+}
+
+const TestWecomDialog: React.FC = ({
+ open,
+ onOpenChange,
+ config
+}) => {
+ const { language } = useLanguage();
+ const [serviceName, setServiceName] = useState(language === "zh-CN" ? '测试服务' : 'Test Service');
+ const [isTesting, setIsTesting] = useState(false);
+ const [lastResult, setLastResult] = useState<{ success: boolean; message: string } | null>(null);
+
+ const handleSend = async () => {
+ if (!config) {
+ toast({
+ title: language === "zh-CN" ? "配置错误" : "Configuration Error",
+ description: language === "zh-CN" ? "无法获取企业微信配置信息" : "Unable to get Wecom configuration",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ if (!config.wecom_webhook_url) {
+ toast({
+ title: language === "zh-CN" ? "配置错误" : "Configuration Error",
+ description: language === "zh-CN" ? "请先设置企业微信 Webhook URL" : "Please set Wecom Webhook URL first",
+ variant: "destructive",
+ });
+ return;
+ }
+
+ try {
+ setLastResult(null);
+ setIsTesting(true);
+
+ console.log(language === "zh-CN" ? '发送企业微信测试消息:' : 'Sending Wecom test message:', {
+ serviceName,
+ webhookUrl: config.wecom_webhook_url ? (language === "zh-CN" ? "[已隐藏]" : "[hidden]") : undefined
+ });
+
+ const result = await testSendWecomMessage(config, serviceName);
+
+ if (result) {
+ setLastResult({
+ success: true,
+ message: language === "zh-CN" ? `测试消息已成功发送到企业微信` : `Test message has been successfully sent to Wecom`
+ });
+
+ toast({
+ title: language === "zh-CN" ? "发送成功" : "Send Success",
+ description: language === "zh-CN" ? `测试消息已成功发送到企业微信` : `Test message has been successfully sent to Wecom`,
+ variant: "default",
+ });
+ } else {
+ setLastResult({
+ success: false,
+ message: language === "zh-CN" ? "发送测试消息失败,请检查配置和网络连接" : "Failed to send test message, please check configuration and network connection"
+ });
+
+ toast({
+ title: language === "zh-CN" ? "发送失败" : "Send Failed",
+ description: language === "zh-CN" ? "发送测试消息失败,请检查配置和网络连接" : "Failed to send test message, please check configuration and network connection",
+ variant: "destructive",
+ });
+ }
+ } catch (error) {
+ console.error(language === "zh-CN" ? '发送企业微信测试消息出错:' : 'Error sending Wecom test message:', error);
+ const errorMessage = error instanceof Error ? error.message : (language === "zh-CN" ? "发送测试消息失败" : "Failed to send test message");
+
+ setLastResult({
+ success: false,
+ message: errorMessage
+ });
+
+ toast({
+ title: language === "zh-CN" ? "错误" : "Error",
+ description: errorMessage,
+ variant: "destructive",
+ });
+ } finally {
+ setIsTesting(false);
+ }
+ };
+
+ const handleClose = () => {
+ onOpenChange(false);
+ // 重置表单但保留上次结果以供参考
+ setServiceName(language === "zh-CN" ? '测试服务' : 'Test Service');
+ // 不立即重置lastResult,以便用户查看结果
+ setTimeout(() => setLastResult(null), 300);
+ };
+
+ return (
+
+
+
+
+
+ {language === "zh-CN" ? "发送企业微信测试消息" : "Send Wecom Test Message"}
+
+
+
+
+
+
+
+ {/* 显示上次结果 */}
+ {lastResult && (
+
+ {lastResult.success ? (
+
+ ) : (
+
+ )}
+
+ {lastResult.message}
+
+
+ )}
+
+ {/* 服务名称 */}
+
+ {language === "zh-CN" ? "服务名称" : "Service Name"}
+ setServiceName(e.target.value)}
+ placeholder={language === "zh-CN" ? "输入服务名称" : "Enter service name"}
+ disabled={isTesting}
+ />
+
+
+ {/* 信息提示 */}
+
+
+
+ {language === "zh-CN"
+ ? "这将使用您配置的企业微信 Webhook URL 发送测试消息。请确保已正确配置企业微信机器人。"
+ : "This will send a test message using the Wecom Webhook URL you configured. Please ensure the Wecom bot is correctly configured."}
+
+
+
+
+
+
+ {language === "zh-CN" ? "关闭" : "Close"}
+
+
+ {isTesting ? (
+
+ ) : (
+
+ )}
+ {isTesting
+ ? (language === "zh-CN" ? "发送中..." : "Sending...")
+ : (language === "zh-CN" ? "发送测试消息" : "Send Test Message")}
+
+
+
+
+ );
+};
+
+export default TestWecomDialog;
\ No newline at end of file
diff --git a/application/src/components/ssl-domain/SSLCertificateActions.tsx b/application/src/components/ssl-domain/SSLCertificateActions.tsx
index a1a2148..68ad461 100644
--- a/application/src/components/ssl-domain/SSLCertificateActions.tsx
+++ b/application/src/components/ssl-domain/SSLCertificateActions.tsx
@@ -45,20 +45,20 @@ export const SSLCertificateActions = ({
- onView(certificate)}>
+ { e.stopPropagation(); onView(certificate); }}>
{t('view')}
-
+ { e.stopPropagation(); handleCheck(); }}>
Check
- onEdit(certificate)}>
+ { e.stopPropagation(); onEdit(certificate); }}>
{t('edit')}
onDelete(certificate)}
+ onClick={(e) => { e.stopPropagation(); onDelete(certificate); }}
className="text-destructive"
>
@@ -67,4 +67,4 @@ export const SSLCertificateActions = ({
);
-};
\ No newline at end of file
+};
diff --git a/application/src/components/ssl-domain/SSLCertificatesTable.tsx b/application/src/components/ssl-domain/SSLCertificatesTable.tsx
index 75df57a..a1e5008 100644
--- a/application/src/components/ssl-domain/SSLCertificatesTable.tsx
+++ b/application/src/components/ssl-domain/SSLCertificatesTable.tsx
@@ -33,11 +33,13 @@ import { AddSSLCertificateForm } from "./AddSSLCertificateForm";
import { EditSSLCertificateForm } from "./EditSSLCertificateForm";
import { SSLCertificateActions } from "./SSLCertificateActions";
import { SSLCertificateDetailDialog } from "./SSLCertificateDetailDialog";
+import { SSLPagination } from "./SSLPagination";
import { fetchSSLCertificates, addSSLCertificate, deleteSSLCertificate } from "@/services/sslCertificateService";
import { pb } from "@/lib/pocketbase";
import { SSLCertificate } from "@/types/ssl.types";
import { useLanguage } from "@/contexts/LanguageContext";
import { useTheme } from "@/contexts/ThemeContext";
+import { useSSLPagination } from "@/hooks/useSSLPagination";
import { toast } from "sonner";
export const SSLCertificatesTable = () => {
@@ -56,6 +58,16 @@ export const SSLCertificatesTable = () => {
queryFn: fetchSSLCertificates,
});
+ const {
+ paginatedCertificates,
+ currentPage,
+ totalPages,
+ pageSize,
+ totalItems,
+ handlePageChange,
+ handlePageSizeChange,
+ } = useSSLPagination({ certificates });
+
if (isLoading) return Loading...
;
if (isError) return Error loading certificates
;
@@ -67,7 +79,6 @@ export const SSLCertificatesTable = () => {
setShowAddDialog(false);
toast.success(t('certificateAdded'));
} catch (error) {
- // console.error("Error adding certificate:", error);
toast.error(t('failedToAddCertificate'));
} finally {
setIsSubmitting(false);
@@ -89,7 +100,6 @@ export const SSLCertificatesTable = () => {
setSelectedCertificate(null);
toast.success(t('certificateUpdated'));
} catch (error) {
- // console.error("Error updating certificate:", error);
toast.error(t('failedToUpdateCertificate'));
} finally {
setIsSubmitting(false);
@@ -107,7 +117,6 @@ export const SSLCertificatesTable = () => {
setSelectedCertificate(null);
toast.success(t('certificateDeleted'));
} catch (error) {
- // console.error("Error deleting certificate:", error);
toast.error(t('failedToDeleteCertificate'));
} finally {
setIsSubmitting(false);
@@ -136,53 +145,68 @@ export const SSLCertificatesTable = () => {
{t('noCertificatesFound')}
) : (
-