Commit d19f9fd7 authored by Georgios Ouzounis's avatar Georgios Ouzounis
Browse files

Service-VM: Remove projects with not enough quotas from drop down lists.

parent de05dc1b
......@@ -6,6 +6,7 @@ var UploadController = Ember.Controller.extend({
outOfSpace: false,
userHasEnteredData: false,
submitDisabled: false,
enoughQuotas: false,
actions : {
upload: function() {
......
......@@ -11,6 +11,10 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
});
},
afterModel: function(model) {
// After the models are loaded, check each project's quotas. If a least one project
// has enough quotas to create a Lambda Instance, set enoughQuotas to true.
// Delete every project that doesn't have the quotas to create the smallest Lambda
// Instance.
for (var i = 0;i < model.userOkeanosProjects.get('length');i++){
if (model.userOkeanosProjects.objectAt(i).get('vm') >= 2 &&
model.userOkeanosProjects.objectAt(i).get('cpu') >= 4 &&
......@@ -18,8 +22,14 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
model.userOkeanosProjects.objectAt(i).get('disk') >= 21474836480 &&
model.userOkeanosProjects.objectAt(i).get('floating_ip') >= 1 &&
model.userOkeanosProjects.objectAt(i).get('private_network') >= 1) {
this.controllerFor('create-lambda-instance').set('enoughQuotas', true);
if(!this.controllerFor('create-lambda-instance').get('enoughQuotas')){
this.controllerFor('create-lambda-instance').set('enoughQuotas', true);
}
}
else{
model.userOkeanosProjects.objectAt(i).deleteRecord();
}
}
}
});
......@@ -17,6 +17,22 @@ var UploadRoute = Ember.Route.extend(AuthenticatedRouteMixin, {
}
},
},
afterModel: function(model) {
// After the models are loaded, check each project's quotas. If a least one project
// has enough quotas to upload a Lambda Application, set enoughQuotas to true.
// Delete every project that has no quotas on Pithos+.
for (var i = 0;i < model.userOkeanosProjects.get('length');i++){
if (model.userOkeanosProjects.objectAt(i).get('pithos_space') > 0) {
if(!this.controllerFor('lambda-apps.upload').get('enoughQuotas')){
this.controllerFor('lambda-apps.upload').set('enoughQuotas', true);
}
}
else{
model.userOkeanosProjects.objectAt(i).deleteRecord();
}
}
}
});
export default UploadRoute;
......@@ -38,6 +38,21 @@
<div class="col-xs-12">
</div><!--col-xs-12-->
</div><!--row-->
{{#unless enoughQuotas}}
<div class="row">
<div class="col-xs-12">
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-warning"></i> Alert! - No resources available to upload a Lambda Application.</h4>
Based on the ~okeanos projects we found on your ~okeanos profile, you don't have the resources needed to upload a Lambda Application.
A Lambda Application requires at least some available space on <a href="https://okeanos.grnet.gr/services/pithos/">Pithos+</a> service.
</div> <!-- class="alert alert-warning alert-dismissable" -->
</div> <!-- col-xs-12 -->
</div><!-- row -->
{{/unless}}
{{#if enoughQuotas}}
<form method="post" id="upload-app-form" {{action "upload" on="submit"}}>
<div class="row">
<div class="col-xs-12">
......@@ -150,4 +165,5 @@
</form>
{{/if}}
</section><!-- /.content -->
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment