Improves host details panel UI

* Hooks up the first two context menu buttons
* Makes the rename and details menu show up
    wherever the user's cursor's location
* Adds TopologyInventory and DeviceHost tables
* Adds design for host_id on the Device table
* Adds migrations for TopologyInventory
* Adds host_id to Device table
* Adds inventory_id and host_id tracking
* Auto-closes the right hand panel if focus is directed to the canvas.
* Retrieves the host details on inventory load.
* Adds back support for inventory and host_id tracking
* Adds host icon
* Changes rack icon to new icon
* Site icon replacement
* Fixes host icon "hitbox", and adding debug and construction
* Adds construction and debug lines for switch, router, rack, and site
* Adds some error handling for REST calls, as well as alert on
    host detail panel.
This commit is contained in:
Jared Tabor
2018-01-03 17:43:44 -08:00
committed by Ben Thomasson
parent 1c1844d889
commit 050f43e3bf
23 changed files with 1034 additions and 704 deletions

View File

@@ -4,12 +4,13 @@ var button = require('./button.js');
var util = require('./util.js');
var inherits = require('inherits');
function Device(id, name, x, y, type) {
function Device(id, name, x, y, type, host_id) {
this.id = id;
this.host_id = host_id ? host_id: 0;
this.name = name;
this.x = x;
this.y = y;
this.height = type === "host" ? 15 : 50;
this.height = type === "host" ? 30 : 50;
this.width = 50;
this.size = 50;
this.type = type;
@@ -374,9 +375,9 @@ function ContextMenu(name, x, y, width, height, callback, enabled, buttons, trac
this.callback = callback;
this.is_pressed = false;
this.mouse_over = false;
this.enabled = enabled;
this.enabled = false;
this.buttons = buttons;
this.fsm = new fsm.FSMController(this, "button_fsm", button.Start, tracer);
this.fsm = new fsm.FSMController(this, "button_fsm", enabled ? button.Start : button.Disabled, tracer);
}
exports.ContextMenu = ContextMenu;