diff --git a/webadmin/src/index.html b/webadmin/src/index.html index 748199fe6..a61fd7d8a 100644 --- a/webadmin/src/index.html +++ b/webadmin/src/index.html @@ -183,7 +183,7 @@
diff --git a/webadmin/src/js/main.js b/webadmin/src/js/main.js index d286f5c5b..196f4c53b 100644 --- a/webadmin/src/js/main.js +++ b/webadmin/src/js/main.js @@ -32,9 +32,29 @@ angular.module('Application').controller('MainController', ['$scope', '$route', window.location.href = '/error.html'; }; - $scope.showUpdateModalFromVersion1Modal = function () { - $('#version1Modal').modal('hide'); - $('#updateModal').modal('show'); + $scope.waitingForPlanSelection = false; + $('#version1Modal').on('hide.bs.modal', function () { + $scope.waitingForPlanSelection = false; + }); + + $scope.waitForPlanSelection = function () { + if ($scope.waitingForPlanSelection) return; + + $scope.waitingForPlanSelection = true; + + function checkPlan() { + if (!$scope.waitingForPlanSelection) return; + + if ($scope.currentSubscription.plan.id !== 'undecided') { + $scope.waitingForPlanSelection = false; + $('#version1Modal').modal('hide'); + $('#updateModal').modal('show'); + } else { + $timeout(checkPlan, 1000); + } + } + + checkPlan(); }; $scope.showUpdateModal = function (form) { @@ -142,7 +162,7 @@ angular.module('Application').controller('MainController', ['$scope', '$route', $scope.currentSubscription = result; // check again to give more immediate feedback once a subscription was setup - if (result.plan.id === 'undecided') $timeout(getSubscription, 10000); + if (result.plan.id === 'undecided') $timeout(getSubscription, 5000); }); }); }