Some code cleanup

This commit is contained in:
Johannes Zellner
2019-09-19 18:41:03 +02:00
parent 4a558a7f65
commit 4822984e34
2 changed files with 10 additions and 14 deletions
+2 -2
View File
@@ -471,7 +471,7 @@
<fieldset>
<form role="form" name="securityForm" ng-submit="security.submit()" autocomplete="off">
<div class="form-group">
<label class="control-label" style="width: 100%">Specify robots.txt file content <sup><a ng-href="{{ config.webServerOrigin }}/documentation/apps/#indexing-by-search-engines-robotstxt" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup> <a href="" class="pull-right" style="font-weight: normal;" ng-click="security.robotsTxt = disableIndexingTemplate">Disable indexing</a></label>
<label class="control-label" style="width: 100%">Specify robots.txt file content <sup><a ng-href="{{ config.webServerOrigin }}/documentation/apps/#indexing-by-search-engines-robotstxt" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup> <a href="" class="pull-right" style="font-weight: normal;" ng-click="security.robotsTxt = ROBOTS_DISABLE_INDEXING_TEMPLATE">Disable indexing</a></label>
<textarea ng-model="security.robotsTxt" placeholder="Leave empty to allow all bots to index this app." class="form-control" rows="4"></textarea>
</div>
@@ -571,7 +571,7 @@
</p>
<button class="btn btn-danger" ng-click="debug.stopAppTask(app.taskId)" ng-disabled="!app.taskId">Cancel Current Task</button>
<button class="btn btn-danger" ng-click="debug.restartApp()" ng-disabled="app.taskId || appIsRestarting"><i class="fa fa-circle-notch fa-spin" ng-show="appIsRestarting"></i> Restart App</button>
<button class="btn btn-danger" ng-click="debug.restartApp()" ng-disabled="app.taskId || debug.appIsRestarting"><i class="fa fa-circle-notch fa-spin" ng-show="debug.appIsRestarting"></i> Restart App</button>
<a class="btn btn-primary pull-right" ng-href="{{ '/terminal.html?id=' + app.id }}" target="_blank">Terminal</a>
<a class="btn btn-primary pull-right" ng-href="{{ '/logs.html?appId=' + app.id }}" target="_blank">Logs</a>
</div>
+8 -12
View File
@@ -52,18 +52,15 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.view = '';
$scope.app = null;
$scope.activeTask = null;
$scope.appIsRestarting = false;
$scope.ready = false;
$scope.HOST_PORT_MIN = 1024;
$scope.HOST_PORT_MAX = 65535;
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.domains = [];
$scope.groups = [];
$scope.users = [];
$scope.backupsEnabled = true;
$scope.disableIndexingTemplate = '# Disable search engine indexing\n\nUser-agent: *\nDisallow: /';
$scope.HOST_PORT_MIN = 1024;
$scope.HOST_PORT_MAX = 65535;
$scope.ROBOTS_DISABLE_INDEXING_TEMPLATE = '# Disable search engine indexing\n\nUser-agent: *\nDisallow: /';
$scope.setView = function (view) {
if ($scope.view === view) return;
@@ -599,6 +596,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.debug = {
show: function () {},
appIsRestarting: false,
stopAppTask: function (taskId) {
Client.stopTask(taskId, function (error) {
@@ -608,12 +606,12 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
},
restartApp: function () {
$scope.appIsRestarting = true;
$scope.debug.appIsRestarting = true;
Client.restartApp($scope.app.id, function (error) {
if (error) Client.error(error);
$scope.appIsRestarting = false;
$scope.debug.appIsRestarting = false;
});
}
};
@@ -778,9 +776,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.backups.show();
$scope.updates.show();
$scope.ready = true;
var refreshTimer = $interval(function () { refreshApp(); }, 5000); // call with inline function to avoid iteration argument passed see $interval docs
var refreshTimer = $interval(function () { refreshApp(); }, 3000); // call with inline function to avoid iteration argument passed see $interval docs
$scope.$on('$destroy', function () {
$interval.cancel(refreshTimer);
});