Skip to content

Info Panel Show Trace Results Should Use Axios for HTTP Requests #109

@HeriLFIU

Description

@HeriLFIU

fetchTrace() {
var self = this;
$.ajax({
async: true,
dataType: "json",
type: "GET",
url: `${self.$kytos_server_api}amlight/sdntrace/v1/trace/${self.traceId}`,
success: function(response) {
if (response?.msg) {
let notification = {
icon: 'gear',
title: 'Trace in progress...'
};
self.$kytos.eventBus.$emit("setNotification", notification);
} else {
self.trace_results = response.result;
self.updateId = response.request_id;
self.is_empty = !self.trace_results.length;
}
},
error: function() {
self.is_empty = true;
self.trace_results = [];
}
});
},
get_all_traces () {
var self = this
self.get_topology()
let request = $.ajax({
async: true,
dataType: "json",
type: "GET",
contentType: "application/json",
url: this.$kytos_server_api + "amlight/sdntrace/v1/trace",
});
request.done(function(data) {
self.trace = data;
self.show_traces();
});
request.fail(function(data) {
let notification = {
icon: 'gear',
title: 'Bad request',
description: data.status + ': ' + data.responseJSON.description
};
self.$kytos.eventBus.$emit("setNotification", notification);
});
},
show_traces: function() {
var content = {
"component": 'amlight-sdntrace-k-info-panel-show_all_traces',
"content": this.trace,
"icon": "map-marker",
"maximized": true,
"title": "Trace",
"subtitle": "by amlight/sdntrace"
}
this.$kytos.eventBus.$emit("showInfoPanel", content)
},
get_topology: function() {
var self = this;
$.ajax({
async: true,
dataType: "json",
url: this.$kytos_server_api + "kytos/topology/v3",
success: function(data) {
self.switches = data['topology']['switches']
self.links = data['topology']['links']
}
});
}
},

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