From 53d4143da377f26642c0f6c6dacf61f01493b8a9 Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Thu, 19 Jan 2023 18:29:46 +0000
Subject: [PATCH] WebUI component:

- improved name reporting of devices and links
---
 src/webui/service/templates/device/detail.html |  3 ++-
 src/webui/service/templates/device/home.html   | 10 ++++++----
 src/webui/service/templates/link/detail.html   |  5 ++++-
 src/webui/service/templates/link/home.html     | 14 ++++++++------
 4 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/webui/service/templates/device/detail.html b/src/webui/service/templates/device/detail.html
index 69ca93727..6b39e2217 100644
--- a/src/webui/service/templates/device/detail.html
+++ b/src/webui/service/templates/device/detail.html
@@ -17,7 +17,7 @@
    {% extends 'base.html' %}
    
    {% block content %}
-       <h1>Device {{ device.device_id.device_uuid.uuid }}</h1>
+       <h1>Device {{ device.name }} ({{ device.device_id.device_uuid.uuid }})</h1>
    
        <div class="row mb-3">
            <div class="col-sm-3">
@@ -44,6 +44,7 @@
        <div class="row mb-3">
             <div class="col-sm-4">
                 <b>UUID: </b>{{ device.device_id.device_uuid.uuid }}<br><br>
+                <b>Name: </b>{{ device.name }}<br><br>
                 <b>Type: </b>{{ device.device_type }}<br><br>
                 <b>Status: </b> {{ dose.Name(device.device_operational_status).replace('DEVICEOPERATIONALSTATUS_', '') }}<br>
                 <b>Drivers: </b>
diff --git a/src/webui/service/templates/device/home.html b/src/webui/service/templates/device/home.html
index 2c108add9..7b4437cce 100644
--- a/src/webui/service/templates/device/home.html
+++ b/src/webui/service/templates/device/home.html
@@ -42,7 +42,8 @@
     <table class="table table-striped table-hover">
         <thead>
           <tr>
-            <th scope="col">#</th>
+            <th scope="col">UUID</th>
+            <th scope="col">Name</th>
             <th scope="col">Type</th>
             <th scope="col">Endpoints</th>
             <th scope="col">Drivers</th>
@@ -56,9 +57,10 @@
                 {% for device in devices %}
                 <tr>
                     <td>
-                        <!-- <a href="{{ url_for('device.detail', device_uuid=device.device_id.device_uuid.uuid) }}"> -->
-                            {{ device.device_id.device_uuid.uuid }}
-                        <!-- </a> -->
+                        {{ device.device_id.device_uuid.uuid }}
+                    </td>
+                    <td>
+                        {{ device.name }}
                     </td>
                     <td>
                         {{ device.device_type }}
diff --git a/src/webui/service/templates/link/detail.html b/src/webui/service/templates/link/detail.html
index 7df9ddce6..fc865a4b9 100644
--- a/src/webui/service/templates/link/detail.html
+++ b/src/webui/service/templates/link/detail.html
@@ -16,7 +16,7 @@
    {% extends 'base.html' %}
    
    {% block content %}
-    <h1>Link {{ link.link_id.link_uuid.uuid }}</h1>
+    <h1>Link {{ link.name }} ({{ link.link_id.link_uuid.uuid }})</h1>
     <div class="row mb-3">
           <div class="col-sm-3">
                <button type="button" class="btn btn-success" onclick="window.location.href='{{ url_for('link.home') }}'">
@@ -31,6 +31,9 @@
             <div class="col-sm-4">
                 <b>UUID: </b>{{ link.link_id.link_uuid.uuid }}<br><br>
             </div>
+            <div class="col-sm-4">
+               <b>Name: </b>{{ link.name }}<br><br>
+           </div>
             <div class="col-sm-8">
                     <table class="table table-striped table-hover">
                         <thead>
diff --git a/src/webui/service/templates/link/home.html b/src/webui/service/templates/link/home.html
index 77d00d341..16fe36e1f 100644
--- a/src/webui/service/templates/link/home.html
+++ b/src/webui/service/templates/link/home.html
@@ -27,7 +27,7 @@
                </a> -->
            </div>
            <div class="col">
-               {{ links | length }} links found</i>
+               {{ links | length }} links found in context <i>{{ session['context_uuid'] }}</i>
            </div>
            <!-- <div class="col">
                <form>
@@ -42,7 +42,8 @@
        <table class="table table-striped table-hover">
            <thead>
              <tr>
-               <th scope="col">#</th>
+               <th scope="col">UUID</th>
+               <th scope="col">Name</th>
                <th scope="col">Endpoints</th>
                <th scope="col"></th>
              </tr>
@@ -52,11 +53,12 @@
                    {% for link in links %}
                    <tr>
                        <td>
-                           <!-- <a href="#"> -->
-                               {{ link.link_id.link_uuid.uuid }}
-                           <!-- </a> -->
+                            {{ link.link_id.link_uuid.uuid }}
                        </td>
-   
+                       <td>
+                            {{ link.name }}
+                        </td>
+
                        <td>
                            <ul>
                                {% for end_point in link.link_endpoint_ids %}
-- 
GitLab