luci-app-aria2: Refactor, new views and more options
[project/luci.git] / applications / luci-app-aria2 / luasrc / view / aria2 / log_template.htm
1 <%#
2 Copyright 2017-2019 Xingwang Liao <kuoruan@gmail.com>
3 Licensed to the public under the MIT License.
4 -%>
5
6 <% css = [[
7
8 #log_text {
9 padding: 10px;
10 text-align: left;
11 }
12 #log_text pre {
13 word-break: break-all;
14 margin: 0;
15 }
16 .description {
17 background-color: #33ccff;
18 }
19
20 ]]
21 -%>
22
23 <%+header%>
24
25 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
26 <script type="text/javascript">//<![CDATA[
27 XHR.poll(10, '<%=url("admin/services/aria2/log/read")%>', null,
28 function(x, data) {
29 var logElm = document.getElementById('log_text');
30 if (logElm) {
31 logElm.innerHTML = data
32 ? String.format(
33 '<pre>%s%s%s%s</pre>',
34 '<span class="description"><%:Last 50 lines of log file:%></span><br/><br/>',
35 data.log || '<%:No log data.%>',
36 '<br/><br/><span class="description"><%:Last 50 lines of syslog:%></span><br/><br/>',
37 data.syslog || '<%:No log data.%>'
38 )
39 : '<strong><%:Failed to load log data.%></strong>';
40 }
41 }
42 );
43 //]]></script>
44 <div class="cbi-map">
45 <h2 name="content"><%:Aria2%> - <%:Log Data%></h2>
46 <fieldset class="cbi-section">
47 <div id="log_text">
48 <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
49 <%:Collecting data...%>
50 </div>
51 <div style="text-align:right"><small><%:Refresh every 10 seconds.%></small></div>
52 </fieldset>
53 </div>
54
55 <%+footer%>