luci-app-diskman: sync with upstream source

This commit is contained in:
CN_SZTL 2020-04-09 01:40:08 +08:00
parent 85866629a8
commit 2d72232269
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 65 additions and 60 deletions

View File

@ -27,9 +27,11 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
bool "Include mdadm"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456
depends on PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
bool "Include kmod-md-raid456"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linear
depends on PACKAGE_$(PKG_NAME)_INCLUDE_mdadm
bool "Include kmod-md-linear"
default n
endef
@ -44,9 +46,9 @@ define Package/$(PKG_NAME)
+PACKAGE_$(PKG_NAME)_INCLUDE_btrfs_progs:btrfs-progs \
+PACKAGE_$(PKG_NAME)_INCLUDE_lsblk:lsblk \
+PACKAGE_$(PKG_NAME)_INCLUDE_mdadm:mdadm \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456:kmod-md-mod \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456:mdadm \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_raid456:kmod-md-raid456 \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linears:kmod-md-mod \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linears:mdadm \
+PACKAGE_$(PKG_NAME)_INCLUDE_kmod_md_linears:kmod-md-linear
endef

View File

@ -2,76 +2,79 @@
<head>
<title>S.M.A.R.T detail of <%=dev%></title>
<link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
<script type="text/javascript">//<![CDATA[
XHR.get('<%=luci.dispatcher.build_url("admin", "system", "diskman", "smartattr", dev)%>', null,
function (x, st) {
var tb = document.getElementById('smart_attr_table');
if (st && tb) {
/* clear all rows */
while (tb.rows.length > 1)
tb.deleteRow(1);
let formData = new FormData()
let xhr = new XMLHttpRequest()
xhr.open("GET", '<%=luci.dispatcher.build_url("admin", "system", "diskman", "smartattr", dev)%>', true)
xhr.onload = function () {
let st = JSON.parse(xhr.responseText)
let tb = document.getElementById('smart_attr_table');
console.log(st)
if (st && tb) {
/* clear all rows */
while (tb.rows.length > 1)
tb.deleteRow(1);
for (var i = 0; i < st.length; i++) {
var tr = tb.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
var td = null
<% if dev:match("nvme") then %>
tr.insertCell(-1).innerHTML = st[i].key;
tr.insertCell(-1).innerHTML = st[i].value;
for (var i = 0; i < st.length; i++) {
var tr = tb.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
var td = null
<% if dev: match("nvme") then %>
tr.insertCell(-1).innerHTML = st[i].key;
tr.insertCell(-1).innerHTML = st[i].value;
<% else %>
tr.insertCell(-1).innerHTML = st[i].id;
tr.insertCell(-1).innerHTML = st[i].attrbute;
tr.insertCell(-1).innerHTML = st[i].flag;
tr.insertCell(-1).innerHTML = st[i].value;
tr.insertCell(-1).innerHTML = st[i].worst;
tr.insertCell(-1).innerHTML = st[i].thresh;
tr.insertCell(-1).innerHTML = st[i].type;
tr.insertCell(-1).innerHTML = st[i].updated;
tr.insertCell(-1).innerHTML = st[i].raw;
if ((st[i].id == '05' || st[i].id == 'C5') && st[i].raw != '0') {
tr.style.cssText = "background-color:red !important;";
}
tr.insertCell(-1).innerHTML = st[i].attrbute;
tr.insertCell(-1).innerHTML = st[i].flag;
tr.insertCell(-1).innerHTML = st[i].value;
tr.insertCell(-1).innerHTML = st[i].worst;
tr.insertCell(-1).innerHTML = st[i].thresh;
tr.insertCell(-1).innerHTML = st[i].type;
tr.insertCell(-1).innerHTML = st[i].updated;
tr.insertCell(-1).innerHTML = st[i].raw;
if ((st[i].id == '05' || st[i].id == 'C5') && st[i].raw != '0') {
tr.style.cssText = "background-color:red !important;";
}
<% end %>
}
if (tb.rows.length == 1) {
var tr = tb.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 4;
td.innerHTML = '<em><br /><%:No Attrbute to display.%></em>';
}
if (tb.rows.length == 1) {
var tr = tb.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 4;
td.innerHTML = '<em><br /><%:No Attrbute to display.%></em>';
}
}
);
}
xhr.send(formData)
//]]></script>
</head>
<body>
<div id="maincontainer">
<fieldset class="cbi-section">
<legend><%:S.M.A.R.T Attrbutes%>: /dev/<%=dev%></legend>
<table class="cbi-section-table" id="smart_attr_table">
<tr class="cbi-section-table-titles">
<% if dev:match("nvme") then %>
<!-- <th class="cbi-section-table-cell"><%:KEY%></th>
<fieldset class="cbi-section">
<legend><%:S.M.A.R.T Attrbutes%>: /dev/<%=dev%></legend>
<table class="cbi-section-table" id="smart_attr_table">
<tr class="cbi-section-table-titles">
<% if dev:match("nvme") then %>
<!-- <th class="cbi-section-table-cell"><%:KEY%></th>
<th class="cbi-section-table-cell"><%:VALUE%></th> -->
<% else %>
<th class="cbi-section-table-cell"><%:ID%></th>
<th class="cbi-section-table-cell"><%:Attrbute%></th>
<th class="cbi-section-table-cell"><%:Flag%></th>
<th class="cbi-section-table-cell"><%:Value%></th>
<th class="cbi-section-table-cell"><%:Worst%></th>
<th class="cbi-section-table-cell"><%:Thresh%></th>
<th class="cbi-section-table-cell"><%:Type%></th>
<th class="cbi-section-table-cell"><%:Updated%></th>
<th class="cbi-section-table-cell"><%:Raw%></th>
<% end %>
</tr>
<tr class="cbi-section-table-row">
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
</tr>
</table>
</fieldset>
<% else %>
<th class="cbi-section-table-cell"><%:ID%></th>
<th class="cbi-section-table-cell"><%:Attrbute%></th>
<th class="cbi-section-table-cell"><%:Flag%></th>
<th class="cbi-section-table-cell"><%:Value%></th>
<th class="cbi-section-table-cell"><%:Worst%></th>
<th class="cbi-section-table-cell"><%:Thresh%></th>
<th class="cbi-section-table-cell"><%:Type%></th>
<th class="cbi-section-table-cell"><%:Updated%></th>
<th class="cbi-section-table-cell"><%:Raw%></th>
<% end %>
</tr>
<tr class="cbi-section-table-row">
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
</tr>
</table>
</fieldset>
</div>
</body>
</html>

View File

@ -71,7 +71,7 @@ msgid "Free Space"
msgstr "空闲空间"
msgid "Model"
msgstr "主机型号"
msgstr "型号"
msgid "Size"
msgstr "容量"