Merge pull request #62 from operacle/develop
Fix: Instance monitoring dashboard styling and Improved docker compose configuration
This commit is contained in:
@@ -74,9 +74,9 @@ const ContainerMonitoring = () => {
|
|||||||
if (error) {
|
if (error) {
|
||||||
console.error('Container monitoring error:', error);
|
console.error('Container monitoring error:', error);
|
||||||
return (
|
return (
|
||||||
<div className={`min-h-screen flex ${theme === 'dark' ? 'bg-[#0a0a0a] text-white' : 'bg-gray-50 text-gray-900'}`}>
|
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||||
<Sidebar collapsed={sidebarCollapsed} />
|
<Sidebar collapsed={sidebarCollapsed} />
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
<div className="flex flex-col flex-1">
|
||||||
<Header
|
<Header
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
onLogout={handleLogout}
|
onLogout={handleLogout}
|
||||||
@@ -108,9 +108,9 @@ const ContainerMonitoring = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`min-h-screen flex ${theme === 'dark' ? 'bg-[#0a0a0a] text-white' : 'bg-gray-50 text-gray-900'}`}>
|
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||||
<Sidebar collapsed={sidebarCollapsed} />
|
<Sidebar collapsed={sidebarCollapsed} />
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
<div className="flex flex-col flex-1">
|
||||||
<Header
|
<Header
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
onLogout={handleLogout}
|
onLogout={handleLogout}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { useTheme } from "@/contexts/ThemeContext";
|
import { useTheme } from "@/contexts/ThemeContext";
|
||||||
@@ -11,70 +12,83 @@ import { Server, ServerStats } from "@/types/server.types";
|
|||||||
import { useSidebar } from "@/contexts/SidebarContext";
|
import { useSidebar } from "@/contexts/SidebarContext";
|
||||||
import { authService } from "@/services/authService";
|
import { authService } from "@/services/authService";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const InstanceMonitoring = () => {
|
const InstanceMonitoring = () => {
|
||||||
const {
|
const { theme } = useTheme();
|
||||||
theme
|
const { t } = useLanguage();
|
||||||
} = useTheme();
|
const { sidebarCollapsed, toggleSidebar } = useSidebar();
|
||||||
const {
|
|
||||||
t
|
|
||||||
} = useLanguage();
|
|
||||||
const {
|
|
||||||
sidebarCollapsed,
|
|
||||||
toggleSidebar
|
|
||||||
} = useSidebar();
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [stats, setStats] = useState<ServerStats>({
|
const [stats, setStats] = useState<ServerStats>({
|
||||||
total: 0,
|
total: 0,
|
||||||
online: 0,
|
online: 0,
|
||||||
offline: 0,
|
offline: 0,
|
||||||
warning: 0
|
warning: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
const [currentUser, setCurrentUser] = useState(authService.getCurrentUser());
|
const [currentUser, setCurrentUser] = useState(authService.getCurrentUser());
|
||||||
const {
|
|
||||||
data: servers = [],
|
const { data: servers = [], isLoading, error, refetch } = useQuery({
|
||||||
isLoading,
|
|
||||||
error,
|
|
||||||
refetch
|
|
||||||
} = useQuery({
|
|
||||||
queryKey: ['servers'],
|
queryKey: ['servers'],
|
||||||
queryFn: serverService.getServers,
|
queryFn: serverService.getServers,
|
||||||
refetchInterval: 30000 // Refetch every 30 seconds
|
refetchInterval: 30000 // Refetch every 30 seconds
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (servers.length > 0) {
|
if (servers.length > 0) {
|
||||||
serverService.getServerStats(servers).then(setStats);
|
serverService.getServerStats(servers).then(setStats);
|
||||||
}
|
}
|
||||||
}, [servers]);
|
}, [servers]);
|
||||||
|
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
refetch();
|
refetch();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
authService.logout();
|
authService.logout();
|
||||||
navigate('/login');
|
navigate('/login');
|
||||||
};
|
};
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return <div className={`min-h-screen flex ${theme === 'dark' ? 'bg-[#0a0a0a] text-white' : 'bg-gray-50 text-gray-900'}`}>
|
return (
|
||||||
|
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||||
<Sidebar collapsed={sidebarCollapsed} />
|
<Sidebar collapsed={sidebarCollapsed} />
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
<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}
|
||||||
|
/>
|
||||||
<main className="flex-1 flex flex-col items-center justify-center p-4 sm:p-6">
|
<main className="flex-1 flex flex-col items-center justify-center p-4 sm:p-6">
|
||||||
<div className="text-center max-w-md w-full">
|
<div className="text-center max-w-md w-full">
|
||||||
<h2 className="text-xl sm:text-2xl font-bold mb-4">Error loading servers</h2>
|
<h2 className="text-xl sm:text-2xl font-bold mb-4">Error loading servers</h2>
|
||||||
<p className="text-muted-foreground mb-4 text-sm sm:text-base">
|
<p className="text-muted-foreground mb-4 text-sm sm:text-base">
|
||||||
Unable to fetch server data. Please check your connection and try again.
|
Unable to fetch server data. Please check your connection and try again.
|
||||||
</p>
|
</p>
|
||||||
<button onClick={handleRefresh} className="px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 text-sm sm:text-base">
|
<button
|
||||||
|
onClick={handleRefresh}
|
||||||
|
className="px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 text-sm sm:text-base"
|
||||||
|
>
|
||||||
Retry
|
Retry
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return <div className={`min-h-screen flex ${theme === 'dark' ? 'bg-[#0a0a0a] text-white' : 'bg-gray-50 text-gray-900'}`}>
|
|
||||||
|
return (
|
||||||
|
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||||
<Sidebar collapsed={sidebarCollapsed} />
|
<Sidebar collapsed={sidebarCollapsed} />
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
<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}
|
||||||
|
/>
|
||||||
<main className="flex-1 overflow-auto">
|
<main className="flex-1 overflow-auto">
|
||||||
<div className="mx-[20px] my-[20px]">
|
<div className="mx-[20px] my-[20px]">
|
||||||
{/* Header Section */}
|
{/* Header Section */}
|
||||||
@@ -103,6 +117,8 @@ const InstanceMonitoring = () => {
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default InstanceMonitoring;
|
export default InstanceMonitoring;
|
||||||
@@ -47,9 +47,9 @@ const ServerDetail = () => {
|
|||||||
if (serverError) {
|
if (serverError) {
|
||||||
console.error('Server detail error:', serverError);
|
console.error('Server detail error:', serverError);
|
||||||
return (
|
return (
|
||||||
<div className={`min-h-screen flex ${theme === 'dark' ? 'bg-[#0a0a0a] text-white' : 'bg-gray-50 text-gray-900'}`}>
|
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||||
<Sidebar collapsed={sidebarCollapsed} />
|
<Sidebar collapsed={sidebarCollapsed} />
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
<div className="flex flex-col flex-1">
|
||||||
<Header
|
<Header
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
onLogout={handleLogout}
|
onLogout={handleLogout}
|
||||||
@@ -77,9 +77,9 @@ const ServerDetail = () => {
|
|||||||
|
|
||||||
if (serverLoading) {
|
if (serverLoading) {
|
||||||
return (
|
return (
|
||||||
<div className={`min-h-screen flex ${theme === 'dark' ? 'bg-[#0a0a0a] text-white' : 'bg-gray-50 text-gray-900'}`}>
|
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||||
<Sidebar collapsed={sidebarCollapsed} />
|
<Sidebar collapsed={sidebarCollapsed} />
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
<div className="flex flex-col flex-1">
|
||||||
<Header
|
<Header
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
onLogout={handleLogout}
|
onLogout={handleLogout}
|
||||||
@@ -98,9 +98,9 @@ const ServerDetail = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`min-h-screen flex ${theme === 'dark' ? 'bg-[#0a0a0a] text-white' : 'bg-gray-50 text-gray-900'}`}>
|
<div className="flex h-screen overflow-hidden bg-background text-foreground">
|
||||||
<Sidebar collapsed={sidebarCollapsed} />
|
<Sidebar collapsed={sidebarCollapsed} />
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
<div className="flex flex-col flex-1">
|
||||||
<Header
|
<Header
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
onLogout={handleLogout}
|
onLogout={handleLogout}
|
||||||
|
|||||||
+4
-2
@@ -5,9 +5,11 @@ services:
|
|||||||
container_name: checkcle
|
container_name: checkcle
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "8090:8090" # Web Application
|
- "8090:8090" # Map ports for external access, if local only "127.0.0.1:8090:8090"
|
||||||
volumes:
|
volumes:
|
||||||
- /opt/pb_data:/mnt/pb_data # Host directory mapped to container path
|
- /opt/pb_data:/mnt/pb_data # Mount persistent data
|
||||||
|
|
||||||
|
# Optional: set user limits
|
||||||
ulimits:
|
ulimits:
|
||||||
nofile:
|
nofile:
|
||||||
soft: 4096
|
soft: 4096
|
||||||
|
|||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "checkcle-dev",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user