diskLayout() optimized parsing linux (JSON)

This commit is contained in:
Sebastian Hildebrandt 2022-06-13 22:45:53 +02:00
parent f556cd88c3
commit 199a887c6e
4 changed files with 10 additions and 4 deletions

View File

@ -80,6 +80,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.11.19 | 2022-06-13 | `diskLayout()` optimized parsing linux (JSON) |
| 5.11.18 | 2022-06-13 | `diskLayout()` fix parsing linux (JSON) |
| 5.11.17 | 2022-06-13 | `diskLayout()` fix parsing linux (JSON) |
| 5.11.16 | 2022-05-30 | `docs` updated, `tests` added node 18 |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.11.19</th>
<td>2022-06-13</td>
<td><span class="code">diskLayout()</span> optimized parsing linux (JSON)</td>
</tr>
<tr>
<th scope="row">5.11.18</th>
<td>2022-06-13</td>
@ -2684,4 +2689,4 @@
</body>
</html>
</html>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.11.18</span></div>
<div class="version">New Version: <span id="version">5.11.19</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">
@ -403,4 +403,4 @@
</script>
</body>
</html>
</html>

View File

@ -852,7 +852,7 @@ function diskLayout(callback) {
try {
const outJSON = JSON.parse(out);
if (outJSON && {}.hasOwnProperty.call(outJSON, 'blockdevices')) {
devices = outJSON.blockdevices.filter(item => { return (item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fsType === null && item.parttype === null && item.name.indexOf('ram') !== 0)); });
devices = outJSON.blockdevices.filter(item => { return (item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fsType === null && item.parttype === null && item.path && item.path.indexOf('/ram') !== 0 && item.path.indexOf('/loop') !== 0 && item['disc-max'] && item['disc-max'] !== 0)); });
}
} catch (e) {
// fallback to older version of lsblk