Fixed auto refresh with wrong layout

Fixes #783.
CSRF used old inputfield.
Update pagelayout after update.
This commit is contained in:
TimZ99 2019-09-26 12:52:14 +02:00
parent 9f3e140b29
commit 6aca2e1077
No known key found for this signature in database
GPG Key ID: 4D8268DC68E8339D
3 changed files with 7 additions and 2 deletions

View File

@ -62,6 +62,7 @@ class StatusController extends AbstractServerController {
'block_layout_active' => ($layout == 0) ? 'active' : '',
'list_layout_active' => ($layout != 0) ? 'active' : '',
'label_add_server' => psm_get_lang('system', 'add_new'),
'layout' => $layout,
'url_save' => psm_build_url(array('mod' => 'server', 'action' => 'edit')),
);
$this->setHeaderAccessories($this->twig->render('module/server/status/header.tpl.html', $layout_data));

View File

@ -102,6 +102,7 @@ setInterval(function() {
url:"?",
success: function(html, status) {
$("#content").html(html);
psm_setLayout({{ layout }});
}
});
}, {{ auto_refresh_seconds }} * 1000);

View File

@ -122,7 +122,7 @@ function psm_xhr(mod, params, method, on_complete, options) {
return result;
}
function psm_saveLayout(layout) {
function psm_setLayout(layout) {
if (layout) {
$("#list-layout").show();
$("#flow-layout").hide();
@ -134,11 +134,14 @@ function psm_saveLayout(layout) {
$("#block-layout").addClass('active');
$("#table-layout").removeClass('active');
}
}
function psm_saveLayout(layout) {
psm_setLayout(layout)
var params = {
action: 'saveLayout',
csrf: $("input[name=saveLayout_csrf]").val(),
csrf: $("input[name=csrf]").val(),
layout: layout
};
psm_xhr('server_status', params, 'POST');