feat: initialize netx ops tool repository

Set up netx as a standalone git-managed project with isolated Python dependencies, alarm ingestion/query APIs, oclaw bridge integration, and ops-focused UI enhancements including history and raw field access.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-03 23:43:21 +08:00
commit f49c0b5bad
56 changed files with 6974 additions and 0 deletions

20
web/src/hooks/useToast.ts Normal file
View file

@ -0,0 +1,20 @@
import { useCallback, useEffect, useState } from "react";
export type ToastState = { type: "ok" | "error"; text: string } | null;
export function useToast(autoHideMs = 2600) {
const [toast, setToast] = useState<ToastState>(null);
const showOk = useCallback((text: string) => setToast({ type: "ok", text }), []);
const showError = useCallback((text: string) => setToast({ type: "error", text }), []);
const clear = useCallback(() => setToast(null), []);
useEffect(() => {
if (!toast) return;
const t = setTimeout(() => setToast(null), autoHideMs);
return () => clearTimeout(t);
}, [toast, autoHideMs]);
return { toast, showOk, showError, clear };
}