Add UI for enabling spaces

This commit is contained in:
Girish Ramakrishnan
2018-08-02 19:44:00 -07:00
parent d73f7304b3
commit 7969dff043
3 changed files with 67 additions and 0 deletions

View File

@@ -64,6 +64,23 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
}
};
$scope.spaces = {
error: '',
busy: false,
enabled: false,
submit: function () {
$scope.spaces.error = null;
$scope.spaces.busy = true;
Client.setSpacesConfig({ enabled: !$scope.spaces.enabled }, function (error) {
if (error) $scope.spaces.error = error.message;
getSpacesConfig();
});
}
};
$scope.planChange = {
busy: false,
error: {},
@@ -296,6 +313,17 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
});
}
function getSpacesConfig() {
$scope.spaces.busy = true;
Client.getSpacesConfig(function (error, result) {
if (error) return console.error(error);
$scope.spaces.busy = false;
$scope.spaces.enabled = result.enabled;
});
}
function getSubscription() {
AppStore.getSubscription($scope.appstoreConfig, function (error, result) {
if (error) return console.error(error);
@@ -405,6 +433,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
Client.onReady(function () {
getAutoupdatePattern();
getSpacesConfig();
if ($scope.config.provider === 'caas') {
Client.getCaasConfig(function (error, caasConfig) {