~xibo-maintainers/xibo/tempel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{#
/*
 * Spring Signage Ltd - http://www.springsignage.com
 * Copyright (C) 2015 Spring Signage Ltd
 * (${FILE_NAME})
 */

#}
{% extends "authed.twig" %}
{% import "inline.twig" as inline %}

{% block actionMenu %}
    <ul class="nav nav-pills pull-right">
        <li><a title="{% trans "Open the Filter Form" %}" href="#" onclick="ToggleFilterView('Filter')">{% trans "Filter" %}</a></li>
        <li><a class="XiboFormButton" title="{% trans "Truncate the Log" %}" href="{{ urlFor("log.truncate.form") }}">{% trans "Truncate" %}</a></li>
        <li><a id="refreshLog" title="{% trans "Refresh the Log" %}" href="#">{% trans "Refresh" %}</a></li>
    </ul>
{% endblock %}


{% block pageContent %}
    <div class="widget">
        <div class="widget-title">{% trans "Logs" %}</div>
        <div class="widget-body">
            <div class="XiboGrid" id="{{ random() }}">
                <div class="XiboFilter">
                    <div class="FilterDiv" id="Filter">
                        <ul class="nav nav-tabs" role="tablist">
                            <li class="active"><a href="#general" role="tab" data-toggle="tab">{% trans "General" %}</a></li>
                            <li><a href="#advanced" role="tab" data-toggle="tab">{% trans "Advanced" %}</a></li>
                        </ul>
                        <form class="form-inline">
                            <div class="tab-content">
                                <div class="tab-pane active" id="general">
                                    {% set title %}{% trans "Level" %}{% endset %}
                                    {{ inline.input("filter_type", title, defaults.type) }}
                                    {{ inline.dropdown("filter_intervalTypeId", "single", "Interval", defaults.intervalType, options.intervalType, "id", "value") }}
                                    {{ inline.number("filter_seconds", "Duration back", defaults.seconds) }}
                                    {{ inline.input("runNo", "Run") }}

                                    {{ inline.checkbox("XiboFilterPinned", "Keep Open", defaults.filterPinned) }}
                                </div>
                                <div class="tab-pane" id="advanced">
                                    {{ inline.date("filter_fromdt", "From Date", defaults.fromDt) }}

                                    {% set title %}{% trans "Channel" %}{% endset %}
                                    {{ inline.input("channel", title, defaults.channel) }}
                                    {{ inline.input("filter_page", "Page", defaults.page) }}
                                    {{ inline.input("filter_function", "Function", defaults.function) }}

                                    {% set displays = [{displayId: null, display: ""}]|merge(options.displays) %}
                                    {{ inline.dropdown("filter_display", "single", "Display", defaults.display, displays, "displayId", "display") }}
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="XiboData">
                    <table id="logs" class="table table-striped">
                        <thead>
                            <tr>
                                <th>{% trans "ID" %}</th>
                                <th>{% trans "Run" %}</th>
                                <th>{% trans "Date" %}</th>
                                <th>{% trans "Channel" %}</th>
                                <th>{% trans "Function" %}</th>
                                <th>{% trans "Level" %}</th>
                                <th>{% trans "Display" %}</th>
                                <th>{% trans "Page" %}</th>
                                <th style="width: 50%">{% trans "Message" %}</th>
                            </tr>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block javaScript %}
    <script type="text/javascript">

        var table = $("#logs").DataTable({ "language": dataTablesLanguage,
            serverSide: true, stateSave: true,
            filter: false,
            searchDelay: 3000,
            "order": [[ 0, "desc"]],
            ajax: {
                url: "{{ urlFor("log.search") }}",
                "data": function(d) {
                    $.extend(d, $("#logs").closest(".XiboGrid").find(".FilterDiv form").serializeObject());
                }
            },
            "columns": [
                { "data": "logId" },
                { "data": "runNo" },
                { "data": "logDate", "render": dataTableDateFromIso },
                { "data": "channel" },
                { "data": "function" },
                { "data": "type" },
                { "data": "display" },
                { "data": "page" },
                { "data": "message" }
            ]
        });

        table.on('draw', dataTableDraw);
        table.on('processing.dt', dataTableProcessing);
        dataTableAddButtons(table, $('#logs_wrapper').find('.col-sm-6').eq(1));

        $("#refreshLog").click(function() {
            table.ajax.reload();
        });
    </script>
{% endblock %}