From 4d10ade6eef1202146ce2ef713a339024fa89a2b Mon Sep 17 00:00:00 2001 From: bergware Date: Sun, 22 Mar 2020 16:53:49 +0100 Subject: [PATCH 1/2] Bug fixes --- plugins/dynamix/DeviceInfo.page | 18 +++++++++++++++++- plugins/dynamix/include/ReloadPage.php | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/dynamix/DeviceInfo.page b/plugins/dynamix/DeviceInfo.page index ec7a59b73..c6ec13058 100644 --- a/plugins/dynamix/DeviceInfo.page +++ b/plugins/dynamix/DeviceInfo.page @@ -237,7 +237,23 @@ $(function() { if ($.cookie('btrfs-check-')) btrfs = btrfsCheck($.cookie('btrfs-check-')); if ($.cookie('rfs-check-')) btrfs = rfsCheck($.cookie('rfs-check-')); if ($.cookie('xfs-check-')) btrfs = xfsCheck($.cookie('xfs-check-')); - if (!btrfs) $.get('/webGui/include/ReloadPage.php',{btrfs:'btrfs'},function(btrfs){if(btrfs=='disable'){$.cookie('btrfs-balance-','/mnt/');btrfsBalance($.cookie('btrfs-balance-'));}}); + if (!btrfs) { + $.get('/webGui/include/ReloadPage.php',{mount:''},function(a){ + var action = a.split(','); + for (var i=0,busy; busy=action[i]; i++) { + switch (busy) { + case 'balance': + $.cookie('btrfs-balance-','/mnt/'); + btrfsBalance($.cookie('btrfs-balance-')); + break; + case 'scrub': + $.cookie('btrfs-scrub-','/mnt/'); + btrfsScrub($.cookie('btrfs-scrub-')); + break; + } + } + }); + } }); diff --git a/plugins/dynamix/include/ReloadPage.php b/plugins/dynamix/include/ReloadPage.php index e555fbcf0..b1143b7a8 100644 --- a/plugins/dynamix/include/ReloadPage.php +++ b/plugins/dynamix/include/ReloadPage.php @@ -16,7 +16,10 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp'; $_SERVER['REQUEST_URI'] = ''; require_once "$docroot/webGui/include/Translations.php"; -if (empty($_GET['btrfs'])) { +if (isset($_GET['mount'])) { + exec("ps -eo cmd|awk '/^\/sbin\/btrfs.*\/mnt\/{$_GET['mount']}/{print $2}'",$action); + echo implode(',',$action); +} elseif (empty($_GET['btrfs'])) { $var = parse_ini_file("state/var.ini"); switch ($var['fsState']) { case 'Copying': From 3243005ea33512383f47bd108a60f203b0286f03 Mon Sep 17 00:00:00 2001 From: bergware Date: Sun, 22 Mar 2020 17:08:57 +0100 Subject: [PATCH 2/2] Bug fixes --- plugins/dynamix/DeviceInfo.page | 4 ++++ plugins/dynamix/include/ReloadPage.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/dynamix/DeviceInfo.page b/plugins/dynamix/DeviceInfo.page index c6ec13058..75483708f 100644 --- a/plugins/dynamix/DeviceInfo.page +++ b/plugins/dynamix/DeviceInfo.page @@ -250,6 +250,10 @@ $(function() { $.cookie('btrfs-scrub-','/mnt/'); btrfsScrub($.cookie('btrfs-scrub-')); break; + case 'check': + $.cookie('btrfs-check-','/mnt/'); + btrfsCheck($.cookie('btrfs-check-')); + break; } } }); diff --git a/plugins/dynamix/include/ReloadPage.php b/plugins/dynamix/include/ReloadPage.php index b1143b7a8..5a4ef7288 100644 --- a/plugins/dynamix/include/ReloadPage.php +++ b/plugins/dynamix/include/ReloadPage.php @@ -17,7 +17,7 @@ $_SERVER['REQUEST_URI'] = ''; require_once "$docroot/webGui/include/Translations.php"; if (isset($_GET['mount'])) { - exec("ps -eo cmd|awk '/^\/sbin\/btrfs.*\/mnt\/{$_GET['mount']}/{print $2}'",$action); + exec("ps -eo cmd|awk '/^(\/sbin\/)?btrfs.*\/mnt\/{$_GET['mount']}/{print $2}'",$action); echo implode(',',$action); } elseif (empty($_GET['btrfs'])) { $var = parse_ini_file("state/var.ini");