Adds creating links from host vars from inventory

* Adds creating links from host vars
* Returns devices to the toolbox after they are removed from the canvas
This commit is contained in:
Ben Thomasson
2018-03-08 22:32:35 -05:00
parent 66c351c60c
commit b9d4fc2bb9
6 changed files with 181 additions and 83 deletions

View File

@@ -16,19 +16,13 @@ function Device(id, name, x, y, type, host_id) {
this.type = type;
this.selected = false;
this.remote_selected = false;
this.edit_label = false;
this.status = null;
this.working = false;
this.moving = false;
this.icon = false;
this.tasks = [];
this.shape = type === "router" ? "circular" : "rectangular";
this.interface_seq = util.natural_numbers(0);
this.interfaces = [];
this.process_id_seq = util.natural_numbers(0);
this.processes = [];
this.in_group = false;
this.template = false;
this.interfaces_by_name = {};
this.variables = {};
}
exports.Device = Device;
@@ -42,9 +36,8 @@ Device.prototype.toJSON = function () {
interfaces: this.interfaces.map(function (x) {
return x.toJSON();
}),
processes: this.processes.map(function (x) {
return x.toJSON();
})};
variables: this.variables
};
};
Device.prototype.is_selected = function (x, y) {
@@ -76,18 +69,6 @@ Interface.prototype.toJSON = function () {
name: this.name};
};
Interface.prototype.remote_interface = function () {
if (this.link === null) {
return null;
}
if (this.link.to_interface === this) {
return this.link.from_interface;
} else {
return this.link.to_interface;
}
};
Interface.prototype.is_selected = function (x, y) {
if (this.link === null || this.device === null) {