Fix run build
This commit is contained in:
1 parent
e8a92bf87b
commit
4beb27e618
3 files changed
+8
-8
No files matched your search
+2
-1
@@ -1,9 +1,10 @@
|
|||||||
export interface LogService {
|
export interface LogService {
|
||||||
id: number;
|
id: number | string;
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
pathOrContainerId: string;
|
pathOrContainerId: string;
|
||||||
alertKeyword: string | null;
|
alertKeyword: string | null;
|
||||||
|
createdAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GlobalSettings {
|
export interface GlobalSettings {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { PlusCircle, Clock, Server, HardDrive, LayoutGrid, Search, SearchX, Globe, Cpu, ChevronRight } from 'lucide-react';
|
import { PlusCircle, Clock, Server, HardDrive, LayoutGrid, Search, SearchX, Globe, ChevronRight } from 'lucide-react';
|
||||||
import AddServiceModal from '../components/AddServiceModal';
|
import AddServiceModal from '../components/AddServiceModal';
|
||||||
import type { LogService } from '../types';
|
import type { LogService } from '../types';
|
||||||
|
|
||||||
@@ -18,7 +18,6 @@ export default function HomeView() {
|
|||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
const [searchTerm, setSearchTerm] = useState('');
|
const [searchTerm, setSearchTerm] = useState('');
|
||||||
const [systemServices, setSystemServices] = useState<SystemService[]>([]);
|
const [systemServices, setSystemServices] = useState<SystemService[]>([]);
|
||||||
const [isSearchingSystem, setIsSearchingSystem] = useState(false);
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const fetchServices = async () => {
|
const fetchServices = async () => {
|
||||||
@@ -31,8 +30,8 @@ export default function HomeView() {
|
|||||||
|
|
||||||
// Load recents from localStorage
|
// Load recents from localStorage
|
||||||
const recentIds: number[] = JSON.parse(localStorage.getItem('recentServiceIds') || '[]');
|
const recentIds: number[] = JSON.parse(localStorage.getItem('recentServiceIds') || '[]');
|
||||||
const recents = data.filter((s: LogService) => recentIds.includes(s.id))
|
const recents = data.filter((s: LogService) => recentIds.includes(s.id as any))
|
||||||
.sort((a: LogService, b: LogService) => recentIds.indexOf(a.id) - recentIds.indexOf(b.id));
|
.sort((a: LogService, b: LogService) => recentIds.indexOf(a.id as any) - recentIds.indexOf(b.id as any));
|
||||||
setRecentServices(recents);
|
setRecentServices(recents);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('API non joignable', e);
|
console.error('API non joignable', e);
|
||||||
@@ -41,7 +40,6 @@ export default function HomeView() {
|
|||||||
|
|
||||||
const fetchSystemServices = async () => {
|
const fetchSystemServices = async () => {
|
||||||
if (systemServices.length > 0) return; // Only fetch once or when forced
|
if (systemServices.length > 0) return; // Only fetch once or when forced
|
||||||
setIsSearchingSystem(true);
|
|
||||||
try {
|
try {
|
||||||
const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:3001';
|
const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:3001';
|
||||||
const [dockerRes, osRes] = await Promise.allSettled([
|
const [dockerRes, osRes] = await Promise.allSettled([
|
||||||
@@ -67,7 +65,7 @@ export default function HomeView() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Erreur lors du fetch des services système', e);
|
console.error('Erreur lors du fetch des services système', e);
|
||||||
} finally {
|
} finally {
|
||||||
setIsSearchingSystem(false);
|
// setIsSearchingSystem(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -68,10 +68,11 @@ export default function ServiceView() {
|
|||||||
const logs = await logsRes.json();
|
const logs = await logsRes.json();
|
||||||
|
|
||||||
setService({
|
setService({
|
||||||
id: `ephemeral-${target}` as any, // On triche avec le type pour le passer au terminal
|
id: `ephemeral-${target}`,
|
||||||
name,
|
name,
|
||||||
type: type as any,
|
type: type as any,
|
||||||
pathOrContainerId: target,
|
pathOrContainerId: target,
|
||||||
|
alertKeyword: null,
|
||||||
createdAt: new Date().toISOString()
|
createdAt: new Date().toISOString()
|
||||||
});
|
});
|
||||||
setInitialLogs(logs);
|
setInitialLogs(logs);
|
||||||
|
|||||||
Reference in new issue
Block a user