Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(240)

Unified Diff: app/store/env/python.js

Issue 8728043: Support setting constraints for the go backend.
Patch Set: Support setting constraints for the go backend. Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/store/env/go.js ('k') | app/views/service.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/store/env/python.js
=== modified file 'app/store/env/python.js'
--- app/store/env/python.js 2013-04-03 11:12:24 +0000
+++ app/store/env/python.js 2013-04-12 21:53:39 +0000
@@ -356,21 +356,31 @@
data: data}, callback, true);
},
+ // The constraints that the backend understands. Used to generate forms.
+ genericConstraints: ['cpu', 'mem', 'arch'],
+
/**
* Change the constraints of the given service.
*
* @method set_constraints
* @param {String} service The service name.
- * @param {Object} constraints The charm constraints.
+ * @param {Object} constraints A hash of charm constraints.
* @param {Function} callback A callable that must be called once the
operation is performed.
* @return {undefined} Sends a message to the server only.
*/
set_constraints: function(service, constraints, callback) {
+ // Transform the constraints mapping into a string the backend
+ // understands.
+ var values = [];
+ Y.Object.each(constraints, function(value, name) {
+ values.push(name + '=' + value);
+ });
+
this._send_rpc({
op: 'set_constraints',
service_name: service,
- constraints: constraints}, callback, true);
+ constraints: values}, callback, true);
},
/**
« no previous file with comments | « app/store/env/go.js ('k') | app/views/service.js » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b