display post install message after installation

fixes #19
This commit is contained in:
Girish Ramakrishnan
2016-09-07 12:36:49 -07:00
parent a52f1e07ee
commit b4c030b02b
2 changed files with 31 additions and 9 deletions

View File

@@ -111,9 +111,15 @@
<h4 class="text-danger">This Cloudron is running low on resources.</h4>
<p>Please upgrade to a bigger plan. Alternately, free up resources by uninstalling unused applications.</p>
</div>
<div class="collapse" id="postInstallMessage" data-toggle="false">
<div class="appstore-install-description">
<div ng-bind-html="appInstall.app.manifest.postInstallMessage | markdown2html"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<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()">OK</button>
<button type="button" class="btn btn-success" ng-show="config.provider === 'caas' && user.admin && appInstall.state === 'resourceConstraint'" ng-click="showRequestUpgrade()">Upgrade Cloudron</button>
<button type="button" class="btn btn-danger" ng-show="(config.isDev || 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

@@ -71,6 +71,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$('#collapseInstallForm').collapse('hide');
$('#collapseResourceConstraint').collapse('hide');
$('#collapseMediaLinksCarousel').collapse('show');
$('#postInstallMessage').collapse('hide');
if ($scope.appInstallForm) {
$scope.appInstallForm.$setPristine();
@@ -174,15 +175,30 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.appInstall.busy = false;
// 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.appInstall.reset();
$('#appInstallModal').off('hidden.bs.modal');
$location.path('/apps');
});
$('#appInstallModal').modal('hide');
$scope.appInstall.postInstall();
});
},
postInstall: function () {
if ($scope.appInstall.app.manifest.postInstallMessage) {
$scope.appInstall.state = 'postInstall';
$('#collapseInstallForm').collapse('hide');
$('#postInstallMessage').collapse('show');
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.appInstall.reset();
$('#appInstallModal').off('hidden.bs.modal');
$location.path('/apps');
});
$('#appInstallModal').modal('hide');
}
};