diff --git a/src/webui/service/link/routes.py b/src/webui/service/link/routes.py index 0bfe2b9026050b3de6d6f0a1ee3674169c53913a..0fc598d657797a3ba6f657faa6de3f04383483d3 100644 --- a/src/webui/service/link/routes.py +++ b/src/webui/service/link/routes.py @@ -13,8 +13,9 @@ # limitations under the License. -from flask import current_app, render_template, Blueprint, flash, session, redirect, url_for -from common.proto.context_pb2 import Empty, Link, LinkEvent, LinkId, LinkIdList, LinkList, DeviceId, TopologyId +from flask import render_template, Blueprint, flash, session, redirect, url_for +from common.proto.context_pb2 import Empty, LinkId, LinkList, TopologyId +from common.tools.context_queries.EndPoint import get_endpoint_names from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Topology import json_topology_id from context.client.ContextClient import ContextClient @@ -37,22 +38,26 @@ def home(): grpc_topology = context_client.GetTopology(TopologyId(**json_topo_id)) topo_link_uuids = {link_id.link_uuid.uuid for link_id in grpc_topology.link_ids} grpc_links: LinkList = context_client.ListLinks(Empty()) - context_client.close() - links = [ - link for link in grpc_links.links - if link.link_id.link_uuid.uuid in topo_link_uuids - ] + endpoint_ids = [] + links = [] + for link_ in grpc_links.links: + if link_.link_id.link_uuid.uuid not in topo_link_uuids: continue + links.append(link_) + endpoint_ids.extend(link_.link_endpoint_ids) + + device_names, endpoints_data = get_endpoint_names(context_client, endpoint_ids) + context_client.close() - return render_template( - 'link/home.html', links=links) + return render_template('link/home.html', links=links, device_names=device_names, endpoints_data=endpoints_data) @link.route('detail/<path:link_uuid>', methods=('GET', 'POST')) def detail(link_uuid: str): request = LinkId() - request.link_uuid.uuid = link_uuid + request.link_uuid.uuid = link_uuid # pylint: disable=no-member context_client.connect() response = context_client.GetLink(request) + device_names, endpoints_data = get_endpoint_names(context_client, response.link_endpoint_ids) context_client.close() - return render_template('link/detail.html',link=response) + return render_template('link/detail.html',link=response, device_names=device_names, endpoints_data=endpoints_data) diff --git a/src/webui/service/service/routes.py b/src/webui/service/service/routes.py index bc05daee3e4ff8795c26bed9e0707b9a3ab2be7c..c3b33df1e93516c1cbd9e19743898f253887a627 100644 --- a/src/webui/service/service/routes.py +++ b/src/webui/service/service/routes.py @@ -14,7 +14,8 @@ import grpc from flask import current_app, redirect, render_template, Blueprint, flash, session, url_for -from common.proto.context_pb2 import ContextId, Service, ServiceId, ServiceList, ServiceTypeEnum, ServiceStatusEnum, Connection +from common.proto.context_pb2 import ContextId, Service, ServiceId, ServiceTypeEnum, ServiceStatusEnum, Connection +from common.tools.context_queries.EndPoint import get_endpoint_names from context.client.ContextClient import ContextClient from service.client.ServiceClient import ServiceClient @@ -39,18 +40,25 @@ def home(): service_list = context_client.ListServices(request) # print(service_list) services = service_list.services - context_not_found = False + context_found = True except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: raise if e.details() != 'Context({:s}) not found'.format(context_uuid): raise services = [] - context_not_found = True + context_found = False + + if context_found: + endpoint_ids = [] + for service_ in services: + endpoint_ids.extend(service_.service_endpoint_ids) + device_names, endpoints_data = get_endpoint_names(context_client, endpoint_ids) + else: + device_names, endpoints_data = [],[] context_client.close() - return render_template('service/home.html', services=services, - context_not_found=context_not_found, - ste=ServiceTypeEnum, - sse=ServiceStatusEnum) + return render_template( + 'service/home.html', services=services, device_names=device_names, endpoints_data=endpoints_data, + context_not_found=not context_found, ste=ServiceTypeEnum, sse=ServiceStatusEnum) @service.route('add', methods=['GET', 'POST']) @@ -74,13 +82,22 @@ def detail(service_uuid: str): context_client.connect() response: Service = context_client.GetService(request) connections: Connection = context_client.ListConnections(request) + connections = connections.connections + + endpoint_ids = [] + endpoint_ids.extend(response.service_endpoint_ids) + for connection in connections: + endpoint_ids.extend(connection.path_hops_endpoint_ids) + device_names, endpoints_data = get_endpoint_names(context_client, endpoint_ids) + context_client.close() except Exception as e: flash('The system encountered an error and cannot show the details of this service.', 'warning') current_app.logger.exception(e) return redirect(url_for('service.home')) - return render_template('service/detail.html', service=response, connections=connections,ste=ServiceTypeEnum, - sse=ServiceStatusEnum) + return render_template( + 'service/detail.html', service=response, connections=connections, device_names=device_names, + endpoints_data=endpoints_data, ste=ServiceTypeEnum, sse=ServiceStatusEnum) @service.get('<path:service_uuid>/delete') @@ -102,4 +119,4 @@ def delete(service_uuid: str): except Exception as e: flash('Problem deleting service "{:s}": {:s}'.format(service_uuid, str(e.details())), 'danger') current_app.logger.exception(e) - return redirect(url_for('service.home')) \ No newline at end of file + return redirect(url_for('service.home')) diff --git a/src/webui/service/slice/routes.py b/src/webui/service/slice/routes.py index c5287501362db88edaf334426ca6e6d0e3331ef2..a3dfc99ea76a25167f185fe5d1682cd578b36e67 100644 --- a/src/webui/service/slice/routes.py +++ b/src/webui/service/slice/routes.py @@ -14,22 +14,18 @@ # import grpc from flask import current_app, redirect, render_template, Blueprint, flash, session, url_for -from common.proto.context_pb2 import ContextId, Slice, SliceId, SliceList, Connection, SliceStatusEnum +from common.proto.context_pb2 import ContextId, Slice, SliceId, SliceStatusEnum +from common.tools.context_queries.EndPoint import get_endpoint_names from context.client.ContextClient import ContextClient -#from slice.client.SliceClient import SliceClient - - +from slice.client.SliceClient import SliceClient slice = Blueprint('slice', __name__, url_prefix='/slice') context_client = ContextClient() -#slice_client = SliceClient() +slice_client = SliceClient() @slice.get('/') def home(): - # flash('This is an info message', 'info') - # flash('This is a danger message', 'danger') - context_uuid = session.get('context_uuid', '-') if context_uuid == "-": flash("Please select a context!", "warning") @@ -39,25 +35,36 @@ def home(): context_client.connect() try: slice_list = context_client.ListSlices(request) - # print(slice_list) slices = slice_list.slices - context_not_found = False + context_found = True except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: raise if e.details() != 'Context({:s}) not found'.format(context_uuid): raise slices = [] - context_not_found = True + context_found = False + + if context_found: + endpoint_ids = [] + for slice_ in slices: + endpoint_ids.extend(slice_.slice_endpoint_ids) + device_names, endpoints_data = get_endpoint_names(context_client, endpoint_ids) + else: + device_names, endpoints_data = [],[] + context_client.close() - return render_template('slice/home.html',slices=slices, context_not_found=context_not_found, sse=SliceStatusEnum) -# -#@slice.route('add', methods=['GET', 'POST']) -#def add(): -# flash('Add slice route called', 'danger') -# raise NotImplementedError() -# return render_template('slice/home.html') -# -# + return render_template( + 'slice/home.html', slices=slices, device_names=device_names, endpoints_data=endpoints_data, + context_not_found=not context_found, sse=SliceStatusEnum) + + +@slice.route('add', methods=['GET', 'POST']) +def add(): + flash('Add slice route called', 'danger') + raise NotImplementedError() + return render_template('slice/home.html') + + @slice.get('<path:slice_uuid>/detail') def detail(slice_uuid: str): context_uuid = session.get('context_uuid', '-') @@ -74,13 +81,20 @@ def detail(slice_uuid: str): context_client.connect() response: Slice = context_client.GetSlice(request) services = context_client.ListServices(req) + + endpoint_ids = [] + endpoint_ids.extend(response.slice_endpoint_ids) + device_names, endpoints_data = get_endpoint_names(context_client, endpoint_ids) + context_client.close() except Exception as e: flash('The system encountered an error and cannot show the details of this slice.', 'warning') current_app.logger.exception(e) return redirect(url_for('slice.home')) - return render_template('slice/detail.html', slice=response, sse=SliceStatusEnum, services=services) -# + return render_template( + 'slice/detail.html', slice=response, device_names=device_names, endpoints_data=endpoints_data, + sse=SliceStatusEnum, services=services) + #@slice.get('<path:slice_uuid>/delete') #def delete(slice_uuid: str): # context_uuid = session.get('context_uuid', '-') @@ -100,4 +114,4 @@ def detail(slice_uuid: str): # except Exception as e: # flash('Problem deleting slice "{:s}": {:s}'.format(slice_uuid, str(e.details())), 'danger') # current_app.logger.exception(e) -# return redirect(url_for('slice.home')) \ No newline at end of file +# return redirect(url_for('slice.home')) diff --git a/src/webui/service/templates/link/detail.html b/src/webui/service/templates/link/detail.html index 16ec5470cfa428905091004affe28b8876d9c68d..d247527dedcac45180af528c2ddf9141974c0292 100644 --- a/src/webui/service/templates/link/detail.html +++ b/src/webui/service/templates/link/detail.html @@ -38,23 +38,27 @@ <tr> <th scope="col">Endpoint UUID</th> <th scope="col">Device</th> + <th scope="col">Endpoint Type</th> </tr> </thead> <tbody> - {% for end_point in link.link_endpoint_ids %} + {% for endpoint in link.link_endpoint_ids %} <tr> <td> - {{ end_point.endpoint_uuid.uuid }} + {{ endpoints_data.get(endpoint.endpoint_uuid.uuid, (endpoint.endpoint_uuid.uuid, ''))[0] }} </td> <td> - <a href="{{ url_for('device.detail', device_uuid=end_point.device_id.device_uuid.uuid) }}"> - {{ end_point.device_id.device_uuid.uuid }} + <a href="{{ url_for('device.detail', device_uuid=endpoint.device_id.device_uuid.uuid) }}"> + {{ device_names.get(endpoint.device_id.device_uuid.uuid, endpoint.device_id.device_uuid.uuid) }} <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> </svg> </a> </td> + <td> + {{ endpoints_data.get(endpoint.endpoint_uuid.uuid, ('', '-'))[1] }} + </td> </tr> {% endfor %} </tbody> diff --git a/src/webui/service/templates/link/home.html b/src/webui/service/templates/link/home.html index 16fe36e1f4a70ce76ff32257a508acc841248605..6a14e60dd751d32499a101588384a20d48cc06ad 100644 --- a/src/webui/service/templates/link/home.html +++ b/src/webui/service/templates/link/home.html @@ -61,12 +61,12 @@ <td> <ul> - {% for end_point in link.link_endpoint_ids %} + {% for endpoint in link.link_endpoint_ids %} <li> - {{ end_point.endpoint_uuid.uuid }} / + {{ endpoints_data.get(endpoint.endpoint_uuid.uuid, (endpoint.endpoint_uuid.uuid, ''))[0] }} / Device: - <a href="{{ url_for('device.detail', device_uuid=end_point.device_id.device_uuid.uuid) }}"> - {{ end_point.device_id.device_uuid.uuid }} + <a href="{{ url_for('device.detail', device_uuid=endpoint.device_id.device_uuid.uuid) }}"> + {{ device_names.get(endpoint.device_id.device_uuid.uuid, endpoint.device_id.device_uuid.uuid) }} <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> diff --git a/src/webui/service/templates/service/detail.html b/src/webui/service/templates/service/detail.html index e8d3a4221f68c5b0ea1eb51dcdc81cf13266c8e8..cb13009e7197ad086b5e70b349e97bf9e3fbf72d 100644 --- a/src/webui/service/templates/service/detail.html +++ b/src/webui/service/templates/service/detail.html @@ -55,26 +55,27 @@ <tr> <th scope="col">Endpoint UUID</th> <th scope="col">Device</th> + <th scope="col">Endpoint Type</th> </tr> </thead> <tbody> {% for endpoint in service.service_endpoint_ids %} <tr> <td> - {{ endpoint.endpoint_uuid.uuid }} + {{ endpoints_data.get(endpoint.endpoint_uuid.uuid, (endpoint.endpoint_uuid.uuid, ''))[0] }} </td> <td> <a href="{{ url_for('device.detail', device_uuid=endpoint.device_id.device_uuid.uuid) }}"> - {{ endpoint.device_id.device_uuid.uuid }} - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" - class="bi bi-eye" viewBox="0 0 16 16"> - <path - d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z" /> - <path - d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z" /> + {{ device_names.get(endpoint.device_id.device_uuid.uuid, endpoint.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> </svg> </a> </td> + <td> + {{ endpoints_data.get(endpoint.endpoint_uuid.uuid, ('', '-'))[1] }} + </td> </tr> {% endfor %} </tbody> @@ -102,8 +103,14 @@ <tr> <td>Endpoint Location</td> <td> - {{ constraint.endpoint_location.endpoint_id.device_id.device_uuid.uuid }} / {{ - constraint.endpoint_location.endpoint_id.endpoint_uuid.uuid }} + <a href="{{ url_for('device.detail', device_uuid=constraint.endpoint_location.endpoint_id.device_id.device_uuid.uuid) }}"> + {{ device_names.get(constraint.endpoint_location.endpoint_id.device_id.device_uuid.uuid, constraint.endpoint_location.endpoint_id.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> + </svg> + </a> + / {{ endpoints_data.get(constraint.endpoint_location.endpoint_id.endpoint_uuid.uuid, (constraint.endpoint_location.endpoint_id.endpoint_uuid.uuid, ''))[0] }} </td> <td> {% if constraint.endpoint_location.location.WhichOneof('location')=='region' %} @@ -119,8 +126,14 @@ <tr> <td>Endpoint Priority</td> <td> - {{ constraint.endpoint_priority.endpoint_id.device_id.device_uuid.uuid }} / {{ - constraint.endpoint_priority.endpoint_id.endpoint_uuid.uuid }} + <a href="{{ url_for('device.detail', device_uuid=constraint.endpoint_priority.endpoint_id.device_id.device_uuid.uuid) }}"> + {{ device_names.get(constraint.endpoint_priority.endpoint_id.device_id.device_uuid.uuid, constraint.endpoint_priority.endpoint_id.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> + </svg> + </a> + / {{ endpoints_data.get(constraint.endpoint_priority.endpoint_id.endpoint_uuid.uuid, (constraint.endpoint_priority.endpoint_id.endpoint_uuid.uuid, ''))[0] }} </td> <td>{{ constraint.endpoint_priority.priority }}</td> </tr> @@ -130,7 +143,7 @@ <td>-</td> <td> {{ constraint.sla_availability.num_disjoint_paths }} disjoint paths; - {% if constraint.sla_availability.all_active %}all{% else %}single{% endif %}active + {% if constraint.sla_availability.all_active %}all{% else %}single{% endif %}-active </td> </tr> {% else %} @@ -206,7 +219,7 @@ </tr> </thead> <tbody> - {% for connection in connections.connections %} + {% for connection in connections %} <tr> <td> {{ connection.connection_id.connection_uuid.uuid }} @@ -231,10 +244,16 @@ </ul> </td> - {% for i in range(connection.path_hops_endpoint_ids|length) %} + {% for endpoint_id in connection.path_hops_endpoint_ids %} <td> - {{ connection.path_hops_endpoint_ids[i].device_id.device_uuid.uuid }} / {{ - connection.path_hops_endpoint_ids[i].endpoint_uuid.uuid }} + <a href="{{ url_for('device.detail', device_uuid=endpoint_id.device_id.device_uuid.uuid) }}"> + {{ device_names.get(endpoint_id.device_id.device_uuid.uuid, endpoint_id.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> + </svg> + </a> + / {{ endpoints_data.get(endpoint_id.endpoint_uuid.uuid, (endpoint_id.endpoint_uuid.uuid, ''))[0] }} </td> {% endfor %} </tr> diff --git a/src/webui/service/templates/service/home.html b/src/webui/service/templates/service/home.html index 280685fc537af1b0eafd4d04056f4e4b0ed48e48..785012422b66039a8c42dbd3a7e4da1ce101bb1e 100644 --- a/src/webui/service/templates/service/home.html +++ b/src/webui/service/templates/service/home.html @@ -69,7 +69,17 @@ <td> <ul> {% for end_point in service.service_endpoint_ids %} - <li>{{ end_point.device_id.device_uuid.uuid }} / {{ end_point.endpoint_uuid.uuid }}</li> + <li> + {{ endpoints_data.get(end_point.endpoint_uuid.uuid, (end_point.endpoint_uuid.uuid, ''))[0] }} / + Device: + <a href="{{ url_for('device.detail', device_uuid=end_point.device_id.device_uuid.uuid) }}"> + {{ device_names.get(end_point.device_id.device_uuid.uuid, end_point.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> + </svg> + </a> + </li> {% endfor %} </ul> </td> diff --git a/src/webui/service/templates/slice/detail.html b/src/webui/service/templates/slice/detail.html index 4f26c75a50138df4fe1ff0806d250a5906e8cfd3..733c3d5095076602473683e4724ad760e82b8a3b 100644 --- a/src/webui/service/templates/slice/detail.html +++ b/src/webui/service/templates/slice/detail.html @@ -56,26 +56,27 @@ <tr> <th scope="col">Endpoint UUID</th> <th scope="col">Device</th> + <th scope="col">Endpoint Type</th> </tr> </thead> <tbody> {% for endpoint in slice.slice_endpoint_ids %} <tr> <td> - {{ endpoint.endpoint_uuid.uuid }} + {{ endpoints_data.get(endpoint.endpoint_uuid.uuid, (endpoint.endpoint_uuid.uuid, ''))[0] }} </td> <td> <a href="{{ url_for('device.detail', device_uuid=endpoint.device_id.device_uuid.uuid) }}"> - {{ endpoint.device_id.device_uuid.uuid }} - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" - class="bi bi-eye" viewBox="0 0 16 16"> - <path - d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z" /> - <path - d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z" /> + {{ device_names.get(endpoint.device_id.device_uuid.uuid, endpoint.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> </svg> </a> </td> + <td> + {{ endpoints_data.get(endpoint.endpoint_uuid.uuid, ('', '-'))[1] }} + </td> </tr> {% endfor %} </tbody> @@ -103,8 +104,14 @@ <tr> <td>Endpoint Location</td> <td> - {{ constraint.endpoint_location.endpoint_id.device_id.device_uuid.uuid }} / {{ - constraint.endpoint_location.endpoint_id.endpoint_uuid.uuid }} + <a href="{{ url_for('device.detail', device_uuid=constraint.endpoint_location.endpoint_id.device_id.device_uuid.uuid) }}"> + {{ device_names.get(constraint.endpoint_location.endpoint_id.device_id.device_uuid.uuid, constraint.endpoint_location.endpoint_id.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> + </svg> + </a> + / {{ endpoints_data.get(constraint.endpoint_location.endpoint_id.endpoint_uuid.uuid, (constraint.endpoint_location.endpoint_id.endpoint_uuid.uuid, ''))[0] }} </td> <td> {% if constraint.endpoint_location.location.WhichOneof('location')=='region' %} @@ -120,8 +127,14 @@ <tr> <td>Endpoint Priority</td> <td> - {{ constraint.endpoint_priority.endpoint_id.device_id.device_uuid.uuid }} / {{ - constraint.endpoint_priority.endpoint_id.endpoint_uuid.uuid }} + <a href="{{ url_for('device.detail', device_uuid=constraint.endpoint_priority.endpoint_id.device_id.device_uuid.uuid) }}"> + {{ device_names.get(constraint.endpoint_priority.endpoint_id.device_id.device_uuid.uuid, constraint.endpoint_priority.endpoint_id.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> + </svg> + </a> + / {{ endpoints_data.get(constraint.endpoint_priority.endpoint_id.endpoint_uuid.uuid, (constraint.endpoint_priority.endpoint_id.endpoint_uuid.uuid, ''))[0] }} </td> <td>{{ constraint.endpoint_priority.priority }}</td> </tr> diff --git a/src/webui/service/templates/slice/home.html b/src/webui/service/templates/slice/home.html index 141234acadfc4dac61070e55ac9b161bbb01e2b2..59ad1750bf201b594c52cf29032cb37d67ce1d32 100644 --- a/src/webui/service/templates/slice/home.html +++ b/src/webui/service/templates/slice/home.html @@ -46,8 +46,18 @@ <td>{{ slice.name }}</td> <td> <ul> - {% for i in range(slice.slice_endpoint_ids|length) %} - <li> {{ slice.slice_endpoint_ids[i].device_id.device_uuid.uuid }} / {{ slice.slice_endpoint_ids[i].endpoint_uuid.uuid }} </li> + {% for end_point in slice.slice_endpoint_ids %} + <li> + {{ endpoints_data.get(end_point.endpoint_uuid.uuid, (end_point.endpoint_uuid.uuid, ''))[0] }} / + Device: + <a href="{{ url_for('device.detail', device_uuid=end_point.device_id.device_uuid.uuid) }}"> + {{ device_names.get(end_point.device_id.device_uuid.uuid, end_point.device_id.device_uuid.uuid) }} + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16"> + <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/> + <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/> + </svg> + </a> + </li> {% endfor %} </ul> </td>