summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm
blob: 31ed42b0ac5ff5fae6ba45e1fe4a5fd4416a447f (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
56
57
58
59
60
<!-- ++ BEGIN ++ Dynamic DNS ++ system_status.htm ++ -->
<script type="text/javascript">//<![CDATA[

	//start polling data every 30 second, this doesn't change so much
	XHR.poll(30, '<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
		function(x, data) {
			if (data) { 
				var tbl = document.getElementById('ddns_status_table');
				// security check
				if ( !(tbl) ) { return; }
				
				var rows = [];
		
				// DDNS Service disabled
				if (data[0].enabled == 0) {
					var ddns_legend = document.getElementById('ddns_status_legend');
					ddns_legend.style.display='none';
					rows.push([
							'<strong><font color="red"><%:DDNS Autostart disabled%></font>',
							'<a class="cbi-button cbi-button-action important" type="button" href="' + data[0].url_up + '"><%:enable here%></a></strong>'
							]);
				} else {
					for( j = 1; j < data.length; j++ )
					{
						
						rows.push([
								'<strong>' + data[j].section + '</strong>', //configuration
								data[j].datenextstat ? '<em>'+data[j].datenextstat+'</em>' : '<em><%:Unknown error%></em>',
								data[j].lookup ? data[j].lookup : '<em><%:config error%></em>',
								data[j].reg_ip ? data[j].reg_ip : '<em><%:No data%></em>',
								data[j].iface        // monitored interface
								]);
					}
				}
				
				cbi_update_table(tbl, rows, '<%:There is no service configured.%>'); 
			}
		}
	);
	
//]]></script>

<fieldset class="cbi-section" id="ddns_status_section">
	<legend><a href="<%=url([[admin]], [[services]], [[ddns]])%>"><%:Dynamic DNS%></a></legend>
	<div class="cbi-section-node">
		<div class="table" id="ddns_status_table">
			<div class="tr table-titles" id="ddns_status_legend">
				<div class="th"><%:Configuration%></div>
				<div class="th"><%:Next Update%></div>
				<div class="th"><%:Lookup Hostname%></div>
				<div class="th"><%:Registered IP%></div>
				<div class="th"><%:Network%></div>
			</div>
			<div class="tr">
				<div class="td"><em><br /><%:Collecting data...%></em></div>
			</div>
		</div>
	</div>
</fieldset>
<!-- ++ END ++ Dynamic DNS ++ system_status.htm ++ -->