List volumes of the app in filemanager

This commit is contained in:
Johannes Zellner
2020-12-08 13:02:14 +01:00
parent 6590c06f5b
commit b63d1fa8e1
2 changed files with 23 additions and 0 deletions

View File

@@ -75,6 +75,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$scope.sortAsc = true;
$scope.sortProperty = 'fileName';
$scope.view = 'fileTree';
$scope.volumes = [];
$scope.owners = [
{ name: 'cloudron', value: 1000 },
@@ -703,6 +704,22 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
}
};
function fetchVolumesInfo(mounts) {
$scope.volumes = [];
async.each(mounts, function (mount, callback) {
Client.getVolume(mount.volumeId, function (error, result) {
if (error) return callback(error);
$scope.volumes.push(result);
callback();
});
}, function (error) {
if (error) console.error('Failed to fetch volumes info.', error);
});
}
function init() {
Client.getStatus(function (error, status) {
@@ -738,6 +755,9 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
return;
}
// fine to do async
fetchVolumesInfo(result.mounts || []);
$scope.title = $scope.type === 'app' ? (result.label || result.fqdn) : result.name;
window.document.title = $scope.title + ' - ' + $translate.instant('filemanager.title');