unassigned-sensors.html 2.67 KB
Newer Older
1 2 3 4 5 6 7
{% extends "bmsapp/base.html" %}

{% block pagetitle %}Unassigned Sensors{% endblock %}

{% block title %}Sensors not Assigned to a Building{% endblock %}

{% block content %}
8

9 10
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.22/sl-1.3.1/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.22/sl-1.3.1/datatables.min.js"></script>
11

12 13
<script>
    $(function () {
14
        $('#Sensors').DataTable({
15 16 17 18 19 20 21 22 23 24 25 26 27
            paging: false,
            scrollY: '80vh',
            scrollCollapse: true,
            columnDefs: [ {
                orderable: false,
                className: 'select-checkbox',
                targets:   0
            } ],
            select: {
                style:    'os',
                selector: 'td:first-child'
            },
            order: [[ 1, 'asc' ]]
28
        });
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
        $(".bmon-sensor-id")
            .attr("data-toggle","tooltip")
            .attr("data-original-title", "Click to copy Sensor ID to Clipboard")
            .css("cursor","pointer")
            .tooltip()
            .click(function(){
                var target = this;
                navigator.clipboard.writeText(target.innerText).then(function() {
                    $(target)
                        .attr("data-original-title", "Copied Sensor ID to Clipboard!")
                        .tooltip('show')
                });
            })
            .on('hidden.bs.tooltip', function () {
                $(this).attr("data-original-title", "Click to copy Sensor ID to Clipboard")
            })
            
    });
</script>

49 50 51 52 53 54 55
<p>This is a list of sensors that are either:</p>

<ul>
    <li>Not entered into the Admin Sensor list, or</li>
    <li>They are entered in the list of Sensors but they are not assigned to a building.</li>
</ul>

56 57 58
<div style="background-color: white; width: fit-content; padding: 5px;">
    <table id="Sensors" class="table table-sm table-striped table-responsive mt-1">
        <thead><tr>
59
            <th></th>
60 61 62 63 64 65 66 67
            <th class="text-center">Sensor ID</th>
            <th class="text-center">Last Reading</th>
            <th class="text-center">Minutes Ago</th>
            <th class="text-center">Sensor Name, if available</th>
        </tr></thead>
        <tbody style="background-color: white">
        {% for sensor in sensor_list %}
            <tr>
68
                <td></td>
69 70 71 72 73 74 75 76 77
                <td class="bmon-sensor-id">{{ sensor.id }}</td>
                <td class="text-right px-4">{{ sensor.cur_value }}</td>
                <td>{{ sensor.minutes_ago }}</td>
                <td>{{ sensor.title }}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
78
{% endblock %}