diff --git a/CHANGES b/CHANGES index e2ecdb3fd..d73a8e9fb 100644 --- a/CHANGES +++ b/CHANGES @@ -608,4 +608,5 @@ * Make email optional (settings -> enable/disable mail) * Make PostgresSQL behave better in low memory cloudrons * Add demo mode check +* Fix plan listing diff --git a/webadmin/src/views/settings.js b/webadmin/src/views/settings.js index 052aa6ada..fb77edcbf 100644 --- a/webadmin/src/views/settings.js +++ b/webadmin/src/views/settings.js @@ -141,22 +141,18 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca AppStore.getSizes(function (error, result) { if (error) return console.error(error); - // only show plans bigger than the current size var found = false; + var SIZE_SLUGS = [ '512mb', '1gb', '2gb', '4gb', '8gb', '16bg', '32gb', '48gb', '64gb' ]; result = result.filter(function (size) { - if (size.slug === $scope.config.plan.slug) { - found = true; - return true; - } else { - return found; - } + // 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); + return found; }); angular.copy(result, $scope.availablePlans); - // prepend the 'custom' plan' - if ($scope.availablePlans.length === 0 || $scope.availablePlans[0].name !== $scope.config.plan.name) { - $scope.availablePlans.unshift($scope.config.plan); - } + // prepend the current plan + $scope.availablePlans.unshift($scope.config.plan); $scope.planChange.requestedPlan = $scope.availablePlans[0]; // need the reference to preselect