206d25054327a8107d7cf267d180ec1ca7130ff0
[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 device_name then -%>
18 <fieldset class="cbi-section">
19   <legend><%=device_name%><%: Partitions%></legend>
20   <table class="cbi-section-table" id="partitions">
21     <tr class="cbi-section-table-titles">
22       <th class="cbi-section-table-cell"><%:Partition%></th>
23       <th class="cbi-section-table-cell"><%:Status%></th>
24       <th class="cbi-section-table-cell"><%:Firmware/OS (Kernel)%></th>
25       <th class="cbi-section-table-cell"><%:Action%></th>
26     </tr>
27     <tr class="cbi-section-table-row">
28       <td>
29         <%=boot_envvar1_partition_one%>
30       </td>
31       <td>
32         <%- if boot_envvar1_partition_one == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
33       </td>
34       <td>
35         <%=partition_one_os%>
36       </td>
37       <td>
38         <%- if boot_envvar1_partition_one == current_partition then -%>
39         <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
40           <input type="hidden" name="token" value="<%=token%>" />
41           <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
42         </form>
43       <%- else -%>
44       <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
45         <input type="hidden" name="token" value="<%=token%>" />
46         <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
47       </form>
48         <%- end -%>
49       </td>
50     </tr>
51     <tr class="cbi-section-table-row">
52       <td>
53         <%=boot_envvar1_partition_two%>
54       </td>
55       <td>
56         <%- if boot_envvar1_partition_two == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
57       </td>
58       <td>
59         <%=partition_two_os%>
60       </td>
61       <td>
62         <%- if boot_envvar1_partition_two == current_partition then -%>
63           <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
64                 <input type="hidden" name="token" value="<%=token%>" />
65             <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
66           </form>
67         <%- else -%>
68         <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
69           <input type="hidden" name="token" value="<%=token%>" />
70           <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
71         </form>
72         <%- end -%>
73       </td>
74     </tr>
75   </table>
76 </fieldset>
77 <%- else -%>
78   <p class="alert-message warning"><%:Warning: This system does not have two partitions!%></p>
79 <%- end -%>
80
81 <hr />
82
83 <%- if nixio.fs.access("/sbin/poweroff") then -%>
84 <form method="post" action="<%=url('admin/system/advanced_reboot/power_off')%>">
85         <input type="hidden" name="token" value="<%=token%>" />
86   <input id="poweroff-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Perform power off...%>" />
87 </form>
88 <%- else -%>
89   <p class="alert-message warning"><%:Warning: This system does not support powering off!%></p>
90 <%- end -%>
91
92 <%+footer%>