Update the underlying node model when toggling eligibility in mirage

This commit is contained in:
Michael Lange
2019-11-02 00:54:37 -07:00
parent 09b62eb8cb
commit 44904ba3f1

View File

@@ -207,8 +207,12 @@ export default function() {
return this.serialize(allocations.where({ nodeId: params.id }));
});
this.post('/node/:id/eligibility', function({ nodes }, { params }) {
return this.serialize(nodes.find({ id: params.id }));
this.post('/node/:id/eligibility', function({ nodes }, { params, requestBody }) {
const body = JSON.parse(requestBody);
const node = nodes.find({ id: params.id });
node.update({ schedulingEligibility: body.Elibility === 'eligible' });
return this.serialize(node);
});
this.post('/node/:id/drain', function({ nodes }, { params }) {