feat(topology): M2 - API-driven demo page with layout tables and dynamic rendering
- Add diagram_layouts and diagram_nodes tables - Seed layout coordinates extracted from SVG - Extend snapshot API to return layout data - Rewrite demo page to fetch from API dynamically - Support ?mission= and ?at= URL parameters - Modal details populated from database component data - Show/hide nodes based on component existence at snapshot time Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
-- topology_api/migrations/004_layout.sql
|
||||
-- Diagram layout tables for topology visualization
|
||||
|
||||
CREATE TABLE topology.diagram_layouts (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
base_id uuid NOT NULL REFERENCES topology.bases(id),
|
||||
layout_key text NOT NULL,
|
||||
name text NOT NULL,
|
||||
canvas_width numeric NOT NULL DEFAULT 1500,
|
||||
canvas_height numeric NOT NULL DEFAULT 1900,
|
||||
is_default boolean NOT NULL DEFAULT false,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT uq_layout_base_key UNIQUE (base_id, layout_key)
|
||||
);
|
||||
|
||||
CREATE TABLE topology.diagram_nodes (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
layout_id uuid NOT NULL REFERENCES topology.diagram_layouts(id),
|
||||
component_id uuid REFERENCES topology.components(id),
|
||||
node_key text NOT NULL,
|
||||
x numeric NOT NULL,
|
||||
y numeric NOT NULL,
|
||||
width numeric NOT NULL DEFAULT 200,
|
||||
height numeric NOT NULL DEFAULT 120,
|
||||
rotation_deg numeric NOT NULL DEFAULT 0,
|
||||
style_key text NOT NULL DEFAULT 'node-card',
|
||||
label_override text,
|
||||
z_index integer NOT NULL DEFAULT 0,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
CONSTRAINT uq_diagram_node UNIQUE (layout_id, node_key)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_diagram_nodes_layout
|
||||
ON topology.diagram_nodes(layout_id);
|
||||
Reference in New Issue
Block a user