Commit 38f382ae authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

WebUI component:

- Add logic to show link type
- Minor code formatting
parent de8c9150
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -13,10 +13,14 @@
# limitations under the License.

import json
from flask import current_app, render_template, Blueprint, flash, session, redirect, url_for
from flask import (
    current_app, render_template, Blueprint, flash, session, redirect, url_for
)
from common.DeviceTypes import DeviceTypeEnum
from common.proto.context_pb2 import (
    ConfigActionEnum, Device, DeviceDriverEnum, DeviceId, DeviceList, DeviceOperationalStatusEnum, Empty)
    ConfigActionEnum, Device, DeviceDriverEnum, DeviceId, DeviceList,
    DeviceOperationalStatusEnum, Empty
)
from common.tools.context_queries.Device import get_device
from common.tools.context_queries.Topology import get_topology
from context.client.ContextClient import ContextClient
+12 −4
Original line number Diff line number Diff line
@@ -13,8 +13,10 @@
# 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, LinkId, LinkList
from flask import (
    current_app, render_template, Blueprint, flash, session, redirect, url_for
)
from common.proto.context_pb2 import Empty, Link, LinkId, LinkList, LinkTypeEnum
from common.tools.context_queries.EndPoint import get_endpoint_names
from common.tools.context_queries.Link import get_link
from common.tools.context_queries.Topology import get_topology
@@ -50,7 +52,10 @@ def home():
        device_names, endpoints_data = get_endpoint_names(context_client, endpoint_ids)
    context_client.close()

    return render_template('link/home.html', links=links, device_names=device_names, endpoints_data=endpoints_data)
    return render_template(
        'link/home.html', links=links, device_names=device_names,
        endpoints_data=endpoints_data, lte=LinkTypeEnum
    )


@link.route('detail/<path:link_uuid>', methods=('GET', 'POST'))
@@ -64,7 +69,10 @@ def detail(link_uuid: str):
    else:
        device_names, endpoints_data = get_endpoint_names(context_client, link_obj.link_endpoint_ids)
    context_client.close()
    return render_template('link/detail.html',link=link_obj, device_names=device_names, endpoints_data=endpoints_data)
    return render_template(
        'link/detail.html', link=link_obj, device_names=device_names,
        endpoints_data=endpoints_data, lte=LinkTypeEnum
    )

@link.get('<path:link_uuid>/delete')
def delete(link_uuid):
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
    <div class="col-sm-4">
        <b>UUID: </b>{{ link.link_id.link_uuid.uuid }}<br>
        <b>Name: </b>{{ link.name }}<br>
        <b>Type: </b>{{ lte.Name(link.link_type).replace('LINKTYPE_', '') }}<br>
    </div>
    <div class="col-sm-8">
        <table class="table table-striped table-hover">
+81 −79
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
            <tr>
                <th scope="col">UUID</th>
                <th scope="col">Name</th>
                <th scope="col">Type</th>
                <th scope="col">Endpoints</th>
                <th scope="col"></th>
            </tr>
@@ -58,7 +59,9 @@
                        <td>
                            {{ link.name }}
                        </td>

                        <td>
                            {{ lte.Name(link.link_type).replace('LINKTYPE_', '') }}
                        </td>
                        <td>
                            <ul>
                                {% for endpoint in link.link_endpoint_ids %}
@@ -94,5 +97,4 @@
            {% endif %}
        </tbody>
    </table>
   
{% endblock %}