Immediately show the auto update state when directly visiting the app update section

This commit is contained in:
Johannes Zellner
2022-10-06 16:17:25 +02:00
parent e4c507d9b6
commit a285ebc749
2 changed files with 8 additions and 12 deletions

View File

@@ -1353,9 +1353,9 @@
<div class="col-md-12">
<label class="control-label">{{ 'app.updates.auto.title' | tr }}</label>
<p>{{ 'app.updates.auto.description' | tr }}</p>
<p class="text-success" ng-show="updates.enableAutomaticUpdate">{{ 'app.updates.auto.enabled' | tr }}</p>
<p class="text-danger" ng-hide="updates.enableAutomaticUpdate">{{ 'app.updates.auto.disabled' | tr }}</p>
<button class="btn btn-primary pull-right" uib-tooltip="{{ app.appStoreId ? '' : 'Not available for custom apps' }}" ng-class="{ 'btn-danger': updates.enableAutomaticUpdate }" ng-click="updates.toggleAutomaticUpdates()" ng-disabled="updates.busyAutomaticUpdates || !app.appStoreId"><i class="fa fa-circle-notch fa-spin" ng-show="updates.busyAutomaticUpdates"></i> {{ updates.enableAutomaticUpdate ? ('app.updates.auto.disableAction' | tr) : ('app.updates.auto.enableAction' | tr) }} </button>
<p class="text-success" ng-show="app.enableAutomaticUpdate">{{ 'app.updates.auto.enabled' | tr }}</p>
<p class="text-danger" ng-hide="app.enableAutomaticUpdate">{{ 'app.updates.auto.disabled' | tr }}</p>
<button class="btn btn-primary pull-right" uib-tooltip="{{ app.appStoreId ? '' : 'Not available for custom apps' }}" ng-class="{ 'btn-danger': app.enableAutomaticUpdate }" ng-click="updates.toggleAutomaticUpdates()" ng-disabled="updates.busyAutomaticUpdates || !app.appStoreId"><i class="fa fa-circle-notch fa-spin" ng-show="updates.busyAutomaticUpdates"></i> {{ app.enableAutomaticUpdate ? ('app.updates.auto.disableAction' | tr) : ('app.updates.auto.enableAction' | tr) }} </button>
</div>
</div>
</div>

View File

@@ -1081,25 +1081,21 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
busyAutomaticUpdates: false,
skipBackup: false,
enableAutomaticUpdate: false,
show: function () {
var app = $scope.app;
$scope.updates.enableAutomaticUpdate = app.enableAutomaticUpdate;
$scope.updates.skipBackup = false;
},
toggleAutomaticUpdates: function () {
$scope.updates.busyAutomaticUpdates = true;
Client.configureApp($scope.app.id, 'automatic_update', { enable: !$scope.updates.enableAutomaticUpdate }, function (error) {
Client.configureApp($scope.app.id, 'automatic_update', { enable: !$scope.app.enableAutomaticUpdate }, function (error) {
if (error) return Client.error(error);
$timeout(function () {
$scope.updates.enableAutomaticUpdate = !$scope.updates.enableAutomaticUpdate;
refreshApp($scope.app.id, function (error) {
if (error) console.error(error);
$scope.updates.busyAutomaticUpdates = false;
}, 1000);
});
});
},