luci-app-advanced-reboot: show OpenWrt info on compatible NAND routers
[oweals/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-2018 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         <div class="table cbi-section-table" id="partitions">
25                 <div class="tr cbi-section-table-titles">
26                         <div class="th cbi-section-table-cell"><%:Partition%></div>
27                         <div class="th cbi-section-table-cell"><%:Status%></div>
28                         <div class="th cbi-section-table-cell"><%:Firmware%></div>
29                         <div class="th cbi-section-table-cell"><%:Reboot%></div>
30                 </div>
31                 <div class="tr cbi-section-table-row cbi-rowstyle-1">
32                         <div class="td">
33                                 <%=string.format("%X", bev1p1)%>
34                         </div>
35                         <div class="td">
36                                 <%- if bev1p1 == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
37                         </div>
38                         <div class="td">
39                                 <%=p1_os%>
40                         </div>
41                         <div class="td">
42                                 <%- if bev1p1 == 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 important" 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 important" value="<%:Reboot to alternative partition...%>" />
51                         </form>
52                                 <%- end -%>
53                         </div>
54                 </div>
55                 <div class="tr cbi-section-table-row cbi-rowstyle-2">
56                         <div class="td">
57                                 <%=string.format("%X", bev1p2)%>
58                         </div>
59                         <div class="td">
60                                 <%- if bev1p2 == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
61                         </div>
62                         <div class="td">
63                                 <%=p2_os%>
64                         </div>
65                         <div class="td">
66                                 <%- if bev1p2 == 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 important" 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 important" value="<%:Reboot to alternative partition...%>" />
75                                 </form>
76                                 <%- end -%>
77                         </div>
78                 </div>
79         </div>
80 </fieldset>
81 <%- else -%>
82         <%- if rom_board_name then -%>
83                 <p class="alert-message warning"><%=pcdata(translatef("Warning: Device (%s) is unknown or isn't a dual-partition device!", rom_board_name))%></p>
84         <%- else -%>
85                 <p class="alert-message warning"><%=pcdata(translatef("Warning: Unable to obtain device information!"))%></p>
86         <%- end -%>
87 <%- end -%>
88
89 <hr />
90
91 <%- if nixio.fs.access("/sbin/poweroff") then -%>
92 <form method="post" action="<%=url('admin/system/advanced_reboot/power_off')%>">
93         <input type="hidden" name="token" value="<%=token%>" />
94         <input id="poweroff-button" type="submit" class="cbi-button cbi-button-apply important" value="<%:Perform power off...%>" />
95 </form>
96 <%- else -%>
97         <p class="alert-message warning"><%:Warning: This system does not support powering off!%></p>
98 <%- end -%>
99
100 <%+footer%>