mail: expose maildata via filemanager

part of cloudron/box#794
This commit is contained in:
Girish Ramakrishnan
2021-09-26 12:19:32 -07:00
parent f7d3f611cd
commit 3c1b01a857
7 changed files with 51 additions and 21 deletions

View File

@@ -65,8 +65,8 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$scope.client = Client;
$scope.cwd = null;
$scope.cwdParts = [];
$scope.id = search.appId || search.volumeId;
$scope.type = search.appId ? 'app' : 'volume';
$scope.id = search.id;
$scope.type = search.type;
$scope.rootDirLabel = '';
$scope.title = '';
$scope.entries = [];
@@ -996,7 +996,14 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
Client.refreshUserInfo(function (error) {
if (error) return Client.initError(error, init);
var getter = $scope.type === 'app' ? Client.getApp.bind(Client, $scope.id) : Client.getVolume.bind(Client, $scope.id);
var getter;
if ($scope.type === 'app') {
getter = Client.getApp.bind(Client, $scope.id);
} else if ($scope.type === 'volume') {
getter = Client.getVolume.bind(Client, $scope.id);
} else if ($scope.type === 'mail') {
getter = function (next) { next(null, null); };
}
getter(function (error, result) {
if (error) {
@@ -1005,10 +1012,23 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
}
// fine to do async
fetchVolumesInfo(result.mounts || []);
if ($scope.type === 'app') fetchVolumesInfo(result.mounts || []);
switch ($scope.type) {
case 'app':
$scope.title = result.label || result.fqdn;
$scope.rootDirLabel = '/app/data/';
break;
case 'volume':
$scope.title = result.name;
$scope.rootDirLabel = result.hostPath;
break;
case 'mail':
$scope.title = 'mail';
$scope.rootDirLabel = 'mail';
break;
}
$scope.title = $scope.type === 'app' ? (result.label || result.fqdn) : result.name;
$scope.rootDirLabel = $scope.type === 'app' ? '/app/data/' : result.hostPath;
window.document.title = $scope.title + ' - ' + $translate.instant('filemanager.title');
// now mark the Client to be ready