mirror of
				https://github.com/Telecominfraproject/oopt-gnpy-web-gui.git
				synced 2025-10-31 18:18:01 +00:00 
			
		
		
		
	To add comments for js file and font information moved to license.md file
This commit is contained in:
		
							
								
								
									
										24
									
								
								LICENSE.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								LICENSE.md
									
									
									
									
									
								
							| @@ -88,4 +88,28 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |||||||
|  Font Awesome Free 5.0.6 by @fontawesome - http://fontawesome.com |  Font Awesome Free 5.0.6 by @fontawesome - http://fontawesome.com | ||||||
|  License - http://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) |  License - http://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) | ||||||
|  |  | ||||||
|  |  **Material Icons** | ||||||
|  |  | ||||||
|  |  We have made these icons available for you to incorporate them into your products under the Apache License Version 2.0.  | ||||||
|  |  | ||||||
|  |  Feel free to remix and re-share these icons and documentation in your products.  | ||||||
|  |  | ||||||
|  |  We'd love attribution in your app's about screen, but it's not required. | ||||||
|  |   | ||||||
|  | **Roboto Icons**       | ||||||
|  |  | ||||||
|  |  These fonts are licensed under the Apache License, Version 2.0. | ||||||
|  |  | ||||||
|  |  You can use them in your products & projects <20> print or digital, commercial or otherwise. | ||||||
|  |  | ||||||
|  |  This isn't legal advice, please consider consulting a lawyer and see the full license for all details. | ||||||
|  |  | ||||||
|  | **Oswald Icons**  | ||||||
|  |  | ||||||
|  |  These fonts are licensed under the Open Font License. | ||||||
|  |  | ||||||
|  |  You can use them in your products & projects <20> print or digital, commercial or otherwise. | ||||||
|  |  | ||||||
|  |  This isn't legal advice, please consider consulting a lawyer and see the full license for all details. | ||||||
|  |   | ||||||
|             |             | ||||||
							
								
								
									
										48
									
								
								js/main.js
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								js/main.js
									
									
									
									
									
								
							| @@ -1,3 +1,8 @@ | |||||||
|  | /** | ||||||
|  |  *  main.js. | ||||||
|  |  * The main.js library describes UI actions. like show/hide and update the html element with style based on user interaction. | ||||||
|  |  */ | ||||||
|  |  | ||||||
| let attenuator = document.querySelector('#attenuator'); | let attenuator = document.querySelector('#attenuator'); | ||||||
| let roadm = document.querySelector('#roadm'); | let roadm = document.querySelector('#roadm'); | ||||||
| let ILA = document.querySelector('#ILA'); | let ILA = document.querySelector('#ILA'); | ||||||
| @@ -9,10 +14,12 @@ let singlefiber = document.querySelector('#singlefiber'); | |||||||
| let singlepatch = document.querySelector('#singlepatch'); | let singlepatch = document.querySelector('#singlepatch'); | ||||||
| let dualpatch = document.querySelector('#dualpatch'); | let dualpatch = document.querySelector('#dualpatch'); | ||||||
| let ramanamp = document.querySelector('#ramanamp'); | let ramanamp = document.querySelector('#ramanamp'); | ||||||
|  |  | ||||||
|  |  | ||||||
| let drawerclose = document.getElementById('drawer-close') | let drawerclose = document.getElementById('drawer-close') | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Open drawer based on node/fiber/patch/service. | ||||||
|  |  * @param {string} node - The type of component. | ||||||
|  |  */ | ||||||
| function openDrawer(node) { | function openDrawer(node) { | ||||||
|     switch (node) { |     switch (node) { | ||||||
|         case 'attenuator': |         case 'attenuator': | ||||||
| @@ -187,6 +194,10 @@ function openDrawer(node) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Close drawer based on node/fiber/patch/service. | ||||||
|  |  * @param {string} node - The type of component. | ||||||
|  |  */ | ||||||
| function closeDrawer(node) { | function closeDrawer(node) { | ||||||
|     switch (node) { |     switch (node) { | ||||||
|         case 'attenuator': |         case 'attenuator': | ||||||
| @@ -238,30 +249,16 @@ function closeDrawer(node) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| //sidebar |  | ||||||
|  |  | ||||||
| // let sidebarleft = document.querySelector('#sidebar'); |  | ||||||
| // let buttonleft = document.getElementById('lefttoggle'); |  | ||||||
| // buttonleft.addEventListener("click",function(){ |  | ||||||
| //   sidebarleft.classList.toggle("d-left-none") |  | ||||||
| //   buttonleft.classList.toggle('ml--btn') |  | ||||||
| // }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| var tabcontent = document.querySelector(".stp-tab"); | var tabcontent = document.querySelector(".stp-tab"); | ||||||
| var arrowbtn1 = document.querySelector("#toggle-arrow-1"); | var arrowbtn1 = document.querySelector("#toggle-arrow-1"); | ||||||
| var arrowbtn2 = document.querySelector("#toggle-arrow-2"); | var arrowbtn2 = document.querySelector("#toggle-arrow-2"); | ||||||
| var arrowbtn3 = document.querySelector("#toggle-arrow-3"); | var arrowbtn3 = document.querySelector("#toggle-arrow-3"); | ||||||
| var arrowbtn4 = document.querySelector("#toggle-arrow-4"); | var arrowbtn4 = document.querySelector("#toggle-arrow-4"); | ||||||
| //var arrowbtn5 = document.querySelector("#toggle-arrow-5"); |  | ||||||
| var sidebartext = document.querySelectorAll(".sidebar-text"); | var sidebartext = document.querySelectorAll(".sidebar-text"); | ||||||
| var sidebartext1 = document.querySelectorAll(".sidebar-text1"); | var sidebartext1 = document.querySelectorAll(".sidebar-text1"); | ||||||
| var sidebartext2 = document.querySelectorAll(".sidebar-text2"); | var sidebartext2 = document.querySelectorAll(".sidebar-text2"); | ||||||
| var sidebartext3 = document.querySelectorAll(".sidebar-text3"); | var sidebartext3 = document.querySelectorAll(".sidebar-text3"); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| arrowbtn2.addEventListener("click", function () { | arrowbtn2.addEventListener("click", function () { | ||||||
|     tabcontent.classList.toggle('left-59') |     tabcontent.classList.toggle('left-59') | ||||||
|     for (var i = 0; i < sidebartext1.length; i++) { |     for (var i = 0; i < sidebartext1.length; i++) { | ||||||
| @@ -284,15 +281,11 @@ arrowbtn4.addEventListener("click", function () { | |||||||
|         sidebartext3[i].classList.toggle("d-none") |         sidebartext3[i].classList.toggle("d-none") | ||||||
|     } |     } | ||||||
| }) | }) | ||||||
| //arrowbtn5.addEventListener("click", function () { |  | ||||||
| //    tabcontent.classList.toggle('left-59') |  | ||||||
| //    for (var i = 0; i < sidebartext4.length; i++) { |  | ||||||
| //        sidebartext4[i].classList.toggle("d-none") |  | ||||||
| //    } |  | ||||||
| //}) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Highlight the steper menu by selection. | ||||||
|  |  * @param {number} index - The menu index. | ||||||
|  |  */ | ||||||
| function stepColor(index) { | function stepColor(index) { | ||||||
|     showMenu = 0; |     showMenu = 0; | ||||||
|     modeHighLight(); |     modeHighLight(); | ||||||
| @@ -331,6 +324,7 @@ function stepColor(index) { | |||||||
|             break; |             break; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| var btnAddRoadm = "#btnAddRoadm"; | var btnAddRoadm = "#btnAddRoadm"; | ||||||
| var btnAddFused = "#btnAddFused"; | var btnAddFused = "#btnAddFused"; | ||||||
| var btnAddILA = "#btnAddILA"; | var btnAddILA = "#btnAddILA"; | ||||||
| @@ -342,6 +336,11 @@ var btnServiceActive = "#btnServiceActive"; | |||||||
| var btnAddSinglePatch = "#btnAddSinglePatch"; | var btnAddSinglePatch = "#btnAddSinglePatch"; | ||||||
| var btnAddDualPatch = "#btnAddDualPatch"; | var btnAddDualPatch = "#btnAddDualPatch"; | ||||||
| var btnAddRamAmp = "#btnAddRamAmp"; | var btnAddRamAmp = "#btnAddRamAmp"; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Highlight node/fiber/patch/service menu by name. | ||||||
|  |  * @param {string} node - The type on component. | ||||||
|  |  */ | ||||||
| function modeHighLight(node) { | function modeHighLight(node) { | ||||||
|     disableFiberService(); |     disableFiberService(); | ||||||
|     showHideDrawerandMenu(); |     showHideDrawerandMenu(); | ||||||
| @@ -489,6 +488,7 @@ function modeHighLight(node) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Show/Hide the context menu of node/fiber/patch/service.  */ | ||||||
| function showHideDrawerandMenu() { | function showHideDrawerandMenu() { | ||||||
|     document.getElementById("roadmMenu").style.display = "none"; |     document.getElementById("roadmMenu").style.display = "none"; | ||||||
|     document.getElementById("attenuatorMenu").style.display = "none"; |     document.getElementById("attenuatorMenu").style.display = "none"; | ||||||
|   | |||||||
| @@ -1,4 +1,9 @@ | |||||||
| (function (root, factory) { | /** | ||||||
|  |  * alea.js. | ||||||
|  |  * Alea library is a pseudo-random number generator (PRNG). | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | (function (root, factory) { | ||||||
|     if (typeof exports === 'object') { |     if (typeof exports === 'object') { | ||||||
|         module.exports = factory(); |         module.exports = factory(); | ||||||
|     } else if (typeof define === 'function' && define.amd) { |     } else if (typeof define === 'function' && define.amd) { | ||||||
|   | |||||||
| @@ -1,4 +1,16 @@ | |||||||
| function nodeRule(from, to, nodeType) { | /** | ||||||
|  |  * constraints.js | ||||||
|  |  * The constraints library a list of rules for components. It is defining the network topology validation. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check connections rules between nodes. | ||||||
|  |  * @param {string} from - Source node. | ||||||
|  |  * @param {string} to - Destination node. | ||||||
|  |  * @param {string} nodeType - Node type. | ||||||
|  |  */ | ||||||
|  | function nodeRule(from, to, nodeType) { | ||||||
|     var fromConnections = network.getConnectedEdges(from); |     var fromConnections = network.getConnectedEdges(from); | ||||||
|     var toConnections = network.getConnectedEdges(to); |     var toConnections = network.getConnectedEdges(to); | ||||||
|     var connections = []; |     var connections = []; | ||||||
| @@ -85,6 +97,7 @@ | |||||||
|     return { message: message, flag: flag }; |     return { message: message, flag: flag }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Check the ROADM, transceiver link and type rules. */ | ||||||
| function checkLink() { | function checkLink() { | ||||||
|  |  | ||||||
|     var roadmList = network.body.data.nodes.get({ |     var roadmList = network.body.data.nodes.get({ | ||||||
| @@ -145,6 +158,7 @@ function checkLink() { | |||||||
|     return { message: message, flag: flag }; |     return { message: message, flag: flag }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** check the limits of amplifier, attenuator link rules. */ | ||||||
| function checkMisLink() { | function checkMisLink() { | ||||||
|  |  | ||||||
|     var roadmList = network.body.data.nodes.get({ |     var roadmList = network.body.data.nodes.get({ | ||||||
| @@ -219,6 +233,7 @@ function checkMisLink() { | |||||||
|     return { message: message, flag: flag }; |     return { message: message, flag: flag }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** To check the node type force rules. */ | ||||||
| function checkTypeForce() { | function checkTypeForce() { | ||||||
|  |  | ||||||
|     var transList = network.body.data.nodes.get({ |     var transList = network.body.data.nodes.get({ | ||||||
| @@ -272,6 +287,7 @@ function checkTypeForce() { | |||||||
|     return { message: message, flag: flag }; |     return { message: message, flag: flag }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** check the fiber properties rules. */ | ||||||
| function checkFiberPro() { | function checkFiberPro() { | ||||||
|  |  | ||||||
|     var fiberList = network.body.data.edges.get({ |     var fiberList = network.body.data.edges.get({ | ||||||
| @@ -302,6 +318,8 @@ function checkFiberPro() { | |||||||
|     message = msg.join(' '); |     message = msg.join(' '); | ||||||
|     return { message: message, flag: flag }; |     return { message: message, flag: flag }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Check the node link and type rules on import network JSON file. */ | ||||||
| function nodeRuleOnImportJSON() { | function nodeRuleOnImportJSON() { | ||||||
|     //checkLink |     //checkLink | ||||||
|     var roadmList = network.body.data.nodes.get({ |     var roadmList = network.body.data.nodes.get({ | ||||||
| @@ -384,6 +402,7 @@ function nodeRuleOnImportJSON() { | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Set fiber/patch/service smooth while on import network JSON file. */ | ||||||
| function edgeStyleOnImportJSON() { | function edgeStyleOnImportJSON() { | ||||||
|     var edgeList = network.body.data.edges.get(); |     var edgeList = network.body.data.edges.get(); | ||||||
|     var cfrom; |     var cfrom; | ||||||
| @@ -439,6 +458,12 @@ function edgeStyleOnImportJSON() { | |||||||
|  |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check the node connections and fiber/patch/service rules on import network JSON file. | ||||||
|  |  * @param {string} cfrom - Source node. | ||||||
|  |  * @param {string} cto - Destination node. | ||||||
|  |  */ | ||||||
| function nodeValidationInEdge(cfrom, cto) { | function nodeValidationInEdge(cfrom, cto) { | ||||||
|     // start remove highlight once roadm have equal in/out conn |     // start remove highlight once roadm have equal in/out conn | ||||||
|     var roadmList = []; |     var roadmList = []; | ||||||
|   | |||||||
| @@ -1,4 +1,9 @@ | |||||||
| var addEdgeData = { | /** | ||||||
|  |  * fiber.js. | ||||||
|  |  * The fiber library describes to add a fiber connection between any 2 nodes by dragging from source node to destination and defines the fiber manipulation. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | var addEdgeData = { | ||||||
|     from: '', |     from: '', | ||||||
|     to: '' |     to: '' | ||||||
| }; | }; | ||||||
| @@ -16,6 +21,10 @@ function dualFiberMode() { | |||||||
|         to: '' |         to: '' | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  | /** | ||||||
|  |  * Enable settings for fiber and reset other settings. | ||||||
|  |  * Set fiber 1 = enable, 0 = disable. | ||||||
|  |  */ | ||||||
| function singleFiberMode() { | function singleFiberMode() { | ||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|     isSingleFiberMode = 1; |     isSingleFiberMode = 1; | ||||||
| @@ -29,7 +38,7 @@ function singleFiberMode() { | |||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Check connections rule for dual fiber not single fiber before add it. */ | ||||||
| function addFiber() { | function addFiber() { | ||||||
|     var srcNode = network.body.data.nodes.get(addEdgeData.from); |     var srcNode = network.body.data.nodes.get(addEdgeData.from); | ||||||
|     var DestNode = network.body.data.nodes.get(addEdgeData.to); |     var DestNode = network.body.data.nodes.get(addEdgeData.to); | ||||||
| @@ -77,6 +86,18 @@ function addFiber() { | |||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|     network.addEdgeMode(); |     network.addEdgeMode(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Fiber creation. | ||||||
|  |  * Fiber style and configuration data loaded from configurationdata, styledata json. | ||||||
|  |  * Check connections rules. | ||||||
|  |  * @param {number} cmode - Fiber mode 1 for add. | ||||||
|  |  * @param {string} cfrom - Source node ID. | ||||||
|  |  * @param {string} cto - Destination node ID. | ||||||
|  |  * @param {string} clabel - The Label of the service. | ||||||
|  |  * @param {string} ctext - The Text of the service. | ||||||
|  |  * @param {boolean} isImport - false -> manual add, true -> automattically added while import json. | ||||||
|  |  */ | ||||||
| function addFiberComponent(cmode, cfrom, cto, clabel, ctext, isImport) { | function addFiberComponent(cmode, cfrom, cto, clabel, ctext, isImport) { | ||||||
|     if (cmode == 1) { |     if (cmode == 1) { | ||||||
|  |  | ||||||
| @@ -289,6 +310,7 @@ function addFiberComponent(cmode, cfrom, cto, clabel, ctext, isImport) { | |||||||
|         tempUndo.push(tedge); |         tempUndo.push(tedge); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| function dualFiberInsertNode(fiberID, node_type, callback) { | function dualFiberInsertNode(fiberID, node_type, callback) { | ||||||
|     var fiberDetails = network.body.data.edges.get(fiberID); |     var fiberDetails = network.body.data.edges.get(fiberID); | ||||||
|     var fromNode = network.body.nodes[fiberDetails.from]; |     var fromNode = network.body.nodes[fiberDetails.from]; | ||||||
| @@ -500,6 +522,12 @@ function dualFiberInsertNode(fiberID, node_type, callback) { | |||||||
|     enableEdgeIndicator(); |     enableEdgeIndicator(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Insert a node (ROADM/Attenuator/Amplifier/Raman Amplifier) in the middle of selected fiber. | ||||||
|  |  * @param {string} fiberID - Selected fiber ID | ||||||
|  |  * @param {string} node_type - Type of node. | ||||||
|  |  * @param callback - The callback that handles the response.. | ||||||
|  |  */ | ||||||
| function singleFiberInsertNode(fiberID, node_type, callback) { | function singleFiberInsertNode(fiberID, node_type, callback) { | ||||||
|  |  | ||||||
|     var fiberDetails = network.body.data.edges.get(fiberID); |     var fiberDetails = network.body.data.edges.get(fiberID); | ||||||
| @@ -752,6 +780,11 @@ function clearCbxandAccordian() { | |||||||
|     $('#cbx_clone').prop('checked', false); |     $('#cbx_clone').prop('checked', false); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Populate fiber details by fiber ID. | ||||||
|  |  * @param {string} fiberID - Selected Fiber ID. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function singleFiberEdit(fiberID, callback) { | function singleFiberEdit(fiberID, callback) { | ||||||
|     $("#txtLoss_Coefficient").removeClass('input_error'); |     $("#txtLoss_Coefficient").removeClass('input_error'); | ||||||
|     $('#cbxLength_Based_Loss').prop('checked', false); |     $('#cbxLength_Based_Loss').prop('checked', false); | ||||||
| @@ -817,6 +850,13 @@ function singleFiberEdit(fiberID, callback) { | |||||||
|     document.getElementById("btnCloseSingleFiber").onclick = clearSingleFiber.bind( |     document.getElementById("btnCloseSingleFiber").onclick = clearSingleFiber.bind( | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update fiber. | ||||||
|  |  * Update fiber by fiber ID. | ||||||
|  |  * Apply connections rules. | ||||||
|  |  * @param {string} fiberID - Fiber ID. | ||||||
|  |  */ | ||||||
| function updateSingleFiber(fiberID) { | function updateSingleFiber(fiberID) { | ||||||
|     removeEdgeList = []; |     removeEdgeList = []; | ||||||
|     var id = fiberID[fiberID.length - 1].id; |     var id = fiberID[fiberID.length - 1].id; | ||||||
| @@ -918,6 +958,8 @@ function updateSingleFiber(fiberID) { | |||||||
|  |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear input/teporary data and other settings. */ | ||||||
| function clearSingleFiber() { | function clearSingleFiber() { | ||||||
|  |  | ||||||
|     $("#txtSinlgeFiberName").val(''); |     $("#txtSinlgeFiberName").val(''); | ||||||
| @@ -967,6 +1009,12 @@ function deleteFiber(fiberList) { | |||||||
|     enableEdgeIndicator(); |     enableEdgeIndicator(); | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Remove fiber by fiber ID. | ||||||
|  |  * @param {string} fiberID - Component ID. | ||||||
|  |  * @param {boolean} isMultiple - Remove multiple fiber. | ||||||
|  |  */ | ||||||
| function removeFiber(fiberID, isMultiple) { | function removeFiber(fiberID, isMultiple) { | ||||||
|     var fiber = network.body.data.edges.get(fiberID); |     var fiber = network.body.data.edges.get(fiberID); | ||||||
|  |  | ||||||
| @@ -1023,6 +1071,10 @@ function removeFiber(fiberID, isMultiple) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Displays fiber details when hover the mouse near the single fiber. | ||||||
|  |  * @param {object} params - Fiber details. | ||||||
|  |  */ | ||||||
| function displayFiberHover(params) { | function displayFiberHover(params) { | ||||||
|     var fiberDetails = network.body.data.edges.get(params.edge); |     var fiberDetails = network.body.data.edges.get(params.edge); | ||||||
|     var fiber_type = ""; |     var fiber_type = ""; | ||||||
|   | |||||||
| @@ -1,4 +1,9 @@ | |||||||
| var nodes = null; | /** | ||||||
|  |  * mynetwork.js. | ||||||
|  |  * The mynetwork library file describes to initialize the network area using vis.js and defines common functionalities of network components. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | var nodes = null; | ||||||
| var edges = null; | var edges = null; | ||||||
| var network = null; | var network = null; | ||||||
| var data = getScaleFreeNetwork(0); | var data = getScaleFreeNetwork(0); | ||||||
| @@ -72,7 +77,13 @@ var preScale; | |||||||
| var prePosition; | var prePosition; | ||||||
| var _eqpt_json; | var _eqpt_json; | ||||||
| var isEqptFile = false; | var isEqptFile = false; | ||||||
|  | var isImportJSON = false; | ||||||
|  |  | ||||||
|  | var displayEdgeLabels = false; | ||||||
|  | var hiddenNodeTextDisplayOptions; | ||||||
|  | var displayNodeLabels = false; | ||||||
|  |  | ||||||
|  | /**  Hide fiber/patch/service label. */ | ||||||
| var hiddenEdgeTextOptions = { | var hiddenEdgeTextOptions = { | ||||||
|     edges: { |     edges: { | ||||||
|         font: { |         font: { | ||||||
| @@ -89,8 +100,8 @@ var hiddenEdgeTextOptions = { | |||||||
|         } |         } | ||||||
|     }, |     }, | ||||||
| }; | }; | ||||||
| var displayEdgeLabels = false; |  | ||||||
|  |  | ||||||
|  | /** Hide node label. */ | ||||||
| var hiddenNodeTextOptions = { | var hiddenNodeTextOptions = { | ||||||
|     nodes: { |     nodes: { | ||||||
|         font: { |         font: { | ||||||
| @@ -100,8 +111,6 @@ var hiddenNodeTextOptions = { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
| var hiddenNodeTextDisplayOptions; |  | ||||||
| var displayNodeLabels = false; |  | ||||||
|  |  | ||||||
| $(document).ready(function () { | $(document).ready(function () { | ||||||
|  |  | ||||||
| @@ -386,6 +395,12 @@ $(document).ready(function () { | |||||||
|     $("#importEqptLink").click(function () { |     $("#importEqptLink").click(function () { | ||||||
|         $("#importEqpt").click(); |         $("#importEqpt").click(); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |     * Read text from import json file. | ||||||
|  |     * @param {string} file - Get path as file. | ||||||
|  |     * @param callback - The callback that handles the response. | ||||||
|  |     */ | ||||||
|     function readTextFile(file, callback) { |     function readTextFile(file, callback) { | ||||||
|         var rawFile = new XMLHttpRequest(); |         var rawFile = new XMLHttpRequest(); | ||||||
|         rawFile.overrideMimeType("application/json"); |         rawFile.overrideMimeType("application/json"); | ||||||
| @@ -429,6 +444,19 @@ $(document).ready(function () { | |||||||
|             }); |             }); | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     /**  | ||||||
|  |      *  Undo network actions.  | ||||||
|  |      *  The redo function is used to restores any actions that were previously undone using an undo.  | ||||||
|  |      *  We stored every undo action detail one by one into array list (tempRedo) like node creation/deletion/updating etc... | ||||||
|  |      *  Ex: node creation/deletion/updating: tempRedo.push(nodedata). | ||||||
|  |      *  we fetch latest one record from array list (tempRedo) then will check record whether creation/deletion/updating after that will call the relevant action.  | ||||||
|  |      *  After will stored action details into new array list (tempUndo) then will using pop method to remove record from array list (tempRedo) ex: tempRedo.pop(). | ||||||
|  |      *  Ex: node deletion: | ||||||
|  |      *  tempUndoo.push(nodedata). | ||||||
|  |      *  data.nodes.remove (latest record of tempRedo). | ||||||
|  |      */ | ||||||
|  |      | ||||||
|     $("#button_undo").on("click", function () { |     $("#button_undo").on("click", function () { | ||||||
|         if (tempUndo.length > 0) { |         if (tempUndo.length > 0) { | ||||||
|             var tempData = tempUndo[tempUndo.length - 1]; |             var tempData = tempUndo[tempUndo.length - 1]; | ||||||
| @@ -580,6 +608,18 @@ $(document).ready(function () { | |||||||
|         enableEdgeIndicator(); |         enableEdgeIndicator(); | ||||||
|  |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     /**  | ||||||
|  |      *  Redo network actions. | ||||||
|  |      *  The undo function is used to reverse a mistake, such as deleting the wrong element in a network topology.  | ||||||
|  |      *  We stored every action detail one by one into array list (tempUndo) like node creation/deletion/updating etc... | ||||||
|  |      *  ex:node creation/deletion/updating: tempUndo.push(nodedata). | ||||||
|  |      *  we fetch latest one record from array list (tempUndo) then will check record whether creation/deletion/updating after that will call the relevant action.  | ||||||
|  |      *  After will stored action details into new array list (tempRedo) then will using pop method to remove record from array list (tempUndo) ex: tempUndo.pop(). | ||||||
|  |      *  Ex: node updating: | ||||||
|  |      *  tempRedo.push(nodedata). | ||||||
|  |      *  data.nodes.update (latest record of tempUndo). | ||||||
|  |      */ | ||||||
|     $("#button_redo").on("click", function () { |     $("#button_redo").on("click", function () { | ||||||
|         if (tempRedo.length > 0) { |         if (tempRedo.length > 0) { | ||||||
|             var tempData = tempRedo[tempRedo.length - 1]; |             var tempData = tempRedo[tempRedo.length - 1]; | ||||||
| @@ -670,7 +710,6 @@ $(document).ready(function () { | |||||||
|         enableEdgeIndicator(); |         enableEdgeIndicator(); | ||||||
|  |  | ||||||
|     }); |     }); | ||||||
|     //end undo and redo |  | ||||||
|     $("#showHideEle").on("click", function () { |     $("#showHideEle").on("click", function () { | ||||||
|         hideEdgeLabels(); |         hideEdgeLabels(); | ||||||
|         enableEdgeIndicator(); |         enableEdgeIndicator(); | ||||||
| @@ -712,6 +751,11 @@ $(document).ready(function () { | |||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Network view changes by selection.  | ||||||
|  |  * Show/Hid the some components menu and options based on selected network view. | ||||||
|  |  * @param {number} view - 1 -> NE view, 2-> Functional view. | ||||||
|  |  */ | ||||||
| function networkView(view) { | function networkView(view) { | ||||||
|     if (view == topologyView.NE_View)//collapsed view /NE view |     if (view == topologyView.NE_View)//collapsed view /NE view | ||||||
|     { |     { | ||||||
| @@ -759,6 +803,10 @@ function networkView(view) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Show/Hide the node/fiber/patch/service label by network view. | ||||||
|  |  * @param {number} view - 1 -> NE view, 2-> Functional view. | ||||||
|  |  */ | ||||||
| function expandAndCollapseView(view) { | function expandAndCollapseView(view) { | ||||||
|     var FVEdges = network.body.data.edges.get({ |     var FVEdges = network.body.data.edges.get({ | ||||||
|         filter: function (item) { |         filter: function (item) { | ||||||
| @@ -845,6 +893,11 @@ function networkMenuHide() { | |||||||
|         $("#stepCreateTopology").click(); |         $("#stepCreateTopology").click(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | /** This function is used to show/hide the nodes/fiber/patch/service labels except ROADM.  | ||||||
|  |  * Here we udpate the network options. | ||||||
|  |  * Update the model of edge and node color as transparent then set it to network options.  | ||||||
|  |  */ | ||||||
|  |  | ||||||
| function hideEdgeLabels() { | function hideEdgeLabels() { | ||||||
|     if (!displayEdgeLabels) { |     if (!displayEdgeLabels) { | ||||||
|         // Apply options for hidden edge text |         // Apply options for hidden edge text | ||||||
| @@ -860,6 +913,13 @@ function hideEdgeLabels() { | |||||||
|     } |     } | ||||||
|     enableEdgeIndicator(); |     enableEdgeIndicator(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Calculate the fiber span loss, length and coefficient. | ||||||
|  |  * @param {string} eleSL - The span length of fiber. | ||||||
|  |  * @param {string} eleLC - The loss coefficient of fiber. | ||||||
|  |  * @param {string} eleSpanLoss - The span loss of fiber. | ||||||
|  |  */ | ||||||
| function fiberLengthCal(eleSL, eleLC, eleSpanLoss) { | function fiberLengthCal(eleSL, eleLC, eleSpanLoss) { | ||||||
|     var spanLength = "#" + eleSL; |     var spanLength = "#" + eleSL; | ||||||
|     var lossCoefficient = "#" + eleLC; |     var lossCoefficient = "#" + eleLC; | ||||||
| @@ -868,6 +928,12 @@ function fiberLengthCal(eleSL, eleLC, eleSpanLoss) { | |||||||
|     var loss_coefficient = parseFloat($(lossCoefficient).val()); |     var loss_coefficient = parseFloat($(lossCoefficient).val()); | ||||||
|     $(spanLoss).val(span_length * loss_coefficient); |     $(spanLoss).val(span_length * loss_coefficient); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Highlight/Un-Highlight the component menu by node mode and name. | ||||||
|  |  * @param {string} mode - Node mode. | ||||||
|  |  * @param {string} nodename - Node name. | ||||||
|  |  */ | ||||||
| function enableDisableNode(mode, nodename) { | function enableDisableNode(mode, nodename) { | ||||||
|     if (nodeMode == mode) { |     if (nodeMode == mode) { | ||||||
|         modeHighLight(); |         modeHighLight(); | ||||||
| @@ -878,16 +944,28 @@ function enableDisableNode(mode, nodename) { | |||||||
|         AddNodeMode(mode); |         AddNodeMode(mode); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| //disabled browser right click menu |  | ||||||
|  | /**  Disable browser right click options. */ | ||||||
| $(document).bind("contextmenu", function (e) { | $(document).bind("contextmenu", function (e) { | ||||||
|     return false; |     return false; | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | /** To create random text for token creation. */ | ||||||
| var rand = function () { | var rand = function () { | ||||||
|     return Math.random().toString(36).substr(2); // remove `0.` |     return Math.random().toString(36).substr(2); // remove `0.` | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | /** To generate token for component creation. | ||||||
|  |  * It will consider as component ID. */ | ||||||
| var token = function () { | var token = function () { | ||||||
|     return rand() + rand(); // to make it longer |     return rand() + rand(); // to make it longer | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Initialize the vis.network,Data and options. | ||||||
|  |  * Define all component events. | ||||||
|  |  * @param {boolean} isImport - True -> Initialize while import network json file, False -> Initialize while page loading. | ||||||
|  |  */ | ||||||
| function draw(isImport) { | function draw(isImport) { | ||||||
|     // create a network |     // create a network | ||||||
|     var container = document.getElementById("mynetwork"); |     var container = document.getElementById("mynetwork"); | ||||||
| @@ -1993,6 +2071,11 @@ function draw(isImport) { | |||||||
|         hideEdgeLabels(); |         hideEdgeLabels(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Create container element for display component details when hover mouse on it. | ||||||
|  |  * @param {string} html - Html elements. | ||||||
|  |  */ | ||||||
| function htmlTitle(html) { | function htmlTitle(html) { | ||||||
|     const container = document.createElement("pre"); |     const container = document.createElement("pre"); | ||||||
|     container.innerHTML = html; |     container.innerHTML = html; | ||||||
| @@ -2005,6 +2088,12 @@ function htmlTitle(html) { | |||||||
|     container.style.fontVariant = commonJSON.font_variant; |     container.style.fontVariant = commonJSON.font_variant; | ||||||
|     return container; |     return container; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  *Initiate the network initialize by the flag. | ||||||
|  |  * @param {boolean} isImport - True -> Initialize network while import network json file, False -> Will initialize while page loading. | ||||||
|  |  */ | ||||||
|  |  | ||||||
| function init(isImport) { | function init(isImport) { | ||||||
|     if (isImport) { |     if (isImport) { | ||||||
|         draw(isImport); |         draw(isImport); | ||||||
| @@ -2015,6 +2104,13 @@ function init(isImport) { | |||||||
|         }, 1000); |         }, 1000); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Export/Save the network topology as a JSON file. | ||||||
|  |  * The JSON file data's are loaded from network dataset. like nodes, edges. | ||||||
|  |  * The schema of the JSON file will match the given JSON file like Equipment_JSON_MOD2.json. | ||||||
|  |  * @param {boolean} isSaveNetwork - True -> Save network topology, False -> Export network topology. | ||||||
|  |  */ | ||||||
| function exportNetwork(isSaveNetwork) { | function exportNetwork(isSaveNetwork) { | ||||||
|     var nodeList = []; |     var nodeList = []; | ||||||
|     var edgeList = []; |     var edgeList = []; | ||||||
| @@ -2232,10 +2328,17 @@ function exportNetwork(isSaveNetwork) { | |||||||
|  |  | ||||||
|     saveAs(blob, filename); |     saveAs(blob, filename); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /**  Hide the loader after completion of action. */ | ||||||
| function hideLoader() { | function hideLoader() { | ||||||
|     $('#loader').hide(); |     $('#loader').hide(); | ||||||
|     $("#importEqpt").val(''); |     $("#importEqpt").val(''); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to load the equipment configuration data from the import json file. | ||||||
|  |  * @param {boolean} isFileUpload - True -> Load data from import network json, False -> Load data from default equipment configuration json. | ||||||
|  |  */ | ||||||
| function load_EqptConfig(isFileUpload) { | function load_EqptConfig(isFileUpload) { | ||||||
|     try { |     try { | ||||||
|         if (!eqpt_config['tip-photonic-simulation:simulation'] || !eqpt_config['tip-photonic-equipment:transceiver'] || !eqpt_config['tip-photonic-equipment:fiber'] || !eqpt_config['tip-photonic-equipment:amplifier']) { |         if (!eqpt_config['tip-photonic-simulation:simulation'] || !eqpt_config['tip-photonic-equipment:transceiver'] || !eqpt_config['tip-photonic-equipment:fiber'] || !eqpt_config['tip-photonic-equipment:amplifier']) { | ||||||
| @@ -2306,6 +2409,11 @@ function handleFileLoad(event) { | |||||||
|     _import_json = event.target.result; |     _import_json = event.target.result; | ||||||
|     importNetwork(); |     importNetwork(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to load all nodes element data into dataset from import json file. | ||||||
|  |  * @param {number} index - Index number for get node details from import json. | ||||||
|  |  */ | ||||||
| function importNode(index) { | function importNode(index) { | ||||||
|     var nodeDetails = ""; |     var nodeDetails = ""; | ||||||
|     var shape = ""; |     var shape = ""; | ||||||
| @@ -2449,6 +2557,11 @@ function importNode(index) { | |||||||
|     }); |     }); | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to load all fiber/patch/service element data into dataset from import json file. | ||||||
|  |  * @param {number} index - Index number for get edge details from import json. | ||||||
|  |  */ | ||||||
| function importEdge(index) { | function importEdge(index) { | ||||||
|     var edgeData = _import_json["network"][0]['ietf-network-topology:link'][index]; |     var edgeData = _import_json["network"][0]['ietf-network-topology:link'][index]; | ||||||
|     var to = edgeData["destination"]["dest-node"]; |     var to = edgeData["destination"]["dest-node"]; | ||||||
| @@ -2485,10 +2598,17 @@ function importEdge(index) { | |||||||
|         addServiceComponent(1, from, to, labelvalue, textvalue, true); |         addServiceComponent(1, from, to, labelvalue, textvalue, true); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Get random point to displays node if not available lat, long in import network json file. | ||||||
|  |  * @param {number} min - Minimum of random number. | ||||||
|  |  * @param {number} max - Maximum of random number. | ||||||
|  |  */ | ||||||
| function getRandomNumberBetween(min, max) { | function getRandomNumberBetween(min, max) { | ||||||
|     return Math.floor(Math.random() * (max - min + 1) + min); |     return Math.floor(Math.random() * (max - min + 1) + min); | ||||||
| } | } | ||||||
| var isImportJSON = false; |  | ||||||
|  | /** This is used to load the network component data from import network json file. */ | ||||||
| function importNetwork() { | function importNetwork() { | ||||||
|     try { |     try { | ||||||
|         importNodes = []; |         importNodes = []; | ||||||
| @@ -2564,6 +2684,12 @@ function importNetwork() { | |||||||
|     } |     } | ||||||
|     draw(true); |     draw(true); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Loop through the node dataset and get some properties then store it into array list. | ||||||
|  |  * It is return node dataset. | ||||||
|  |  * @param {object} data - Dataset of node. | ||||||
|  |  */ | ||||||
| function getNodeData(data) { | function getNodeData(data) { | ||||||
|     data.forEach(function (elem, index, array) { |     data.forEach(function (elem, index, array) { | ||||||
|         importNodes.push({ |         importNodes.push({ | ||||||
| @@ -2586,6 +2712,12 @@ function getNodeData(data) { | |||||||
|  |  | ||||||
|     return new vis.DataSet(importNodes); |     return new vis.DataSet(importNodes); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Get node details by ID. | ||||||
|  |  * @param {object} data - Node details. | ||||||
|  |  * @param {string} id - The ID of destination node component. | ||||||
|  |  */ | ||||||
| function getNodeById(data, id) { | function getNodeById(data, id) { | ||||||
|     for (var n = 0; n < data.length; n++) { |     for (var n = 0; n < data.length; n++) { | ||||||
|         if (data[n].id == id) { |         if (data[n].id == id) { | ||||||
| @@ -2596,6 +2728,12 @@ function getNodeById(data, id) { | |||||||
|  |  | ||||||
|     throw "cannot find id '" + id + "' in data"; |     throw "cannot find id '" + id + "' in data"; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Loop through the edge dataset and assign some properties then store it into array list. | ||||||
|  |  * It is return edge dataset. | ||||||
|  |  * @param {object} data - Dataset of edge. edge like fiber/patch/service. | ||||||
|  |  */ | ||||||
| function getEdgeData(data) { | function getEdgeData(data) { | ||||||
|  |  | ||||||
|     data.forEach(function (elem) { |     data.forEach(function (elem) { | ||||||
| @@ -2636,13 +2774,19 @@ function getEdgeData(data) { | |||||||
|  |  | ||||||
|     return new vis.DataSet(importEdges); |     return new vis.DataSet(importEdges); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Save the network topology. */ | ||||||
| function SaveNetwork() { | function SaveNetwork() { | ||||||
|     exportNetwork(true); |     exportNetwork(true); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear component selection. */ | ||||||
| function UnSelectAll() { | function UnSelectAll() { | ||||||
|     network.unselectAll(); |     network.unselectAll(); | ||||||
|     remove_NodeFiberHighlight(); |     remove_NodeFiberHighlight(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Capture network topology as image file. */ | ||||||
| function captureImage() { | function captureImage() { | ||||||
|     network.fit(); |     network.fit(); | ||||||
|     html2canvas(document.querySelector("#mynetwork"), { |     html2canvas(document.querySelector("#mynetwork"), { | ||||||
| @@ -2657,6 +2801,10 @@ function captureImage() { | |||||||
|     }); |     }); | ||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Disable fiber/patch/service mode. | ||||||
|  |   * Reteset the data values. | ||||||
|  |  */ | ||||||
| function disableFiberService() { | function disableFiberService() { | ||||||
|  |  | ||||||
|     nodeMode = ""; |     nodeMode = ""; | ||||||
| @@ -2678,6 +2826,12 @@ function disableFiberService() { | |||||||
|         to: '' |         to: '' | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check source and destination node have same connections. | ||||||
|  |  * @param {string} fromNode - Source node ID. | ||||||
|  |  * @param {string} toNode - Destination node ID. | ||||||
|  |  */ | ||||||
| function checkfiberconnection(fromNode, toNode) { | function checkfiberconnection(fromNode, toNode) { | ||||||
|     var edgesarr = network.body.data.edges.get(); |     var edgesarr = network.body.data.edges.get(); | ||||||
|     var flag = false; |     var flag = false; | ||||||
| @@ -2689,6 +2843,12 @@ function checkfiberconnection(fromNode, toNode) { | |||||||
|     } |     } | ||||||
|     return flag; |     return flag; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to add multiple single fiber / patch and service between same set of nodes and re - arrange them one by one. | ||||||
|  |  * @param {string} cfrom - Source node ID. | ||||||
|  |  * @param {string} cto - Destination node ID. | ||||||
|  |  */ | ||||||
| function multipleFiberService1(cfrom, cto) { | function multipleFiberService1(cfrom, cto) { | ||||||
|  |  | ||||||
|     var connectedFiber = network.getConnectedEdges(cfrom); |     var connectedFiber = network.getConnectedEdges(cfrom); | ||||||
| @@ -2724,6 +2884,12 @@ function multipleFiberService1(cfrom, cto) { | |||||||
|     else |     else | ||||||
|         return fiberJSON.options.smooth; |         return fiberJSON.options.smooth; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to add multiple single fiber / patch and service between same set of nodes and re - arrange them one by one. | ||||||
|  |  * @param {string} cfrom - Source node ID. | ||||||
|  |  * @param {string} cto - Destination node ID. | ||||||
|  |  */ | ||||||
| function multipleFiberService(cfrom, cto) { | function multipleFiberService(cfrom, cto) { | ||||||
|     var connectedFiber = network.getConnectedEdges(cfrom); |     var connectedFiber = network.getConnectedEdges(cfrom); | ||||||
|     connectedFiber.push(network.getConnectedEdges(cto)); |     connectedFiber.push(network.getConnectedEdges(cto)); | ||||||
| @@ -2769,6 +2935,16 @@ function multipleFiberService(cfrom, cto) { | |||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Count fiber/patch and service connections between same set of node. | ||||||
|  |  * @param {number} isdualfiber - True -> Dual fiber connection count. | ||||||
|  |  * @param {number} issinglefiber - True -> Single fiber connection count. | ||||||
|  |  * @param {number} isservice - True - > Service connection count. | ||||||
|  |  * @param {number} ispatch - True -> Single patch connection count. | ||||||
|  |  * @param {string} cfrom - Source node ID. | ||||||
|  |  * @param {string} cto - Destination node ID. | ||||||
|  |  */ | ||||||
| function countFiberService(isdualfiber, issinglefiber, isservice, ispatch, cfrom, cto) { | function countFiberService(isdualfiber, issinglefiber, isservice, ispatch, cfrom, cto) { | ||||||
|     var conCount = 1; |     var conCount = 1; | ||||||
|     var connectedFiber = network.getConnectedEdges(cfrom); |     var connectedFiber = network.getConnectedEdges(cfrom); | ||||||
| @@ -2806,7 +2982,12 @@ function countFiberService(isdualfiber, issinglefiber, isservice, ispatch, cfrom | |||||||
|     }); |     }); | ||||||
|     return conCount; |     return conCount; | ||||||
| } | } | ||||||
| //check node have connection |  | ||||||
|  | /** | ||||||
|  |  * Check node component have connection. | ||||||
|  |  * @param {string} from -Source node ID. | ||||||
|  |  * @param {string} to - Destination node ID . | ||||||
|  |  */ | ||||||
| function checkNodeConnection(from, to) { | function checkNodeConnection(from, to) { | ||||||
|     var flag = false; |     var flag = false; | ||||||
|     var fiberList = network.getConnectedEdges(from); |     var fiberList = network.getConnectedEdges(from); | ||||||
| @@ -2819,7 +3000,12 @@ function checkNodeConnection(from, to) { | |||||||
|     }); |     }); | ||||||
|     return flag; |     return flag; | ||||||
| } | } | ||||||
| //check node have service connection |  | ||||||
|  | /** | ||||||
|  |  * Check node component have a service connection. | ||||||
|  |  * @param {string} from - Source node ID. | ||||||
|  |  * @param {string} to - Destination node ID. | ||||||
|  |  */ | ||||||
| function checkNodeServiceConnection(from, to) { | function checkNodeServiceConnection(from, to) { | ||||||
|     var flag = false; |     var flag = false; | ||||||
|     var fiberList = network.getConnectedEdges(from); |     var fiberList = network.getConnectedEdges(from); | ||||||
| @@ -2835,6 +3021,13 @@ function checkNodeServiceConnection(from, to) { | |||||||
|     }); |     }); | ||||||
|     return flag; |     return flag; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Restriction to remove transceiver node connection(fiber/patch) while transceiver having service. | ||||||
|  |  * @param {number} from - Source node ID. | ||||||
|  |  * @param {number} to - Destination node ID. | ||||||
|  |  * @param {string} edgeType - The type of fiber/patch/service. | ||||||
|  |  */ | ||||||
| function checkFiberPatchServiceCon(from, to, edgeType) { | function checkFiberPatchServiceCon(from, to, edgeType) { | ||||||
|     var isOk = false; |     var isOk = false; | ||||||
|     var nodeDetails = network.body.data.nodes.get(from); |     var nodeDetails = network.body.data.nodes.get(from); | ||||||
| @@ -2885,12 +3078,18 @@ function checkFiberPatchServiceCon(from, to, edgeType) { | |||||||
|  |  | ||||||
|     return isOk; |     return isOk; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Close context menu by menu ID. | ||||||
|  |  * @param {string} menuID - The ID of menu. | ||||||
|  |  */ | ||||||
| function closeMenu(menuID) { | function closeMenu(menuID) { | ||||||
|     document.getElementById(menuID).style.display = "none"; |     document.getElementById(menuID).style.display = "none"; | ||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|  |  | ||||||
| } | } | ||||||
| //append node,preamp, booster type |  | ||||||
|  | /** Append node,preamp and booster type to dropdown input control. */ | ||||||
| function appendSinglePreAmpandBoosterType() { | function appendSinglePreAmpandBoosterType() { | ||||||
|  |  | ||||||
|     if (eqpt_config['tip-photonic-equipment:amplifier']) { |     if (eqpt_config['tip-photonic-equipment:amplifier']) { | ||||||
| @@ -2901,7 +3100,11 @@ function appendSinglePreAmpandBoosterType() { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| //append node, preamp, booster type for dynamic ele |  | ||||||
|  | /** | ||||||
|  |  * Append node, preamp, booster type for dynamically generate element. | ||||||
|  |  * @param {string} ddlID - The ID of dynamic input control. like dropdown. | ||||||
|  |  */ | ||||||
| function appendPreAmpandBoosterType(ddlID) { | function appendPreAmpandBoosterType(ddlID) { | ||||||
|     var preAmpType = []; |     var preAmpType = []; | ||||||
|     var boosterType = []; |     var boosterType = []; | ||||||
| @@ -2923,7 +3126,13 @@ function appendPreAmpandBoosterType(ddlID) { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| //show context menu on righ click of the component |  | ||||||
|  | /** | ||||||
|  |  * show context menu near by selected component. | ||||||
|  |  * @param {string} x - The point of selected component. | ||||||
|  |  * @param {string} y - The point of selected component. | ||||||
|  |  * @param {string} menu - Html element ID. | ||||||
|  |  */ | ||||||
| function showContextMenu(x, y, menu) { | function showContextMenu(x, y, menu) { | ||||||
|     showHideDrawerandMenu(); |     showHideDrawerandMenu(); | ||||||
|     var windowHeight = $(window).height() / 2; |     var windowHeight = $(window).height() / 2; | ||||||
| @@ -2955,31 +3164,38 @@ function showContextMenu(x, y, menu) { | |||||||
|     } |     } | ||||||
|     document.getElementById(menu).style.display = "block"; |     document.getElementById(menu).style.display = "block"; | ||||||
| } | } | ||||||
| //show fiber and service details when hover the mouse over on it  |  | ||||||
|  | /** | ||||||
|  |  * Show the element for displays fiber, service and node components details when hover the mouse over on it. | ||||||
|  |  * @param {string} x - left side menu. | ||||||
|  |  * @param {string} y - bottom of the menu. | ||||||
|  |  * @param {string} menu - Element ID. | ||||||
|  |  */ | ||||||
| function showHoverDiv(x, y, menu) { | function showHoverDiv(x, y, menu) { | ||||||
|  |  | ||||||
|     var windowHeight = $(window).height() / 2; |     var windowHeight = $(window).height() / 2; | ||||||
|     var windowWidth = $(window).width() / 2; |     var windowWidth = $(window).width() / 2; | ||||||
|     var element = "#" + menu; |     var element = "#" + menu; | ||||||
|     if (y > windowHeight && x <= windowWidth) { |     if (y > windowHeight && x <= windowWidth) { | ||||||
|  |         //Bottom-left part of window | ||||||
|         $(element).css("left", x); |         $(element).css("left", x); | ||||||
|         $(element).css("bottom", $(window).height() - y); |         $(element).css("bottom", $(window).height() - y); | ||||||
|         $(element).css("right", "auto"); |         $(element).css("right", "auto"); | ||||||
|         $(element).css("top", "auto"); |         $(element).css("top", "auto"); | ||||||
|     } else if (y > windowHeight && x > windowWidth) { |     } else if (y > windowHeight && x > windowWidth) { | ||||||
|         //When user click on bottom-right part of window |         //Bottom-right part of window | ||||||
|         $(element).css("right", $(window).width() - x); |         $(element).css("right", $(window).width() - x); | ||||||
|         $(element).css("bottom", $(window).height() - y); |         $(element).css("bottom", $(window).height() - y); | ||||||
|         $(element).css("left", "auto"); |         $(element).css("left", "auto"); | ||||||
|         $(element).css("top", "auto"); |         $(element).css("top", "auto"); | ||||||
|     } else if (y <= windowHeight && x <= windowWidth) { |     } else if (y <= windowHeight && x <= windowWidth) { | ||||||
|         //When user click on top-left part of window |         //Top-left part of window | ||||||
|         $(element).css("left", x); |         $(element).css("left", x); | ||||||
|         $(element).css("top", y); |         $(element).css("top", y); | ||||||
|         $(element).css("right", "auto"); |         $(element).css("right", "auto"); | ||||||
|         $(element).css("bottom", "auto"); |         $(element).css("bottom", "auto"); | ||||||
|     } else { |     } else { | ||||||
|         //When user click on top-right part of window |         //Top-right part of window | ||||||
|         $(element).css("right", $(window).width() - x); |         $(element).css("right", $(window).width() - x); | ||||||
|         $(element).css("top", y); |         $(element).css("top", y); | ||||||
|         $(element).css("left", "auto"); |         $(element).css("left", "auto"); | ||||||
| @@ -2987,6 +3203,8 @@ function showHoverDiv(x, y, menu) { | |||||||
|     } |     } | ||||||
|     document.getElementById(menu).style.display = "block"; |     document.getElementById(menu).style.display = "block"; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** To check network topology have components. */ | ||||||
| function networkValidation() { | function networkValidation() { | ||||||
|     var flag = false; |     var flag = false; | ||||||
|     if (network.body.data.nodes.get().length > 0 || network.body.data.edges.get().length > 0) |     if (network.body.data.nodes.get().length > 0 || network.body.data.edges.get().length > 0) | ||||||
| @@ -2997,6 +3215,14 @@ function networkValidation() { | |||||||
|  |  | ||||||
|     return flag; |     return flag; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * To load ROADM component type to dropdown control. | ||||||
|  |  * @param {string} fiberID - The ID of fiber component. | ||||||
|  |  * @param {string} nodeID - The ID of node component. | ||||||
|  |  * @param {string} node_type - Type of ROADM component. | ||||||
|  |  * @param {string} appendElement - Html element for loading component type. | ||||||
|  |  */ | ||||||
| function loadRoadmType(fiberID, nodeID, node_type, appendElement) { | function loadRoadmType(fiberID, nodeID, node_type, appendElement) { | ||||||
|     var appendDiv = "#" + appendElement |     var appendDiv = "#" + appendElement | ||||||
|     var fiberDetails = network.body.data.edges.get(fiberID); |     var fiberDetails = network.body.data.edges.get(fiberID); | ||||||
| @@ -3028,6 +3254,12 @@ function loadRoadmType(fiberID, nodeID, node_type, appendElement) { | |||||||
|         getRoadmDetails(fiberID, node_type); |         getRoadmDetails(fiberID, node_type); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Generate accordian and dropdown element for loading type. | ||||||
|  |  * @param {string} label - The label of component. | ||||||
|  |  * @param {string} ddlEleID - Dropdown element for loading component type. | ||||||
|  |  */ | ||||||
| function generateAccordianEle(label, ddlEleID) { | function generateAccordianEle(label, ddlEleID) { | ||||||
|     var eleHtml = ""; |     var eleHtml = ""; | ||||||
|     eleHtml += "<div class='form-group'>"; |     eleHtml += "<div class='form-group'>"; | ||||||
| @@ -3036,6 +3268,12 @@ function generateAccordianEle(label, ddlEleID) { | |||||||
|     eleHtml += "</div>"; |     eleHtml += "</div>"; | ||||||
|     return eleHtml; |     return eleHtml; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Get ROADM component details by fiber ID. | ||||||
|  |  * @param {string} fiberID - Fiber component ID. | ||||||
|  |  * @param {string} node_type - The type of component. | ||||||
|  |  */ | ||||||
| function getRoadmDetails(fiberID, node_type) { | function getRoadmDetails(fiberID, node_type) { | ||||||
|     if (_roadmListDB({ roadm_fiber_id: fiberID }).count() > 0) { |     if (_roadmListDB({ roadm_fiber_id: fiberID }).count() > 0) { | ||||||
|         var roadmDetails = _roadmListDB({ roadm_fiber_id: fiberID }).first(); |         var roadmDetails = _roadmListDB({ roadm_fiber_id: fiberID }).first(); | ||||||
| @@ -3055,6 +3293,13 @@ function getRoadmDetails(fiberID, node_type) { | |||||||
|             clearILA(); |             clearILA(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Get next level of fiber/patch/service label. | ||||||
|  |  * @param {string} from - Source node ID. | ||||||
|  |  * @param {string} to -  Destination node ID. | ||||||
|  |  * @param {string} component_type - The type of component. | ||||||
|  |  */ | ||||||
| function getLabel(from, to, component_type) { | function getLabel(from, to, component_type) { | ||||||
|     var flabel; |     var flabel; | ||||||
|     var tlabel; |     var tlabel; | ||||||
| @@ -3071,6 +3316,15 @@ function getLabel(from, to, component_type) { | |||||||
|  |  | ||||||
|     return component_type + " " + flabel + ' - ' + tlabel; |     return component_type + " " + flabel + ' - ' + tlabel; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to store simulation parameters in session storage as JSON format. | ||||||
|  |  * @param {number} fre_min - Frequency-max value. | ||||||
|  |  * @param {number} frq_max - Frequency-min value. | ||||||
|  |  * @param {number} spacing - Spacings. | ||||||
|  |  * @param {number} channel - Number of channels. | ||||||
|  |  * @param {number} margin - System margin. | ||||||
|  |  */ | ||||||
| function saveSimulations(fre_min, frq_max, spacing, channel, margin) { | function saveSimulations(fre_min, frq_max, spacing, channel, margin) { | ||||||
|     var simulationPara = { |     var simulationPara = { | ||||||
|         "frequency-min": fre_min, |         "frequency-min": fre_min, | ||||||
| @@ -3081,6 +3335,13 @@ function saveSimulations(fre_min, frq_max, spacing, channel, margin) { | |||||||
|     } |     } | ||||||
|     sessionStorage.setItem("simulationParameters", JSON.stringify(simulationPara)); |     sessionStorage.setItem("simulationParameters", JSON.stringify(simulationPara)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to show alert message. | ||||||
|  |  * @param {string} messageType - Type of message.ex : Success/Info/Error/Warning. | ||||||
|  |  * @param {string} textmsg - Message content. | ||||||
|  |  * @param {boolean} removeTimeout - Set timeout for alert message. | ||||||
|  |  */ | ||||||
| function showMessage(messageType, textmsg, removeTimeout) { | function showMessage(messageType, textmsg, removeTimeout) { | ||||||
|     $("#img_src").show(); |     $("#img_src").show(); | ||||||
|     switch (messageType) { |     switch (messageType) { | ||||||
| @@ -3151,6 +3412,12 @@ function showMessage(messageType, textmsg, removeTimeout) { | |||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to set/remove time interval for alert message. | ||||||
|  |  * @param {number} targetEle - Target of toaster element like. Success/Warning/Error... | ||||||
|  |  * @param {number} removeTimeout - Remove the interval time for alert message . | ||||||
|  |  */ | ||||||
| function clearAndSetTimeout(targetEle, removeTimeout) { | function clearAndSetTimeout(targetEle, removeTimeout) { | ||||||
|     const highestId = window.setTimeout(() => { |     const highestId = window.setTimeout(() => { | ||||||
|         for (let i = highestId; i >= 0; i--) { |         for (let i = highestId; i >= 0; i--) { | ||||||
| @@ -3164,10 +3431,17 @@ function clearAndSetTimeout(targetEle, removeTimeout) { | |||||||
|         }, 6000); |         }, 6000); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** To enable fiber/patch/service mode. */ | ||||||
| function enableEdgeIndicator() { | function enableEdgeIndicator() { | ||||||
|     if (isDualFiberMode == 1 || isSingleFiberMode == 1 || isSinglePatchMode == 1 || isDualPatchMode == 1 || isAddService == 1) |     if (isDualFiberMode == 1 || isSingleFiberMode == 1 || isSinglePatchMode == 1 || isDualPatchMode == 1 || isAddService == 1) | ||||||
|         network.addEdgeMode(); |         network.addEdgeMode(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used to check the node link, mis-link, fiber properties and consolidate all error list. | ||||||
|  |  * @param {number} isTime - True -> remove time interval for error summary list. | ||||||
|  |  */ | ||||||
| function topologyValidation(isTime) { | function topologyValidation(isTime) { | ||||||
|     //removeHighlight(); |     //removeHighlight(); | ||||||
|     var flag = false; |     var flag = false; | ||||||
| @@ -3202,6 +3476,14 @@ function topologyValidation(isTime) { | |||||||
|     } |     } | ||||||
|     return flag; |     return flag; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Focus the error componets. | ||||||
|  |  * Focus the node/fiber/patch/service components by span error ID. | ||||||
|  |  * Update the components for highlight error component to set image, size, is_error, color properties by span error ID. | ||||||
|  |  * @param {string} ID - Node/Fiber ID. | ||||||
|  |  * @param {number} type - Component type. | ||||||
|  |  */ | ||||||
| function focusNodeFiber(ID, type) { | function focusNodeFiber(ID, type) { | ||||||
|     removeHighlight(); |     removeHighlight(); | ||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
| @@ -3233,6 +3515,12 @@ function focusNodeFiber(ID, type) { | |||||||
|         network.body.data.edges.update([{ id: ID, pre_color: edgeDetails.color, color: singleFiberJSON.options.err_color, is_error: true }]); |         network.body.data.edges.update([{ id: ID, pre_color: edgeDetails.color, color: singleFiberJSON.options.err_color, is_error: true }]); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |  * To remove focused error component highlight.  | ||||||
|  |  * Update node component to set image, size, is_error by focused component ID. | ||||||
|  |  * Update fiber/patch/service components to set color, is_error by focused component ID. | ||||||
|  |  */ | ||||||
| function removeHighlight() { | function removeHighlight() { | ||||||
|  |  | ||||||
|     var errNodes = network.body.data.nodes.get({ |     var errNodes = network.body.data.nodes.get({ | ||||||
| @@ -3260,6 +3548,12 @@ function removeHighlight() { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * To remove span error element on error summary list. | ||||||
|  |  * @param {string} item - Node ID. | ||||||
|  |  * @param {boolean} transUpdate - True -> remove span error element for transceiver, False -> remove rest of span error. | ||||||
|  |  */ | ||||||
| function removeSpanInError(item, transUpdate) { | function removeSpanInError(item, transUpdate) { | ||||||
|  |  | ||||||
|     var image; |     var image; | ||||||
| @@ -3288,6 +3582,8 @@ function removeSpanInError(item, transUpdate) { | |||||||
|     $(removeID).remove(); |     $(removeID).remove(); | ||||||
|     checkErrorFree(); |     checkErrorFree(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** To clear summary error element if there is no any error. */ | ||||||
| function checkErrorFree() { | function checkErrorFree() { | ||||||
|     var roadmRule = $("#spanEven").find('p').length; |     var roadmRule = $("#spanEven").find('p').length; | ||||||
|     var linkRule = $("#spanMisLink").find('p').length; |     var linkRule = $("#spanMisLink").find('p').length; | ||||||
| @@ -3310,12 +3606,23 @@ function checkErrorFree() { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /**  | ||||||
|  |  *  Realtime update of summary error list.  | ||||||
|  |  *  To do any action with component while error chec active on active, summary error list automatically update by component action. | ||||||
|  |  */ | ||||||
| function realUpdate() { | function realUpdate() { | ||||||
|     if ($("#div_toaster").is(":visible") && !$("#img_src").is(":visible")) { |     if ($("#div_toaster").is(":visible") && !$("#img_src").is(":visible")) { | ||||||
|         $("#btnValidation").click(); |         $("#btnValidation").click(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * To reset component selection/highlight. | ||||||
|  |  * Get all highlighted components by is_highlight. | ||||||
|  |  * Update the node components to set is_highlight, image properties by selected component ID. | ||||||
|  |  * Update the fiber/patch/service components to set is_highlight, shadow properties by selected component ID. | ||||||
|  |  * */ | ||||||
| function remove_NodeFiberHighlight() { | function remove_NodeFiberHighlight() { | ||||||
|     var hNodes = network.body.data.nodes.get({ |     var hNodes = network.body.data.nodes.get({ | ||||||
|         filter: function (item) { |         filter: function (item) { | ||||||
|   | |||||||
| @@ -1,4 +1,13 @@ | |||||||
| //1-roadm, 2-amp, 3-fused, 4-transceiver, 6- raman amp | /** | ||||||
|  |  * node.js. | ||||||
|  |  * The node  can be defined as the connection point of "ROADM, Attenuator, Transceiver, Amplifier and Raman Amplifier" and defines the node manipulations. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check node Mode 1-roadm, 2-amp, 3-fused, 4-transceiver, 6- raman amp | ||||||
|  |  * @param {Number} nodemode - Mode of the component. | ||||||
|  |  */ | ||||||
| function AddNodeMode(nodemode) { | function AddNodeMode(nodemode) { | ||||||
|  |  | ||||||
|     nodeMode = nodemode; |     nodeMode = nodemode; | ||||||
| @@ -8,6 +17,13 @@ function AddNodeMode(nodemode) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Node creation by node mode. | ||||||
|  |  * Node will be placed based on co-ordidate points x,y. | ||||||
|  |  * Node style and configuration data loaded from configurationdata, styledata json. | ||||||
|  |  * @param {object} data - The data of the component. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function addNodes(data, callback) { | function addNodes(data, callback) { | ||||||
|  |  | ||||||
|     var nodeDetails = ""; |     var nodeDetails = ""; | ||||||
| @@ -110,6 +126,11 @@ function addNodes(data, callback) { | |||||||
|     tempUndo.push(network.body.data.nodes.get(data.id)); |     tempUndo.push(network.body.data.nodes.get(data.id)); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Populate ROADM component details by node ID. | ||||||
|  |  * @param {string} nodeID - The ID of the ROADM component. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function roadmEdit(nodeID, callback) { | function roadmEdit(nodeID, callback) { | ||||||
|     _roadmListDB().remove(); |     _roadmListDB().remove(); | ||||||
|     document.getElementById("roadmMenu").style.display = "none"; |     document.getElementById("roadmMenu").style.display = "none"; | ||||||
| @@ -174,6 +195,12 @@ function roadmEdit(nodeID, callback) { | |||||||
|     document.getElementById("btnCloseRoadm").onclick = clearRoadm.bind( |     document.getElementById("btnCloseRoadm").onclick = clearRoadm.bind( | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update ROADM. | ||||||
|  |  * Update ROADM label, type by ROADM ID. | ||||||
|  |  * @param {string} nodeID - The ID of the ROADM component | ||||||
|  |  */ | ||||||
| function updateRoadm(nodeID) { | function updateRoadm(nodeID) { | ||||||
|     removeNodeList = []; |     removeNodeList = []; | ||||||
|     if (nameLengthValidation("txtRoadmName")) { |     if (nameLengthValidation("txtRoadmName")) { | ||||||
| @@ -252,6 +279,8 @@ function updateRoadm(nodeID) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear input/teporary data and other settings. */ | ||||||
| function clearRoadm() { | function clearRoadm() { | ||||||
|     $("#txtRoadmName").val(''); |     $("#txtRoadmName").val(''); | ||||||
|     $("#divRoadmPro").empty(); |     $("#divRoadmPro").empty(); | ||||||
| @@ -261,6 +290,11 @@ function clearRoadm() { | |||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check ROADM component rules and update check-errors summary. | ||||||
|  |  * @param {string} id - The ID of ROADM component. | ||||||
|  |  * @param {string} rtype - The type of ROADM component. | ||||||
|  |  */ | ||||||
| function realUpdate_Roadm(id, rtype) { | function realUpdate_Roadm(id, rtype) { | ||||||
|     var roadmtype = rtype; |     var roadmtype = rtype; | ||||||
|     var connectedEges = network.getConnectedEdges(id); |     var connectedEges = network.getConnectedEdges(id); | ||||||
| @@ -291,6 +325,11 @@ function realUpdate_Roadm(id, rtype) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Populate Attenuator component details by node ID. | ||||||
|  |  * @param {string} nodeID - The ID of the Attenuator component. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function attenuatorEdit(nodeID, callback) { | function attenuatorEdit(nodeID, callback) { | ||||||
|     document.getElementById("attenuatorMenu").style.display = "none"; |     document.getElementById("attenuatorMenu").style.display = "none"; | ||||||
|     openDrawer('attenuator'); |     openDrawer('attenuator'); | ||||||
| @@ -306,6 +345,12 @@ function attenuatorEdit(nodeID, callback) { | |||||||
|     document.getElementById("btnCloseAttenuator").onclick = clearAttenuator.bind( |     document.getElementById("btnCloseAttenuator").onclick = clearAttenuator.bind( | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update Attenuator. | ||||||
|  |  * Update Attenuator label, type by Attenuator ID. | ||||||
|  |  * @param {string} nodeID - The ID of the Attenuator component | ||||||
|  |  */ | ||||||
| function updateAttenuator(nodeID) { | function updateAttenuator(nodeID) { | ||||||
|  |  | ||||||
|     var id = nodeID; |     var id = nodeID; | ||||||
| @@ -328,6 +373,8 @@ function updateAttenuator(nodeID) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear input/teporary data and other settings. */ | ||||||
| function clearAttenuator() { | function clearAttenuator() { | ||||||
|     $("#txtAttenuatorName").val(''); |     $("#txtAttenuatorName").val(''); | ||||||
|     closeDrawer('attenuator'); |     closeDrawer('attenuator'); | ||||||
| @@ -404,6 +451,11 @@ function clearILA() { | |||||||
|     _roadmListDB().remove(); |     _roadmListDB().remove(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Populate Amplifier component details by node ID. | ||||||
|  |  * @param {string} nodeID - The ID of the Amplifier component. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function amplifierEdit(nodeID, callback) { | function amplifierEdit(nodeID, callback) { | ||||||
|     document.getElementById("amplifierMenu").style.display = "none"; |     document.getElementById("amplifierMenu").style.display = "none"; | ||||||
|     openDrawer('amplifier'); |     openDrawer('amplifier'); | ||||||
| @@ -448,6 +500,12 @@ function amplifierEdit(nodeID, callback) { | |||||||
|     document.getElementById("btnCloseAmplifier").onclick = clearAmplifier.bind( |     document.getElementById("btnCloseAmplifier").onclick = clearAmplifier.bind( | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update Amplifier. | ||||||
|  |  * Update Amplifier label, type by Amplifier ID. | ||||||
|  |  * @param {string} nodeID - The ID of the Amplifier component | ||||||
|  |  */ | ||||||
| function updateAmplifier(nodeID) { | function updateAmplifier(nodeID) { | ||||||
|     removeNodeList = []; |     removeNodeList = []; | ||||||
|     if (nameLengthValidation("txtAmplifierName")) { |     if (nameLengthValidation("txtAmplifierName")) { | ||||||
| @@ -508,12 +566,20 @@ function updateAmplifier(nodeID) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear input/teporary data and other settings. */ | ||||||
| function clearAmplifier() { | function clearAmplifier() { | ||||||
|     $("#txtAmplifierName").val(''); |     $("#txtAmplifierName").val(''); | ||||||
|     $("#ddlAmplifierType").val(''); |     $("#ddlAmplifierType").val(''); | ||||||
|     closeDrawer('amplifier'); |     closeDrawer('amplifier'); | ||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check Amplifier component rules and update check-errors summary. | ||||||
|  |  * @param {string} id - The ID of Amplifier component. | ||||||
|  |  * @param {string} rtype - The type of Amplifier component. | ||||||
|  |  */ | ||||||
| function realUpdate_Amplifier(id, rtype) { | function realUpdate_Amplifier(id, rtype) { | ||||||
|     var amptype = rtype; |     var amptype = rtype; | ||||||
|     var connectedEdges; |     var connectedEdges; | ||||||
| @@ -544,6 +610,11 @@ function realUpdate_Amplifier(id, rtype) { | |||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Populate Raman Amplifier component details by node ID. | ||||||
|  |  * @param {string} nodeID - The ID of the Raman Amplifier component. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function ramanAmpEdit(nodeID, callback) { | function ramanAmpEdit(nodeID, callback) { | ||||||
|     document.getElementById("ramanAmpMenu").style.display = "none"; |     document.getElementById("ramanAmpMenu").style.display = "none"; | ||||||
|     openDrawer('ramanamp'); |     openDrawer('ramanamp'); | ||||||
| @@ -601,6 +672,12 @@ function ramanAmpEdit(nodeID, callback) { | |||||||
|     document.getElementById("btnCloseRamanAmp").onclick = clearRamanAmp.bind( |     document.getElementById("btnCloseRamanAmp").onclick = clearRamanAmp.bind( | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update Raman Amplifier. | ||||||
|  |  * Update Raman Amplifier label, type by Raman Amplifier ID. | ||||||
|  |  * @param {string} nodeID - The ID of the Raman Amplifier component | ||||||
|  |  */ | ||||||
| function updateRamanAmp(nodeID) { | function updateRamanAmp(nodeID) { | ||||||
|     removeNodeList = []; |     removeNodeList = []; | ||||||
|     if (nameLengthValidation("txtRamanAmpName")) { |     if (nameLengthValidation("txtRamanAmpName")) { | ||||||
| @@ -665,6 +742,8 @@ function updateRamanAmp(nodeID) { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear input/teporary data and other settings. */ | ||||||
| function clearRamanAmp() { | function clearRamanAmp() { | ||||||
|     $("#txtRamanAmpName").val(''); |     $("#txtRamanAmpName").val(''); | ||||||
|     $("#ddlRamanAmpType").val(''); |     $("#ddlRamanAmpType").val(''); | ||||||
| @@ -672,6 +751,12 @@ function clearRamanAmp() { | |||||||
|     closeDrawer('ramanamp'); |     closeDrawer('ramanamp'); | ||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check Raman Amplifier component rules and update check-errors summary. | ||||||
|  |  * @param {string} id - The ID of Raman Amplifier component. | ||||||
|  |  * @param {string} rtype - The type of Raman Amplifier component. | ||||||
|  |  */ | ||||||
| function realUpdate_RamanAmp(id, rtype) { | function realUpdate_RamanAmp(id, rtype) { | ||||||
|     var amptype = rtype; |     var amptype = rtype; | ||||||
|     var connectedEdges; |     var connectedEdges; | ||||||
| @@ -705,6 +790,11 @@ function realUpdate_RamanAmp(id, rtype) { | |||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Populate Transceiver component details by node ID. | ||||||
|  |  * @param {string} nodeID - The ID of the Transceiver component. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function transceiverEdit(nodeID, callback) { | function transceiverEdit(nodeID, callback) { | ||||||
|     document.getElementById("transceiverMenu").style.display = "none"; |     document.getElementById("transceiverMenu").style.display = "none"; | ||||||
|     openDrawer('transceiver'); |     openDrawer('transceiver'); | ||||||
| @@ -749,6 +839,12 @@ function transceiverEdit(nodeID, callback) { | |||||||
|     document.getElementById("btnCloseTransceiver").onclick = clearTransceiver.bind( |     document.getElementById("btnCloseTransceiver").onclick = clearTransceiver.bind( | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update Transceiver. | ||||||
|  |  * Update Transceiver label, type by Transceiver ID. | ||||||
|  |  * @param {string} nodeID - The ID of the Transceiver component | ||||||
|  |  */ | ||||||
| function updateTransceiver(nodeID) { | function updateTransceiver(nodeID) { | ||||||
|     removeNodeList = []; |     removeNodeList = []; | ||||||
|     if (nameLengthValidation("txtTransceiverName")) { |     if (nameLengthValidation("txtTransceiverName")) { | ||||||
| @@ -906,6 +1002,8 @@ function updateTransceiver(nodeID) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear input/teporary data and other settings. */ | ||||||
| function clearTransceiver() { | function clearTransceiver() { | ||||||
|     $("#txtTransceiverName").val(''); |     $("#txtTransceiverName").val(''); | ||||||
|     $("#ddlTransceiverType").val(''); |     $("#ddlTransceiverType").val(''); | ||||||
| @@ -913,6 +1011,12 @@ function clearTransceiver() { | |||||||
|     closeDrawer('transceiver'); |     closeDrawer('transceiver'); | ||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Check Transceiver component rules and update check-errors summary. | ||||||
|  |  * @param {string} id - The ID of Transceiver component. | ||||||
|  |  * @param {string} rtype - The type of Transceiver component. | ||||||
|  |  */ | ||||||
| function realUpdate_Transceiver(id, rtype) { | function realUpdate_Transceiver(id, rtype) { | ||||||
|     var connectedEges = network.getConnectedEdges(id); |     var connectedEges = network.getConnectedEdges(id); | ||||||
|     var tempEdge = []; |     var tempEdge = []; | ||||||
| @@ -978,6 +1082,12 @@ function deleteNode(nodeList) { | |||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Remove node by node ID. | ||||||
|  |  * @param {string} nodeID - Component ID. | ||||||
|  |  * @param {boolean} isMultiple - Remove multiple node. | ||||||
|  |  */ | ||||||
| function removeNodes(nodeID, isMultiple) { | function removeNodes(nodeID, isMultiple) { | ||||||
|     var nodeDetails = network.body.data.nodes.get(nodeID); |     var nodeDetails = network.body.data.nodes.get(nodeID); | ||||||
|     var node_type = nodeDetails.node_type; |     var node_type = nodeDetails.node_type; | ||||||
| @@ -1033,6 +1143,12 @@ function removeNodes(nodeID, isMultiple) { | |||||||
|     network.body.data.nodes.remove(nodeID); |     network.body.data.nodes.remove(nodeID); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Bind pasteNode method. | ||||||
|  |  * Copy node parameters by selected node ID | ||||||
|  |  * @param {string} nodeID - Component ID. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function copyNode(nodeID, callback) { | function copyNode(nodeID, callback) { | ||||||
|     showHideDrawerandMenu(); |     showHideDrawerandMenu(); | ||||||
|     isCopy = true; |     isCopy = true; | ||||||
| @@ -1044,6 +1160,12 @@ function copyNode(nodeID, callback) { | |||||||
|  |  | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Create new node by copied node parameters. | ||||||
|  |  * Node will be placed based on co-ordidates. | ||||||
|  |  * @param {string} nodeId - Copied node ID. | ||||||
|  |  */ | ||||||
| function pasteNode(nodeId) { | function pasteNode(nodeId) { | ||||||
|     if (isCopy) { |     if (isCopy) { | ||||||
|         isCopy = false; |         isCopy = false; | ||||||
| @@ -1128,6 +1250,12 @@ function pasteNode(nodeId) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Copy node template by selected node ID. | ||||||
|  |  * Validate the node template by type, category | ||||||
|  |  * @param {string} nodeID - The ID of Copied node template. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function copyNodeTemplate(nodeID, callback) { | function copyNodeTemplate(nodeID, callback) { | ||||||
|     var isOk = false; |     var isOk = false; | ||||||
|     var nodeDetails = network.body.data.nodes.get(nodeID); |     var nodeDetails = network.body.data.nodes.get(nodeID); | ||||||
| @@ -1162,12 +1290,27 @@ function copyNodeTemplate(nodeID, callback) { | |||||||
| function cancelCopyTemplate(nodeId) { | function cancelCopyTemplate(nodeId) { | ||||||
|     clearNodeTemplate(); |     clearNodeTemplate(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Apply copied template to specified ROADM node. | ||||||
|  |  * Check node rules and update check-errors summary. | ||||||
|  |  * @param {string} nodeID - The ID of the destination node. | ||||||
|  |  * @param {string} roadm_type - Coponent type. | ||||||
|  |  */ | ||||||
| function applyRoadmTemplate(nodeID, roadm_type) { | function applyRoadmTemplate(nodeID, roadm_type) { | ||||||
|     network.body.data.nodes.update({ |     network.body.data.nodes.update({ | ||||||
|         id: nodeID, roadm_type: roadm_type |         id: nodeID, roadm_type: roadm_type | ||||||
|     }); |     }); | ||||||
|     realUpdate_Roadm(nodeID, roadm_type); |     realUpdate_Roadm(nodeID, roadm_type); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Apply copied template to specified Transceiver node. | ||||||
|  |  * Check node rules and update check-errors summary. | ||||||
|  |  * @param {string} nodeID - The ID of the destination node. | ||||||
|  |  * @param {string} node_type - Node type. | ||||||
|  |  * @param {string} trans_type - Transceiver type. | ||||||
|  |  */ | ||||||
| function applyTransceiverTemplate(nodeID, node_type, trans_type) { | function applyTransceiverTemplate(nodeID, node_type, trans_type) { | ||||||
|     var id = nodeID; |     var id = nodeID; | ||||||
|     var connectedEdges = network.getConnectedEdges(id); |     var connectedEdges = network.getConnectedEdges(id); | ||||||
| @@ -1213,12 +1356,20 @@ function applyTransceiverTemplate(nodeID, node_type, trans_type) { | |||||||
|     } |     } | ||||||
|     return isOk; |     return isOk; | ||||||
| } | } | ||||||
|  | /// <summary> | ||||||
|  | /// To apply copied template to specified Amplifier node. | ||||||
|  | /// Apply node rules. | ||||||
|  | /// </summary> | ||||||
| function applyAmpTemplate(nodeID, amp_type) { | function applyAmpTemplate(nodeID, amp_type) { | ||||||
|     network.body.data.nodes.update({ |     network.body.data.nodes.update({ | ||||||
|         id: nodeID, amp_type: amp_type |         id: nodeID, amp_type: amp_type | ||||||
|     }); |     }); | ||||||
|     realUpdate_Amplifier(nodeID, amp_type); |     realUpdate_Amplifier(nodeID, amp_type); | ||||||
| } | } | ||||||
|  | /// <summary> | ||||||
|  | /// To apply copied template to specified Raman Amplifier node. | ||||||
|  | /// Apply node rules. | ||||||
|  | /// </summary> | ||||||
| function applyRamanAmpTemplate(nodeID, amp_type, category) { | function applyRamanAmpTemplate(nodeID, amp_type, category) { | ||||||
|     network.body.data.nodes.update({ |     network.body.data.nodes.update({ | ||||||
|         id: nodeID, amp_type: amp_type, category: category |         id: nodeID, amp_type: amp_type, category: category | ||||||
| @@ -1226,6 +1377,13 @@ function applyRamanAmpTemplate(nodeID, amp_type, category) { | |||||||
|     realUpdate_RamanAmp(nodeID, amp_type); |     realUpdate_RamanAmp(nodeID, amp_type); | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Apply copied template to specified node. | ||||||
|  |  * Apply node rules. | ||||||
|  |  * @param {object} nodes - Selected destination nodes for apply template. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function applyTemplate(nodes, callback) { | function applyTemplate(nodes, callback) { | ||||||
|     var isUpdated = false; |     var isUpdated = false; | ||||||
|     if (isCopyPara) { |     if (isCopyPara) { | ||||||
| @@ -1317,6 +1475,8 @@ function applyTemplate(nodes, callback) { | |||||||
|         clearNodeTemplate(); |         clearNodeTemplate(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Reset the copied template data. */ | ||||||
| function clearNodeTemplate() { | function clearNodeTemplate() { | ||||||
|     isCopyPara = false; |     isCopyPara = false; | ||||||
|     copiedNodeID = ""; |     copiedNodeID = ""; | ||||||
| @@ -1327,6 +1487,10 @@ function clearNodeTemplate() { | |||||||
|     remove_NodeFiberHighlight(); |     remove_NodeFiberHighlight(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Displays node name, type parameter when hover the mouse near the node. | ||||||
|  |  * @param {object} params - Node details. | ||||||
|  |  */ | ||||||
| function displayNodesHover(params) { | function displayNodesHover(params) { | ||||||
|     var nodeDetails = network.body.data.nodes.get(params.node); |     var nodeDetails = network.body.data.nodes.get(params.node); | ||||||
|     if (nodeDetails.component_type == roadmJSON.component_type) { |     if (nodeDetails.component_type == roadmJSON.component_type) { | ||||||
| @@ -1348,6 +1512,11 @@ function displayNodesHover(params) { | |||||||
|     showHoverDiv(params.event.pageX, params.event.pageY, "hoverDiv"); |     showHoverDiv(params.event.pageX, params.event.pageY, "hoverDiv"); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Get next level of node label name by node type/amplifer category. | ||||||
|  |  * @param {string} node_type - Node type. | ||||||
|  |  * @param {string} amp_category - Amplifier category. | ||||||
|  |  */ | ||||||
| function nodeName(node_type, amp_category) { | function nodeName(node_type, amp_category) { | ||||||
|     const number = []; |     const number = []; | ||||||
|     var nodeList = []; |     var nodeList = []; | ||||||
| @@ -1419,6 +1588,11 @@ function nodeName(node_type, amp_category) { | |||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Set warning icons to imcompleted node by node ID. | ||||||
|  |  * Update node size, image by node ID. | ||||||
|  |  * @param {string} nodeID - Node ID. | ||||||
|  |  */ | ||||||
| function addNodeHighlight(nodeID) { | function addNodeHighlight(nodeID) { | ||||||
|     var nodeDetails = network.body.data.nodes.get(nodeID); |     var nodeDetails = network.body.data.nodes.get(nodeID); | ||||||
|     if (nodeDetails.node_type == roadmJSON.node_type) |     if (nodeDetails.node_type == roadmJSON.node_type) | ||||||
|   | |||||||
| @@ -1,4 +1,9 @@ | |||||||
| var isDualPatchMode = 0; | /** | ||||||
|  |  * patch.js | ||||||
|  |  * The patch library describes to add a patch connection between any 2 nodes by dragging from source node to destination and defines the patch manipulation. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | var isDualPatchMode = 0; | ||||||
| var isSinglePatchMode = 0; | var isSinglePatchMode = 0; | ||||||
| var addPatchData = { | var addPatchData = { | ||||||
|     from: '', |     from: '', | ||||||
| @@ -16,6 +21,11 @@ function dualPatchMode() { | |||||||
|         to: '' |         to: '' | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Enable settings for patch and reset other settings. | ||||||
|  |  * Set patch 1 = enable, 0 = disable. | ||||||
|  |  */ | ||||||
| function singlePatchMode() { | function singlePatchMode() { | ||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|     isDualPatchMode = 0; |     isDualPatchMode = 0; | ||||||
| @@ -59,6 +69,17 @@ function addSinglePatch() { | |||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|     network.addEdgeMode(); |     network.addEdgeMode(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Patch creation. | ||||||
|  |  * Patch style and configuration data loaded from configurationdata, styledata json. | ||||||
|  |  * @param {number} cmode - Service mode 1 for add. | ||||||
|  |  * @param {string} cfrom - Source node ID. | ||||||
|  |  * @param {string} cto - Destination node ID. | ||||||
|  |  * @param {string} clabel - The Label of the service. | ||||||
|  |  * @param {string} ctext - The Text of the service. | ||||||
|  |  * @param {boolean} isImport - false -> manual add, true -> automattically added while import json. | ||||||
|  |  */ | ||||||
| function addPatchComponent(cmode, cfrom, cto, clabel, ctext, isImport) { | function addPatchComponent(cmode, cfrom, cto, clabel, ctext, isImport) { | ||||||
|  |  | ||||||
|     if (cmode == 1) { |     if (cmode == 1) { | ||||||
| @@ -136,6 +157,12 @@ function addPatchComponent(cmode, cfrom, cto, clabel, ctext, isImport) { | |||||||
|         tempUndo.push(tedge); |         tempUndo.push(tedge); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Populate patch details by patch ID. | ||||||
|  |  * @param {string} patchID - Patch ID. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function singlePatchEdit(patchID, callback) { | function singlePatchEdit(patchID, callback) { | ||||||
|     document.getElementById("singlePatchMenu").style.display = "none"; |     document.getElementById("singlePatchMenu").style.display = "none"; | ||||||
|     var edgeDetails = network.body.data.edges.get(patchID); |     var edgeDetails = network.body.data.edges.get(patchID); | ||||||
| @@ -149,6 +176,12 @@ function singlePatchEdit(patchID, callback) { | |||||||
|     document.getElementById("btnCloseSinglePatch").onclick = clearSinglePatch.bind( |     document.getElementById("btnCloseSinglePatch").onclick = clearSinglePatch.bind( | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update patch. | ||||||
|  |  * Update patch label, text by patch ID. | ||||||
|  |  * @param {string} patchID - patch ID. | ||||||
|  |  */ | ||||||
| function updateSinglePatch(patchID) { | function updateSinglePatch(patchID) { | ||||||
|  |  | ||||||
|     var id = patchID; |     var id = patchID; | ||||||
| @@ -172,6 +205,11 @@ function updateSinglePatch(patchID) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Remove patch by patch ID. | ||||||
|  |  * @param {string} patchID - patch ID. | ||||||
|  |  */ | ||||||
| function deletePatch(patchID) { | function deletePatch(patchID) { | ||||||
|     var patchDetails = network.body.data.edges.get(patchID); |     var patchDetails = network.body.data.edges.get(patchID); | ||||||
|     var patchLabel = patchDetails.label; |     var patchLabel = patchDetails.label; | ||||||
| @@ -192,6 +230,8 @@ function deletePatch(patchID) { | |||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|     enableEdgeIndicator(); |     enableEdgeIndicator(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear input/teporary data and other settings. */ | ||||||
| function clearSinglePatch() { | function clearSinglePatch() { | ||||||
|  |  | ||||||
|     $("#txtSinglePatchName").val(''); |     $("#txtSinglePatchName").val(''); | ||||||
|   | |||||||
| @@ -1,8 +1,18 @@ | |||||||
| var isAddService = 0; | /** | ||||||
|  |  * service.js | ||||||
|  |  * The Service it is also same as the connectivity path between 2 transceiver nodes. This library file defines the service manipulation. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | var isAddService = 0; | ||||||
| var addServiceData = { | var addServiceData = { | ||||||
|     from: '', |     from: '', | ||||||
|     to: '' |     to: '' | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Enable settings for service and reset other settings. | ||||||
|  |  * Set service 1 = enable, 0 = disable. | ||||||
|  |  */ | ||||||
| function addServiceMode() { | function addServiceMode() { | ||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|     isAddService = 1; |     isAddService = 1; | ||||||
| @@ -15,6 +25,8 @@ function addServiceMode() { | |||||||
|         to: '' |         to: '' | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Check service connections rule before add it. */ | ||||||
| function addService() { | function addService() { | ||||||
|  |  | ||||||
|     var fromDetails = network.body.data.nodes.get(addServiceData.from); |     var fromDetails = network.body.data.nodes.get(addServiceData.from); | ||||||
| @@ -50,6 +62,16 @@ function addService() { | |||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Service creation. | ||||||
|  |  * Service style and configuration data loaded from configurationdata, styledata json. | ||||||
|  |  * @param {number} cmode - Service mode 1 for add. | ||||||
|  |  * @param {string} cfrom - Source node ID. | ||||||
|  |  * @param {string} cto - Destination node ID. | ||||||
|  |  * @param {string} clabel - The Label of the service. | ||||||
|  |  * @param {boolean} isImport - false -> manual add, true -> automattically added while import json. | ||||||
|  |  */ | ||||||
| function addServiceComponent(cmode, cfrom, cto, clabel, isImport) { | function addServiceComponent(cmode, cfrom, cto, clabel, isImport) { | ||||||
|     var serviceID = token(); |     var serviceID = token(); | ||||||
|     if (cmode == 1) { |     if (cmode == 1) { | ||||||
| @@ -79,6 +101,12 @@ function addServiceComponent(cmode, cfrom, cto, clabel, isImport) { | |||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|     network.addEdgeMode(); |     network.addEdgeMode(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Populate service details by service ID. | ||||||
|  |  * @param {string} serviceID - Service ID. | ||||||
|  |  * @param callback - The callback that handles the response. | ||||||
|  |  */ | ||||||
| function serviceEdit(serviceID, callback) { | function serviceEdit(serviceID, callback) { | ||||||
|     document.getElementById("serviceMenu").style.display = "none"; |     document.getElementById("serviceMenu").style.display = "none"; | ||||||
|     var edgeDetails = network.body.data.edges.get(serviceID); |     var edgeDetails = network.body.data.edges.get(serviceID); | ||||||
| @@ -96,6 +124,12 @@ function serviceEdit(serviceID, callback) { | |||||||
|     document.getElementById("btnCloseService").onclick = clearService.bind( |     document.getElementById("btnCloseService").onclick = clearService.bind( | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Update service. | ||||||
|  |  * Update service label, text, band_width by service ID. | ||||||
|  |  * @param {string} serviceID - Service ID. | ||||||
|  |  */ | ||||||
| function updateService(serviceID) { | function updateService(serviceID) { | ||||||
|  |  | ||||||
|     var id = serviceID; |     var id = serviceID; | ||||||
| @@ -123,6 +157,11 @@ function updateService(serviceID) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Remove service by service ID. | ||||||
|  |  * @param {string} serviceID - Service ID. | ||||||
|  |  */ | ||||||
| function deleteService(serviceID) { | function deleteService(serviceID) { | ||||||
|     var serviceDetails = network.body.data.edges.get(serviceID); |     var serviceDetails = network.body.data.edges.get(serviceID); | ||||||
|     document.getElementById("serviceMenu").style.display = "none"; |     document.getElementById("serviceMenu").style.display = "none"; | ||||||
| @@ -135,6 +174,8 @@ function deleteService(serviceID) { | |||||||
|     UnSelectAll(); |     UnSelectAll(); | ||||||
|     enableEdgeIndicator(); |     enableEdgeIndicator(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Clear input/teporary data and other settings. */ | ||||||
| function clearService() { | function clearService() { | ||||||
|  |  | ||||||
|     $("#txtServiceName").val(''); |     $("#txtServiceName").val(''); | ||||||
|   | |||||||
| @@ -1,4 +1,9 @@ | |||||||
| $(document).ready(function () { | /** | ||||||
|  |  * validation.js | ||||||
|  |  * The Validations library currently describes the validation of component name, length, type. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | $(document).ready(function () { | ||||||
|     $("#txtSpan_Length").change(function () { |     $("#txtSpan_Length").change(function () { | ||||||
|         var span_length = $("#txtSpan_Length").val().trim(); |         var span_length = $("#txtSpan_Length").val().trim(); | ||||||
|         var spanlen = parseFloat(span_length); |         var spanlen = parseFloat(span_length); | ||||||
| @@ -93,6 +98,10 @@ | |||||||
|  |  | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Validate the node/fiber/patch/service name and name length. | ||||||
|  |  * @param {HTMLElement} element - Input element | ||||||
|  |  */ | ||||||
| function nameLengthValidation(element) { | function nameLengthValidation(element) { | ||||||
|     var flag = true; |     var flag = true; | ||||||
|     var elementID = "#" + element |     var elementID = "#" + element | ||||||
| @@ -110,6 +119,8 @@ function nameLengthValidation(element) { | |||||||
|         showMessage(alertType.Error, msg); |         showMessage(alertType.Error, msg); | ||||||
|     return flag; |     return flag; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Validate export file name. */ | ||||||
| function exportFileValidation() { | function exportFileValidation() { | ||||||
|     var flag = false; |     var flag = false; | ||||||
|     if ($("#txtFileName").val().trim() != '') |     if ($("#txtFileName").val().trim() != '') | ||||||
| @@ -118,6 +129,8 @@ function exportFileValidation() { | |||||||
|         showMessage(alertType.Error, 'Please enter file name'); |         showMessage(alertType.Error, 'Please enter file name'); | ||||||
|     return flag; |     return flag; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /** Validate ROADM list, type and Amplifier type. */ | ||||||
| function roadmProVal() { | function roadmProVal() { | ||||||
|     var flag = false; |     var flag = false; | ||||||
|     if ($("#ddlRoadmList").val().trim() != 0 && $("#ddlROADMType").val().trim() != 0 && $("#ddlRPreAmpType").val().trim() != 0 && $("#ddlRBoosterType").val().trim() != 0) |     if ($("#ddlRoadmList").val().trim() != 0 && $("#ddlROADMType").val().trim() != 0 && $("#ddlRPreAmpType").val().trim() != 0 && $("#ddlRBoosterType").val().trim() != 0) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sakv2e10204
					sakv2e10204