Skip to content

Commit

Permalink
webui: jstree error callback function
Browse files Browse the repository at this point in the history
Replaces the jstree error callback function which is called
when something goes wrong (operation prevented, ajax failed,
etc.) with a more meaningful one that provides data from the
error object to the user.
  • Loading branch information
fbergkemper committed Jun 18, 2019
1 parent c92ce8c commit 60876b3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions webui/module/Restore/view/restore/restore/index.phtml
Expand Up @@ -354,8 +354,15 @@ $this->headTitle($title);
'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>"
);
},
'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 Down
11 changes: 9 additions & 2 deletions webui/module/Restore/view/restore/restore/versions.phtml
Expand Up @@ -477,8 +477,15 @@ $('#filebrowser').jstree({
'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>"
);
},
'multiple': false,
'data': {
Expand Down

0 comments on commit 60876b3

Please sign in to comment.