Skip to content

Commit

Permalink
Merge pull request #243 from fbergkemper/dev/fbergkemper/bareos-18.2/…
Browse files Browse the repository at this point in the history
…story-3067-webui

webui: Notify user about Bvfs cache update
  • Loading branch information
fbergkemper committed Aug 19, 2019
2 parents 3ed5379 + c82c33c commit ffa14a9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
7 changes: 7 additions & 0 deletions webui/config/autoload/global.php.in
Expand Up @@ -112,6 +112,13 @@ function read_configuration_ini($configuration, $configuration_ini)
$arr['dashboard']['autorefresh_interval'] = 60000;
}

if( array_key_exists('restore', $configuration) && array_key_exists('filetree_refresh_timeout', $configuration['restore']) && isset($configuration['restore']['filetree_refresh_timeout']) ) {
$arr['restore']['filetree_refresh_timeout'] = $configuration['restore']['filetree_refresh_timeout'];
}
else {
$arr['restore']['filetree_refresh_timeout'] = 120000;
}

return $arr;
}

Expand Down
5 changes: 5 additions & 0 deletions webui/install/configuration.ini.in
Expand Up @@ -45,3 +45,8 @@ save_previous_state=false
; Default: none
labelpooltype=scratch

[restore]
; Restore filetree refresh timeout after n milliseconds
; Default: 120000 milliseconds
filetree_refresh_timeout=120000

3 changes: 3 additions & 0 deletions webui/module/Auth/src/Auth/Controller/AuthController.php
Expand Up @@ -207,6 +207,9 @@ public function loginAction()
}
// Push dashboard configuration settings into SESSION context.
$_SESSION['bareos']['dashboard_autorefresh_interval'] = $configuration['configuration']['dashboard']['autorefresh_interval'];
// Push restore configuration settings into SESSION context.
$_SESSION['bareos']['filetree_refresh_timeout'] = $configuration['configuration']['restore']['filetree_refresh_timeout'];

if($this->params()->fromQuery('req')) {
$redirect = $this->params()->fromQuery('req');
$request = $this->getRequest();
Expand Down
25 changes: 23 additions & 2 deletions webui/module/Restore/view/restore/restore/index.phtml
Expand Up @@ -269,19 +269,39 @@ $this->headTitle($title);

}

function displayBvfsCacheUpdateInfo() {
$('#filebrowser').append("<br>");
$('#filebrowser').append("<div id='alert-bvfs' class='alert alert-info' role='alert'>");
$('#alert-bvfs').append("Update the Bvfs cache frequently to avoid timeouts.<br>");
$('#alert-bvfs').append("Please read the Bareos Documentation for further details.");
$('#filebrowser').append("</div>");
}

$(".search-input").keyup(function() {
var searchString = $(this).val();
console.log(searchString);
$('#filebrowser').jstree('search', searchString);
});

$("#filebrowser").bind("loading.jstree", function() {
displayBvfsCacheUpdateInfo();
});

$('#filebrowser').jstree({
'plugins' : [ "grid", "checkbox", "state", "sort", "search", "types" ],
'core' : {
'animation': false,
'force_text': true,
'error': function () {
alert('Oops, something went wrong, probably too many files.')
'error': function (e) {
$('#filebrowser').html(
"<h4>There was an error while loading data for this tree.</h4>" +
"<p><b>Error: </b>" + e.error + "</p>" +
"<p><b>Plugin: </b>" + e.plugin + "</p>" +
"<p><b>Reason: </b> " + e.reason + "</p>" +
"<p><b>Data:</b></p>" +
"<pre><code>" + e.data + "</code></pre>"
);
displayBvfsCacheUpdateInfo();
},
'data' :{
'url' : '<?php echo $this->basePath() . "/restore/filebrowser?type=" . $this->restore_params['type'] . "&jobid=" . $this->restore_params['jobid'] . "&mergefilesets=" . $this->restore_params['mergefilesets'] . "&mergejobs=" . $this->restore_params['mergejobs'] . "&limit=" . $this->restore_params['limit']; ?>',
Expand All @@ -290,6 +310,7 @@ $this->headTitle($title);
return { 'id' : node.id };
},
},
timeout: <?php echo $_SESSION['bareos']['filetree_refresh_timeout']; ?>,
},
'grid' : {
width: '100%',
Expand Down

0 comments on commit ffa14a9

Please sign in to comment.