code cleanup

This commit is contained in:
Sebastian Hildebrandt 2020-05-13 19:51:10 +02:00
parent dc88096e7a
commit 269b928c6e
4 changed files with 20 additions and 14 deletions

View File

@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.26.1 | 2020-05-13 | code cleanup |
| 4.26.0 | 2020-05-12 | `diskLayout()` added full smart data where supported |
| 4.25.2 | 2020-05-12 | `getDynamicData()` added wifiNetworks() |
| 4.25.1 | 2020-05-07 | `get()` minor bounds test fix, updated docs |

View File

@ -83,6 +83,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.26.1</th>
<td>2020-05-13</td>
<td>code cleanup </td>
</tr>
<tr>
<th scope="row">4.26.0</th>
<td>2020-05-12</td>

View File

@ -168,7 +168,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.26.0</span></div>
<div class="version">Current Version: <span id="version">4.26.1</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -801,7 +801,7 @@ function diskLayout(callback) {
BSDName: BSDName
});
cmd += `printf "\n${BSDName}|"; smartctl -H ${BSDName} | grep overall;`;
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`
cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`;
});
} catch (e) {
util.noop();
@ -809,20 +809,20 @@ function diskLayout(callback) {
}
// check S.M.A.R.T. status
if (cmdFullSmart) {
exec(cmdFullSmart, function (error, stdout) {
try {
const data = JSON.parse(`[${stdout}]`);
data.forEach(disk => {
const diskBSDName = disk.smartctl.argv[disk.smartctl.argv.length - 1];
exec(cmdFullSmart, function (error, stdout) {
try {
const data = JSON.parse(`[${stdout}]`);
data.forEach(disk => {
const diskBSDName = disk.smartctl.argv[disk.smartctl.argv.length - 1];
for (let i = 0; i < result.length; i++) {
if (result[i].BSDName === diskBSDName) {
result[i].smartStatus = (disk.smart_status.passed ? 'Ok' : (disk.smart_status.passed === false ? 'Predicted Failure' : 'unknown'));
result[i].smartData = disk;
}
for (let i = 0; i < result.length; i++) {
if (result[i].BSDName === diskBSDName) {
result[i].smartStatus = (disk.smart_status.passed ? 'Ok' : (disk.smart_status.passed === false ? 'Predicted Failure' : 'unknown'));
result[i].smartData = disk;
}
});
commitResult(result);
}
});
commitResult(result);
} catch (e) {
if (cmd) {
cmd = cmd + 'printf "\n"';