summaryrefslogtreecommitdiffstats
path: root/modules-available/sysconfig/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2020-11-17 13:07:09 +0100
committerSimon Rettberg2020-11-17 13:07:09 +0100
commit9c2c64312771673012b3143a073bb6c227f4745f (patch)
treea9ac2e401217be2fecc0328e41bbf26eab7413f6 /modules-available/sysconfig/page.inc.php
parent[style/default.css] Fix margin/padding of slx-ellipsis hack (diff)
downloadslx-admin-9c2c64312771673012b3143a073bb6c227f4745f.tar.gz
slx-admin-9c2c64312771673012b3143a073bb6c227f4745f.tar.xz
slx-admin-9c2c64312771673012b3143a073bb6c227f4745f.zip
[sysconfig] Dynamically update warnings button
As we use AJAX to query build state for configs that don't have state === 'OK', the warnings list might be out of date. Hide the warnings button for all modules that aren't up to date, and dynamically load their warnings. The warnings button will be shown when the module finished building, assuming any warnings were generated.
Diffstat (limited to 'modules-available/sysconfig/page.inc.php')
-rw-r--r--modules-available/sysconfig/page.inc.php13
1 files changed, 3 insertions, 10 deletions
diff --git a/modules-available/sysconfig/page.inc.php b/modules-available/sysconfig/page.inc.php
index ede80aa7..1ef478b3 100644
--- a/modules-available/sysconfig/page.inc.php
+++ b/modules-available/sysconfig/page.inc.php
@@ -209,6 +209,7 @@ class Page_SysConfig extends Page
}
$configs[] = array(
'warnings' => $row['warnings'],
+ 'warnings_hidden' => (!empty($row['warnings']) && $row['status'] === 'OK') ? '' : 'hidden',
'configid' => $row['configid'],
'config' => $row['title'],
'modlist' => $row['modlist'],
@@ -482,22 +483,14 @@ class Page_SysConfig extends Page
if (Request::post('action') === 'status') {
$mods = Request::post('mods');
$confs = Request::post('confs');
- $outMods = array();
- $outConfs = array();
$mods = explode(',', $mods);
$confs = explode(',', $confs);
// Mods
- $res = Database::simpleQuery("SELECT moduleid FROM configtgz_module
+ $outMods = Database::queryAll("SELECT moduleid AS id FROM configtgz_module
WHERE moduleid in (:mods) AND status = 'OK'", compact('mods'));
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $outMods[] = $row['moduleid'];
- }
// Confs
- $res = Database::simpleQuery("SELECT configid FROM configtgz
+ $outConfs = Database::queryAll("SELECT configid AS id, warnings FROM configtgz
WHERE configid in (:confs) AND status = 'OK'", compact('confs'));
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $outConfs[] = $row['configid'];
- }
Header('Content-Type: application/json');
die(json_encode(array('mods' => $outMods, 'confs' => $outConfs)));
}