feat: add initial setup wizard, workload insights, and policy audit mode
Add setup wizard with status tracking via SystemSetting model, implement /setup/status and /setup/complete endpoints to create initial admin user and optional cluster configuration, add workload insights endpoint with traffic analysis and policy matching including audit mode detection, implement enforcement_mode property on Policy model with audit/enforced states, add Modal component for dialogs, create SetupWizard page with multi
This commit is contained in:
@@ -10,6 +10,12 @@ export type Dashboard = {
|
||||
top_talkers: Array<{ name: string; bytes: number }>;
|
||||
};
|
||||
|
||||
export type SetupStatus = {
|
||||
complete: boolean;
|
||||
has_users: boolean;
|
||||
has_clusters: boolean;
|
||||
};
|
||||
|
||||
export type Cluster = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -97,10 +103,31 @@ export type Policy = {
|
||||
name: string;
|
||||
version: number;
|
||||
enabled: boolean;
|
||||
enforcement_mode: string;
|
||||
definition: Record<string, unknown>;
|
||||
last_compiled: Record<string, unknown> | null;
|
||||
};
|
||||
|
||||
export type Workload = {
|
||||
id: string;
|
||||
cluster_id: string;
|
||||
node_id: string;
|
||||
project_id: string | null;
|
||||
external_id: string;
|
||||
name: string;
|
||||
kind: string;
|
||||
status: string;
|
||||
tags: string[];
|
||||
};
|
||||
|
||||
export type WorkloadInsight = {
|
||||
workload: Workload;
|
||||
traffic: Array<Record<string, unknown>>;
|
||||
matching_policies: Policy[];
|
||||
effective_decision: string;
|
||||
audit_mode_notes: string[];
|
||||
};
|
||||
|
||||
export type ServiceCatalogItem = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -140,6 +167,20 @@ export async function api<T>(path: string, init: RequestInit = {}): Promise<T> {
|
||||
return response.json() as Promise<T>;
|
||||
}
|
||||
|
||||
export async function publicApi<T>(path: string, init: RequestInit = {}): Promise<T> {
|
||||
const response = await fetch(`${API_BASE_URL}${path}`, {
|
||||
...init,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...init.headers,
|
||||
},
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(await response.text());
|
||||
}
|
||||
return response.json() as Promise<T>;
|
||||
}
|
||||
|
||||
export async function login(email: string, password: string) {
|
||||
const data = await api<{ access_token: string }>("/auth/login", {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user