summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-system/luasrc/view/admin_system/reboot.htm
diff options
context:
space:
mode:
authorDaniel F. Dickinson <cshored@thecshore.com>2018-08-03 12:36:51 -0400
committerJo-Philipp Wich <jo@mein.io>2018-09-19 20:08:19 +0200
commit58d97b5e271bc0d7507eab5b9bd2902181864e02 (patch)
tree80e250346ad33c79b3f821daf7b7d9be90d99240 /modules/luci-mod-system/luasrc/view/admin_system/reboot.htm
parent6ec0353201435e0d0d7d32820d8ba600b4ca7b5b (diff)
modules: Split luci-mod-full
Move some common elements to luci-base, and otherwise make three packages out of status, system, and network. They were mostly separated already, but there were some shared elements between status and network that are now in luci-base. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
Diffstat (limited to 'modules/luci-mod-system/luasrc/view/admin_system/reboot.htm')
-rw-r--r--modules/luci-mod-system/luasrc/view/admin_system/reboot.htm62
1 files changed, 62 insertions, 0 deletions
diff --git a/modules/luci-mod-system/luasrc/view/admin_system/reboot.htm b/modules/luci-mod-system/luasrc/view/admin_system/reboot.htm
new file mode 100644
index 0000000000..d23664adac
--- /dev/null
+++ b/modules/luci-mod-system/luasrc/view/admin_system/reboot.htm
@@ -0,0 +1,62 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<%+header%>
+
+<h2 name="content"><%:Reboot%></h2>
+
+<p><%:Reboots the operating system of your device%></p>
+
+<%- local c = require("luci.model.uci").cursor():changes(); if c and next(c) then -%>
+ <p class="alert-message warning"><%:Warning: There are unsaved changes that will get lost on reboot!%></p>
+<%- end -%>
+
+<hr />
+
+<input class="cbi-button cbi-button-action important" type="button" value="<%:Perform reboot%>" onclick="reboot(this)" />
+
+<p class="alert-message notice reboot-message" style="display:none">
+ <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
+ <span><%:Device is rebooting...%></span>
+</p>
+
+<script type="text/javascript">//<![CDATA[
+ var tries = 0,
+ message = document.querySelector('p.reboot-message'),
+ label = message.querySelector('span');
+
+ function ok() {
+ window.location = '<%=url("admin")%>';
+ }
+
+ function check() {
+ window.setTimeout(ping, 5000);
+ }
+
+ function ping() {
+ var img = document.createElement('img');
+
+ img.onload = ok;
+ img.onerror = check;
+ img.src = '<%=resource%>/icons/loading.gif?' + Math.random();
+
+ if (tries++ >= 30) {
+ message.classList.remove('notice');
+ message.classList.add('warning');
+ label.innerHTML = '<%:Device unreachable! Still waiting for device...%>';
+ }
+ }
+
+ function reboot(button) {
+ button.style.display = 'none';
+ message.style.display = '';
+ label.innerHTML = '<%:Waiting for device...%>';
+
+ (new XHR()).post('<%=url("admin/system/reboot/call")%>', { token: '<%=token%>' }, check);
+ }
+//]]></script>
+
+<%+footer%>