Visualizando todo grafo com anzograph
This commit is contained in:
@@ -43,7 +43,18 @@ export default function App() {
|
||||
|
||||
setStatus("Fetching graph…");
|
||||
const graphRes = await fetch(`/api/graph?graph_query_id=${encodeURIComponent(graphQueryId)}`, { signal });
|
||||
if (!graphRes.ok) throw new Error(`Failed to fetch graph: ${graphRes.status}`);
|
||||
if (!graphRes.ok) {
|
||||
let detail = "";
|
||||
try {
|
||||
const err = await graphRes.json();
|
||||
if (err && typeof err === "object" && typeof (err as any).detail === "string") {
|
||||
detail = (err as any).detail;
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
throw new Error(`Failed to fetch graph: ${graphRes.status}${detail ? ` (${detail})` : ""}`);
|
||||
}
|
||||
const graph = await graphRes.json();
|
||||
if (signal.aborted) return;
|
||||
|
||||
|
||||
@@ -10,7 +10,23 @@ const __dirname = path.dirname(__filename);
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), tailwindcss(), viteSingleFile()],
|
||||
plugins: [
|
||||
react(),
|
||||
tailwindcss(),
|
||||
viteSingleFile(),
|
||||
{
|
||||
name: "long-timeouts",
|
||||
configureServer(server) {
|
||||
// Large graph snapshots can take minutes; keep the dev server from killing the request.
|
||||
const httpServer = server.httpServer;
|
||||
if (!httpServer) return;
|
||||
const ms30m = 30 * 60 * 1000;
|
||||
httpServer.headersTimeout = ms30m;
|
||||
httpServer.requestTimeout = ms30m;
|
||||
httpServer.keepAliveTimeout = ms30m;
|
||||
},
|
||||
},
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "src"),
|
||||
@@ -19,7 +35,20 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
// Backend is reachable as http://backend:8000 inside docker-compose; localhost outside.
|
||||
"/api": process.env.VITE_BACKEND_URL || "http://localhost:8000",
|
||||
"/api": {
|
||||
target: process.env.VITE_BACKEND_URL || "http://localhost:8000",
|
||||
changeOrigin: true,
|
||||
configure: (proxy) => {
|
||||
proxy.on("error", (err) => {
|
||||
// Surface upstream timeouts/socket errors in `docker compose logs frontend`.
|
||||
console.error("[vite-proxy] /api error:", err);
|
||||
});
|
||||
},
|
||||
// The initial graph snapshot can take minutes with large limits (SPARQL + layout + labels).
|
||||
// Prevent the dev proxy from timing out and returning a 500 to the browser.
|
||||
timeout: 30 * 60 * 1000,
|
||||
proxyTimeout: 30 * 60 * 1000,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user