Skip to content

Commit

Permalink
webui: fix uncaught type error (multiple file restore view)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergkemper committed Mar 8, 2022
1 parent c77ea86 commit a24f5dd
Showing 1 changed file with 102 additions and 93 deletions.
195 changes: 102 additions & 93 deletions webui/module/Restore/view/restore/restore/index.phtml
Expand Up @@ -179,15 +179,13 @@ $this->headTitle($title);

<div class="col-md-9">
<?php
echo '<strong>';
echo $this->translate("File selection");
echo '</strong>';
?>
<div class="panel panel-default">
<div id="filebrowser"></div>
</div>
<?php
echo '<strong>';
echo $this->translate("File selection");
echo '</strong>';
?>
<div class="panel panel-default">
<div id="filebrowser" style="width: 100%; height: 60vH;"></div>
</div>
</div>

</div>
Expand Down Expand Up @@ -365,94 +363,101 @@ $this->headTitle($title);
$('#spinner').fadeOut('slow');
});

$('#filebrowser').jstree({
'plugins' : [ "grid", "checkbox", "state", "sort", "search", "types" ],
'core' : {
'animation': false,
'force_text': true,
'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?jobid=" . $this->restore_params['jobid'] . "&client=" . $this->restore_params['client'] . "&mergefilesets=" . $this->restore_params['mergefilesets'] . "&mergejobs=" . $this->restore_params['mergejobs'] . "&limit=" . $this->restore_params['limit']; ?>',
'dataType' : 'json',
'data' : function (node) {
return { 'id' : node.id };
},
timeout: <?php echo $_SESSION['bareos']['filetree_refresh_timeout']; ?>,
},
},
'state' : {
'key': 'restore'
},
'grid' : {
width: '100%',
height: '60vh',
fixedHeader: true,
resizable: false,
columns: [
{
width: '100%',
height: '100%',
header: '<?php echo $this->translate("Name"); ?>',
headerClass: 'jsTreeGridHeader',
title: "_DATA_"
},
{
width: 100,
header: '<?php echo $this->translate("Mode"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
return formatJSTreeGridModeItem(node.data.stat.mode);
}
function showFileTree() {
$('#filebrowser').jstree({
'plugins' : [ "grid", "checkbox", "state", "sort", "search", "types" ],
'core' : {
'animation': false,
'force_text': true,
'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();
},
{
width: 120,
header: '<?php echo $this->translate("User"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
return formatJSTreeGridUserItem(node);
}
},
{
width: 120,
header: '<?php echo $this->translate("Group"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
return formatJSTreeGridGroupItem(node);
}
},
{
width: 120,
header: '<?php echo $this->translate("Size"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
return formatJSTreeGridSizeItem(node);
}
'data' :{
'url' : '<?php echo $this->basePath() . "/restore/filebrowser?jobid=" . $this->restore_params['jobid'] . "&client=" . $this->restore_params['client'] . "&mergefilesets=" . $this->restore_params['mergefilesets'] . "&mergejobs=" . $this->restore_params['mergejobs'] . "&limit=" . $this->restore_params['limit']; ?>',
'dataType' : 'json',
'data' : function (node) {
return { 'id' : node.id };
},
timeout: <?php echo $_SESSION['bareos']['filetree_refresh_timeout']; ?>,
},
{
width: 150,
header: '<?php echo $this->translate("Last modification"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
return formatJSTreeGridLastModItem(node.data.stat.mtime);
},
'state' : {
'key': 'restore'
},
'grid' : {
width: '100%',
height: '60vh',
fixedHeader: true,
resizable: false,
columns: [
{
width: '100%',
height: '100%',
header: '<?php echo $this->translate("Name"); ?>',
headerClass: 'jsTreeGridHeader',
title: "_DATA_"
},
{
width: 100,
header: '<?php echo $this->translate("Mode"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
if(node.data === null) return null;
return formatJSTreeGridModeItem(node.data.stat.mode);
}
},
{
width: 120,
header: '<?php echo $this->translate("User"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
if(node.data === null) return null;
return formatJSTreeGridUserItem(node);
}
},
{
width: 120,
header: '<?php echo $this->translate("Group"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
if(node.data === null) return null;
return formatJSTreeGridGroupItem(node);
}
},
{
width: 120,
header: '<?php echo $this->translate("Size"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
if(node.data === null) return null;
return formatJSTreeGridSizeItem(node);
}
},
{
width: 150,
header: '<?php echo $this->translate("Last modification"); ?>',
headerClass: 'jsTreeGridHeader',
value: function(node) {
if(node.data === null) return null;
return formatJSTreeGridLastModItem(node.data.stat.mtime);
}
}
}
],
},
'search' : {
"case_sensitive" : false,
"show_only_matches" : false
}
});
],
},
'search' : {
"case_sensitive" : false,
"show_only_matches" : false
}
});
}

$('#jobid').change(function(event) {
window.location.href = window.location.pathname + '?' + updateRestoreParams('jobid', this.value);
Expand Down Expand Up @@ -486,6 +491,10 @@ $this->headTitle($title);

var errors = '<?php echo str_replace(array("\n","\r"), "", $this->errors); ?>';

if($('#client').val() !== "") {
showFileTree();
}

if(errors.length > 0) {
$("#modal-001").modal();
}
Expand Down

0 comments on commit a24f5dd

Please sign in to comment.