Make unstable apps a normal button

This commit is contained in:
Girish Ramakrishnan
2019-10-22 10:06:32 -07:00
parent 499cb76492
commit 9c418e110f
2 changed files with 10 additions and 20 deletions
+4 -11
View File
@@ -282,21 +282,14 @@
<b class="text-danger">
Do not use these apps in production.
</b>
<div class="checkbox">
<label>
<input type="checkbox" ng-model="unstableApps.enabled">Enable unstable app listing</input>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<span class="text-success text-bold" ng-show="unstableApps.success">Saved</span>
</div>
<div class="col-md-6 text-right">
<button class="btn btn-outline btn-primary pull-right" ng-click="unstableApps.submit()" ng-disabled="unstableApps.busy"><i class="fa fa-circle-notch fa-spin" ng-show="unstableApps.busy"></i> Save</button>
<div class="col-md-6 col-md-offset-6 text-right">
<button ng-class="!unstableApps.enabled ? 'btn btn-outline pull-right btn-danger' : 'btn btn-outline pull-right btn-primary'" ng-click="unstableApps.submit()" ng-disabled="unstableApps.busy"><i class="fa fa-circle-notch fa-spin" ng-show="unstableApps.busy"></i>
{{ unstableApps.enabled ? 'Disable' : 'Enable' }}
</button>
</div>
</div>
</div>
+6 -9
View File
@@ -355,25 +355,22 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
$scope.unstableApps = {
busy: false,
success: false,
enabled: false,
submit: function () {
$scope.unstableApps.busy = true;
Client.setUnstableAppsConfig($scope.unstableApps.enabled, function (error) {
$scope.unstableApps.busy = false;
Client.setUnstableAppsConfig(!$scope.unstableApps.enabled, function (error) {
if (error) {
console.error('Unable to change unstable app listing.', error);
Client.error(error);
$scope.unstableApps.busy = false;
return;
}
$scope.unstableApps.success = true;
$timeout(function () {
$scope.unstableApps.success = false;
}, 5000);
$scope.unstableApps.busy = false;
$scope.unstableApps.enabled = !$scope.unstableApps.enabled;
}, 3000);
});
}
};