From 1df8f6ad56093db2c4c9a095fdd60b9e23d45f7d Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Tue, 5 Nov 2024 12:47:03 +0000
Subject: [PATCH] WebUI component:

- Corrected home page copyright message
- Corrected topology.js
---
 src/webui/service/templates/base.html      |  2 +-
 src/webui/service/templates/js/topology.js | 45 +++++++++++-----------
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/src/webui/service/templates/base.html b/src/webui/service/templates/base.html
index 8bded20ff..d2eadf121 100644
--- a/src/webui/service/templates/base.html
+++ b/src/webui/service/templates/base.html
@@ -192,7 +192,7 @@
           <div class="container">
             <div class="row">
               <div class="col-md-12">
-                <p class="text-center" style="color: white;">&copy; 2022-2024 <a href="https://tfs.etsi.org/">ETSI OSG/SDG TeraFlowSDN (TFS)</a></p>
+                <p class="text-center" style="color: white;">&copy; 2022-2024 <a href="https://tfs.etsi.org/">ETSI SDG TeraFlowSDN (TFS)</a></p>
               </div>
             </div>
             <div class="row">
diff --git a/src/webui/service/templates/js/topology.js b/src/webui/service/templates/js/topology.js
index 3e0a766ee..8a8ba0e40 100644
--- a/src/webui/service/templates/js/topology.js
+++ b/src/webui/service/templates/js/topology.js
@@ -86,21 +86,21 @@ d3.json("{{ url_for('main.topology') }}", function(data) {
             return l.name.toLowerCase().includes('mgmt') ? "5,5" : "0";
         });
 
-     optical_link = svg.append("g").attr("class", "links").style('stroke', '#aaa')
-         .selectAll("line")
-         .data(data.optical_links)
-         .enter()
-         .append("line")
-         .attr("opacity", 1)
-         .attr("stroke", function(l) {
-             return l.name.toLowerCase().includes('mgmt') ? '#AAAAAA' : '#555555';
-         })
-         .attr("stroke-width", function(l) {
-             return l.name.toLowerCase().includes('mgmt') ? 1 : 2;
-         })
-         .attr("stroke-dasharray", function(l) {
-             return l.name.toLowerCase().includes('mgmt') ? "5,5" : "0";
-         });   
+    optical_link = svg.append("g").attr("class", "links")//.style('stroke', '#aaa')
+        .selectAll("line")
+        .data(data.optical_links)
+        .enter()
+        .append("line")
+        .attr("opacity", 1)
+        .attr("stroke", function(l) {
+            return l.name.toLowerCase().includes('mgmt') ? '#AAAAAA' : '#555555';
+        })
+        .attr("stroke-width", function(l) {
+            return l.name.toLowerCase().includes('mgmt') ? 1 : 2;
+        })
+        .attr("stroke-dasharray", function(l) {
+            return l.name.toLowerCase().includes('mgmt') ? "5,5" : "0";
+        });
 
     node = svg.append("g").attr("class", "devices").attr('r', 20).style('fill', '#69b3a2')
         .selectAll("circle")
@@ -130,18 +130,19 @@ d3.json("{{ url_for('main.topology') }}", function(data) {
     simulation.nodes(data.devices);
 
     // add forces, associate each with a name, and set their properties
+    // Experimental : Optical link part 
+    all_links = data.links.concat(data.optical_links)
     simulation
         .force("link", d3.forceLink()
             .id(function(d) {return d.id;})
             .distance(forceProperties.link.distance)
             .iterations(forceProperties.link.iterations)
-            .links(forceProperties.link.enabled ? data.links.length>0? data.links :[]:[]))
-//  ------------------    Experimental : Optical link part 
-        .force("link", d3.forceLink()
-            .id(function(d) {return d.id;})
-            .distance(forceProperties.link.distance)
-            .iterations(forceProperties.link.iterations)
-            .links(forceProperties.link.enabled ?  data.optical_links.length>0?data.optical_links:[]:[])) 
+            .links(
+                forceProperties.link.enabled ? (
+                    (all_links.length > 0) ? all_links : []
+                ) : []
+            )
+        )
 
         .force("charge", d3.forceManyBody()
             .strength(forceProperties.charge.strength * forceProperties.charge.enabled)
-- 
GitLab