From 282de13218c9704f7bb7f43a4c8c3d2d3e7796d7 Mon Sep 17 00:00:00 2001 From: Frank Bergkemper Date: Fri, 25 Feb 2022 14:03:56 +0100 Subject: [PATCH] webui: fix uncaught type error (file version restore view) --- .../view/restore/restore/versions.phtml | 140 +++++++++--------- 1 file changed, 74 insertions(+), 66 deletions(-) diff --git a/webui/module/Restore/view/restore/restore/versions.phtml b/webui/module/Restore/view/restore/restore/versions.phtml index 8766748e742..49520e31a95 100644 --- a/webui/module/Restore/view/restore/restore/versions.phtml +++ b/webui/module/Restore/view/restore/restore/versions.phtml @@ -182,7 +182,7 @@ $this->headTitle($title); echo ''; ?>
-
+
@@ -505,74 +505,78 @@ $("#filebrowser").bind("loading.jstree", function() { displayBvfsCacheUpdateInfo(); }); -$('#filebrowser').jstree({ - 'plugins': ["grid", "state", "sort", "search", "types"], - 'core': { - 'animation': false, - 'force_text': true, - 'error': function (e) { - $('#filebrowser').html( - "

There was an error while loading data for this tree.

" + - "

Error: " + e.error + "

" + - "

Plugin: " + e.plugin + "

" + - "

Reason: " + e.reason + "

" + - "

Data:

" + - "
" + e.data + "
" - ); - displayBvfsCacheUpdateInfo(); - }, - 'multiple': false, - 'data': { - 'url': '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, - 'state': {'checkbox_disabled': true} - }; - }, - timeout: , - }, - }, - 'state' : { - 'key': 'versions' - }, - 'grid': { - width: '100%', - height: '60vh', - fixedHeader: true, - resizable: false, - columns: [ - { - width: '100%', - height: '100%', - header: 'translate("Name"); ?>', - headerClass: 'jsTreeGridHeader', - title: "_DATA_" +function showFileTree() { + $('#filebrowser').jstree({ + 'plugins': ["grid", "state", "sort", "search", "types"], + 'core': { + 'animation': false, + 'force_text': true, + 'error': function (e) { + $('#filebrowser').html( + "

There was an error while loading data for this tree.

" + + "

Error: " + e.error + "

" + + "

Plugin: " + e.plugin + "

" + + "

Reason: " + e.reason + "

" + + "

Data:

" + + "
" + e.data + "
" + ); + displayBvfsCacheUpdateInfo(); }, - { - width: 120, - header: 'translate("Size"); ?>', - headerClass: 'jsTreeGridHeader', - value: function (node) { - return formatJSTreeGridSizeItem(node); - } + 'multiple': false, + 'data': { + 'url': '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, + 'state': {'checkbox_disabled': true} + }; + }, + timeout: , }, - { - width: 150, - header: 'translate("Last modification"); ?>', - headerClass: 'jsTreeGridHeader', - value: function (node) { - return formatJSTreeGridLastModItem(node.data.stat.mtime); + }, + 'state' : { + 'key': 'versions' + }, + 'grid': { + width: '100%', + height: '60vh', + fixedHeader: true, + resizable: false, + columns: [ + { + width: '100%', + height: '100%', + header: 'translate("Name"); ?>', + headerClass: 'jsTreeGridHeader', + title: "_DATA_" + }, + { + width: 120, + header: 'translate("Size"); ?>', + headerClass: 'jsTreeGridHeader', + value: function (node) { + if(node.data === null) return null; + return formatJSTreeGridSizeItem(node); + } + }, + { + width: 150, + header: '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); @@ -608,6 +612,10 @@ $(document).ready(function () { var errors = 'errors); ?>'; + if($('#client').val() !== "") { + showFileTree(); + } + if (errors.length > 0) { $("#modal-001").modal(); }