Add UI for enabling spaces
This commit is contained in:
@@ -324,4 +324,28 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-left">
|
||||
<h3>Cloudron Spaces</h3>
|
||||
</div>
|
||||
|
||||
<div class="card" style="margin-bottom: 15px;">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p>Cloudron Spaces allows users to install and run apps of their own</p>
|
||||
<p class="text-danger" ng-show="spaces.error"><br/>{{ spaces.error }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<button ng-class="spaces.enabled ? 'btn btn-danger' : 'btn btn-primary'" class="pull-right" ng-click="spaces.submit()" ng-disabled="spaces.busy">
|
||||
<i class="fa fa-circle-o-notch fa-spin" ng-show="spaces.busy"></i>
|
||||
{{ spaces.enabled ? "Disable" : "Enable" }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user