Remove subscription setup modal, instead open cloudron.io directly
This commit is contained in:
+5
-27
@@ -95,24 +95,6 @@
|
||||
|
||||
<a class="offline-banner animateMe" ng-show="client.offline" ng-cloak href="https://cloudron.io/documentation/troubleshooting/" target="_blank"><i class="fa fa-circle-notch fa-spin"></i> Cloudron is offline. Reconnecting...</a>
|
||||
|
||||
<!-- Modal setup subscription -->
|
||||
<div class="modal fade" id="setupSubscriptionModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Setup Subscription</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<iframe ng-show="subscription.plan.id === 'free'" ng-src="{{ config.webServerOrigin + '/helper/setup_subscription_info.html?email=' + subscription.emailEncoded + '&cloudronId=' + subscription.cloudronId }}" style="width: 100%; height: 100px; border: none;"></iframe>
|
||||
<iframe ng-show="subscription.plan.id === 'expired'" ng-src="{{ config.webServerOrigin + '/helper/subscription_expired.html?email=' + subscription.emailEncoded + '&cloudronId=' + subscription.cloudronId }}" style="width: 100%; height: 100px; border: none;"></iframe>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="animateMe ng-hide layout-root" ng-show="initialized">
|
||||
|
||||
<!-- Navigation -->
|
||||
@@ -131,15 +113,11 @@
|
||||
<!-- /.navbar-header -->
|
||||
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav navbar-right" ng-hide="hideNavBarActions">
|
||||
<li ng-show="subscription.plan.id === 'free'">
|
||||
<a ng-href="" ng-click="showSubscriptionModal()" style="cursor: pointer">
|
||||
<span class="badge badge-success">Setup Subscription</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ng-show="subscription.plan.id === 'expired'">
|
||||
<a ng-href="" ng-click="showSubscriptionModal()" style="cursor: pointer">
|
||||
<span class="badge badge-danger">Subscription expired</span>
|
||||
<ul class="nav navbar-nav navbar-right" ng-hide="hideNavBarActions">
|
||||
<li ng-show="subscription.plan.id === 'free' || subscription.plan.id === 'expired'">
|
||||
<a ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + subscription.emailEncoded + '&cloudronId=' + subscription.cloudronId }}" target="_blank" ng-click="pollSubscriptionStatus()" style="cursor: pointer">
|
||||
<span class="badge badge-success" ng-show="subscription.plan.id === 'free'">Setup Subscription</span>
|
||||
<span class="badge badge-success" ng-show="subscription.plan.id === 'expired'">Reactivate Subscription</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
+25
-30
@@ -12,9 +12,10 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
$scope.client = Client;
|
||||
$scope.subscription = {};
|
||||
$scope.notifications = [];
|
||||
|
||||
$scope.hideNavBarActions = $location.path() === '/logs';
|
||||
|
||||
var waitingForPlanSelection = false;
|
||||
|
||||
$scope.isActive = function (url) {
|
||||
if (!$route.current) return false;
|
||||
return $route.current.$$route.originalPath.indexOf(url) === 0;
|
||||
@@ -26,23 +27,13 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
Client.logout();
|
||||
};
|
||||
|
||||
$scope.waitingForPlanSelection = false;
|
||||
$('#setupSubscriptionModal').on('hide.bs.modal', function () {
|
||||
$scope.waitingForPlanSelection = false;
|
||||
|
||||
// check for updates to stay in sync
|
||||
Client.checkForUpdates(function (error) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
Client.refreshConfig();
|
||||
});
|
||||
});
|
||||
|
||||
$scope.showSubscriptionModal = function () {
|
||||
$('#setupSubscriptionModal').modal('show');
|
||||
// NOTE: this function is exported and called from the settings.js
|
||||
$scope.pollSubscriptionStatus = function () {
|
||||
if (waitingForPlanSelection) return; // prevent double polling
|
||||
waitingForPlanSelection = true;
|
||||
|
||||
function checkPlan() {
|
||||
if (!$scope.waitingForPlanSelection) return;
|
||||
if (!waitingForPlanSelection) return;
|
||||
|
||||
Client.getSubscription(function (error, subscription) {
|
||||
if (error) return console.error(error);
|
||||
@@ -51,28 +42,23 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
if (subscription.plan.id === 'free' || subscription.plan.id === 'expired') {
|
||||
$timeout(checkPlan, 5000);
|
||||
} else {
|
||||
$scope.waitingForPlanSelection = false;
|
||||
$('#setupSubscriptionModal').modal('hide');
|
||||
waitingForPlanSelection = false;
|
||||
$scope.subscription = subscription;
|
||||
|
||||
// check for updates to stay in sync
|
||||
Client.checkForUpdates(function (error) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
Client.refreshConfig();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$scope.waitingForPlanSelection = true;
|
||||
|
||||
checkPlan();
|
||||
};
|
||||
|
||||
function refreshNotifications() {
|
||||
Client.getNotifications(false, 1, 20, function (error, results) {
|
||||
if (error) console.error(error);
|
||||
else $scope.notifications = results;
|
||||
|
||||
$timeout(refreshNotifications, 60 * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
// NOTE: this function is exported and called from the settings.js
|
||||
// NOTE: this function is exported and called from the appstore.js
|
||||
$scope.updateSubscriptionStatus = function () {
|
||||
if (!Client.getUserInfo().admin) return;
|
||||
|
||||
@@ -84,6 +70,15 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
|
||||
});
|
||||
};
|
||||
|
||||
function refreshNotifications() {
|
||||
Client.getNotifications(false, 1, 20, function (error, results) {
|
||||
if (error) console.error(error);
|
||||
else $scope.notifications = results;
|
||||
|
||||
$timeout(refreshNotifications, 60 * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
// update state of acknowledged notification
|
||||
$scope.notificationAcknowledged = function (notificationId) {
|
||||
// remove notification from list
|
||||
|
||||
+4
-16
@@ -34,11 +34,7 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
|
||||
$scope.update.error.generic = null;
|
||||
$scope.update.busy = false;
|
||||
|
||||
if (!$scope.config.update.box.sourceTarballUrl) {
|
||||
$('#setupSubscriptionModal').modal('show');
|
||||
} else {
|
||||
$('#updateModal').modal('show');
|
||||
}
|
||||
$('#updateModal').modal('show');
|
||||
},
|
||||
|
||||
stopUpdate: function () {
|
||||
@@ -359,18 +355,10 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
|
||||
}
|
||||
|
||||
$scope.pollSubscriptionStatus = function () {
|
||||
Client.getSubscription(function (error, result) {
|
||||
if (error && error.statusCode === 412) return; // not yet registered
|
||||
if (error) return console.error(error);
|
||||
if (!$scope.$parent) return; // user changed view. otherwise we get an error that $scope.$parent is null
|
||||
if (!$scope.$parent) return; // user changed view. otherwise we get an error that $scope.$parent is null
|
||||
|
||||
$scope.subscription = result;
|
||||
|
||||
// also reload the subscription on the main controller
|
||||
$scope.$parent.updateSubscriptionStatus();
|
||||
|
||||
$timeout($scope.pollSubscriptionStatus, 10 * 1000);
|
||||
});
|
||||
// poll on the main controller
|
||||
$scope.$parent.pollSubscriptionStatus();
|
||||
};
|
||||
|
||||
$('#avatarFileInput').get(0).onchange = function (event) {
|
||||
|
||||
Reference in New Issue
Block a user