Add settings UI to enable unstable apps listing

This commit is contained in:
Johannes Zellner
2019-04-27 22:38:09 +02:00
parent 1629be3788
commit 0226a5603d
3 changed files with 85 additions and 0 deletions

View File

@@ -299,6 +299,14 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
});
}
function getUnstableAppsConfig() {
Client.getUnstableAppsConfig(function (error, result) {
if (error) return console.error(error);
$scope.unstableApps.enabled = result;
});
}
function getSubscription() {
AppStore.getSubscription($scope.appstoreConfig, function (error, result) {
if (error) return console.error(error);
@@ -331,6 +339,31 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
fr.readAsDataURL(event.target.files[0]);
};
$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;
if (error) {
console.error('Unable to change unstable app listing.', error);
return;
}
$scope.unstableApps.success = true;
$timeout(function () {
$scope.unstableApps.success = false;
}, 5000);
});
}
};
$scope.cloudronNameChange = {
busy: false,
error: {},
@@ -380,6 +413,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
Client.onReady(function () {
getAutoupdatePattern();
getUnstableAppsConfig();
$scope.update.checkStatus();