|
@@ -1,215 +1,92 @@
|
|
|
-<!DOCTYPE html>
|
|
|
-<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
|
-<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=0.6, maximum-scale=0.6" />
|
|
|
-<html>
|
|
|
-
|
|
|
-<head>
|
|
|
- <meta charset="UTF-8">
|
|
|
- <script type='text/javascript' charset='utf-8'>
|
|
|
- // Hides mobile browser's address bar when page is done loading.
|
|
|
- window.addEventListener('load', function(e) {
|
|
|
- setTimeout(function() {
|
|
|
- window.scrollTo(0, 1);
|
|
|
- }, 1);
|
|
|
- }, false);
|
|
|
- </script>
|
|
|
- <title>ArOZ Onlineβ</title>
|
|
|
- <link rel="stylesheet" href="../../../script/tocas/tocas.css">
|
|
|
- <script src="../../../script/tocas/tocas.js"></script>
|
|
|
- <script src="../../../script/jquery.min.js"></script>
|
|
|
- <!--<script src="../../../script/ao_module.js"></script>-->
|
|
|
- <style>
|
|
|
-
|
|
|
- </style>
|
|
|
-</head>
|
|
|
-
|
|
|
-<body style="background-color: rgba(255, 255, 255,0.9)">
|
|
|
- <div class="ts relaxed separated mini compact buttons">
|
|
|
- <button onclick="showSMART(this)" class="ts button">Health Info</button>
|
|
|
- <button onclick="shortTest(this)" class="ts button">S.M.A.R.T Test</button>
|
|
|
- </div>
|
|
|
- <div class="ts divider"></div>
|
|
|
- <div class="ts bottom attached vertical menu" id="mainmenu">
|
|
|
- </div>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <div id="mainmenumsg" style="display:none;">
|
|
|
- <p>Location: <span id="location"></span></p>
|
|
|
- <p>Temperature: <span id="temperature"></span></p>
|
|
|
- <p>Serial Number: <span id="serial_number"></span></p>
|
|
|
- <p>Firmware Version: <span id="firmware_version"></span></p>
|
|
|
- <p>SMART Support: <span id="smart"></span></p>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div>
|
|
|
- </div>
|
|
|
|
|
|
- <!-- use for displaying dialog , for VDI user , use VDI module instead -->
|
|
|
- <div class="ts modals dimmer">
|
|
|
- <dialog id="modal" class="ts basic modal" style="background-color: white;color: black!important" open>
|
|
|
- <div class="content" id="modaldata">
|
|
|
- </div>
|
|
|
- <div class="actions">
|
|
|
- <div class="ts fluid separated stackable buttons">
|
|
|
- <button class="ts info button">Close</button>
|
|
|
- </div>
|
|
|
+<html>
|
|
|
+ <head>
|
|
|
+ <title>Disk Quota</title>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
|
|
|
+ <link rel="stylesheet" href="../../../script/semantic/semantic.min.css">
|
|
|
+ <link rel="stylesheet" href="../disk/quota/script/Chart.min.css">
|
|
|
+ <script type="text/javascript" src="../../../script/jquery.min.js"></script>
|
|
|
+ <script type="text/javascript" src="../../../script/semantic/semantic.min.js"></script>
|
|
|
+ <script src="../disk/quota/script/Chart.min.js"></script>
|
|
|
+ <style>
|
|
|
+
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div class="ui container">
|
|
|
+ <p>Drive SMART</p>
|
|
|
+ <h1 class="ui header">
|
|
|
+ <span id="healthy">Loading</span>
|
|
|
+ <div class="sub header"><span id="totaldisk">N/A</span> disks detected.</div>
|
|
|
+ </h1>
|
|
|
+ <div class="ui divider"></div>
|
|
|
+ <p id="loadWarning"><i class="ui loading spinner icon"></i> Loading SMART data...</p>
|
|
|
+ <div id="smart-holder" class="ui unstackable items">
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <div class="ui divider"></div>
|
|
|
+ </div>
|
|
|
+ <div class="ui modal">
|
|
|
+ <i class="close icon"></i>
|
|
|
+ <div class="header">
|
|
|
+ SMART Information (<span id="modal_model"></span>)
|
|
|
+ </div>
|
|
|
+ <div class="content">
|
|
|
+ <table class="ui very basic fluid celled table">
|
|
|
+ <thead>
|
|
|
+ <tr><th>ID</th>
|
|
|
+ <th>Name</th>
|
|
|
+ <th>Value</th>
|
|
|
+ <th>Worst</th>
|
|
|
+ <th>Thresh</th>
|
|
|
+ <th>Status</th>
|
|
|
+ </tr></thead>
|
|
|
+ <tbody id="modal_smart">
|
|
|
+ <tr>
|
|
|
+ <td>
|
|
|
+ ...
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class="actions">
|
|
|
+ <div class="ui black deny button">
|
|
|
+ Close
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div id="msgbox" class="ts bottom right snackbar">
|
|
|
- <div class="content">
|
|
|
- Your request is processing now.
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <br><br>
|
|
|
- <script>
|
|
|
- ts('.secondary.menu .item').tab();
|
|
|
- $("#mainmenu").html("");
|
|
|
- var lastSelectedObject = "";
|
|
|
- startup();
|
|
|
-
|
|
|
- function startup() {
|
|
|
- $.getJSON("../../system/disk/smart/getSMART", function(data) {
|
|
|
+ <script>
|
|
|
+ var smart_template = '<div class="item"><div class="image" style="width: auto !important"><img src="/SystemAO/disk/smart/img/hard-drive.svg" style="height:60px;width:auto"></div><div class="content"><p class="header">{model}</p><button class="ui right floated icon button" id="{id}" onclick="showDetails(this)"><i class="info icon"></i></button><div class="meta"><span>{status}</span></div><div class="description"><p></p></div><div class="extra">{capacity}</div></div></div>';
|
|
|
+ var smartDATA;
|
|
|
+ $.getJSON("/system/disk/smart/getSMART", function(data) {
|
|
|
+ smartDATA = data;
|
|
|
$("#mainmenu").html("");
|
|
|
if ($(data).length == 0) {
|
|
|
- msg("No harddisk detected.");
|
|
|
- MainHTML = "";
|
|
|
- MainHTML += "<div class=\"item\">";
|
|
|
- MainHTML += "<div class=\"ts comments\">";
|
|
|
- MainHTML += "<div class=\"comment\" style=\"cursor:pointer;width:98vw\">";
|
|
|
- MainHTML += "<div class=\"avatar\"><i class=\"big caution sign icon\"></i></div>";
|
|
|
- MainHTML += "<div class=\"content\">";
|
|
|
- MainHTML += "<p class=\"author\">No disk was found on this system</p>";
|
|
|
- MainHTML += "<div class=\"text\">Please make sure your disk installed correctly</div>";
|
|
|
- MainHTML += "</div>";
|
|
|
- MainHTML += "</div>";
|
|
|
- MainHTML += "</div>";
|
|
|
- MainHTML += "</div>";
|
|
|
- $("#mainmenu").append(MainHTML);
|
|
|
+ $("#smart-holder").append(append("-1","No disk find!","",-1));
|
|
|
+ $("#healthy").text("No disks detected.");
|
|
|
+ $("#totaldisk").text("0");
|
|
|
+ }else{
|
|
|
+ $.each(data.devices, function(index, value) {
|
|
|
+ $("#smart-holder").append(append(index,value.smart.model_name,value.smart.healthy,value.smart.user_capacity.bytes));
|
|
|
+ });
|
|
|
+ $("#healthy").text(data.healthy);
|
|
|
+ $("#totaldisk").text(data.devices.length);
|
|
|
}
|
|
|
- $.each(data, function(index, value) {
|
|
|
-
|
|
|
- if (value["SMART"]["smartctl"]["messages"] !== null) {
|
|
|
- if (value["SMART"]["smartctl"]["messages"][0]["severity"] == "error") {
|
|
|
- msg(value["SMART"]["smartctl"]["messages"][0]["string"]);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (value["SMART"]["user_capacity"] !== null) {
|
|
|
- var capacity = disksize(value["SMART"]["user_capacity"]["bytes"]);
|
|
|
- } else {
|
|
|
- var capacity = "Unknown";
|
|
|
- }
|
|
|
- if (typeof value["SMART"]["model_name"] !== null) {
|
|
|
- var model_name = value["SMART"]["model_name"];
|
|
|
- } else {
|
|
|
- var model_name = "Unknown";
|
|
|
- }
|
|
|
- //for extended
|
|
|
- var location = "This Host";
|
|
|
- if (value["SMART"]["temperature"] !== null) {
|
|
|
- var temperatureF = Math.round(1.8 * parseInt(value["SMART"]["temperature"]["current"]) + 32);
|
|
|
- var temperature = value["SMART"]["temperature"]["current"] + "°C | " + temperatureF + "°F";
|
|
|
- } else {
|
|
|
- var temperature = "Unknown";
|
|
|
- }
|
|
|
- if (value["SMART"]["serial_number"] !== null) {
|
|
|
- var serial_number = value["SMART"]["serial_number"];
|
|
|
- } else {
|
|
|
- var serial_number = "Unknown";
|
|
|
- }
|
|
|
- if (value["SMART"]["firmware_version"] !== null) {
|
|
|
- var firmware_version = value["SMART"]["firmware_version"];
|
|
|
- } else {
|
|
|
- var firmware_version = "Unknown";
|
|
|
- }
|
|
|
- if (value["SMART"]["ata_smart_attributes"] !== null) {
|
|
|
- var smart = "Yes";
|
|
|
- var icon = "info";
|
|
|
- $.each(value["SMART"]["ata_smart_attributes"]["table"], function(indexf, valuef) {
|
|
|
- if (typeof valuef["when_failed"] !== "undefined") {
|
|
|
- if (valuef["when_failed"] !== "") { //probabally FAILING_NOW, but not sure.
|
|
|
- icon = "negative";
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- var smart = "No";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $("#mainmenu").append('<div class="item" ondblclick="showSMART()" onClick="selected(this);" diskid="' + value["Port"] + '" location="' + location + '" temperature="' + temperature + '" serial_number="' + serial_number + '" firmware_version="' + firmware_version + '" smart="' + smart + '"><div class="ts comments"><div class="comment" style="cursor:pointer;"><div class="avatar"><i class="inverted ' + icon + ' circular disk outline icon"></i></div><div class="content"><p class="author">' + value["Port"] + '</p><div class="text">' + model_name + ", " + capacity + '</div></div></div></div></div>');
|
|
|
-
|
|
|
- });
|
|
|
+ $("#loadWarning").remove();
|
|
|
});
|
|
|
- }
|
|
|
-
|
|
|
- function showSMART() {
|
|
|
- if ($("div[active='true']").length == 0) {
|
|
|
- msg("Nothing selected");
|
|
|
- } else {
|
|
|
- window.history.pushState("", "", "?disk=" + $("div[active='true']").attr("diskid"));
|
|
|
- showDialog("table.html?disk=" + $("div[active='true']").attr("diskid"), 300, 300);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function shortTest() {
|
|
|
- if ($("div[active='true']").length == 0) {
|
|
|
- msg("Nothing selected");
|
|
|
- } else {
|
|
|
- window.history.pushState("", "", "?disk=" + $("div[active='true']").attr("diskid"));
|
|
|
- showDialog("dotest.html?disk=" + $("div[active='true']").attr("diskid"), 300, 300);
|
|
|
+
|
|
|
+ function append(id, name, status, capacity){
|
|
|
+ var tmp = smart_template;
|
|
|
+ tmp = tmp.replaceAll("{id}",id);
|
|
|
+ tmp = tmp.replaceAll("{model}",name);
|
|
|
+ tmp = tmp.replaceAll("{status}",status);
|
|
|
+ tmp = tmp.replaceAll("{capacity}",disksize(capacity));
|
|
|
+ return tmp;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- function selected(object) {
|
|
|
- if (lastSelectedObject != "") {
|
|
|
- $(lastSelectedObject).css("border-style", "solid");
|
|
|
- $(lastSelectedObject).css("border-width", "0px");
|
|
|
- $(lastSelectedObject).css("border-color", "#ffffff");
|
|
|
- $(lastSelectedObject).css("background-color", "#ffffff");
|
|
|
- $(lastSelectedObject).removeAttr("style");
|
|
|
- $(lastSelectedObject).removeAttr("active");
|
|
|
- $(lastSelectedObject).children("div[class='ts comments']").children("div[class='comment']").children("div[class='avatar']").children("i[name='arrow']").attr("class", "large chevron down icon")
|
|
|
- }
|
|
|
- $(object).css("border-style", "solid");
|
|
|
- $(object).css("border-width", "1px");
|
|
|
- $(object).css("border-color", "#5998ff");
|
|
|
- $(object).css("background-color", "#e2fdff");
|
|
|
- $(object).attr("active", "true");
|
|
|
- $(object).attr("active", "true");
|
|
|
- $(object).children("div[class='ts comments']").children("div[class='comment']").children("div[class='avatar']").children("i[name='arrow']").attr("class", "large chevron up icon")
|
|
|
- $("#mainmenumsg").appendTo(object);
|
|
|
- $("#mainmenumsg").show();
|
|
|
- $("#location").text($(object).attr("location"));
|
|
|
- $("#temperature").text($(object).attr("temperature"));
|
|
|
- $("#serial_number").text($(object).attr("serial_number"));
|
|
|
- $("#firmware_version").text($(object).attr("firmware_version"));
|
|
|
- $("#smart").text($(object).attr("smart"));
|
|
|
-
|
|
|
- lastSelectedObject = object;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
-
|
|
|
- function msg(content) {
|
|
|
- ts('.snackbar').snackbar({
|
|
|
- content: content,
|
|
|
- actionEmphasis: 'negative',
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- function disksize(size) {
|
|
|
+ function disksize(size) {
|
|
|
if (size >= 1000000000000) {
|
|
|
return Math.floor(size / 1000000000000) + " TB";
|
|
|
} else if (size >= 1000000000) {
|
|
@@ -218,29 +95,32 @@
|
|
|
return Math.floor(size / 1000000) + " MB";
|
|
|
} else if (size >= 1024) {
|
|
|
return Math.floor(size / 1000) + " KB";
|
|
|
- } else {
|
|
|
+ } else if (size > 0) {
|
|
|
return size + " Bytes";
|
|
|
+ } else if (size == 0) {
|
|
|
+ return "Unknown capacity";
|
|
|
+ } else {
|
|
|
+ return "";
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- function showDialog(href, x, y) {
|
|
|
- $("#modaldata").html("");
|
|
|
- if (typeof loadViaSystemSetting !== "undefined") {
|
|
|
- if (loadViaSystemSetting == true) {
|
|
|
- href = "../disk/smart/" + href;
|
|
|
- }
|
|
|
- }
|
|
|
- $("#modaldata").load(href);
|
|
|
- ts('#modal').modal({
|
|
|
- approve: '.info',
|
|
|
- onApprove: function() {
|
|
|
- try {
|
|
|
- clearInterval(timer);
|
|
|
- } catch (err) {}
|
|
|
- }
|
|
|
- }).modal("show")
|
|
|
- }
|
|
|
- </script>
|
|
|
-</body>
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ function showDetails(selector) {
|
|
|
+ $("#modal_smart").html("");
|
|
|
+ var id = $(selector).attr("id");
|
|
|
+ $("#modal_model").text(smartDATA.devices[id].smart.model_name);
|
|
|
+ $.each(smartDATA.devices[id].smart.ata_smart_attributes.table, function(index, value) {
|
|
|
+ $("#modal_smart").append("<tr>");
|
|
|
+ $("#modal_smart").append("<td>" + value.id + "</td>");
|
|
|
+ $("#modal_smart").append("<td>" + value.name + "</td>");
|
|
|
+ $("#modal_smart").append("<td>" + value.value + "</td>");
|
|
|
+ $("#modal_smart").append("<td>" + value.worst + "</td>");
|
|
|
+ $("#modal_smart").append("<td>" + value.thresh + "</td>");
|
|
|
+ $("#modal_smart").append("<td>" + value.healthy + "</td>");
|
|
|
+ $("#modal_smart").append("</tr>");
|
|
|
+ });
|
|
|
+ $('.ui.modal').modal('show');
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+
|
|
|
+ </body>
|
|
|
</html>
|