Fixes to the update dialog logic
This commit is contained in:
@@ -171,8 +171,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-default pull-left" ng-click="showUpdateModalFromVersion1Modal()">Maybe later</a>
|
||||
<a class="btn btn-success" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email }}" target="_blank">Setup Update Subscription</a>
|
||||
<a class="btn btn-success" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email + '&cloudronId=' + appstoreConfig.cloudronId }}" target="_blank">Choose Your Options</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -199,8 +198,7 @@
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li ng-show="config.update.box && user.admin">
|
||||
<a ng-href="" ng-click="showUpdateModal(update_form)" style="cursor: pointer">
|
||||
<span ng-show="config.update.box.version !== '1.0.0' || config.provider === 'caas'" class="badge badge-success">Update available</span>
|
||||
<span ng-show="config.update.box.version === '1.0.0' && config.provider !== 'caas'" class="badge badge-success">Setup Cloudron Subscription</span>
|
||||
<span class="badge badge-success">Update available</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
@@ -45,11 +45,21 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
form.$setPristine();
|
||||
form.$setUntouched();
|
||||
|
||||
if ($scope.currentSubscription && $scope.currentSubscription.plan && $scope.currentSubscription.plan.id === 'free') {
|
||||
if ($scope.config.update.box.version === '1.0.0') {
|
||||
if (!$scope.config.update.box.sourceTarballUrl) {
|
||||
// no sourceTarballUrl means we can't update here this is only from 1.0 on
|
||||
// this will also handle the 'undecided' and 'free' plan, since the server does not send the url in this case
|
||||
$('#setupSubscriptionModal').modal('show');
|
||||
} else if ($scope.config.provider === 'caas') {
|
||||
$('#updateModal').modal('show');
|
||||
} else if (!$scope.currentSubscription || !$scope.currentSubscription.plan) {
|
||||
// do nothing as we were not able to get a subscription, yet
|
||||
} else if ($scope.config.update.box.version === '1.0.0') {
|
||||
// special case for updating to 1.0
|
||||
if ($scope.currentSubscription.plan.id === 'undecided') {
|
||||
$('#version1Modal').modal('show');
|
||||
} else {
|
||||
$('#setupSubscriptionModal').modal('show');
|
||||
// user selected a plan already, let him update
|
||||
$('#updateModal').modal('show');
|
||||
}
|
||||
} else {
|
||||
$('#updateModal').modal('show');
|
||||
@@ -132,7 +142,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 === 'free') $timeout(getSubscription, 10000);
|
||||
if (result.plan.id === 'undecided') $timeout(getSubscription, 10000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -348,8 +348,8 @@
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<a class="btn btn-primary pull-right" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email }}" target="_blank" ng-show="currentSubscription.plan && currentSubscription.plan.id !== 'free'">Change Subscription</a>
|
||||
<a class="btn btn-success pull-right" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email }}" target="_blank" ng-show="currentSubscription.plan.id === 'free'">Setup Subscription</a>
|
||||
<a class="btn btn-primary pull-right" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email + '&cloudronId=' + appstoreConfig.cloudronId }}" target="_blank" ng-show="currentSubscription.plan && currentSubscription.plan.id !== 'free'">Change Subscription</a>
|
||||
<a class="btn btn-success pull-right" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email + '&cloudronId=' + appstoreConfig.cloudronId }}" target="_blank" ng-show="currentSubscription.plan.id === 'free'">Setup Subscription</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user