aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/nms-info-box.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/js/nms-info-box.js')
-rw-r--r--web/js/nms-info-box.js38
1 files changed, 35 insertions, 3 deletions
diff --git a/web/js/nms-info-box.js b/web/js/nms-info-box.js
index 9a5edae..73dcd72 100644
--- a/web/js/nms-info-box.js
+++ b/web/js/nms-info-box.js
@@ -981,8 +981,16 @@ var switchEditPanel = function () {
submit.classList.add("btn", "btn-primary");
submit.id = "edit-submit-" + this.sw;
submit.setAttribute("onclick","nmsInfoBox._windowHandler.doInPanel('" + this.id + "','save');");
+ submit.style = "margin-right: 5px";
nav.appendChild(submit);
+ var deleteButton = document.createElement("button");
+ deleteButton.innerHTML = "Delete switch";
+ deleteButton.classList.add("btn", "btn-danger");
+ deleteButton.id = "delete-submit-" + this.sw;
+ deleteButton.setAttribute("onclick","nmsInfoBox._windowHandler.doInPanel('" + this.id + "','deleteSwitch');");
+ nav.appendChild(deleteButton);
+
var toggleDetails = document.createElement("button");
toggleDetails.innerHTML = '<span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span>';
toggleDetails.classList.add("btn", "btn-default", "pull-right");
@@ -1026,6 +1034,24 @@ var switchEditPanel = function () {
}
});
};
+
+ this.deleteSwitch = function () {
+ if(confirm("This will delete the switch: " + this.sw)) {
+ var myData = [{'sysname': this.sw, 'deleted': true}];
+ myData = JSON.stringify(myData);
+ $.ajax({
+ type: "POST",
+ url: "/api/write/switch-update",
+ dataType: "text",
+ data:myData,
+ success: function (data, textStatus, jqXHR) {
+ nmsInfoBox.hide();
+ nmsData.invalidate("switches");
+ nmsData.invalidate("smanagement");
+ }
+ });
+ };
+ };
};
nmsInfoBox.addPanelType("switchEdit",switchEditPanel);
@@ -1080,9 +1106,9 @@ nmsInfoBox.addPanelType("switchComments",switchCommentsPanel);
*/
var switchSummaryPanel = function() {
nmsInfoPanel.call(this,"switchSummary");
+ var latencyChart;
this.init = function() {
- //TODO Fix this so the chart is automatic updated
- //this.addHandler("ticker");
+ this.addHandler("ticker");
this.refresh();
};
this.refresh = function(reason) {
@@ -1091,6 +1117,12 @@ var switchSummaryPanel = function() {
console.log("ugh, cleanup failed?");
return;
}
+
+ if(reason == 'handler-ticker' && latencyChart != undefined) {
+ drawLatency(this.sw+'latency_chart',this.sw, latencyChart);
+ //TODO Fix so it will update table to
+ return;
+ }
var topper = document.createElement("div");
for ( var h in handlers ) {
if (handlers[h].getInfo != undefined) {
@@ -1115,7 +1147,7 @@ var switchSummaryPanel = function() {
latency.id = this.sw+'latency_chart';
latency.width = 500;
latency.height = 250;
- drawLatency(this.sw+'latency_chart',this.sw);
+ drawLatency(this.sw+'latency_chart',this.sw, false, function(chart) { latencyChart = chart; });
topper.appendChild(latency);
topper.appendChild(table);