Rework config routes
The config route now returns non-sensitive information under the profile scope. Caas config is a separate route Update config is a separate route
This commit is contained in:
@@ -6,6 +6,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
|
||||
$scope.client = Client;
|
||||
$scope.user = Client.getUserInfo();
|
||||
$scope.config = Client.getConfig();
|
||||
$scope.caasConfig = {};
|
||||
$scope.appstoreConfig = {};
|
||||
$scope.installedApps = Client.getInstalledApps();
|
||||
|
||||
@@ -318,13 +319,13 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
|
||||
result = result.filter(function (size) {
|
||||
// only show plans bigger than the current size
|
||||
if (found) return true;
|
||||
found = SIZE_SLUGS.indexOf(size.slug) > SIZE_SLUGS.indexOf($scope.config.plan.slug);
|
||||
found = SIZE_SLUGS.indexOf(size.slug) > SIZE_SLUGS.indexOf($scope.caasConfig.plan.slug);
|
||||
return found;
|
||||
});
|
||||
angular.copy(result, $scope.availablePlans);
|
||||
|
||||
// prepend the current plan
|
||||
$scope.availablePlans.unshift($scope.config.plan);
|
||||
$scope.availablePlans.unshift($scope.caasConfig.plan);
|
||||
|
||||
$scope.planChange.requestedPlan = $scope.availablePlans[0]; // need the reference to preselect
|
||||
|
||||
@@ -333,7 +334,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
|
||||
|
||||
angular.copy(result, $scope.availableRegions);
|
||||
|
||||
$scope.currentRegionSlug = $scope.config.region;
|
||||
$scope.currentRegionSlug = $scope.caasConfig.region;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -406,10 +407,16 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
|
||||
getAutoupdatePattern();
|
||||
|
||||
if ($scope.config.provider === 'caas') {
|
||||
getPlans();
|
||||
Client.getCaasConfig(function (error, caasConfig) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.currentPlan = $scope.config.plan;
|
||||
$scope.currency = $scope.config.currency === 'eur' ? '€' : '$';
|
||||
$scope.caasConfig = caasConfig;
|
||||
|
||||
getPlans();
|
||||
|
||||
$scope.currentPlan = caasConfig.plan;
|
||||
$scope.currency = caasConfig.currency === 'eur' ? '€' : '$';
|
||||
});
|
||||
} else {
|
||||
Client.getAppstoreConfig(function (error, appstoreConfig) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user