Skip to content

Info Panel List Maintenance Should Use Axios for HTTP Requests #115

@HeriLFIU

Description

@HeriLFIU

/*
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions