Skip to content
detail.html 6.01 KiB
Newer Older
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
    Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
Lucie LONG's avatar
Lucie LONG committed
   
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
   
         http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
   -->
Lucie LONG's avatar
Lucie LONG committed
{% extends 'base.html' %}

{% block content %}
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
<h1>Device {{ device.name }} ({{ device.device_id.device_uuid.uuid }})</h1>
Lucie LONG's avatar
Lucie LONG committed

<div class="row mb-3">
    <div class="col-sm-3">
        <button type="button" class="btn btn-success" onclick="window.location.href='{{ url_for('device.home') }}'">
            <i class="bi bi-box-arrow-in-left"></i>
            Back to device list
        </button>
    </div>
    <div class="col-sm-3">
Lucie LONG's avatar
Lucie LONG committed
        <a id="update" class="btn btn-secondary" href="{{ url_for('device.update',device_uuid=device.device_id.device_uuid.uuid) }}">
Lucie LONG's avatar
Lucie LONG committed
            <i class="bi bi-pencil-square"></i>
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
            Update device
Lucie LONG's avatar
Lucie LONG committed
        </a>
    </div>
    <div class="col-sm-3">
        <!-- <button type="button" class="btn btn-danger"><i class="bi bi-x-square"></i>Delete device</button> -->
        <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteModal">
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
            <i class="bi bi-x-square"></i>
            Delete device
Lucie LONG's avatar
Lucie LONG committed
        </button>
    </div>
</div>
Lucie LONG's avatar
Lucie LONG committed
<br>
<div class="row mb-3">
    <div class="col-sm-4">
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
        <b>UUID: </b>{{ device.device_id.device_uuid.uuid }}<br>
        <b>Name: </b>{{ device.name }}<br>
        <b>Type: </b>{{ device.device_type }}<br>
Lucie LONG's avatar
Lucie LONG committed
        <b>Status: </b> {{ dose.Name(device.device_operational_status).replace('DEVICEOPERATIONALSTATUS_', '') }}<br>
        <b>Drivers: </b>
        <ul>
            {% for driver in device.device_drivers %}
            <li>{{ dde.Name(driver).replace('DEVICEDRIVER_', '').replace('UNDEFINED', 'EMULATED') }}</li>
            {% endfor %}
        </ul>
    </div>
    <div class="col-sm-8">
Lucie LONG's avatar
Lucie LONG committed
        <table class="table table-striped table-hover">
            <thead>
                <tr>
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
                    <th scope="col">Endpoint UUID</th>
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
                    <th scope="col">Name</th>
Lucie LONG's avatar
Lucie LONG committed
                    <th scope="col">Type</th>
                    <th scope="col">Position</th>
Lucie LONG's avatar
Lucie LONG committed
                </tr>
            </thead>
            <tbody>
Lucie LONG's avatar
Lucie LONG committed
                {% for endpoint in device.device_endpoints %}
Lucie LONG's avatar
Lucie LONG committed
                <tr>
                    <td>
Lucie LONG's avatar
Lucie LONG committed
                        {{ endpoint.endpoint_id.endpoint_uuid.uuid }}
Lucie LONG's avatar
Lucie LONG committed
                    </td>
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
                    <td>
                        {{ endpoint.name }}
                    </td>
Lucie LONG's avatar
Lucie LONG committed
                    <td>
Lucie LONG's avatar
Lucie LONG committed
                        {{ endpoint.endpoint_type }}
Lucie LONG's avatar
Lucie LONG committed
                    </td>
                    <td>
                        {{ endpoint.endpoint_location }}
                    </td>
Lucie LONG's avatar
Lucie LONG committed
                </tr>
                {% endfor %}
            </tbody>
        </table>
Lucie LONG's avatar
Lucie LONG committed
    </div>
</div>
</div>
Lucie LONG's avatar
Lucie LONG committed
<b>Configurations:</b>
Lucie LONG's avatar
Lucie LONG committed

Lucie LONG's avatar
Lucie LONG committed
<table class="table table-striped table-hover">
    <thead>
        <tr>
            <th scope="col">Key</th>
            <th scope="col">Value</th>
Lucie LONG's avatar
Lucie LONG committed
            <th scope="col"></th>
            <th scope="col"></th>
Lucie LONG's avatar
Lucie LONG committed
        </tr>
    </thead>
    <tbody>
        {% for config in device.device_config.config_rules %}
        {% if config.WhichOneof('config_rule') == 'custom' %}
        <tr>
            <td>
                {{ config.custom.resource_key }}
            </td>
            <td>
                <ul>
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
                    {% for item_type, item in json_to_list(config.custom.resource_value) %}
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
                        {% if item_type == 'kv' %}
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
                            <li><b>{{ item[0] }}:</b> {{ item[1] }}</li>
Lluis Gifre Renom's avatar
Lluis Gifre Renom committed
                        {% else %}
                            <li>{{ item }}</li>
                        {% endif %}
Lucie LONG's avatar
Lucie LONG committed
                    {% endfor %}
                </ul>
            </td>
Lucie LONG's avatar
Lucie LONG committed
            <td>
                <a id="update" class="btn btn-secondary" href="{{ url_for('device.updateconfig')}}">
                    <i class="bi bi-pencil-square"></i>
                </a>
            </td>
            <td>
                <!-- <button type="button" class="btn btn-danger"><i class="bi bi-x-square"></i>Delete device</button> -->
                <button type="button" class="btn btn-danger">
                    <i class="bi bi-x-square"></i>
                </button>
            </td>
Lucie LONG's avatar
Lucie LONG committed
        </tr>
        {% endif %}
        {% endfor %}
    </tbody>
</table>
Lucie LONG's avatar
Lucie LONG committed
<div class="col">
    <a href="{{ url_for('device.addconfig', device_uuid=device.device_id.device_uuid.uuid) }}" class="btn btn-primary" style="margin-bottom: 10px;">
        <i class="bi bi-plus"></i>
        Add New Configuration
    </a>
</div>
Lucie LONG's avatar
Lucie LONG committed

<!-- Modal -->
<div class="modal fade" id="deleteModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
    aria-labelledby="staticBackdropLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="staticBackdropLabel">Delete device?</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                Are you sure you want to delete the device "{{ device.device_id.device_uuid.uuid }}"?
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">No</button>
                <a type="button" class="btn btn-danger"
                    href="{{ url_for('device.delete', device_uuid=device.device_id.device_uuid.uuid) }}"><i
                        class="bi bi-exclamation-diamond"></i>Yes</a>
            </div>
        </div>
    </div>
</div>

{% endblock %}