Warn the user about installing too many apps, but give an override button

This commit is contained in:
Johannes Zellner
2016-02-25 12:41:15 +01:00
committed by girish@cloudron.io
parent f5189e0a56
commit fab5e36bfe
2 changed files with 8 additions and 4 deletions
+3 -2
View File
@@ -80,12 +80,13 @@
</div>
</div>
<div class="collapse" id="collapseResourceConstraint" data-toggle="false">
<h4 class="text-danger">Not enough resources left to install this application.</h4>
<p>The Cloudron's resources can be extended with a model upgrade or available resources may be freed up by uninstalling unused applications.</p>
<h4 class="text-danger">This Cloudron is running low on resources.</h4>
<p>Installing this app might decrease the performance of other apps. The Cloudron's resources can be extended with a model upgrade or available resources may be freed up by uninstalling unused applications.</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-danger" ng-show="!appInstall.installFormVisible && user.admin && appInstall.resourceConstraintVisible" ng-click="showInstallForm(true)">Install anyway</button>
<button type="button" class="btn btn-success" ng-show="!appInstall.installFormVisible && user.admin && !appInstall.resourceConstraintVisible" ng-click="showInstallForm()">Install</button>
<button type="button" class="btn btn-success" ng-show="appInstall.installFormVisible && user.admin && !appInstall.resourceConstraintVisible" ng-click="doInstall()" ng-disabled="appInstallForm.$invalid || appInstall.busy"><i class="fa fa-spinner fa-pulse" ng-show="appInstall.busy"></i> Install</button>
</div>
+5 -2
View File
@@ -157,13 +157,16 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.appInstallForm.$setUntouched();
};
$scope.showInstallForm = function () {
if (Client.enoughResourcesAvailable($scope.appInstall.app)) {
$scope.showInstallForm = function (force) {
if (Client.enoughResourcesAvailable($scope.appInstall.app) || force) {
$scope.appInstall.installFormVisible = true;
$scope.appInstall.resourceConstraintVisible = false;
$('#collapseMediaLinksCarousel').collapse('hide');
$('#collapseResourceConstraint').collapse('hide');
$('#collapseInstallForm').collapse('show');
$('#appInstallLocationInput').focus();
} else {
$scope.appInstall.installFormVisible = false;
$scope.appInstall.resourceConstraintVisible = true;
$('#collapseMediaLinksCarousel').collapse('hide');
$('#collapseResourceConstraint').collapse('show');