mirror of
https://github.com/Telecominfraproject/oopt-gnpy-web-gui.git
synced 2025-11-02 11:07:47 +00:00
Refactor stylenetwork js into samller ,manageable files and changed folder directory
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
<link rel="icon" href="Assets/img/telecom-favicon.ico" type="image/gif" sizes="16x16">
|
<link rel="icon" href="Assets/img/telecom-favicon.ico" type="image/gif" sizes="16x16">
|
||||||
|
|
||||||
<link href="css/cdn/bootstrap.min.css" rel="stylesheet" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous" />
|
<link href="css/cdn/bootstrap.min.css" rel="stylesheet" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous" />
|
||||||
<link rel="stylesheet" type="text/css" href="css/Style.css" />
|
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
||||||
<link href="css/cdn/font-awesome.min.css" rel="stylesheet" />
|
<link href="css/cdn/font-awesome.min.css" rel="stylesheet" />
|
||||||
|
|
||||||
<link href="css/cdn/roboto-css.css" rel="stylesheet" />
|
<link href="css/cdn/roboto-css.css" rel="stylesheet" />
|
||||||
|
|||||||
@@ -10,25 +10,31 @@
|
|||||||
<meta name="description" content="" />
|
<meta name="description" content="" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="icon" href="Assets/img/telecom-favicon.ico" type="image/gif" sizes="16x16">
|
<link rel="icon" href="Assets/img/telecom-favicon.ico" type="image/gif" sizes="16x16">
|
||||||
<script src="js/Helper/Helper.js"></script>
|
<script src="js/helper/helper.js"></script>
|
||||||
<link href="css/cdn/bootstrap.min.css" rel="stylesheet" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous" />
|
<link href="css/cdn/bootstrap.min.css" rel="stylesheet" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous" />
|
||||||
<link rel="stylesheet" href="css/Style.css" />
|
<link rel="stylesheet" href="css/style.css" />
|
||||||
<link href="css/cdn/font-awesome.min.css" rel="stylesheet" />
|
<link href="css/cdn/font-awesome.min.css" rel="stylesheet" />
|
||||||
<link href="css/cdn/roboto-css.css" rel="stylesheet" />
|
<link href="css/cdn/roboto-css.css" rel="stylesheet" />
|
||||||
<link href="css/cdn/oswald-css.css" rel="stylesheet" />
|
<link href="css/cdn/oswald-css.css" rel="stylesheet" />
|
||||||
<link href="css/cdn/icon.css" rel="stylesheet" />
|
<link href="css/cdn/icon.css" rel="stylesheet" />
|
||||||
<script src="js/Network Graph/FileSaver.js"></script>
|
|
||||||
<script src="js/visunminify.js"></script>
|
|
||||||
<link href="css/cdn/vis-network.min.css" rel="stylesheet" type="text/css" />
|
<link href="css/cdn/vis-network.min.css" rel="stylesheet" type="text/css" />
|
||||||
<script src="js/CdnURL/lodash.min.js"></script>
|
<script src="js/CdnURL/lodash.min.js"></script>
|
||||||
<script src="js/CdnURL/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
|
<script src="js/CdnURL/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
|
||||||
<link href="css/cdn/all.css" rel="stylesheet" />
|
<link href="css/cdn/all.css" rel="stylesheet" />
|
||||||
<script src="js/alea.js"></script>
|
<script src="js/localDB/taffy.js"></script>
|
||||||
<script src="js/exampleUtil.js"></script>
|
<script src="js/networkgraph/vis.js"></script>
|
||||||
<script src="js/LocalDB/taffy.js"></script>
|
<script src="js/networkgraph/filesaver.js"></script>
|
||||||
<script src="js/Network Graph/stylenetwork.js"></script>
|
<script src="js/networkgraph/alea.js"></script>
|
||||||
|
<script src="js/networkgraph/exampleUtil.js"></script>
|
||||||
|
<script src="js/networkgraph/node.js"></script>
|
||||||
|
<script src="js/networkgraph/fiber.js"></script>
|
||||||
|
<script src="js/networkgraph/patch.js"></script>
|
||||||
|
<script src="js/networkgraph/service.js"></script>
|
||||||
|
<script src="js/networkgraph/constraints.js"></script>
|
||||||
|
<script src="js/networkgraph/validation.js"></script>
|
||||||
|
<script src="js/networkgraph/mynetwork.js"></script>
|
||||||
<script src="js/CdnURL/html2canvas.min.js" integrity="sha256-c3RzsUWg+y2XljunEQS0LqWdQ04X1D3j22fd/8JCAKw=" crossorigin="anonymous"></script>
|
<script src="js/CdnURL/html2canvas.min.js" integrity="sha256-c3RzsUWg+y2XljunEQS0LqWdQ04X1D3j22fd/8JCAKw=" crossorigin="anonymous"></script>
|
||||||
<script src="js/validation.js"></script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="body-index" onload="init(false);">
|
<body class="body-index" onload="init(false);">
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="icon" href="Assets/img/telecom-favicon.ico" type="image/gif" sizes="16x16">
|
<link rel="icon" href="Assets/img/telecom-favicon.ico" type="image/gif" sizes="16x16">
|
||||||
<link href="css/cdn/bootstrap.min.css" rel="stylesheet" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous" />
|
<link href="css/cdn/bootstrap.min.css" rel="stylesheet" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous" />
|
||||||
<link rel="stylesheet" type="text/css" href="css/Style.css" />
|
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
||||||
<link href="css/cdn/font-awesome.min.css" rel="stylesheet" />
|
<link href="css/cdn/font-awesome.min.css" rel="stylesheet" />
|
||||||
<link href="css/cdn/roboto-css.css" rel="stylesheet" />
|
<link href="css/cdn/roboto-css.css" rel="stylesheet" />
|
||||||
<link href="css/cdn/oswald-css.css" rel="stylesheet" />
|
<link href="css/cdn/oswald-css.css" rel="stylesheet" />
|
||||||
|
|||||||
59931
js/CdnURL/vis.js
59931
js/CdnURL/vis.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
590
js/networkgraph/constraints.js
Normal file
590
js/networkgraph/constraints.js
Normal file
@@ -0,0 +1,590 @@
|
|||||||
|
function nodeRule(from, to, nodeType) {
|
||||||
|
var fromConnections = network.getConnectedEdges(from);
|
||||||
|
var toConnections = network.getConnectedEdges(to);
|
||||||
|
var connections = [];
|
||||||
|
connections.push(fromConnections);
|
||||||
|
|
||||||
|
$.each(toConnections, function (index, item) {
|
||||||
|
connections.push(item);
|
||||||
|
});
|
||||||
|
|
||||||
|
var fromDetails = network.body.data.nodes.get(from);
|
||||||
|
var toDetails = network.body.data.nodes.get(to);
|
||||||
|
|
||||||
|
var message = "";
|
||||||
|
var flag = false;
|
||||||
|
var connectedNodes;
|
||||||
|
var fromType;
|
||||||
|
var toType;
|
||||||
|
//to check connection b/w roadm and amplifier
|
||||||
|
if ((fromDetails.node_type == roadmJSON.node_type && toDetails.node_type == nodeType) || (toDetails.node_type == roadmJSON.node_type && fromDetails.node_type == nodeType) || (fromDetails.node_type == transceiverJSON.node_type && toDetails.node_type == nodeType) || (toDetails.node_type == transceiverJSON.node_type && fromDetails.node_type == nodeType)) {
|
||||||
|
$.each(connections, function (index, item) {
|
||||||
|
connectedNodes = network.getConnectedNodes(item);
|
||||||
|
if (connectedNodes) {
|
||||||
|
if ((connectedNodes[0] == fromDetails.id && connectedNodes[1] == toDetails.id) || connectedNodes[1] == fromDetails.id && connectedNodes[0] == toDetails.id) {
|
||||||
|
message = "We cannot add more than one " + singleFiberJSON.component_type + "/" + singlePatchJSON.component_type + " connection between " + fromDetails.label + " and " + toDetails.label;
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// to check connection b/w amplifier and amplifier
|
||||||
|
if (fromDetails.node_type == nodeType && toDetails.node_type == nodeType) {
|
||||||
|
$.each(connections, function (index, item) {
|
||||||
|
connectedNodes = network.getConnectedNodes(item);
|
||||||
|
if (connectedNodes) {
|
||||||
|
if ((connectedNodes[0] == fromDetails.id && connectedNodes[1] == toDetails.id) || connectedNodes[1] == fromDetails.id && connectedNodes[0] == toDetails.id) {
|
||||||
|
message = "We cannot add more than one " + singleFiberJSON.component_type + "/" + singlePatchJSON.component_type + " connection between " + fromDetails.label + " and " + toDetails.label;
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var edgeDetails;
|
||||||
|
var nodetype;
|
||||||
|
if (!flag) {
|
||||||
|
message = "";
|
||||||
|
if (fromDetails.node_type == nodeType) {
|
||||||
|
if (fromConnections.length > 1) {
|
||||||
|
message = fromDetails.label + ' can only support 2 links, one outgoing, and one incoming. ';
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$.each(fromConnections, function (index, item) {
|
||||||
|
edgeDetails = network.body.data.edges.get(item);
|
||||||
|
if (edgeDetails.from == from) {
|
||||||
|
message = 'Links wrongly connected. ';
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (toDetails.node_type == nodeType) {
|
||||||
|
if (toConnections.length > 1) {
|
||||||
|
|
||||||
|
if (message != "")
|
||||||
|
message += "<br /> <br />" + toDetails.label + ' can only support 2 links, one outgoing, and one incoming';
|
||||||
|
else
|
||||||
|
message += toDetails.label + ' can only support 2 links, one outgoing, and one incoming';
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$.each(toConnections, function (index, item) {
|
||||||
|
edgeDetails = network.body.data.edges.get(item);
|
||||||
|
if (edgeDetails.to == to) {
|
||||||
|
message = 'Links wrongly connected. ';
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { message: message, flag: flag };
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkLink() {
|
||||||
|
|
||||||
|
var roadmList = network.body.data.nodes.get({
|
||||||
|
filter: function (item) {
|
||||||
|
return (item.node_type == roadmJSON.node_type || item.node_type == transceiverJSON.node_type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var connectedEdges;
|
||||||
|
var fromCount = 0;
|
||||||
|
var toCount = 0;
|
||||||
|
var edgeDetails;
|
||||||
|
var message;
|
||||||
|
var flag = false;
|
||||||
|
var msg = [];
|
||||||
|
var tempEdge = [];
|
||||||
|
$.each(roadmList, function (index, item) {
|
||||||
|
connectedEdges = network.getConnectedEdges(item.id);
|
||||||
|
|
||||||
|
tempEdge = [];
|
||||||
|
$.each(connectedEdges, function (index, item1) {
|
||||||
|
if (network.body.data.edges.get(item1).component_type != serviceJSON.component_type)
|
||||||
|
tempEdge.push(item1);
|
||||||
|
});
|
||||||
|
|
||||||
|
fromCount = 0;
|
||||||
|
toCount = 0;
|
||||||
|
for (i = 0; i < tempEdge.length; i++) {
|
||||||
|
edgeDetails = network.body.data.edges.get(tempEdge[i]);
|
||||||
|
if (edgeDetails.from == item.id)
|
||||||
|
fromCount++;
|
||||||
|
else if (edgeDetails.to == item.id)
|
||||||
|
toCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromCount != toCount || (fromCount == 0 && toCount == 0)) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'span' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> must have an even number of links with an equal number of incoming and outgoing links.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (item.node_type == transceiverJSON.node_type) {
|
||||||
|
if (!item.transceiver_type) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - ' + transceiverJSON.node_type + ' type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (item.node_type == roadmJSON.node_type) {
|
||||||
|
if (!item.roadm_type) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - ' + roadmJSON.node_type.toUpperCase() + ' type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//message = msg.join(' ') + " must have an even number of links with an equal number of incoming and outgoing links";
|
||||||
|
message = msg.join(' ');
|
||||||
|
return { message: message, flag: flag };
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkMisLink() {
|
||||||
|
|
||||||
|
var roadmList = network.body.data.nodes.get({
|
||||||
|
filter: function (item) {
|
||||||
|
return (item.node_type == amplifierJSON.node_type || item.node_type == fusedJSON.node_type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var connectedEdges;
|
||||||
|
var message;
|
||||||
|
var flag = false;
|
||||||
|
var msg = [];
|
||||||
|
var tempEdge = [];
|
||||||
|
var fromCount;
|
||||||
|
var toCount;
|
||||||
|
$.each(roadmList, function (index, item) {
|
||||||
|
connectedEdges = network.getConnectedEdges(item.id);
|
||||||
|
fromCount = 0;
|
||||||
|
toCount = 0;
|
||||||
|
for (i = 0; i < connectedEdges.length; i++) {
|
||||||
|
edgeDetails = network.body.data.edges.get(connectedEdges[i]);
|
||||||
|
if (edgeDetails.from == item.id)
|
||||||
|
fromCount++;
|
||||||
|
else if (edgeDetails.to == item.id)
|
||||||
|
toCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (fromCount != toCount || (fromCount == 0 && toCount == 0) || fromCount > 1 || toCount > 1 ) {
|
||||||
|
// msg.push('<p class="focusNode" title="Click here to focus the node" id=\'span' + item.id.replace(/\s/g, '') + '\' onClick="focusNode(\'' + item.id + '\')"><img width="25" src="./Assets/img/error-listing-icon.png"> One or more links to <b>' + item.label + '</b> is missing.</p>');
|
||||||
|
// flag = true;
|
||||||
|
//}
|
||||||
|
if (connectedEdges.length <= 1) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'span' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> One or more links to <b>' + item.label + '</b> is missing.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
else if (connectedEdges.length > 1) {
|
||||||
|
|
||||||
|
if ((connectedEdges.length == 2 && fromCount == 2) || (connectedEdges.length == 2 && toCount == 2)) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'span' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"><b>' + item.label + '</b> cannot support 2 links of the same type, must have one incoming and one outgoing link</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
else if (fromCount != toCount || connectedEdges.length > 2) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'span' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"><b>' + item.label + '</b> cannot support more than 2 links</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.node_type == amplifierJSON.node_type) {
|
||||||
|
if (item.amp_category == amplifierJSON.amp_category) {
|
||||||
|
if (!item.amp_type) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - ' + amplifierJSON.amp_category + ' type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (item.amp_category == ramanampJSON.amp_category) {
|
||||||
|
if (!item.amp_type) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - Raman amplifier type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (!item.category) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - Raman amplifier category not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
message = msg.join(' ');
|
||||||
|
return { message: message, flag: flag };
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkTypeForce() {
|
||||||
|
|
||||||
|
var transList = network.body.data.nodes.get({
|
||||||
|
filter: function (item) {
|
||||||
|
return (item.node_type == transceiverJSON.node_type || item.node_type == amplifierJSON.node_type || item.node_type == roadmJSON.node_type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var message;
|
||||||
|
var msg = [];
|
||||||
|
var flag = false;
|
||||||
|
$.each(transList, function (index, item) {
|
||||||
|
|
||||||
|
if (item.node_type == transceiverJSON.node_type) {
|
||||||
|
if (!item.transceiver_type) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - ' + transceiverJSON.node_type + ' type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (item.node_type == roadmJSON.node_type) {
|
||||||
|
if (!item.roadm_type) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - ' + roadmJSON.node_type.toUpperCase() + ' type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (item.node_type == amplifierJSON.node_type) {
|
||||||
|
if (item.amp_category == amplifierJSON.amp_category) {
|
||||||
|
if (!item.amp_type) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - ' + amplifierJSON.amp_category + ' type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (item.amp_category == ramanampJSON.amp_category) {
|
||||||
|
if (!item.amp_type) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - Raman amplifier type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (!item.category) {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the node" id=\'spanTF' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',1)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - Raman amplifier category not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
message = msg.join(' ');
|
||||||
|
return { message: message, flag: flag };
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkFiberPro() {
|
||||||
|
|
||||||
|
var fiberList = network.body.data.edges.get({
|
||||||
|
filter: function (item) {
|
||||||
|
return (item.fiber_category == singleFiberJSON.fiber_category);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var message;
|
||||||
|
var msg = [];
|
||||||
|
var flag = false;
|
||||||
|
var spanlen;
|
||||||
|
var span_length;
|
||||||
|
$.each(fiberList, function (index, item) {
|
||||||
|
span_length = item.span_length;
|
||||||
|
spanlen = parseFloat(span_length);
|
||||||
|
if (item.fiber_type == "") {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the fiber" id=\'spanFP' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',2)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - ' + singleFiberJSON.component_type + ' type not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (isNaN(span_length) || spanlen <= 0 || span_length == "") {
|
||||||
|
msg.push('<p class="focusNode" title="Click here to focus the fiber" id=\'spanFP' + item.id.replace(/\s/g, '') + '\' onClick="focusNodeFiber(\'' + item.id + '\',2)"><img width="25" src="./Assets/img/error-listing-icon.png"> <b>' + item.label + '</b> - ' + singleFiberJSON.component_type + ' length not entered by the user.</p>');
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
message = msg.join(' ');
|
||||||
|
return { message: message, flag: flag };
|
||||||
|
}
|
||||||
|
function nodeRuleOnImportJSON() {
|
||||||
|
//checkLink
|
||||||
|
var roadmList = network.body.data.nodes.get({
|
||||||
|
filter: function (item) {
|
||||||
|
return (item.node_type == roadmJSON.node_type || item.node_type == transceiverJSON.node_type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var connectedEdges;
|
||||||
|
var fromCount = 0;
|
||||||
|
var toCount = 0;
|
||||||
|
var edgeDetails;
|
||||||
|
var tempEdge = [];
|
||||||
|
$.each(roadmList, function (index, item) {
|
||||||
|
connectedEdges = network.getConnectedEdges(item.id);
|
||||||
|
tempEdge = [];
|
||||||
|
$.each(connectedEdges, function (index, item1) {
|
||||||
|
if (network.body.data.edges.get(item1).component_type != serviceJSON.component_type)
|
||||||
|
tempEdge.push(item1);
|
||||||
|
});
|
||||||
|
fromCount = 0;
|
||||||
|
toCount = 0;
|
||||||
|
for (i = 0; i < tempEdge.length; i++) {
|
||||||
|
edgeDetails = network.body.data.edges.get(tempEdge[i]);
|
||||||
|
if (edgeDetails.from == item.id)
|
||||||
|
fromCount++;
|
||||||
|
else if (edgeDetails.to == item.id)
|
||||||
|
toCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromCount != toCount || (fromCount == 0 && toCount == 0)) {
|
||||||
|
addNodeHighlight(item.id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (item.node_type == transceiverJSON.node_type && item.transceiver_type == "") {
|
||||||
|
addNodeHighlight(item.id);
|
||||||
|
}
|
||||||
|
else if (item.node_type == roadmJSON.node_type && item.roadm_type == "") {
|
||||||
|
addNodeHighlight(item.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//checkMisLink
|
||||||
|
|
||||||
|
roadmList = network.body.data.nodes.get({
|
||||||
|
filter: function (item) {
|
||||||
|
return (item.node_type == amplifierJSON.node_type || item.node_type == fusedJSON.node_type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.each(roadmList, function (index, item) {
|
||||||
|
connectedEdges = network.getConnectedEdges(item.id);
|
||||||
|
|
||||||
|
fromCount = 0;
|
||||||
|
toCount = 0;
|
||||||
|
for (i = 0; i < connectedEdges.length; i++) {
|
||||||
|
edgeDetails = network.body.data.edges.get(connectedEdges[i]);
|
||||||
|
if (edgeDetails.from == item.id)
|
||||||
|
fromCount++;
|
||||||
|
else if (edgeDetails.to == item.id)
|
||||||
|
toCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromCount != toCount || (fromCount == 0 && toCount == 0) || fromCount > 1 || toCount > 1) {
|
||||||
|
addNodeHighlight(item.id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (item.node_type == amplifierJSON.node_type) {
|
||||||
|
if (item.amp_category == ramanampJSON.amp_category && item.amp_type == "" && !(item.category)) {
|
||||||
|
addNodeHighlight(item.id);
|
||||||
|
}
|
||||||
|
else if (item.amp_category == amplifierJSON.amp_category && item.amp_type == "") {
|
||||||
|
addNodeHighlight(item.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function edgeStyleOnImportJSON() {
|
||||||
|
var edgeList = network.body.data.edges.get();
|
||||||
|
var cfrom;
|
||||||
|
var cto;
|
||||||
|
var fiberData = [];
|
||||||
|
for (var i = 0; i < edgeList.length; i++) {
|
||||||
|
|
||||||
|
cfrom = edgeList[i].from;
|
||||||
|
cto = edgeList[i].to;
|
||||||
|
|
||||||
|
var connectedFiber = network.getConnectedEdges(cfrom);
|
||||||
|
connectedFiber.push(network.getConnectedEdges(cto));
|
||||||
|
var fromFiberCount = 0;
|
||||||
|
var toFiberCount = 0;
|
||||||
|
var fiberCount = 0;
|
||||||
|
|
||||||
|
$.each(connectedFiber, function (index, item) {
|
||||||
|
var fiberDetails = network.body.data.edges.get(item);
|
||||||
|
if (fiberDetails.fiber_category == dualFiberJSON.fiber_category || fiberDetails.fiber_category == singleFiberJSON.fiber_category || fiberDetails.component_type == serviceJSON.component_type || fiberDetails.component_type == dualPatchJSON.component_type) {
|
||||||
|
var fiberSmooth = singleFiberJSON.options.smooth;
|
||||||
|
if (fiberDetails.from == cfrom && fiberDetails.to == cto) {
|
||||||
|
fiberCount++;
|
||||||
|
|
||||||
|
if (fiberCount == 1) {
|
||||||
|
fiberSmooth = fiberJSON.options.smooth;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fromFiberCount++;
|
||||||
|
fiberSmooth.roundness = "0." + fromFiberCount;
|
||||||
|
}
|
||||||
|
network.body.data.edges.update({
|
||||||
|
id: fiberDetails.id, smooth: fiberSmooth
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (fiberDetails.from == cto && fiberDetails.to == cfrom) {
|
||||||
|
fiberCount++;
|
||||||
|
fiberSmooth.roundness = "0." + toFiberCount;
|
||||||
|
if (fiberCount == 1) {
|
||||||
|
fiberSmooth = fiberJSON.options.smooth;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
toFiberCount++;
|
||||||
|
fiberSmooth.roundness = "0." + toFiberCount;
|
||||||
|
}
|
||||||
|
network.body.data.edges.update({
|
||||||
|
id: fiberDetails.id, smooth: fiberSmooth
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function nodeValidationInEdge(cfrom, cto) {
|
||||||
|
// start remove highlight once roadm have equal in/out conn
|
||||||
|
var roadmList = [];
|
||||||
|
|
||||||
|
if (network.body.data.nodes.get(cfrom).node_type == roadmJSON.node_type)
|
||||||
|
roadmList.push(cfrom);
|
||||||
|
|
||||||
|
if (network.body.data.nodes.get(cto).node_type == roadmJSON.node_type)
|
||||||
|
roadmList.push(cto);
|
||||||
|
|
||||||
|
var connectedEdges;
|
||||||
|
var fromCount = 0;
|
||||||
|
var toCount = 0;
|
||||||
|
var edgeDetails;
|
||||||
|
$.each(roadmList, function (index, item) {
|
||||||
|
connectedEdges = network.getConnectedEdges(item);
|
||||||
|
fromCount = 0;
|
||||||
|
toCount = 0;
|
||||||
|
for (i = 0; i < connectedEdges.length; i++) {
|
||||||
|
edgeDetails = network.body.data.edges.get(connectedEdges[i]);
|
||||||
|
if (edgeDetails.from == item)
|
||||||
|
fromCount++;
|
||||||
|
else if (edgeDetails.to == item)
|
||||||
|
toCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromCount != toCount || (fromCount == 0 && toCount == 0)) {
|
||||||
|
addNodeHighlight(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (network.body.data.nodes.get(item).roadm_type != "") {
|
||||||
|
removeSpanInError(item, true);
|
||||||
|
removeSpanInError(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var removeID = "#span" + item.replace(/\s/g, '');
|
||||||
|
$(removeID).remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
// end
|
||||||
|
|
||||||
|
//start mislink
|
||||||
|
roadmList = [];
|
||||||
|
if (network.body.data.nodes.get(cfrom).node_type == fusedJSON.node_type || network.body.data.nodes.get(cfrom).node_type == amplifierJSON.node_type)
|
||||||
|
roadmList.push(cfrom);
|
||||||
|
|
||||||
|
if (network.body.data.nodes.get(cto).node_type == fusedJSON.node_type || network.body.data.nodes.get(cto).node_type == amplifierJSON.node_type)
|
||||||
|
roadmList.push(cto);
|
||||||
|
|
||||||
|
|
||||||
|
$.each(roadmList, function (index, item) {
|
||||||
|
connectedEdges = network.getConnectedEdges(item);
|
||||||
|
fromCount = 0;
|
||||||
|
toCount = 0;
|
||||||
|
for (i = 0; i < connectedEdges.length; i++) {
|
||||||
|
edgeDetails = network.body.data.edges.get(connectedEdges[i]);
|
||||||
|
if (edgeDetails.from == item)
|
||||||
|
fromCount++;
|
||||||
|
else if (edgeDetails.to == item)
|
||||||
|
toCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromCount != toCount || (fromCount == 0 && toCount == 0) || fromCount > 1 || toCount > 1) {
|
||||||
|
addNodeHighlight(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if (network.body.data.nodes.get(item).node_type == amplifierJSON.node_type) {
|
||||||
|
|
||||||
|
|
||||||
|
if (network.body.data.nodes.get(item).amp_category == amplifierJSON.amp_category) {
|
||||||
|
if (network.body.data.nodes.get(item).amp_type != "") {
|
||||||
|
removeSpanInError(item, true);
|
||||||
|
removeSpanInError(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var removeID = "#span" + item.replace(/\s/g, '');
|
||||||
|
$(removeID).remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (network.body.data.nodes.get(item).amp_category == ramanampJSON.amp_category) {
|
||||||
|
if (network.body.data.nodes.get(item).amp_type != "" && (network.body.data.nodes.get(item).category)) {
|
||||||
|
removeSpanInError(item, true);
|
||||||
|
removeSpanInError(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var removeID = "#span" + item.replace(/\s/g, '');
|
||||||
|
$(removeID).remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
removeSpanInError(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//
|
||||||
|
// start remove highlight once transceiver have equal in/out conn
|
||||||
|
var tempEdge = [];
|
||||||
|
roadmList = [];
|
||||||
|
if (network.body.data.nodes.get(cfrom).node_type == transceiverJSON.node_type)
|
||||||
|
roadmList.push(cfrom);
|
||||||
|
|
||||||
|
if (network.body.data.nodes.get(cto).node_type == transceiverJSON.node_type)
|
||||||
|
roadmList.push(cto);
|
||||||
|
|
||||||
|
$.each(roadmList, function (index, item) {
|
||||||
|
connectedEdges = network.getConnectedEdges(item);
|
||||||
|
tempEdge = [];
|
||||||
|
$.each(connectedEdges, function (index, item1) {
|
||||||
|
if (network.body.data.edges.get(item1).component_type != serviceJSON.component_type)
|
||||||
|
tempEdge.push(item1);
|
||||||
|
});
|
||||||
|
fromCount = 0;
|
||||||
|
toCount = 0;
|
||||||
|
for (i = 0; i < tempEdge.length; i++) {
|
||||||
|
edgeDetails = network.body.data.edges.get(tempEdge[i]);
|
||||||
|
if (edgeDetails.from == item)
|
||||||
|
fromCount++;
|
||||||
|
else if (edgeDetails.to == item)
|
||||||
|
toCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fromCount != toCount || (fromCount == 0 && toCount == 0)) {
|
||||||
|
addNodeHighlight(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//removeSpanInError(item);
|
||||||
|
if (network.body.data.nodes.get(item).transceiver_type != "") {
|
||||||
|
removeSpanInError(item, true);
|
||||||
|
removeSpanInError(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var removeID = "#span" + item.replace(/\s/g, '');
|
||||||
|
$(removeID).remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// end
|
||||||
|
|
||||||
|
realUpdate();
|
||||||
|
checkErrorFree();
|
||||||
|
|
||||||
|
//end
|
||||||
|
}
|
||||||
1121
js/networkgraph/fiber.js
Normal file
1121
js/networkgraph/fiber.js
Normal file
File diff suppressed because it is too large
Load Diff
3423
js/networkgraph/mynetwork.js
Normal file
3423
js/networkgraph/mynetwork.js
Normal file
File diff suppressed because it is too large
Load Diff
1423
js/networkgraph/node.js
Normal file
1423
js/networkgraph/node.js
Normal file
File diff suppressed because it is too large
Load Diff
242
js/networkgraph/patch.js
Normal file
242
js/networkgraph/patch.js
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
var isDualPatchMode = 0;
|
||||||
|
var isSinglePatchMode = 0;
|
||||||
|
var addPatchData = {
|
||||||
|
from: '',
|
||||||
|
to: ''
|
||||||
|
};
|
||||||
|
function dualPatchMode() {
|
||||||
|
UnSelectAll();
|
||||||
|
isDualPatchMode = 1;
|
||||||
|
isSinglePatchMode = 0;
|
||||||
|
isAddService = 0;
|
||||||
|
isDualFiberMode = 0;
|
||||||
|
isSingleFiberMode = 0;
|
||||||
|
addPatchData = {
|
||||||
|
from: '',
|
||||||
|
to: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function singlePatchMode() {
|
||||||
|
UnSelectAll();
|
||||||
|
isDualPatchMode = 0;
|
||||||
|
isSinglePatchMode = 1;
|
||||||
|
isAddService = 0;
|
||||||
|
isDualFiberMode = 0;
|
||||||
|
isSingleFiberMode = 0;
|
||||||
|
addPatchData = {
|
||||||
|
from: '',
|
||||||
|
to: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function addDualPatch() {
|
||||||
|
|
||||||
|
var fromDetails = network.body.data.nodes.get(addPatchData.from);
|
||||||
|
var toDetails = network.body.data.nodes.get(addPatchData.to);
|
||||||
|
if ((fromDetails.node_type == transceiverJSON.node_type && toDetails.node_type == roadmJSON.node_type) || (fromDetails.node_type == roadmJSON.node_type && toDetails.node_type == transceiverJSON.node_type)) {
|
||||||
|
|
||||||
|
var labelvalue = dualPatchJSON.component_type + ' ' + network.body.data.nodes.get(addPatchData.from).number + ' - ' + network.body.data.nodes.get(addPatchData.to).number;
|
||||||
|
addPatchComponent(1, addPatchData.from, addPatchData.to, labelvalue, labelvalue, false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
showMessage(alertType.Error, "The " + dualPatchJSON.component_type + " should be between " + transceiverJSON.node_type + " and " + roadmJSON.node_type + " sites");
|
||||||
|
}
|
||||||
|
addPatchData = {
|
||||||
|
from: '',
|
||||||
|
to: ''
|
||||||
|
};
|
||||||
|
UnSelectAll();
|
||||||
|
network.addEdgeMode();
|
||||||
|
|
||||||
|
}
|
||||||
|
function addSinglePatch() {
|
||||||
|
|
||||||
|
var labelvalue = getLabel(addPatchData.from, addPatchData.to, singlePatchJSON.component_type);
|
||||||
|
addPatchComponent(1, addPatchData.from, addPatchData.to, labelvalue, labelvalue, false);
|
||||||
|
addPatchData = {
|
||||||
|
from: '',
|
||||||
|
to: ''
|
||||||
|
};
|
||||||
|
UnSelectAll();
|
||||||
|
network.addEdgeMode();
|
||||||
|
}
|
||||||
|
function addPatchComponent(cmode, cfrom, cto, clabel, ctext, isImport) {
|
||||||
|
|
||||||
|
if (cmode == 1) {
|
||||||
|
var patchID = token();
|
||||||
|
if (!isImport)
|
||||||
|
clabel = countFiberService(false, false, false, true, cfrom, cto) + '-' + clabel;
|
||||||
|
|
||||||
|
elabel = clabel;
|
||||||
|
|
||||||
|
if (isSinglePatchMode == 1) {
|
||||||
|
var flag = false;
|
||||||
|
var message = [];
|
||||||
|
var response = nodeRule(cfrom, cto, amplifierJSON.node_type);
|
||||||
|
if (response.flag) {
|
||||||
|
flag = true
|
||||||
|
message.push(response.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
response = nodeRule(cfrom, cto, fusedJSON.node_type);
|
||||||
|
if (response.flag) {
|
||||||
|
flag = true;
|
||||||
|
message.push(response.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
showMessage(alertType.Error, message.join('. <br /><br /> '));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
network.body.data.edges.add({
|
||||||
|
id: patchID, from: cfrom, to: cto, label: elabel, text: clabel,
|
||||||
|
dashes: singlePatchJSON.dashes, width: singlePatchJSON.width,
|
||||||
|
component_type: singlePatchJSON.component_type, patch_category: singlePatchJSON.patch_category,
|
||||||
|
color: singlePatchJSON.options.color, background: singlePatchJSON.options.background,
|
||||||
|
arrows: singlePatchJSON.options.arrows,
|
||||||
|
smooth: singlePatchJSON.options.smooth,
|
||||||
|
view: topologyView.Functional_View, hidden: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
nodeValidationInEdge(cfrom, cto);
|
||||||
|
}
|
||||||
|
if (isDualPatchMode == 1) {
|
||||||
|
//we cannot add more than 1 patch
|
||||||
|
isPatchAdded = false;
|
||||||
|
var connectedFiber = network.getConnectedEdges(cfrom);
|
||||||
|
connectedFiber.push(network.getConnectedEdges(cto));
|
||||||
|
$.each(connectedFiber, function (index, item) {
|
||||||
|
var fiberDetails = network.body.data.edges.get(item);
|
||||||
|
if (fiberDetails.component_type == dualPatchJSON.component_type) {
|
||||||
|
if ((fiberDetails.from == cfrom && fiberDetails.to == cto) || (fiberDetails.from == cto && fiberDetails.to == cfrom)) {
|
||||||
|
isPatchAdded = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isPatchAdded && !isImport) {
|
||||||
|
showMessage(alertType.Error, 'We cannot add more than 1 ' + dualPatchJSON.patch_category);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//end
|
||||||
|
network.body.data.edges.add({
|
||||||
|
id: patchID, from: cfrom, to: cto, label: elabel, text: ctext,
|
||||||
|
dashes: dualPatchJSON.dashes, width: dualPatchJSON.width,
|
||||||
|
component_type: dualPatchJSON.component_type, patch_category: dualPatchJSON.patch_category,
|
||||||
|
color: dualPatchJSON.options.color, background: dualPatchJSON.options.background,
|
||||||
|
arrows: dualPatchJSON.options.arrows,
|
||||||
|
smooth: dualPatchJSON.options.smooth,
|
||||||
|
view: topologyView.NE_View, hidden: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
multipleFiberService(cfrom, cto);
|
||||||
|
var tedge = network.body.data.edges.get(patchID);
|
||||||
|
tedge.isUpdate = false;
|
||||||
|
tempUndo.push(tedge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function singlePatchEdit(patchID, callback) {
|
||||||
|
document.getElementById("singlePatchMenu").style.display = "none";
|
||||||
|
var edgeDetails = network.body.data.edges.get(patchID);
|
||||||
|
$("#txtSinglePatchName").val(edgeDetails.text);
|
||||||
|
openDrawer('singlepatch');
|
||||||
|
document.getElementById("btnUpdateSinglePatch").onclick = updateSinglePatch.bind(
|
||||||
|
this,
|
||||||
|
patchID,
|
||||||
|
callback
|
||||||
|
);
|
||||||
|
document.getElementById("btnCloseSinglePatch").onclick = clearSinglePatch.bind(
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function updateSinglePatch(patchID) {
|
||||||
|
|
||||||
|
var id = patchID;
|
||||||
|
var label = $("#txtSinglePatchName").val().trim();
|
||||||
|
var patchDetails = network.body.data.edges.get(patchID);
|
||||||
|
if (nameLengthValidation("txtSinglePatchName")) {
|
||||||
|
|
||||||
|
var elabel = "";
|
||||||
|
elabel = label;
|
||||||
|
if (patchDetails.component_type == dualPatchJSON.component_type) {
|
||||||
|
network.body.data.edges.update({
|
||||||
|
id: id, label: elabel, text: label
|
||||||
|
});
|
||||||
|
multipleFiberService(patchDetails.from, patchDetails.to);
|
||||||
|
var tdata = network.body.data.edges.get(id);
|
||||||
|
tdata.isUpdate = true;
|
||||||
|
tempUndo.push(tdata);
|
||||||
|
clearSinglePatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function deletePatch(patchID) {
|
||||||
|
var patchDetails = network.body.data.edges.get(patchID);
|
||||||
|
var patchLabel = patchDetails.label;
|
||||||
|
if (patchDetails.label.trim() == "")
|
||||||
|
patchLabel = patchDetails.text
|
||||||
|
|
||||||
|
if (checkFiberPatchServiceCon(patchDetails.from, patchDetails.to, patchDetails.component_type))
|
||||||
|
return;
|
||||||
|
document.getElementById("singlePatchMenu").style.display = "none";
|
||||||
|
document.getElementById("dualPatchMenu").style.display = "none";
|
||||||
|
var patchd = network.body.data.edges.get(patchID);
|
||||||
|
network.body.data.edges.remove(patchID);
|
||||||
|
multipleFiberService(patchDetails.from, patchDetails.to);
|
||||||
|
nodeValidationInEdge(patchDetails.from, patchDetails.to);
|
||||||
|
patchd.isDelete = true;
|
||||||
|
patchd.isUpdate = false;
|
||||||
|
tempUndo.push(patchd);
|
||||||
|
UnSelectAll();
|
||||||
|
enableEdgeIndicator();
|
||||||
|
}
|
||||||
|
function clearSinglePatch() {
|
||||||
|
|
||||||
|
$("#txtSinglePatchName").val('');
|
||||||
|
closeDrawer('singlepatch');
|
||||||
|
UnSelectAll();
|
||||||
|
enableEdgeIndicator();
|
||||||
|
}
|
||||||
|
function dualPatchEdit(patchID, callback) {
|
||||||
|
document.getElementById("dualPatchMenu").style.display = "none";
|
||||||
|
var edgeDetails = network.body.data.edges.get(patchID);
|
||||||
|
$("#txtDualPatchName").val(edgeDetails.text);
|
||||||
|
openDrawer('dualpatch');
|
||||||
|
document.getElementById("btnUpdateDualPatch").onclick = updateDualPatch.bind(
|
||||||
|
this,
|
||||||
|
patchID,
|
||||||
|
callback
|
||||||
|
);
|
||||||
|
document.getElementById("btnCloseDualPatch").onclick = clearDualPatch.bind(
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function updateDualPatch(patchID) {
|
||||||
|
|
||||||
|
var id = patchID;
|
||||||
|
var label = $("#txtDualPatchName").val().trim();
|
||||||
|
var patchDetails = network.body.data.edges.get(patchID);
|
||||||
|
|
||||||
|
if (nameLengthValidation("txtDualPatchName")) {
|
||||||
|
|
||||||
|
if (patchDetails.component_type == dualPatchJSON.component_type) {
|
||||||
|
|
||||||
|
var elabel = "";
|
||||||
|
elabel = label;
|
||||||
|
network.body.data.edges.update({
|
||||||
|
id: id, label: elabel, text: label
|
||||||
|
});
|
||||||
|
multipleFiberService(patchDetails.from, patchDetails.to);
|
||||||
|
clearDualPatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function clearDualPatch() {
|
||||||
|
$("#txtDualPatchName").val('');
|
||||||
|
closeDrawer('dualpatch');
|
||||||
|
UnSelectAll();
|
||||||
|
enableEdgeIndicator();
|
||||||
|
}
|
||||||
149
js/networkgraph/service.js
Normal file
149
js/networkgraph/service.js
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
var isAddService = 0;
|
||||||
|
var addServiceData = {
|
||||||
|
from: '',
|
||||||
|
to: ''
|
||||||
|
};
|
||||||
|
function addServiceMode() {
|
||||||
|
UnSelectAll();
|
||||||
|
isAddService = 1;
|
||||||
|
isDualFiberMode = 0;
|
||||||
|
isSingleFiberMode = 0;
|
||||||
|
isSinglePatchMode = 0;
|
||||||
|
isDualPatchMode = 0;
|
||||||
|
addServiceData = {
|
||||||
|
from: '',
|
||||||
|
to: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function addService() {
|
||||||
|
|
||||||
|
var fromDetails = network.body.data.nodes.get(addServiceData.from);
|
||||||
|
var toDetails = network.body.data.nodes.get(addServiceData.to);
|
||||||
|
var transNode = transceiverJSON.node_type.toString().toLowerCase();
|
||||||
|
//service should be add between only two transceiver
|
||||||
|
if (fromDetails.node_type == transceiverJSON.node_type && toDetails.node_type == transceiverJSON.node_type) {
|
||||||
|
//transceiver force checking
|
||||||
|
if (fromDetails.transceiver_type != "" && toDetails.transceiver_type != "") {
|
||||||
|
//same transceiver type checking
|
||||||
|
if (fromDetails.transceiver_type == toDetails.transceiver_type) {
|
||||||
|
var labelvalue = getLabel(addServiceData.from, addServiceData.to, serviceJSON.component_type);
|
||||||
|
//2 transceiver must have fiber/patch connection
|
||||||
|
if (network.getConnectedEdges(addServiceData.from).length > 0 && network.getConnectedEdges(addServiceData.to).length > 0)
|
||||||
|
addServiceComponent(1, addServiceData.from, addServiceData.to, labelvalue, false);
|
||||||
|
else
|
||||||
|
showMessage(alertType.Error, "Source " + roadmJSON.component_type + " : " + fromDetails.label + " ,destination " + roadmJSON.component_type + " : " + toDetails.label + " should have " + dualFiberJSON.component_type + "/" + dualPatchJSON.component_type + " connection");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
showMessage(alertType.Error, serviceJSON.component_type + " can be created only between " + transNode + " of same type");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
showMessage(alertType.Error, serviceJSON.component_type + " can be created only when " + transNode + "s are forced");
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
showMessage(alertType.Error, "The " + serviceJSON.component_type + " should be between 2 " + transNode + " sites");
|
||||||
|
}
|
||||||
|
addServiceData = {
|
||||||
|
from: '',
|
||||||
|
to: ''
|
||||||
|
};
|
||||||
|
UnSelectAll();
|
||||||
|
|
||||||
|
}
|
||||||
|
function addServiceComponent(cmode, cfrom, cto, clabel, isImport) {
|
||||||
|
var serviceID = token();
|
||||||
|
if (cmode == 1) {
|
||||||
|
|
||||||
|
var bandwidth = configData[serviceJSON.component_type].default.band_width;
|
||||||
|
if (isImport)
|
||||||
|
bandwidth = tBandwidth;
|
||||||
|
else
|
||||||
|
clabel = countFiberService(false, false, true, false, cfrom, cto) + '-' + clabel;
|
||||||
|
|
||||||
|
elabel = clabel;
|
||||||
|
var fiberSmooth = multipleFiberService1(cfrom, cto);
|
||||||
|
if (!fiberSmooth)
|
||||||
|
fiberSmooth = fiberJSON.options.smooth;
|
||||||
|
network.body.data.edges.add({
|
||||||
|
id: serviceID, from: cfrom, to: cto, label: elabel, text: clabel, dashes: serviceJSON.dashes, width: serviceJSON.width,
|
||||||
|
component_type: serviceJSON.component_type, color: serviceJSON.options.color, background: serviceJSON.options.background,
|
||||||
|
arrows: serviceJSON.options.arrows,
|
||||||
|
smooth: fiberSmooth,
|
||||||
|
band_width: bandwidth
|
||||||
|
});
|
||||||
|
multipleFiberService(cfrom, cto);
|
||||||
|
var tedge = network.body.data.edges.get(serviceID);
|
||||||
|
tedge.isUpdate = false;
|
||||||
|
tempUndo.push(tedge);
|
||||||
|
}
|
||||||
|
UnSelectAll();
|
||||||
|
network.addEdgeMode();
|
||||||
|
}
|
||||||
|
function serviceEdit(serviceID, callback) {
|
||||||
|
document.getElementById("serviceMenu").style.display = "none";
|
||||||
|
var edgeDetails = network.body.data.edges.get(serviceID);
|
||||||
|
$("#txtServiceName").val(edgeDetails.text);
|
||||||
|
var connectedNode = network.getConnectedNodes(serviceID);
|
||||||
|
$("#txtServiceSrc").val(network.body.data.nodes.get(connectedNode[0]).label);
|
||||||
|
$("#txtServiceDest").val(network.body.data.nodes.get(connectedNode[1]).label);
|
||||||
|
$("#txtBandwidth").val(edgeDetails.band_width);
|
||||||
|
openDrawer('service');
|
||||||
|
document.getElementById("btnUpdateService").onclick = updateService.bind(
|
||||||
|
this,
|
||||||
|
serviceID,
|
||||||
|
callback
|
||||||
|
);
|
||||||
|
document.getElementById("btnCloseService").onclick = clearService.bind(
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function updateService(serviceID) {
|
||||||
|
|
||||||
|
var id = serviceID;
|
||||||
|
var label = $("#txtServiceName").val().trim();
|
||||||
|
var bandwidth = $("#txtBandwidth").val();
|
||||||
|
var serviceDetails = network.body.data.edges.get(serviceID);
|
||||||
|
|
||||||
|
if (nameLengthValidation("txtServiceName")) {
|
||||||
|
|
||||||
|
if (serviceDetails.component_type == serviceJSON.component_type) {
|
||||||
|
|
||||||
|
var elabel = "";
|
||||||
|
elabel = label;
|
||||||
|
network.body.data.edges.update({
|
||||||
|
id: id, label: elabel, text: label, band_width: bandwidth
|
||||||
|
});
|
||||||
|
multipleFiberService(serviceDetails.from, serviceDetails.to);
|
||||||
|
var tdata = network.body.data.edges.get(id);
|
||||||
|
tdata.isUpdate = true;
|
||||||
|
tempUndo.push(tdata);
|
||||||
|
|
||||||
|
clearService();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function deleteService(serviceID) {
|
||||||
|
var serviceDetails = network.body.data.edges.get(serviceID);
|
||||||
|
document.getElementById("serviceMenu").style.display = "none";
|
||||||
|
var serviced = network.body.data.edges.get(serviceID);
|
||||||
|
network.body.data.edges.remove(serviceID);
|
||||||
|
multipleFiberService(serviceDetails.from, serviceDetails.to);
|
||||||
|
serviced.isDelete = true;
|
||||||
|
serviced.isUpdate = false;
|
||||||
|
tempUndo.push(serviced);
|
||||||
|
UnSelectAll();
|
||||||
|
enableEdgeIndicator();
|
||||||
|
}
|
||||||
|
function clearService() {
|
||||||
|
|
||||||
|
$("#txtServiceName").val('');
|
||||||
|
$("#txtServiceSrc").val('');
|
||||||
|
$("#txtServiceDest").val('');
|
||||||
|
$("#txtBandwidth").val('');
|
||||||
|
$("#ddlCentralFrq").val('');
|
||||||
|
closeDrawer('service');
|
||||||
|
UnSelectAll();
|
||||||
|
enableEdgeIndicator();
|
||||||
|
}
|
||||||
|
|
||||||
@@ -97,11 +97,7 @@ function nameLengthValidation(element) {
|
|||||||
var flag = true;
|
var flag = true;
|
||||||
var elementID = "#" + element
|
var elementID = "#" + element
|
||||||
var maxLength = Number(configData.node.site_length);
|
var maxLength = Number(configData.node.site_length);
|
||||||
//var maxDegree = Number(configData.node[$("#ddlNodeType").val()].max_degree);
|
|
||||||
//var regex = /^[1-9-+()]*$/;
|
|
||||||
//isDegreeValid = regex.test(document.getElementById("txtNodeDegree").value);
|
|
||||||
var msg = "";
|
var msg = "";
|
||||||
|
|
||||||
if ($(elementID).val().trim() == '') {
|
if ($(elementID).val().trim() == '') {
|
||||||
msg = "Please enter the name";
|
msg = "Please enter the name";
|
||||||
flag = false;
|
flag = false;
|
||||||
@@ -110,30 +106,10 @@ function nameLengthValidation(element) {
|
|||||||
msg = "Name length should be less than or equal to 20";
|
msg = "Name length should be less than or equal to 20";
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
//else if ($("#txtNodeDegree").val().trim() == '') {
|
|
||||||
// msg = "Please enter the node degree";
|
|
||||||
// flag = false;
|
|
||||||
//}
|
|
||||||
//else if (!isDegreeValid || Number($("#txtNodeDegree").val().trim() > maxDegree)) {
|
|
||||||
// msg = "Please enter the valid degree";
|
|
||||||
// flag = false;
|
|
||||||
//}
|
|
||||||
if (!flag)
|
if (!flag)
|
||||||
showMessage(alertType.Error, msg);
|
showMessage(alertType.Error, msg);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
function addMulNodeVal() {
|
|
||||||
var flag = false;
|
|
||||||
var regex = /^[1-9-+()]*$/;
|
|
||||||
isValid = regex.test(document.getElementById("txtNofNode").value);
|
|
||||||
var maxNode = Number(configData.node.multiplenode.max);
|
|
||||||
|
|
||||||
if ($("#txtNofNode").val().trim() != '' && isValid && Number($("#txtNofNode").val().trim() < maxNode))
|
|
||||||
flag = true;
|
|
||||||
else
|
|
||||||
showMessage(alertType.Error, 'Please enter valid number');
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
function exportFileValidation() {
|
function exportFileValidation() {
|
||||||
var flag = false;
|
var flag = false;
|
||||||
if ($("#txtFileName").val().trim() != '')
|
if ($("#txtFileName").val().trim() != '')
|
||||||
Reference in New Issue
Block a user