20260617 增加RPKI Explorer前端
This commit is contained in:
35
ui/rpki-explorer/src/app/App.tsx
Normal file
35
ui/rpki-explorer/src/app/App.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Activity, Braces, Database, FileSearch, GitBranch, Home, PackageOpen, ShieldCheck } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { Shell } from "../components/layout/Shell";
|
||||
import { ObjectDetailPage } from "../features/object-detail/ObjectDetailPage";
|
||||
import { OverviewPage } from "../features/overview/OverviewPage";
|
||||
import { RepositoriesPage } from "../features/repositories/RepositoriesPage";
|
||||
|
||||
const navigationItems = [
|
||||
{ id: "overview", label: "Overview", icon: Home },
|
||||
{ id: "repositories", label: "Repositories", icon: Database },
|
||||
{ id: "publication-points", label: "Publication Points", icon: GitBranch },
|
||||
{ id: "objects", label: "Objects", icon: Braces },
|
||||
{ id: "validation", label: "Validation", icon: ShieldCheck },
|
||||
{ id: "exports", label: "Exports", icon: PackageOpen },
|
||||
{ id: "runs", label: "Runs", icon: Activity },
|
||||
{ id: "api", label: "API", icon: FileSearch }
|
||||
];
|
||||
|
||||
export function App() {
|
||||
const [activeView, setActiveView] = useState("overview");
|
||||
const [selectedObjectInstanceId, setSelectedObjectInstanceId] = useState<string | null>(null);
|
||||
|
||||
const openObject = (objectInstanceId: string) => {
|
||||
setSelectedObjectInstanceId(objectInstanceId);
|
||||
setActiveView("objects");
|
||||
};
|
||||
|
||||
return (
|
||||
<Shell activeView={activeView} navigationItems={navigationItems} onNavigate={setActiveView}>
|
||||
{activeView === "objects" ? <ObjectDetailPage initialObjectInstanceId={selectedObjectInstanceId} /> : null}
|
||||
{activeView === "repositories" ? <RepositoriesPage onOpenObject={openObject} /> : null}
|
||||
{activeView !== "objects" && activeView !== "repositories" ? <OverviewPage /> : null}
|
||||
</Shell>
|
||||
);
|
||||
}
|
||||
7
ui/rpki-explorer/src/app/providers.tsx
Normal file
7
ui/rpki-explorer/src/app/providers.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { QueryClientProvider } from "@tanstack/react-query";
|
||||
import type { PropsWithChildren } from "react";
|
||||
import { queryClient } from "./queryClient";
|
||||
|
||||
export function AppProviders({ children }: PropsWithChildren) {
|
||||
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
|
||||
}
|
||||
15
ui/rpki-explorer/src/app/queryClient.ts
Normal file
15
ui/rpki-explorer/src/app/queryClient.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { QueryClient } from "@tanstack/react-query";
|
||||
|
||||
export const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
staleTime: 10_000,
|
||||
gcTime: 10 * 60_000,
|
||||
retry: 1,
|
||||
refetchOnWindowFocus: false
|
||||
},
|
||||
mutations: {
|
||||
retry: false
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user