Commit acca28af authored by Ioannis Tsafaras's avatar Ioannis Tsafaras
Browse files

Add "Show failed Lambda Instances" checkbox

Add the ability to set whether Lambda Instances with "failed" status are visible on the Lambda Instance list page
parent 5f743c06
......@@ -8,10 +8,15 @@ export default Ember.ArrayController.extend({
session: Ember.inject.service('session'),
delete_success_message: '',
delete_error_message: '',
showFailed: false,
queryParams: ["page", "perPage"],
sortAscending: true,
sortProperties: ['name'],
instanceCount: Ember.computed('model.length', function() {
return this.get('model.length');
}),
page: 1,
perPage: 10,
firstOfCurrentPage: Ember.computed('page', 'perPage', function() {
......@@ -22,8 +27,8 @@ export default Ember.ArrayController.extend({
return (this.get('page')-1)*(this.get('perPage'))+1;
}
}),
lastOfCurrentPage: Ember.computed('page', 'perPage', 'content', function() {
return Math.min(this.get('content.length'), (this.get('page'))*(this.get('perPage')));
lastOfCurrentPage: Ember.computed('page', 'perPage', 'instanceCount', function() {
return Math.min(this.get('instanceCount'), (this.get('page'))*(this.get('perPage')));
}),
pagedContent: pagedArray('arrangedContent', {pageBinding: "page", perPageBinding: "perPage"}),
......
......@@ -23,7 +23,20 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
if (this.store.peekAll('instance-action').get('length') === 0) {
hash.instance_action = this.store.createRecord('instance-action', {});
}
return Ember.RSVP.hash(hash);
var _this = this;
return Ember.RSVP.hash(hash).then(function (hash) {
if (!_this.controllerFor('lambda-instances.index').get('showFailed')) {
hash.instances.forEach(function (instance) {
let status_code = instance.get('status_code');
if (status_code === 9) {
instance.unloadRecord();
}
});
}
_this.controllerFor('lambda-instances.index').send('checkPage');
return hash;
});
},
......@@ -32,6 +45,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
controller.set('instance_action', model.instance_action);
controller.set('failure', false);
controller.set('failed_delete', false);
controller.set('showFailed', false);
controller.send('checkPage');
},
......
......@@ -85,7 +85,10 @@
<i class="fa fa-laptop"></i> Create New Instance</a>
{{/link-to}}
</div><!--box-tools-->
<h5><label>{{input type="checkbox" name="showFailed" checked=showFailed}}
Show failed Lambda Instances</label></h5>
</div><!-- /.box-header -->
{{#if model.length}}
<div class="box-body">
<div class="row">
......
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