summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm
blob: 0629c84b363c0443083de562bf5bbb0b5cb50386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<%#
 Copyright 2008 Steven Barth <steven@midlink.org>
 Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
 Copyright 2017 Stan Grishin <stangri@melmac.net>
 Licensed to the public under the Apache License 2.0.
-%>

<%+header%>

<h2 name="content"><%:Advanced Reboot%></h2>
<br />

<%- 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 -%>

<%- if errorMessage and errorMessage ~= "" then -%>
	<p class="alert-message warning"><%:ERROR: %><%=errorMessage%></p>
<%- end -%>

<%- if device_name then -%>
<fieldset class="cbi-section">
  <legend><%=device_name%><%: Partitions%></legend>
  <table class="cbi-section-table" id="partitions">
    <tr class="cbi-section-table-titles">
      <th class="cbi-section-table-cell"><%:Partition%></th>
      <th class="cbi-section-table-cell"><%:Status%></th>
      <th class="cbi-section-table-cell"><%:Firmware/OS (Kernel)%></th>
      <th class="cbi-section-table-cell"><%:Action%></th>
    </tr>
    <tr class="cbi-section-table-row">
      <td>
        <%=string.format("%X", boot_envvar1_partition_one)%>
      </td>
      <td>
        <%- if boot_envvar1_partition_one == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
      </td>
      <td>
        <%=partition_one_os%>
      </td>
      <td>
        <%- if boot_envvar1_partition_one == current_partition then -%>
        <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
          <input type="hidden" name="token" value="<%=token%>" />
          <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
        </form>
      <%- else -%>
      <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
        <input type="hidden" name="token" value="<%=token%>" />
        <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
      </form>
        <%- end -%>
      </td>
    </tr>
    <tr class="cbi-section-table-row">
      <td>
        <%=string.format("%X", boot_envvar1_partition_two)%>
      </td>
      <td>
        <%- if boot_envvar1_partition_two == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
      </td>
      <td>
        <%=partition_two_os%>
      </td>
      <td>
        <%- if boot_envvar1_partition_two == current_partition then -%>
          <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
          	<input type="hidden" name="token" value="<%=token%>" />
            <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
          </form>
        <%- else -%>
        <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
          <input type="hidden" name="token" value="<%=token%>" />
          <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
        </form>
        <%- end -%>
      </td>
    </tr>
  </table>
</fieldset>
<%- else -%>
  <p class="alert-message warning"><%:Warning: This system does not have two partitions!%></p>
<%- end -%>

<hr />

<%- if nixio.fs.access("/sbin/poweroff") then -%>
<form method="post" action="<%=url('admin/system/advanced_reboot/power_off')%>">
	<input type="hidden" name="token" value="<%=token%>" />
  <input id="poweroff-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Perform power off...%>" />
</form>
<%- else -%>
  <p class="alert-message warning"><%:Warning: This system does not support powering off!%></p>
<%- end -%>

<%+footer%>