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

View File

@@ -280,7 +280,17 @@
</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="uploadFolderInput" style="display: none" multiple webkitdirectory directory/>
@@ -310,6 +320,14 @@
<li><a class="hand" ng-click="onUploadFolder()">{{ 'filemanager.toolbar.uploadFolder' | tr }}</a></li>
</ul>
</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>

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); });
$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 = {
busy: false,
error: null,

View File

@@ -849,7 +849,10 @@
"newFile": "New File",
"newFolder": "New Folder",
"uploadFolder": "Upload Folder",
"uploadFile": "Upload File"
"uploadFile": "Upload File",
"restartApp": "Restart App",
"openTerminal": "Open Terminal",
"openLogs": "Open Logs"
},
"list": {
"name": "Name",
@@ -1165,7 +1168,7 @@
},
"auto": {
"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.",
"disabled": "Automatic Updates is currently disabled.",
"disableAction": "Disable Automatic Updates",