From 81dcea42fb846a2330ca3d55f83ff5dc7369ca1c Mon Sep 17 00:00:00 2001 From: bergware Date: Sun, 16 Feb 2020 19:54:37 +0100 Subject: [PATCH] Device Info: added automatic status updating --- plugins/dynamix/DeviceInfo.page | 97 ++++++++++++++++---- plugins/dynamix/include/FileSystemStatus.php | 38 ++++++++ 2 files changed, 118 insertions(+), 17 deletions(-) create mode 100644 plugins/dynamix/include/FileSystemStatus.php diff --git a/plugins/dynamix/DeviceInfo.page b/plugins/dynamix/DeviceInfo.page index 886aa7d1a..96109d39a 100644 --- a/plugins/dynamix/DeviceInfo.page +++ b/plugins/dynamix/DeviceInfo.page @@ -3,8 +3,8 @@ Title="$name Settings" Tag="hdd-o" --- 0) { + $('#btrfs-balance').text(data); + setTimeout(function(){btrfsBalance(path);},1000); + } else { + $.removeCookie('btrfs-balance'); + refresh(); + } + }); +} +function btrfsScrub(path) { + $.post('/webGui/include/FileSystemStatus.php',{cmd:'scrub',path:path},function(data) { + if (data.indexOf('running')>0) { + $('#btrfs-scrub').text(data); + setTimeout(function(){btrfsScrub(path);},1000); + } else { + $.removeCookie('btrfs-scrub'); + refresh(); + } + }); +} +function btrfsCheck(path) { + $.post('/webGui/include/FileSystemStatus.php',{cmd:'btrfs',path:path},function(data) { + $('#btrfs-check').text(data); + if (data.slice(-1)!='\0') { + setTimeout(function(){btrfsCheck(path);},1000); + } else { + $.removeCookie('btrfs-check'); + refresh(); + } + }); +} +function rfsCheck(path) { + $.post('/webGui/include/FileSystemStatus.php',{cmd:'rfs',path:path},function(data) { + $('#rfs-check').text(data); + if (data.slice(-1)!='\0') { + setTimeout(function(){rfsCheck(path);},1000); + } else { + $.removeCookie('rfs-check'); + refresh(); + } + }); +} +function xfsCheck(path) { + $.post('/webGui/include/FileSystemStatus.php',{cmd:'xfs',path:path},function(data) { + $('#xfs-check').text(data); + if (data.slice(-1)!='\0') { + setTimeout(function(){xfsCheck(path);},1000); + } else { + $.removeCookie('xfs-check'); + refresh(); + } + }); +} $(function() { 1):?> var ctrl = "'>"; @@ -164,6 +222,11 @@ $(function() { form.smType.selectedIndex = 0; setGlue(form,false); + if ($.cookie('btrfs-balance')) btrfsBalance($.cookie('btrfs-balance')); + if ($.cookie('btrfs-scrub')) btrfsScrub($.cookie('btrfs-scrub')); + if ($.cookie('btrfs-check')) btrfsCheck($.cookie('btrfs-check')); + if ($.cookie('rfs-check')) rfsCheck($.cookie('rfs-check')); + if ($.cookie('xfs-check')) xfsCheck($.cookie('xfs-check')); }); @@ -278,7 +341,7 @@ Critical disk utilization threshold (%):
Balance Status
-
+ @@ -286,7 +349,7 @@ btrfs filesystem df: : ".shell_exec("/sbin/btrfs filesystem df /mnt/{$disk['name']}")."";?> btrfs balance status: -: " . implode("\n", $balance_status) . "";?> +: ".implode("\n", $balance_status)."";?> @@ -314,7 +377,7 @@ btrfs balance status:   -: *Running* +: > **Cancel** will cancel the balance operation in progress. @@ -329,12 +392,12 @@ btrfs balance status:
Scrub Status
- + btrfs scrub status: -: " . implode("\n", $scrub_status) . "";?> +: ".implode("\n", $scrub_status)."";?> @@ -356,7 +419,7 @@ btrfs scrub status:   -: *Running* +: > **Cancel** will cancel the Scrub operation in progress. @@ -371,12 +434,12 @@ btrfs scrub status:
Check Filesystem Status
- + btrfs check status: -: " . implode("\n", $check_status) . "";?> +: ".implode("\n", $check_status)."";?> @@ -404,7 +467,7 @@ btrfs check status:   -: *Running* +: *Running* > **Cancel** will cancel the Check operation in progress. @@ -425,12 +488,12 @@ btrfs check status:
Check Filesystem Status
- + reiserfsck status: -: " . implode("\n", $check_status) . "";?> +: ".implode("\n", $check_status)."";?> @@ -459,7 +522,7 @@ reiserfsck status:   -: *Running* +: *Running* > **Cancel** will cancel the Check operation in progress. @@ -474,12 +537,12 @@ reiserfsck status:
Check Filesystem Status
- + xfs_repair status: -: " . implode("\n", $check_status) . "";?> +: ".implode("\n", $check_status)."";?> @@ -506,7 +569,7 @@ xfs_repair status:   -: *Running* +: *Running* > **Cancel** will cancel the Check operation in progress. diff --git a/plugins/dynamix/include/FileSystemStatus.php b/plugins/dynamix/include/FileSystemStatus.php new file mode 100644 index 000000000..92402b8e8 --- /dev/null +++ b/plugins/dynamix/include/FileSystemStatus.php @@ -0,0 +1,38 @@ + +