luci-app-advanced-reboot: 2 new routers + error reporting
[project/luci.git] / applications / luci-app-advanced-reboot / luasrc / view / advanced_reboot / advanced_reboot.htm
1 <%#
2  Copyright 2008 Steven Barth <steven@midlink.org>
3  Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
4  Copyright 2017 Stan Grishin <stangri@melmac.net>
5  Licensed to the public under the Apache License 2.0.
6 -%>
7
8 <%+header%>
9
10 <h2 name="content"><%:Advanced Reboot%></h2>
11 <br />
12
13 <%- local c = require("luci.model.uci").cursor():changes(); if c and next(c) then -%>
14         <p class="alert-message warning"><%:Warning: There are unsaved changes that will get lost on reboot!%></p>
15 <%- end -%>
16
17 <%- if errorMessage and errorMessage ~= "" then -%>
18         <p class="alert-message warning"><%:ERROR: %><%=errorMessage%></p>
19 <%- end -%>
20
21 <%- if device_name then -%>
22 <fieldset class="cbi-section">
23   <legend><%=device_name%><%: Partitions%></legend>
24   <table class="cbi-section-table" id="partitions">
25     <tr class="cbi-section-table-titles">
26       <th class="cbi-section-table-cell"><%:Partition%></th>
27       <th class="cbi-section-table-cell"><%:Status%></th>
28       <th class="cbi-section-table-cell"><%:Firmware/OS (Kernel)%></th>
29       <th class="cbi-section-table-cell"><%:Action%></th>
30     </tr>
31     <tr class="cbi-section-table-row">
32       <td>
33         <%=string.format("%X", boot_envvar1_partition_one)%>
34       </td>
35       <td>
36         <%- if boot_envvar1_partition_one == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
37       </td>
38       <td>
39         <%=partition_one_os%>
40       </td>
41       <td>
42         <%- if boot_envvar1_partition_one == current_partition then -%>
43         <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
44           <input type="hidden" name="token" value="<%=token%>" />
45           <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
46         </form>
47       <%- else -%>
48       <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
49         <input type="hidden" name="token" value="<%=token%>" />
50         <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
51       </form>
52         <%- end -%>
53       </td>
54     </tr>
55     <tr class="cbi-section-table-row">
56       <td>
57         <%=string.format("%X", boot_envvar1_partition_two)%>
58       </td>
59       <td>
60         <%- if boot_envvar1_partition_two == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
61       </td>
62       <td>
63         <%=partition_two_os%>
64       </td>
65       <td>
66         <%- if boot_envvar1_partition_two == current_partition then -%>
67           <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
68                 <input type="hidden" name="token" value="<%=token%>" />
69             <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
70           </form>
71         <%- else -%>
72         <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
73           <input type="hidden" name="token" value="<%=token%>" />
74           <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
75         </form>
76         <%- end -%>
77       </td>
78     </tr>
79   </table>
80 </fieldset>
81 <%- else -%>
82   <p class="alert-message warning"><%:Warning: This system does not have two partitions!%></p>
83 <%- end -%>
84
85 <hr />
86
87 <%- if nixio.fs.access("/sbin/poweroff") then -%>
88 <form method="post" action="<%=url('admin/system/advanced_reboot/power_off')%>">
89         <input type="hidden" name="token" value="<%=token%>" />
90   <input id="poweroff-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Perform power off...%>" />
91 </form>
92 <%- else -%>
93   <p class="alert-message warning"><%:Warning: This system does not support powering off!%></p>
94 <%- end -%>
95
96 <%+footer%>