summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics
diff options
context:
space:
mode:
authorSimon Rettberg2024-09-20 17:08:51 +0200
committerSimon Rettberg2024-09-20 17:08:51 +0200
commit52b3a02fb2dbb0eca3fb4effbe7c6b60a5ecf168 (patch)
treea4b4b63b19c7660b4bdf4b4e9c09466da9d9a151 /modules-available/statistics
parent[statistics] Ignore HDDS (block devices) that are too small (diff)
downloadslx-admin-52b3a02fb2dbb0eca3fb4effbe7c6b60a5ecf168.tar.gz
slx-admin-52b3a02fb2dbb0eca3fb4effbe7c6b60a5ecf168.tar.xz
slx-admin-52b3a02fb2dbb0eca3fb4effbe7c6b60a5ecf168.zip
[rebootcontrol/statistics] Add templates for useful remote exec commands
Diffstat (limited to 'modules-available/statistics')
-rw-r--r--modules-available/statistics/page.inc.php4
-rw-r--r--modules-available/statistics/pages/machine.inc.php3
-rw-r--r--modules-available/statistics/templates/machine-main.html24
3 files changed, 26 insertions, 5 deletions
diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php
index 4f11e835..f07dca56 100644
--- a/modules-available/statistics/page.inc.php
+++ b/modules-available/statistics/page.inc.php
@@ -97,6 +97,10 @@ class Page_Statistics extends Page
if (Module::isAvailable('rebootcontrol')) {
RebootControl::prepareExec();
}
+ } elseif (substr($action, 0, 12) === 'exec-preset-') {
+ if (Module::isAvailable('rebootcontrol')) {
+ RebootControl::prepareExec(substr($action, 12));
+ }
}
// Make sure we don't render any content for POST requests - should be handled above and then
diff --git a/modules-available/statistics/pages/machine.inc.php b/modules-available/statistics/pages/machine.inc.php
index 34ed63da..77d9b28e 100644
--- a/modules-available/statistics/pages/machine.inc.php
+++ b/modules-available/statistics/pages/machine.inc.php
@@ -164,12 +164,13 @@ class SubPage
}
}
// Rebootcontrol
- if (Module::get('rebootcontrol') !== false) {
+ if (Module::isAvailable('rebootcontrol')) {
$client['canReboot'] = (User::hasPermission('.rebootcontrol.action.reboot', (int)$client['locationid']));
$client['canShutdown'] = (User::hasPermission('.rebootcontrol.action.shutdown', (int)$client['locationid']));
$client['canWol'] = (User::hasPermission('.rebootcontrol.action.wol', (int)$client['locationid']));
$client['canExec'] = (User::hasPermission('.rebootcontrol.action.exec', (int)$client['locationid']));
$client['rebootcontrol'] = $client['canReboot'] || $client['canShutdown'] || $client['canWol'] || $client['canExec'];
+ $client['execList'] = ExecTemplate::list();
}
// Baseconfig
if (Module::get('baseconfig') !== false
diff --git a/modules-available/statistics/templates/machine-main.html b/modules-available/statistics/templates/machine-main.html
index be32f9c7..1139d5b9 100644
--- a/modules-available/statistics/templates/machine-main.html
+++ b/modules-available/statistics/templates/machine-main.html
@@ -153,10 +153,26 @@
</button>
{{/canWol}}
{{#canExec}}
- <button type="submit" name="action" value="prepare-exec" class="btn btn-sm btn-primary btn-machine-action">
- <span class="glyphicon glyphicon-play"></span>
- {{lang_remoteExec}}
- </button>
+ <div class="btn-group">
+ <button type="submit" name="action" value="prepare-exec" class="btn btn-sm btn-primary btn-machine-action">
+ <span class="glyphicon glyphicon-play"></span>
+ {{lang_remoteExec}}
+ </button>
+ <button type="button" class="btn btn-sm btn-primary btn-machine-action dropdown-toggle"
+ data-toggle="dropdown" aria-haspopup="true">
+ <span class="caret"></span>
+ <span class="sr-only">Toggle Dropdown</span>
+ </button>
+ <div class="dropdown-menu" style="padding:0">
+ <div class="btn-group-vertical">
+ {{#execList}}
+ <button type="submit" name="action" value="exec-preset-{{id}}" class="btn btn-danger btn-machine-action">
+ {{title}}
+ </button>
+ {{/execList}}
+ </div>
+ </div>
+ </div>
{{/canExec}}
</div>
<div class="modal fade" id="reboot-confirm" tabindex="-1" role="dialog">