Remove postinstall message from the appstore view

This is now shown on first click
This commit is contained in:
Johannes Zellner
2018-06-14 16:07:27 +02:00
parent 37c8b2b57f
commit 1039d9c95e
2 changed files with 11 additions and 35 deletions

View File

@@ -150,15 +150,9 @@
<h4 class="text-danger">Subscription required to install more apps.</h4>
<p>The free plan only allows 2 apps. Please sign up for a paid plan to install more apps.</p>
</div>
<div class="collapse" id="postInstallMessage" data-toggle="false">
<div class="appstore-install-description">
<div ng-bind-html="appInstall.app.manifest.postInstallMessage | postInstallMessage:appInstall.app | markdown2html"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-show="appInstall.state !== 'postInstall'" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" ng-show="appInstall.state === 'postInstall'" data-dismiss="modal" ng-click="appInstall.switchToAppsView()">Got it</button>
<button type="button" class="btn btn-default"data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" ng-show="config.provider === 'caas' && user.admin && appInstall.state === 'resourceConstraint'" ng-click="showView('/settings')">Upgrade Cloudron</button>
<button type="button" class="btn btn-danger" ng-show="config.provider !== 'caas' && user.admin && appInstall.state === 'resourceConstraint'" ng-click="appInstall.showForm(true)">Install anyway</button>
<button type="button" class="btn btn-success" ng-show="appInstall.state === 'appInfo' && user.admin" ng-click="appInstall.showForm()">Install</button>

View File

@@ -75,7 +75,6 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$('#collapseInstallForm').collapse('hide');
$('#collapseResourceConstraint').collapse('hide');
$('#collapseAppLimitReached').collapse('hide');
$('#postInstallMessage').collapse('hide');
$('#collapseMediaLinksCarousel').collapse('show');
if ($scope.appInstallForm) {
@@ -158,9 +157,6 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
sso: !$scope.appInstall.optionalSso ? undefined : ($scope.appInstall.accessRestrictionOption !== 'nosso')
};
// add sso property for the postInstall message to be shown correctly
$scope.appInstall.app.sso = data.sso;
Client.installApp($scope.appInstall.app.id, $scope.appInstall.app.manifest, $scope.appInstall.app.title, data, function (error, newAppId) {
if (error) {
if (error.statusCode === 402) {
@@ -194,35 +190,21 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
// stash new app id for later
$scope.appInstall.app.id = newAppId;
$scope.appInstall.postInstall();
});
},
postInstall: function () {
if ($scope.appInstall.app.manifest.postInstallMessage) {
$scope.appInstall.state = 'postInstall';
$('#collapseInstallForm').collapse('hide');
$('#postInstallMessage').collapse('show');
// we track the postinstall confirmation for the current user's browser
// TODO later we might want to have a notification db to track the state across admins and browsers
localStorage['confirmPostInstall_' + $scope.appInstall.app.id] = true;
if ($scope.appInstall.app.manifest.postInstallMessage) {
localStorage['confirmPostInstall_' + $scope.appInstall.app.id] = true;
}
return;
}
$scope.appInstall.switchToAppsView();
},
switchToAppsView: function () {
// wait for dialog to be fully closed to avoid modal behavior breakage when moving to a different view already
$('#appInstallModal').on('hidden.bs.modal', function () {
$scope.$apply(function () {
$location.path('/apps').search({ });
// wait for dialog to be fully closed to avoid modal behavior breakage when moving to a different view already
$('#appInstallModal').on('hidden.bs.modal', function () {
$scope.$apply(function () {
$location.path('/apps').search({ });
});
});
});
$('#appInstallModal').modal('hide');
$('#appInstallModal').modal('hide');
});
}
};