filemanager: Prevent and reset hash state during busy times

This commit is contained in:
Johannes Zellner
2021-05-20 19:26:20 +02:00
parent ecb93cb115
commit 89754a62fe
2 changed files with 15 additions and 3 deletions

View File

@@ -144,7 +144,6 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
if (entry.isDirectory) {
$scope.cwd = path;
$scope.cwdParts = path.split('/').filter(function (p) { return !!p; }).map(function (p, i) { return { name: decodeURIComponent(p), path: path.split('/').slice(0, i+1).join('/') }; });
// refresh will set busy to false once done
$scope.refresh();
@@ -390,6 +389,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
});
$scope.entries = result.entries;
$scope.cwdParts = $scope.cwd.split('/').filter(function (p) { return !!p; }).map(function (p, i) { return { name: decodeURIComponent(p), path: $scope.cwd.split('/').slice(0, i+1).join('/') }; });
$scope.busy = false;
});
@@ -1024,7 +1024,19 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
init();
var busyHash = window.location.hash.slice(1);
$scope.$watch('busy', function (prev, next) {
if (!prev && next) {
window.location.hash = busyHash;
busyHash = window.location.hash.slice(1);
}
});
window.addEventListener('hashchange', function () {
if ($scope.busy) return false;
busyHash = window.location.hash.slice(1);
$scope.$apply(function () {
// first close all dialogs
$scope.mediaViewer.close();