forked from kytos/maintenance
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
maintenance/ui/k-info-panel/list_maintenance.kytos
Lines 82 to 150 in 170cdd6
| /* | |
| Gets the maintenance windows data by using the /kytos/maintenance endpoint. | |
| */ | |
| listMaintenanceWindows: function(topology) { | |
| var _this = this | |
| var data_rows = [] | |
| this.render_value = 0 | |
| this.loading = true | |
| var request = $.ajax({ | |
| url: this.$kytos_server_api + "kytos/maintenance/v1", | |
| type: "GET", | |
| dataType: "json", | |
| contentType: "application/json" | |
| }) | |
| request.done(function(data) { | |
| $.each(data, function(i, window) { | |
| if(window) { | |
| // Get the items formatted with metadata or id. | |
| var items = _this.formatItems(window.links, window.switches, window.interfaces, topology) | |
| let row = { | |
| "Id": window.id, | |
| "Start": window.start, | |
| "End": window.end, | |
| "Description": window.description, | |
| "Status": window.status, | |
| "Links": items[0].join("\n"), | |
| "Switches": items[1].join("\n"), | |
| "Interfaces": items[2].join("\n"), | |
| } | |
| data_rows.push(row) | |
| } | |
| }) | |
| _this.table_rows = data_rows | |
| _this.loading = false | |
| // If there is maintenance windows to display, do so. | |
| if(_this.table_rows.length > 0) { | |
| _this.forceRender() | |
| } | |
| }) | |
| request.fail(function(jqXHR, status) { | |
| alert("Request failed: " + status + ".") | |
| _this.loading = false | |
| }) | |
| return data_rows | |
| }, | |
| /* | |
| Tries to get the topology for the maintenance window. | |
| Displays maintenance windows regardless of success or failure. | |
| */ | |
| getTopologyForWindows: function() { | |
| var _this = this | |
| this.loading = true | |
| var request = $.ajax({ | |
| url: this.$kytos_server_api + "kytos/topology/v3", | |
| type: "GET", | |
| dataType: "json", | |
| contentType: "application/json" | |
| }) | |
| request.done(function(data) { | |
| // If success, display the mainteinace windows with the current topology. | |
| _this.listMaintenanceWindows(data.topology) | |
| }) | |
| request.fail(function(jqXHR, status) { | |
| // If failure, display the maintenance windows without topology. | |
| _this.listMaintenanceWindows(null) | |
| }) | |
| }, |
jQuery AJAX should be replaced with Axios
Use as reference:
kytos-ng/mef_eline#659
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels