Add logs, terminal and restart action to filemanager

This commit is contained in:
Johannes Zellner
2020-12-07 19:49:53 +01:00
parent 8ef05c850d
commit e1f5fea303
3 changed files with 48 additions and 3 deletions
+19 -1
View File
@@ -280,7 +280,17 @@
</div> </div>
</div> </div>
<div class="card card-large" ng-show="title"> <div class="card card-large" ng-show="restartAppBusy">
<h3 class="text-center">
<br/>
<i class="fa fa-circle-notch fa-spin"></i>
<br/>
<br/>
restarting {{ title }}
</h3>
</div>
<div class="card card-large" ng-show="title && !restartAppBusy">
<input type="file" id="uploadFileInput" style="display: none" multiple/> <input type="file" id="uploadFileInput" style="display: none" multiple/>
<input type="file" id="uploadFolderInput" style="display: none" multiple webkitdirectory directory/> <input type="file" id="uploadFolderInput" style="display: none" multiple webkitdirectory directory/>
@@ -310,6 +320,14 @@
<li><a class="hand" ng-click="onUploadFolder()">{{ 'filemanager.toolbar.uploadFolder' | tr }}</a></li> <li><a class="hand" ng-click="onUploadFolder()">{{ 'filemanager.toolbar.uploadFolder' | tr }}</a></li>
</ul> </ul>
</div> </div>
<div class="btn-group" ng-show="type === 'app'">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-ellipsis-h"></i></button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a class="hand" ng-click="onRestartApp()"><i class="fas fa-sync-alt fa-fw"></i> {{ 'filemanager.toolbar.restartApp' | tr }}</a></li>
<li><a class="hand" ng-href="{{ '/logs.html?appId=' + id }}" target="_blank"><i class="fas fa-align-left fa-fw"></i> {{ 'filemanager.toolbar.openLogs' | tr }}</a></li>
<li><a class="hand" ng-href="{{ '/terminal.html?id=' + id }}" target="_blank"><i class="fa fa-terminal fa-fw"></i> {{ 'filemanager.toolbar.openTerminal' | tr }}</a></li>
</ul>
</div>
</div> </div>
</div> </div>
+24
View File
@@ -414,6 +414,30 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$('#uploadFolderInput').on('change', function (e ) { uploadFiles(e.target.files || [], $scope.cwd, false); }); $('#uploadFolderInput').on('change', function (e ) { uploadFiles(e.target.files || [], $scope.cwd, false); });
$scope.onUploadFolder = function () { $('#uploadFolderInput').click(); }; $scope.onUploadFolder = function () { $('#uploadFolderInput').click(); };
$scope.restartAppBusy = false;
$scope.onRestartApp = function () {
$scope.restartAppBusy = true;
function waitUntilRestarted(callback) {
Client.getApp($scope.id, function (error, result) {
if (error) return callback(error);
if (result.installationState === ISTATES.INSTALLED) return callback();
setTimeout(waitUntilRestarted.bind(null, callback), 2000);
});
}
Client.restartApp($scope.id, function (error) {
if (error) console.error('Failed to restart app.', error);
waitUntilRestarted(function (error) {
if (error) console.error('Failed wait for restart.', error);
$scope.restartAppBusy = false;
});
});
};
$scope.newDirectory = { $scope.newDirectory = {
busy: false, busy: false,
error: null, error: null,
+5 -2
View File
@@ -849,7 +849,10 @@
"newFile": "New File", "newFile": "New File",
"newFolder": "New Folder", "newFolder": "New Folder",
"uploadFolder": "Upload Folder", "uploadFolder": "Upload Folder",
"uploadFile": "Upload File" "uploadFile": "Upload File",
"restartApp": "Restart App",
"openTerminal": "Open Terminal",
"openLogs": "Open Logs"
}, },
"list": { "list": {
"name": "Name", "name": "Name",
@@ -1165,7 +1168,7 @@
}, },
"auto": { "auto": {
"title": "Automatic Updates", "title": "Automatic Updates",
"description": "Cloudron periodically polls the App Store to check for updates. If you disable automatic updates, be sure to manually check for updates.", "description": "Cloudron periodically checks the App Store for updates. If you disable automatic updates, be sure to manually apply the updates.",
"enabled": "Automatic Updates is currently enabled.", "enabled": "Automatic Updates is currently enabled.",
"disabled": "Automatic Updates is currently disabled.", "disabled": "Automatic Updates is currently disabled.",
"disableAction": "Disable Automatic Updates", "disableAction": "Disable Automatic Updates",