Index: app/store/env/sandbox.js |
=== modified file 'app/store/env/sandbox.js' |
--- app/store/env/sandbox.js 2013-03-22 00:19:09 +0000 |
+++ app/store/env/sandbox.js 2013-04-01 22:32:24 +0000 |
@@ -352,6 +352,26 @@ |
PLACEHOLDER. This exists to demo existing functionality. |
**/ |
performOp_update_annotations: function(data) { |
+ }, |
+ |
+ /** |
+ Handles add unit operations from the client. |
+ |
+ @method performOp_add_unit |
+ @param {Object} data contains serviceName and numUnits required for adding |
+ additional units. |
+ */ |
+ performOp_add_unit: function(data) { |
+ var res = this.get('state').addUnit(data.service_name, data.num_units); |
+ if (res.error) { |
+ data.err = res.error; |
+ } else { |
+ data.result = Y.Array.map(res.units, function(unit) { |
+ return unit.id; |
+ }); |
+ } |
+ // respond with the new data or error |
+ this.get('client').receiveNow(data); |
} |
}); |