summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-aria2/luasrc/view/aria2/log_template.htm
blob: ed91168dbc64ec9a394def4a7abe4a7596892f45 (plain)
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
<%#
 Copyright 2017-2019 Xingwang Liao <kuoruan@gmail.com>
 Licensed to the public under the MIT License.
-%>

<% css = [[

	#log_text {
		padding: 10px;
		text-align: left;
	}
	#log_text pre {
		word-break: break-all;
		margin: 0;
	}
	.description {
		background-color: #33ccff;
	}

]]
-%>

<%+header%>

<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
	XHR.poll(10, '<%=url("admin/services/aria2/log/read")%>', null,
		function(x, data) {
			var logElm = document.getElementById('log_text');
			if (logElm) {
				logElm.innerHTML = data
					? String.format(
						'<pre>%s%s%s%s</pre>',
						'<span class="description"><%:Last 50 lines of log file:%></span><br/><br/>',
						data.log || '<%:No log data.%>',
						'<br/><br/><span class="description"><%:Last 50 lines of syslog:%></span><br/><br/>',
						data.syslog || '<%:No log data.%>'
					)
					: '<strong><%:Failed to load log data.%></strong>';
			}
		}
	);
//]]></script>
<div class="cbi-map">
	<h2 name="content"><%:Aria2%> - <%:Log Data%></h2>
	<fieldset class="cbi-section">
		<div id="log_text">
			<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
			<%:Collecting data...%>
		</div>
		<div style="text-align:right"><small><%:Refresh every 10 seconds.%></small></div>
	</fieldset>
</div>

<%+footer%>