Add cutsheets: planned cabling checked against discovery
Lint / JS (eslint) (push) Successful in 7s
Lint / Python (flake8) (push) Successful in 1m36s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m40s
Lint / Python (flake8) (pull_request) Successful in 52s
Test / Python Tests (pytest) (push) Successful in 1m4s
Lint / JS (eslint) (pull_request) Successful in 7s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m13s
Test / Python Tests (pytest) (pull_request) Successful in 1m15s
Lint / JS (eslint) (push) Successful in 7s
Lint / Python (flake8) (push) Successful in 1m36s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m40s
Lint / Python (flake8) (pull_request) Successful in 52s
Test / Python Tests (pytest) (push) Successful in 1m4s
Lint / JS (eslint) (pull_request) Successful in 7s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m13s
Test / Python Tests (pytest) (pull_request) Successful in 1m15s
A new Cutsheet page records where every cable is meant to go and compares it with what Gandalf discovers. - Inventory for what discovery can't see: patch panels, wall jacks, shelves and rack positions. Panels and jacks pass through front to rear. - Cables with two endpoints, ID, type, length, color, status (planned, installed, dark, retired) and notes; the far end may be unterminated. - Each cable's full run is traced through panels and jacks, and runs ending on a switch port are checked against its discovered neighbor (LLDP, client table, or a DAC serial seen at both ends): matches, wrong neighbor, no link, missing port, port conflict, unverified, idle. - Undocumented links: live switch ports no cable mentions, one click to add with what Gandalf already knows. Port panels show the planned cable. - Labels to make: cable IDs and panel-port labels not yet applied, with a print view, for a handheld label maker. - CSV export, and all-or-nothing import that upserts by cable ID. - Cables, panels and jacks appear in the dashboard search. Editing needs the admin group and a JSON request body. Every change is written to cutsheet_history in the same transaction. Tables are created on first use. Refs #12 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+62
@@ -61,3 +61,65 @@ CREATE TABLE IF NOT EXISTS monitor_state (
|
||||
value MEDIUMTEXT NOT NULL,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ── Cutsheets (planned cabling) ────────────────────────────────────────
|
||||
-- Also created automatically on first use (db.ensure_cutsheet_schema).
|
||||
CREATE TABLE IF NOT EXISTS cutsheet_items ( -- panels, jacks, shelves, rack positions
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
kind VARCHAR(20) NOT NULL, -- patch_panel, wall_jack, device, shelf, other
|
||||
port_count SMALLINT NULL,
|
||||
location VARCHAR(255) NOT NULL DEFAULT '',
|
||||
rack_u SMALLINT NULL, -- bottom rack unit
|
||||
rack_height SMALLINT NULL,
|
||||
notes TEXT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY uq_item_name (name)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cutsheet_cables ( -- one row per physical cable
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
label VARCHAR(32) NULL, -- the ID on the cable, e.g. C07
|
||||
a_device VARCHAR(100) NOT NULL, -- device or item name
|
||||
a_port VARCHAR(64) NOT NULL DEFAULT '', -- switch port number, interface, or panel port
|
||||
a_side VARCHAR(5) NOT NULL DEFAULT '', -- front/rear, for panels and jacks
|
||||
b_device VARCHAR(100) NOT NULL DEFAULT '', -- blank = unterminated
|
||||
b_port VARCHAR(64) NOT NULL DEFAULT '',
|
||||
b_side VARCHAR(5) NOT NULL DEFAULT '',
|
||||
cable_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
length_m DECIMAL(5,2) NULL,
|
||||
color VARCHAR(32) NOT NULL DEFAULT '',
|
||||
status VARCHAR(10) NOT NULL DEFAULT 'installed', -- planned, installed, dark, retired
|
||||
label_applied BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
notes TEXT NULL,
|
||||
created_by VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_by VARCHAR(255) NOT NULL DEFAULT '',
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY uq_cable_label (label),
|
||||
INDEX idx_cable_a (a_device, a_port),
|
||||
INDEX idx_cable_b (b_device, b_port)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cutsheet_port_labels ( -- e.g. the room name on a panel port
|
||||
item_id INT NOT NULL,
|
||||
port VARCHAR(64) NOT NULL,
|
||||
label VARCHAR(64) NOT NULL DEFAULT '',
|
||||
applied BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY (item_id, port)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cutsheet_history ( -- who changed what, and when
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
changed_by VARCHAR(255) NOT NULL,
|
||||
entity VARCHAR(12) NOT NULL, -- cable, item, port_label
|
||||
entity_id INT NOT NULL,
|
||||
action VARCHAR(10) NOT NULL, -- create, update, delete
|
||||
summary VARCHAR(500) NOT NULL,
|
||||
before_json TEXT NULL,
|
||||
after_json TEXT NULL,
|
||||
INDEX idx_hist_time (changed_at),
|
||||
INDEX idx_hist_entity (entity, entity_id)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
Reference in New Issue
Block a user