summaryrefslogtreecommitdiffstats
path: root/modules-available/systemstatus/templates
diff options
context:
space:
mode:
authorSimon Rettberg2020-07-07 16:36:46 +0200
committerSimon Rettberg2020-07-07 16:36:46 +0200
commitd635a52fd965519eecb717ea5b953a5f12ef9b88 (patch)
tree621d70b385d35409ff5a9f93edbf42ba39ad584f /modules-available/systemstatus/templates
parent[systemstatus] Add dnbd3-master-proxy to service status (diff)
downloadslx-admin-d635a52fd965519eecb717ea5b953a5f12ef9b88.tar.gz
slx-admin-d635a52fd965519eecb717ea5b953a5f12ef9b88.tar.xz
slx-admin-d635a52fd965519eecb717ea5b953a5f12ef9b88.zip
[systemstatus/sysconfig] Manage LDADP via systemd
Finally got rid of our own little service manager. Status/restart handling capabilities were added to the system status page. TODO: Permissions for dnbd3, service (re)starting in general
Diffstat (limited to 'modules-available/systemstatus/templates')
-rw-r--r--modules-available/systemstatus/templates/_page.html36
-rw-r--r--modules-available/systemstatus/templates/ajax-journal.html19
-rw-r--r--modules-available/systemstatus/templates/services.html32
-rw-r--r--modules-available/systemstatus/templates/systeminfo.html5
4 files changed, 65 insertions, 27 deletions
diff --git a/modules-available/systemstatus/templates/_page.html b/modules-available/systemstatus/templates/_page.html
index f879ea7a..4b62104c 100644
--- a/modules-available/systemstatus/templates/_page.html
+++ b/modules-available/systemstatus/templates/_page.html
@@ -1,12 +1,12 @@
<h1>{{lang_moduleHeading}}</h1>
-{{#rebootTask}}
-<div data-tm-id="{{rebootTask}}" data-tm-log="messages">Reboot...</div>
-{{/rebootTask}}
+{{#taskid}}
+<div data-tm-id="{{taskid}}" data-tm-log="messages">{{taskname}}</div>
+{{/taskid}}
<ul class="nav nav-tabs tabs-up">
<li class="active">
- <a href="#id-default_pane" id="id-default" class="active" data-toggle="tab" role="tab">
+ <a href="#id-default_pane" id="id-default" class="ajax-tab" data-toggle="tab" role="tab">
{{lang_overview}}
</a>
</li>
@@ -128,20 +128,32 @@
<script type="text/javascript"><!--
document.addEventListener("DOMContentLoaded", function() {
- $('#diskstat').load('?do=SystemStatus&action=DiskStat');
- $('#addresses').load('?do=SystemStatus&action=AddressList');
- $('#systeminfo').load('?do=SystemStatus&action=SystemInfo');
- $('#services').load('?do=SystemStatus&action=Services');
var slxDone = {};
- $('.ajax-tab').on('shown.bs.tab', function (e) {
+ var loadTab = function (e) {
var $this = $(this);
var w = $this.attr('id');
if (!slxDone[w]) {
slxDone[w] = true;
var $pane = $('#' + w + '_pane');
- $pane.load('?do=SystemStatus&action=' + w.substring(3));
+ var tab = w.substring(3);
+ if (tab === 'default') {
+ $('#diskstat').load('?do=SystemStatus&action=DiskStat');
+ $('#addresses').load('?do=SystemStatus&action=AddressList');
+ $('#systeminfo').load('?do=SystemStatus&action=SystemInfo');
+ $('#services').load('?do=SystemStatus&action=Services');
+ } else {
+ $pane.load('?do=SystemStatus&action=' + tab, function() {
+ $(this).find('button[data-confirm]').click(slxModalConfirmHandler);
+ });
+ }
}
- });
+ };
+ $('.ajax-tab').on('shown.bs.tab', loadTab);
+ // Need a better solution for this -- there is already code handling tabs in slx-fixes, maybe put this in there?
+ if (location.hash === '' || location.hash === '#' || location.hash === '#id-default_pane') {
+ history.replaceState(null, null, '#id-default_pane');
+ loadTab.call($('#id-default'));
+ }
var $dmsd = $('#dmsd-users');
$.ajax({
url: '?do=dozmod&section=special&action=dmsd-status',
@@ -159,3 +171,5 @@
});
}, false);
//--></script>
+
+<div class="hidden" id="confirm-restart">{{lang_confirmRestart}}</div> \ No newline at end of file
diff --git a/modules-available/systemstatus/templates/ajax-journal.html b/modules-available/systemstatus/templates/ajax-journal.html
new file mode 100644
index 00000000..0405fe93
--- /dev/null
+++ b/modules-available/systemstatus/templates/ajax-journal.html
@@ -0,0 +1,19 @@
+<form method="post" action="?do=systemstatus">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="service-restart">
+ {{#modules}}
+ <div class="slx-space">
+ <div class="pull-right">
+ <button class="btn btn-warning btn-sm pull-right" name="service" value="{{service}}" data-confirm="#confirm-restart">
+ <span class="glyphicon glyphicon-refresh"></span>
+ {{lang_restart}}
+ </button>
+ </div>
+ <h4>{{name}}</h4>
+ <div data-tm-id="{{task.id}}" data-tm-log="messages">{{service}}</div>
+ </div>
+ {{/modules}}
+</form>
+<script>
+ tmInit();
+</script> \ No newline at end of file
diff --git a/modules-available/systemstatus/templates/services.html b/modules-available/systemstatus/templates/services.html
index 29b33687..2614fca9 100644
--- a/modules-available/systemstatus/templates/services.html
+++ b/modules-available/systemstatus/templates/services.html
@@ -1,20 +1,20 @@
+<form method="post" action="?do=systemstatus">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="service-start">
+ <table class="table">
{{#services}}
- {{#unknown}}
- <div class="alert alert-warning">
- {{name}}: {{lang_unknownState}}
- </div>
- {{/unknown}}
- {{^unknown}}
+ <tr class="bg-{{#fail}}danger{{/fail}}{{^fail}}success{{/fail}}">
+ <td>
{{#fail}}
- <div class="alert alert-danger">
- {{name}}: <b>{{lang_failure}}</b>
- {{#data.messages}}<pre>{{data.messages}}</pre>{{/data.messages}}
- </div>
+ <button class="btn btn-default btn-xs pull-right" name="service" value="{{service}}">
+ {{lang_restart}}
+ </button>
{{/fail}}
- {{^fail}}
- <div class="alert alert-success">
- {{name}}: {{lang_OK}}
- </div>
- {{/fail}}
- {{/unknown}}
+ {{name}}: {{#fail}}{{lang_failure}}{{/fail}}{{^fail}}{{lang_OK}}{{/fail}}
+ <div class="clearfix"></div>
+ {{#error}}<pre>{{error}}</pre>{{/error}}
+ </td>
+ </tr>
{{/services}}
+ </table>
+</form> \ No newline at end of file
diff --git a/modules-available/systemstatus/templates/systeminfo.html b/modules-available/systemstatus/templates/systeminfo.html
index ed4a1532..cf3f0cc2 100644
--- a/modules-available/systemstatus/templates/systeminfo.html
+++ b/modules-available/systemstatus/templates/systeminfo.html
@@ -61,6 +61,7 @@
wrpClass: 'circles-wrp',
textClass: 'circles-text'
});
+ var $cpu = $(cpuCircle._el);
var lastCpuTotal = {{CpuTotal}};
var lastCpuIdle = {{CpuIdle}};
var lastCpuPercent = {{cpuLoad}};
@@ -93,6 +94,10 @@
{{/memTotal}}
function updateSystem() {
if (!cpuCircle && !memCircle) return;
+ if (!$cpu.is(':visible')) {
+ setTimeout(updateSystem, 1200);
+ return;
+ }
$.post('?do=SystemStatus&action=SysPoll', { token: TOKEN }, function(data) {
if (memCircle && data.MemPercent) memCircle.update(data.MemPercent);
if (swapCircle && data.SwapPercent) swapCircle.update(data.SwapPercent);