Skip to content

Commit

Permalink
Fixed ata_device_statistics.pages. Minor JS fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gSpotx2f committed Jun 14, 2024
1 parent 6b5ea4a commit 7a9fe96
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

include $(TOPDIR)/rules.mk

PKG_VERSION:=0.4.0-r3
PKG_VERSION:=0.4.1-r1
LUCI_TITLE:=Information about connected disk devices (partitions, filesystems, SMART).
LUCI_DEPENDS:=+fdisk +smartmontools +smartmontools-drivedb
LUCI_PKGARCH:=all
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ Dependences: fdisk, smartmontools, smartmontools-drivedb.
**OpenWrt >= 21.02:**

opkg update
wget --no-check-certificate -O /tmp/luci-app-disks-info_0.4.0-r3_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-disks-info_0.4.0-r3_all.ipk
opkg install /tmp/luci-app-disks-info_0.4.0-r3_all.ipk
rm /tmp/luci-app-disks-info_0.4.0-r3_all.ipk
wget --no-check-certificate -O /tmp/luci-app-disks-info_0.4.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-disks-info_0.4.1-r1_all.ipk
opkg install /tmp/luci-app-disks-info_0.4.1-r1_all.ipk
rm /tmp/luci-app-disks-info_0.4.1-r1_all.ipk
/etc/init.d/rpcd restart

i18n-ru:

wget --no-check-certificate -O /tmp/luci-i18n-disks-info-ru_0.4.0-r3_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-disks-info-ru_0.4.0-r3_all.ipk
opkg install /tmp/luci-i18n-disks-info-ru_0.4.0-r3_all.ipk
rm /tmp/luci-i18n-disks-info-ru_0.4.0-r3_all.ipk
wget --no-check-certificate -O /tmp/luci-i18n-disks-info-ru_0.4.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-disks-info-ru_0.4.1-r1_all.ipk
opkg install /tmp/luci-i18n-disks-info-ru_0.4.1-r1_all.ipk
rm /tmp/luci-i18n-disks-info-ru_0.4.1-r1_all.ipk

**OpenWrt 19.07:**

Expand Down
28 changes: 14 additions & 14 deletions htdocs/luci-static/resources/view/disks-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ return view.extend({

deviceRegExp : new RegExp('^((h|s)d[a-z]|nvme[0-9]+n[0-9]+)$'),

getDeviceData: function(device) {
getDeviceData(device) {
return Promise.all([
device,
L.resolveDefault(fs.exec('/usr/sbin/fdisk', [ '-l', device ]), null),
Expand All @@ -78,7 +78,7 @@ return view.extend({
]);
},

setSctTempLogInterval: function(device) {
setSctTempLogInterval(device) {
let deviceNormalized = device.replace(/\//g, '-');
let num = document.getElementById('logging_interval_value' + deviceNormalized).value;
let pSave = document.getElementById('logging_interval_type' + deviceNormalized).checked;
Expand All @@ -96,7 +96,7 @@ return view.extend({
}).catch(e => ui.addNotification(null, E('p', {}, e.message)));
},

createDiskTable: async function(text) {
async createDiskTable(text) {
let [ diskInfo, partitions ] = text.trim().split('\n\n').map(e => e.trim().split('\n'));
diskInfo = diskInfo.map(e => e.split(':'));

Expand Down Expand Up @@ -244,7 +244,7 @@ return view.extend({
]);
},

createSmartTable: function(smartObject) {
createSmartTable(smartObject) {
let smartStatusLabel = (smartObject.smart_status.passed) ?
E('span', { 'class': 'disks-info-label-status disks-info-ok' }, _('passed')) :
E('span', { 'class': 'disks-info-label-status disks-info-err' }, _('failed'));
Expand Down Expand Up @@ -310,7 +310,7 @@ return view.extend({
]);
},

createErrorLog: function(table) {
createErrorLog(table) {
let errorLogTable = E('table', { 'class': 'table' },
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th left', 'style':'min-width:16%' }, _('Error number')),
Expand All @@ -335,7 +335,7 @@ return view.extend({
]);
},

createTempTable: function(smartObject) {
createTempTable(smartObject) {
return E('div', { 'class': 'cbi-value' }, [
E('h3', {}, _('Temperature') + ':'),
E('table', { 'class': 'table' }, [
Expand Down Expand Up @@ -382,7 +382,7 @@ return view.extend({
]);
},

createSctTempArea: function(smartObject) {
createSctTempArea(smartObject) {
let device = smartObject.device.name;
let deviceTime = smartObject.local_time.time_t;
let intervalMin = smartObject.ata_sct_temperature_history.logging_interval_minutes;
Expand All @@ -408,7 +408,7 @@ return view.extend({
};
dataUnits.reverse();

// GRAPH
/* GRAPH */

let svgWidth = 900;
let svgHeight = 300;
Expand Down Expand Up @@ -517,7 +517,7 @@ return view.extend({
text.appendChild(document.createTextNode(`Interval:${intervalMin}m Tmin:${tempMin}°C Tmax:${tempMax}°C`));
svg.appendChild(text);

// TABLE
/* TABLE */

dataUnits = dataUnits.filter((e, i, a) => {
return e[1] != ((a[i - 1] !== undefined) && a[i - 1][1]);
Expand Down Expand Up @@ -618,12 +618,12 @@ return view.extend({
]);
},

createDeviceStatistics: function(statObject) {
createDeviceStatistics(statObject) {
let statsArea = E('div', { 'class': 'cbi-value' },
E('h3', {}, _('Device statistics') + ':')
);
for(let page of statObject.pages) {
if(!Array.isArray(page.table) || page.table.length === 0) continue;
if(!page || !Array.isArray(page.table) || page.table.length === 0) continue;
let pageTableTitle = E('h5', { 'style': 'width:100% !important; text-align:left !important' }, _(page.name));
let pageTable = E('table', { 'class': 'table' });
for(let entry of page.table) {
Expand Down Expand Up @@ -654,7 +654,7 @@ return view.extend({
return statsArea;
},

createDeviceTable: function(smartObject) {
createDeviceTable(smartObject) {
return E('div', { 'class': 'cbi-value' }, [
E('h3', {}, _('Device') + ':'),
E('table', { 'class': 'table' }, [
Expand Down Expand Up @@ -727,7 +727,7 @@ return view.extend({
]);
},

load: function() {
load() {
return fs.list('/dev').then(stat => {
let devices = [];
stat.forEach(e => {
Expand All @@ -740,7 +740,7 @@ return view.extend({
}).catch(e => ui.addNotification(null, E('p', {}, e.message)));
},

render: function(devices) {
render(devices) {
let devicesNode = E('div', { 'class': 'cbi-section fade-in' },
E('div', { 'class': 'cbi-section-node' },
E('div', { 'class': 'cbi-value' },
Expand Down

0 comments on commit 7a9fe96

Please sign in to comment.