-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from esnet/feature-requests
Feature requests: Traffic Matching by Node and Sidebar Toggle in full-URL-configuration mode
- Loading branch information
Showing
10 changed files
with
251 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ yarn-error.log | |
.vitest | ||
playwright-report | ||
.auth | ||
test-results | ||
test-results | ||
test/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<html> | ||
<head> | ||
<title>Embedded Map Demonstration Page</title> | ||
<script type="module"> | ||
import "./src/components/MapCanvas.component.js"; | ||
</script> | ||
|
||
|
||
</head> | ||
<body> | ||
<table style="width:100%;"> | ||
<tr> | ||
<th colspan="3"> | ||
<h1>Demonstration Page: Traffic Matching by Node Only</h1> | ||
</th> | ||
<tr> | ||
<td style="width:20%"> | ||
<a href="/">Main Demonstration Page</a> | ||
</td> | ||
<tr> | ||
<td colspan="2" style="width:80%;"> | ||
<div id="mapContainer"> | ||
<esnet-map-canvas id="mapCanvas" height="400"> | ||
</esnet-map-canvas> | ||
</div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="width:40%">Map Data</td> | ||
<td style="width:40%">Map Options</td> | ||
<td style="width:20%"></td> | ||
</tr> | ||
<tr> | ||
<td id="mapDataContainer"> | ||
<textarea id="trafficText" style="height:300px; width:100%;"> | ||
</textarea> | ||
</td> | ||
<td id="mapToplogyContainer"> | ||
<textarea id="topologyText" style="height:300px; width:100%"> | ||
</textarea> | ||
</td> | ||
<td id="mapOptionsContainer"> | ||
<textarea id="optionsText" style="height:300px; width:100%;"> | ||
</textarea> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<script type="module"> | ||
import { sanitizeTopology } from "./src/components/lib/topologyTools.js" | ||
import { signals } from "./src/signals.js" | ||
var parsedData = {}; | ||
var lavender = "rgb(202, 149, 229)"; | ||
var options = { | ||
"initialViewStrategy": "viewport", | ||
"showSidebar": true, | ||
"showViewControls": true, | ||
"enableEdgeAnimation": true, | ||
"enableNodeAnimation": true, | ||
"enableScrolling": true, | ||
"enableEditing": true, | ||
"background":"#EDEDED", | ||
"multiLayerNodeSnap": false, | ||
"topologySource": "json", | ||
"viewport": { | ||
"top": 33, | ||
"left": -141, | ||
"bottom": 43, | ||
"right": -41, | ||
"center": { | ||
"lat":38.68, | ||
"lng":-96.96, | ||
}, | ||
"zoom":3.5 | ||
}, | ||
"tileset": { | ||
// global options | ||
// this string corresponds to options in RenderMap.js | ||
"geographic":"esri.shaded", | ||
// this string (or null) corresponds to options in RenderMap.js | ||
"boundaries":null, | ||
// this string (or null) corresponds to options in RenderMap.js | ||
"labels": null, | ||
}, | ||
"layers": [ | ||
{ | ||
// layer 1 rendering options | ||
"visible":true, | ||
"color": lavender, | ||
"endpointId":"names", | ||
"nodeWidth":4, | ||
"edgeWidth":2, | ||
"pathOffset":2, | ||
"srcField": "src_name", | ||
"dstField": "dst_name", | ||
"inboundValueField": "in_bits", | ||
"outboundValueField": "out_bits", | ||
"name":"Nodes Only", | ||
"legend":true, | ||
"nodeThresholds": [{"value": 0, "color": "#E04040"}, {"value": 200000000, "color": "#5bb436"}] | ||
}, | ||
] | ||
}; | ||
var traffic = [ | ||
{"src_latitude":39,"src_longitude":-98,"src_name":"NodeA","in_bits": 16000000, "out_bits": 160000000}, | ||
{"src_latitude":42,"src_longitude":-102,"src_name":"NodeB","in_bits": 320000000, "out_bits": 32000000}, | ||
]; | ||
var topology = [{ | ||
"edges": [], | ||
"nodes": [ | ||
{ "name": "NodeA", "coordinate": [39, -98], "meta": { | ||
"svg": "<g><circle r='15' /><text x='20' y='4' stroke='none' fill='black'>NodeA</text></g>" | ||
} | ||
}, | ||
{ "name": "NodeB", "coordinate": [42, -102], "meta": { | ||
"svg": "<g><circle r='15' /><text x='20' y='4' stroke='none' fill='black'>NodeB</text></g>" | ||
} | ||
} | ||
] | ||
}]; | ||
var canvas = document.getElementById("mapCanvas"); | ||
var optionsElem = document.getElementById("optionsText"); | ||
var topologyElem = document.getElementById("topologyText"); | ||
var trafficElem = document.getElementById("trafficText"); | ||
|
||
console.log("Available signals:", signals); | ||
|
||
const receiveOptionsUpdates = function(options){ | ||
optionsElem.value = JSON.stringify(options, null, " "); | ||
} | ||
const receiveTrafficUpdates = function(traffic){ | ||
trafficElem.value = JSON.stringify(traffic, null, " "); | ||
} | ||
const receiveTopologyUpdates = function(topology){ | ||
var cleanTopology = []; | ||
for(var i=0; i<3; i++){ | ||
if(topology[i]){ | ||
cleanTopology[i] = sanitizeTopology(topology[i]); | ||
} | ||
} | ||
topologyElem.value = JSON.stringify(cleanTopology, null, " "); | ||
} | ||
canvas.listen(signals.TRAFFIC_UPDATED, receiveTrafficUpdates); | ||
canvas.listen(signals.TOPOLOGY_UPDATED, receiveTopologyUpdates); | ||
canvas.listen(signals.OPTIONS_UPDATED, receiveOptionsUpdates); | ||
|
||
canvas.setTopology(topology); | ||
canvas.setOptions(options); | ||
canvas.setTraffic(traffic); | ||
|
||
trafficElem.onchange = function(event){ | ||
canvas.setTraffic(JSON.parse(event.target.value)); | ||
} | ||
|
||
optionsElem.onchange = function(event){ | ||
canvas.setOptions(JSON.parse(event.target.value)); | ||
} | ||
|
||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters