Skip to content

Commit

Permalink
Merge pull request #598 from rmotitsuki/fix-597
Browse files Browse the repository at this point in the history
UI - Fix $payload undefined code
  • Loading branch information
HeriLFIU authored Jan 6, 2025
2 parents c74f6d0 + 8b77a75 commit 112063f
Showing 1 changed file with 34 additions and 35 deletions.
69 changes: 34 additions & 35 deletions ui/k-info-panel/show_circuit.kytos
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div v-if="flag_loading == false" class="mef-table no-compact">
<div class="mef-circuit-table">
<table class="table">
<template v-for="(column, cindex) in basics">
<template v-for="(column, cindex) in basics">
<tr>
<th>{{cindex}}</th>
<td>
Expand All @@ -36,7 +36,7 @@
</div>
<div class="mef-circuit-table" id="mef-flags">
<table class="table">
<template v-for="(column, cindex) in flags">
<template v-for="(column, cindex) in flags">
<tr><th>{{cindex}}</th>
<td>
<template v-if="column.editable">
Expand All @@ -57,7 +57,7 @@
</div>
<div class="mef-circuit-table">
<table class="table">
<template v-for="(column, cindex) in others">
<template v-for="(column, cindex) in others">
<tr>
<th>{{cindex}}</th>
<td>
Expand All @@ -75,7 +75,7 @@
</div>
<div class="mef-circuit-table">
<table class="table">
<template v-for="(column, cindex) in dates">
<template v-for="(column, cindex) in dates">
<tr><th>{{cindex}}</th><td>{{column}}</td></tr>
</template>
</table>
Expand Down Expand Up @@ -157,8 +157,8 @@
<table class="table" id="mef-constraints-spf">
<tr>
<th>{{constraint_labels['spf_attribute']}}</th>
<td>
<k-dropdown :options="get_spf_attribute_options(p_constraint_index)"
<td>
<k-dropdown :options="get_spf_attribute_options(p_constraint_index)"
v-model:value=p_constraint.spf_attribute></k-dropdown>
</td>
</tr>
Expand Down Expand Up @@ -385,7 +385,7 @@ module.exports = {
dataType: "json",
contentType: "application/json; charset=utf-8"
});

request.done(function(data) {
_this.buidEvcView(data);
_this.forceRerender();
Expand Down Expand Up @@ -455,7 +455,7 @@ module.exports = {
this.endpoints_data["Interface"][0]["value"] = splitted_dpid[0];
this.endpoints_data["DPID"][0]["value"] = splitted_dpid[2];
}

let dpid_z = this.endpoints_data["DPID"][1]["value"];
if(dpid_z.lastIndexOf(' ') > 0) {
let splitted_dpid = dpid_z.split(' ');
Expand All @@ -466,7 +466,7 @@ module.exports = {
buidEvcView: function(data) {
/**
* Build new EVC object for exibition.
* Parameter:
* Parameter:
* data: evc json from mef_eline
*/
this.circuit = data;
Expand All @@ -478,25 +478,25 @@ module.exports = {

this.endpoints_data = {
'DPID': [
{'value': uni_a, 'editable':true, 'name':'uni_a'},
{'value': uni_a, 'editable':true, 'name':'uni_a'},
{'value': uni_z, 'editable':true, 'name':'uni_z'}],
'Node': [
{'value': uni_a_data['node_name']},
'Node': [
{'value': uni_a_data['node_name']},
{'value': uni_z_data['node_name']}],
'Interface': [
{'value': uni_a_data['interface_name']},
'Interface': [
{'value': uni_a_data['interface_name']},
{'value': uni_z_data['interface_name']}],
'Port':[
{'value': uni_a_data['port_name']},
'Port':[
{'value': uni_a_data['port_name']},
{'value': uni_z_data['port_name']}]
};

// Tag is optional, but can be edited
let tag_a = {'value': this.circuit['uni_a']['tag'] ? JSON.stringify(this.circuit['uni_a']['tag']['value']) : "",
'editable':true,
let tag_a = {'value': this.circuit['uni_a']['tag'] ? JSON.stringify(this.circuit['uni_a']['tag']['value']) : "",
'editable':true,
'name':'tag_a'};
let tag_z = {'value': this.circuit['uni_z']['tag'] ? JSON.stringify(this.circuit['uni_z']['tag']['value']) : "",
'editable':true,
let tag_z = {'value': this.circuit['uni_z']['tag'] ? JSON.stringify(this.circuit['uni_z']['tag']['value']) : "",
'editable':true,
'name':'tag_z'};
this.endpoints_data['VLAN'] = [tag_a, tag_z];

Expand Down Expand Up @@ -527,7 +527,7 @@ module.exports = {
this.links = {"Primary links": data['primary_links'],
"Backup links": data['backup_links']
};

this.circuit_scheduler = data['circuit_scheduler'];

this.constraints = {
Expand Down Expand Up @@ -589,7 +589,7 @@ module.exports = {
}
if(sw.interfaces) {
$.each(sw.interfaces, function(j , k_interface) {
// store interface name data
// store interface name data
let metadata = k_interface.metadata;
_interface_data[k_interface.id] = {
"name": k_interface.name,
Expand Down Expand Up @@ -626,7 +626,7 @@ module.exports = {

buildPathConstraintsView: function(data) {
/**
* Build path constraint data for exibition
* Build path constraint data for exibition
* (primary and secondary constraints paths).
* Parameter:
* constraints_data: json with path constraint data
Expand Down Expand Up @@ -664,7 +664,7 @@ module.exports = {
'spf_max_path_cost': data['spf_max_path_cost'],
'minimum_flexible_hits': data['minimum_flexible_hits'],
};

if(data['mandatory_metrics']) {
_constraint.mandatory_metrics = {
'bandwidth': data['mandatory_metrics']['bandwidth'],
Expand All @@ -681,7 +681,7 @@ module.exports = {
'delay': '', 'reliability': '', 'ownership': '',
'not_ownership': [],
};
}
}
if(data['flexible_metrics']) {
_constraint.flexible_metrics = {
'bandwidth': data['flexible_metrics']['bandwidth'],
Expand Down Expand Up @@ -724,7 +724,7 @@ module.exports = {
link_name = ("link_name" in _data) ? _data["link_name"] : "";
port_name = ("port_name" in _data) ? _data["port_name"] : "";
}

let result = {
"dpid": dpid,
"node_name": node_name,
Expand Down Expand Up @@ -773,7 +773,7 @@ module.exports = {
let payload = {
name: this.basics["Name"]["value"],
enabled: this.flags["Enabled"]["value"],
dynamic_backup_path: this.flags["Dynamic backup path"]["value"],
dynamic_backup_path: this.flags["Dynamic backup path"]["value"],
sb_priority: parseInt(this.others["Southbound priority"]["value"]) || null,
bandwidth: parseInt(this.others["Bandwidth"]["value"]) || 0,
queue_id: parseInt(this.others["Queue"]["value"]),
Expand All @@ -785,7 +785,7 @@ module.exports = {
interface_id: this.endpoints_data["DPID"][1]["value"],
},
};

// Tag is optional
if(this.endpoints_data["VLAN"][0]["value"]) {
payload["uni_a"]["tag"] = {
Expand All @@ -801,7 +801,7 @@ module.exports = {
}

['primary_constraints', 'secondary_constraints'].forEach(_type => {
let _constraint_payload = {};
let _constraint_payload = {};
// Dropdown forms
if(this.constraints[_type].undesired_links !== undefined && this.constraints[_type].undesired_links.length > 0) {
_constraint_payload.undesired_links = [].concat(
Expand Down Expand Up @@ -856,7 +856,6 @@ module.exports = {
});
payload[_type] = _constraint_payload;
});
$payload = payload;

var request = $.ajax({
url: this.$kytos_server_api + "kytos/mef_eline/v2/evc/" + id,
Expand Down Expand Up @@ -901,7 +900,7 @@ module.exports = {

// Make the panel fill the screen except the left menu width
$('.k-info-panel:has(.mef_circuit_container)').addClass('mef-k-info-panel');

this.$kytos.dpids = this.dpids;
}
['primary_constraints', 'secondary_constraints'].forEach( s => {
Expand Down Expand Up @@ -939,7 +938,7 @@ module.exports = {
<style>
/* Import icons */
@import "https://fonts.googleapis.com/icon?family=Material+Icons";

.mef-k-info-panel {
width: calc(100% - 300px);
}
Expand Down Expand Up @@ -998,7 +997,7 @@ module.exports = {
.mef_circuit_container table {
border-collapse: collapse;
width: 100%;

}
.mef_circuit_container tr:nth-child(even) {
background-color: #2d2d2d;
Expand Down Expand Up @@ -1038,7 +1037,7 @@ module.exports = {
margin-top:4px;
}
.mef-circuit-table-constraints {
clear:both;
clear:both;
width:540px;
}
.mef-circuit-table-constraints #mef-constraints-spf {
Expand Down Expand Up @@ -1080,7 +1079,7 @@ module.exports = {
width:520px;
}
.mef-circuit-table-path {
clear:both;
clear:both;
width:540px;
}
#mef-unis .autocomplete-result-list {
Expand Down

0 comments on commit 112063f

Please sign in to comment.