menu collaged full view and font size adjustment (#162)
* menu sticky and add font adjustment * menu sticky and add font adjustment * ui menu sticky and fontsize adjustment --------- Co-authored-by: phearun <phearun@whitesand.online>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { authService } from "@/services/authService";
|
||||
@@ -7,32 +6,41 @@ import { Header } from "@/components/dashboard/Header";
|
||||
import { Sidebar } from "@/components/dashboard/Sidebar";
|
||||
import { SSLDomainContent } from "@/components/ssl-domain/SSLDomainContent";
|
||||
import { LoadingState } from "@/components/services/LoadingState";
|
||||
import { fetchSSLCertificates, shouldRunDailyCheck, checkAllCertificatesAndNotify } from "@/services/sslCertificateService";
|
||||
import {
|
||||
fetchSSLCertificates,
|
||||
shouldRunDailyCheck,
|
||||
checkAllCertificatesAndNotify,
|
||||
} from "@/services/sslCertificateService";
|
||||
import { useLanguage } from "@/contexts/LanguageContext";
|
||||
import { useSidebar } from "@/contexts/SidebarContext";
|
||||
|
||||
const SslDomain = () => {
|
||||
// Get language context for translations
|
||||
const { t } = useLanguage();
|
||||
|
||||
|
||||
// Use shared sidebar state
|
||||
const { sidebarCollapsed, toggleSidebar } = useSidebar();
|
||||
|
||||
// Get current user
|
||||
const currentUser = authService.getCurrentUser();
|
||||
const navigate = useNavigate();
|
||||
|
||||
|
||||
// Fetch SSL certificates with error handling and debugging
|
||||
const { data: certificates = [], isLoading, error, refetch } = useQuery({
|
||||
queryKey: ['ssl-certificates'],
|
||||
const {
|
||||
data: certificates = [],
|
||||
isLoading,
|
||||
error,
|
||||
refetch,
|
||||
} = useQuery({
|
||||
queryKey: ["ssl-certificates"],
|
||||
queryFn: async () => {
|
||||
// console.log("Fetching SSL certificates from SslDomain page...");
|
||||
// console.log("Fetching SSL certificates from SslDomain page...");
|
||||
try {
|
||||
const result = await fetchSSLCertificates();
|
||||
// console.log("SSL certificates fetch successful, count:", result.length);
|
||||
// console.log("SSL certificates fetch successful, count:", result.length);
|
||||
return result;
|
||||
} catch (err) {
|
||||
// console.error("Error fetching SSL certificates from page:", err);
|
||||
// console.error("Error fetching SSL certificates from page:", err);
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
@@ -40,23 +48,23 @@ const SslDomain = () => {
|
||||
refetchInterval: 300000, // Refresh every 5 minutes
|
||||
retry: 3, // Retry failed requests 3 times
|
||||
});
|
||||
|
||||
|
||||
// Check all SSL certificates once per day
|
||||
useEffect(() => {
|
||||
const checkCertificates = async () => {
|
||||
// Check if we should run daily check
|
||||
if (shouldRunDailyCheck()) {
|
||||
// console.log("Running daily SSL certificate check...");
|
||||
// console.log("Running daily SSL certificate check...");
|
||||
await checkAllCertificatesAndNotify();
|
||||
// Refresh certificate list after daily check
|
||||
refetch();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Run check when component mounts
|
||||
checkCertificates();
|
||||
}, [refetch]);
|
||||
|
||||
|
||||
// Handle logout
|
||||
const handleLogout = () => {
|
||||
authService.logout();
|
||||
@@ -69,11 +77,11 @@ const SslDomain = () => {
|
||||
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||
<Sidebar collapsed={sidebarCollapsed} />
|
||||
<div className="flex flex-col flex-1">
|
||||
<Header
|
||||
currentUser={currentUser}
|
||||
onLogout={handleLogout}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
toggleSidebar={toggleSidebar}
|
||||
<Header
|
||||
currentUser={currentUser}
|
||||
onLogout={handleLogout}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
toggleSidebar={toggleSidebar}
|
||||
/>
|
||||
<LoadingState />
|
||||
</div>
|
||||
@@ -86,23 +94,25 @@ const SslDomain = () => {
|
||||
return (
|
||||
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||
<Sidebar collapsed={sidebarCollapsed} />
|
||||
<div className="flex flex-col flex-1">
|
||||
<Header
|
||||
currentUser={currentUser}
|
||||
onLogout={handleLogout}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
toggleSidebar={toggleSidebar}
|
||||
<div className="flex flex-col flex-1 ">
|
||||
<Header
|
||||
currentUser={currentUser}
|
||||
onLogout={handleLogout}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
toggleSidebar={toggleSidebar}
|
||||
/>
|
||||
<div className="flex flex-col items-center justify-center h-full p-6">
|
||||
<h2 className="text-xl font-bold mb-2">{t('failedToLoadCertificates')}</h2>
|
||||
<div className="flex flex-col items-center justify-center h-full p-6 ">
|
||||
<h2 className="text-xl font-bold mb-2">
|
||||
{t("failedToLoadCertificates")}
|
||||
</h2>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
{error instanceof Error ? error.message : t('unknown')}
|
||||
{error instanceof Error ? error.message : t("unknown")}
|
||||
</p>
|
||||
<button
|
||||
<button
|
||||
className="px-4 py-2 bg-primary text-primary-foreground rounded-md"
|
||||
onClick={() => refetch()}
|
||||
>
|
||||
{t('check')}
|
||||
{t("check")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -114,12 +124,12 @@ const SslDomain = () => {
|
||||
return (
|
||||
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||
<Sidebar collapsed={sidebarCollapsed} />
|
||||
<div className="flex flex-col flex-1">
|
||||
<Header
|
||||
currentUser={currentUser}
|
||||
onLogout={handleLogout}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
toggleSidebar={toggleSidebar}
|
||||
<div className="flex flex-col flex-1 ">
|
||||
<Header
|
||||
currentUser={currentUser}
|
||||
onLogout={handleLogout}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
toggleSidebar={toggleSidebar}
|
||||
/>
|
||||
<SSLDomainContent />
|
||||
</div>
|
||||
@@ -127,4 +137,4 @@ const SslDomain = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default SslDomain;
|
||||
export default SslDomain;
|
||||
|
||||
Reference in New Issue
Block a user