summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-12-03 15:17:05 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-08 16:26:20 +0100
commit1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch)
tree35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-app-ddns/luasrc/view/ddns/system_status.htm
parent9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff)
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-ddns/luasrc/view/ddns/system_status.htm')
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/system_status.htm158
1 files changed, 158 insertions, 0 deletions
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm b/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm
new file mode 100644
index 0000000000..db9d1d1a01
--- /dev/null
+++ b/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm
@@ -0,0 +1,158 @@
+
+<!-- ++ BEGIN ++ Dynamic DNS ++ system_status.htm ++ -->
+<script type="text/javascript">//<![CDATA[
+ // helper to move status data to the relevant
+ // screen objects
+ // called by XHR.poll and XHR.get
+ function _data2elements(x, data) {
+ var tbl = document.getElementById('ddns_status_table');
+ // security check
+ if ( !(tbl) ) { return; }
+
+ // clear all rows
+ while (tbl.rows.length > 1)
+ tbl.deleteRow(1);
+
+ // variable for Modulo-Division use to set cbi-rowstyle-? (0 or 1)
+ var x = -1;
+ var i = 1;
+
+ // no data => no ddns-scripts Version 2 installed
+ if ( !data ) {
+ var txt = '<br /><strong><font color="red"><%:Old version of ddns-scripts installed%></font>' ;
+ var url = '<a href="' ;
+ url += '<%=luci.dispatcher.build_url("admin", "system", "packages")%>' ;
+ url += '"><%:install update here%></a></strong>' ;
+ var tr = tbl.insertRow(-1);
+ tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) % 2) + 1);
+ var td = tr.insertCell(-1);
+ td.colSpan = 2 ;
+ td.innerHTML = txt + " - " + url
+ tr.insertCell(-1).colSpan = 3 ;
+ return;
+ }
+
+ // DDNS Service disabled
+ if (data[0].enabled == 0) {
+ var txt = '<strong><font color="red"><%:DDNS Autostart disabled%></font>' ;
+ var url = '<a href="' + data[0].url_up + '"><%:enable here%></a></strong>' ;
+ var tr = tbl.insertRow(-1);
+ tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) % 2) + 1);
+ var td = tr.insertCell(-1);
+ td.colSpan = 2 ;
+ td.innerHTML = txt + " - " + url
+ tr.insertCell(-1).colSpan = 3 ;
+ x++ ;
+ }
+
+ for( i = 1; i < data.length; i++ )
+ {
+ var tr = tbl.insertRow(-1);
+ tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) % 2) + 1) ;
+
+ // configuration
+ tr.insertCell(-1).innerHTML = '<strong>' + data[i].section + '</strong>' ;
+
+ // pid
+ // data[i].pid ignored here
+
+ // last update
+ // data[i].datelast ignored here
+
+ // next update
+ switch (data[i].datenext) {
+ case "_empty_":
+ tr.insertCell(-1).innerHTML = '<em><%:Unknown error%></em>' ;
+ break;
+ case "_stopped_":
+ tr.insertCell(-1).innerHTML = '<em><%:Stopped%></em>' ;
+ break;
+ case "_disabled_":
+ tr.insertCell(-1).innerHTML = '<em><%:Disabled%></em>' ;
+ break;
+ case "_noupdate_":
+ tr.insertCell(-1).innerHTML = '<em><%:Update error%></em>' ;
+ break;
+ case "_runonce_":
+ tr.insertCell(-1).innerHTML = '<em><%:Run once%></em>' ;
+ break;
+ case "_verify_":
+ tr.insertCell(-1).innerHTML = '<em><%:Verify%></em>';
+ break;
+ default:
+ tr.insertCell(-1).innerHTML = data[i].datenext ;
+ break;
+ }
+
+ // domain
+ if (data[i].domain == "_nodomain_")
+ tr.insertCell(-1).innerHTML = '<em><%:config error%></em>';
+ else
+ tr.insertCell(-1).innerHTML = data[i].domain;
+
+ // registered IP
+ switch (data[i].reg_ip) {
+ case "_nodomain_":
+ tr.insertCell(-1).innerHTML = '<em><%:Config error%></em>';
+ break;
+ case "_nodata_":
+ tr.insertCell(-1).innerHTML = '<em><%:No data%></em>';
+ break;
+ case "_noipv6_":
+ tr.insertCell(-1).innerHTML = '<em><%:IPv6 not supported%></em>';
+ break;
+ default:
+ tr.insertCell(-1).innerHTML = data[i].reg_ip;
+ break;
+ }
+
+ // monitored interfacce
+ if (data[i].iface == "_nonet_")
+ tr.insertCell(-1).innerHTML = '<em><%:Config error%></em>';
+ else
+ tr.insertCell(-1).innerHTML = data[i].iface;
+ }
+
+ if (tbl.rows.length == 1 || (data[0].enabled == 0 && tbl.rows.length == 2) ) {
+ var br = '<br />';
+ if (tbl.rows.length > 1)
+ br = '';
+ var tr = tbl.insertRow(-1);
+ tr.className = "cbi-section-table-row";
+ var td = tr.insertCell(-1);
+ td.colSpan = 5;
+ td.innerHTML = '<em>' + br + '<%:There is no service configured.%></em>' ;
+ }
+ }
+
+ // force to immediate show status (not waiting for XHR.poll)
+ XHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null,
+ function(x, data) {
+ _data2elements(x, data);
+ }
+ );
+
+ XHR.poll(10, '<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null,
+ function(x, data) {
+ _data2elements(x, data);
+ }
+ );
+//]]></script>
+
+<fieldset class="cbi-section" id="ddns_status_section">
+ <legend><a href="<%=luci.dispatcher.build_url([[admin]], [[services]], [[ddns]])%>"><%:Dynamic DNS%></a></legend>
+
+ <table class="cbi-section-table" id="ddns_status_table">
+ <tr class="cbi-section-table-titles">
+ <th class="cbi-section-table-cell"><%:Configuration%></th>
+ <th class="cbi-section-table-cell"><%:Next Update%></th>
+ <th class="cbi-section-table-cell"><%:Hostname/Domain%></th>
+ <th class="cbi-section-table-cell"><%:Registered IP%></th>
+ <th class="cbi-section-table-cell"><%:Network%></th>
+ </tr>
+ <tr class="cbi-section-table-row">
+ <td colspan="5"><em><br /><%:Collecting data...%></em></td>
+ </tr>
+ </table>
+</fieldset>
+<!-- ++ END ++ Dynamic DNS ++ system_status.htm ++ -->