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

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

Issue 13335048: Fix go relations in sandbox
Patch Set: Fix go relations in sandbox Created 11 years, 7 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/base.js ('k') | app/store/env/sandbox.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/store/env/fakebackend.js
=== modified file 'app/store/env/fakebackend.js'
--- app/store/env/fakebackend.js 2013-08-26 13:50:58 +0000
+++ app/store/env/fakebackend.js 2013-09-03 10:02:52 +0000
@@ -698,8 +698,11 @@
and endpoint connection type ie) wordpress:db.
@param {String} endpointB A string representation of the service name
and endpoint connection type ie) wordpress:db.
+ @param {Boolean} useRelationCount whether or not to generate and
+ incremented relation id or to just use the name and types of the
+ endpoints.
*/
- addRelation: function(endpointA, endpointB) {
+ addRelation: function(endpointA, endpointB, useRelationCount) {
if (!this.get('authenticated')) {
return UNAUTHENTICATED_ERROR;
}
@@ -726,16 +729,22 @@
if (match.error) { return match; }
// Assign a unique relation id which is incremented after every
- // successful relation.
- var relationId = 'relation-' + this._relationCount;
+ // successful relation if useRelationCount is set to true. If not, then
+ // it will be set with the requires/provides endpoint names.
+ var relationId = '';
+ if (useRelationCount) {
+ relationId = 'relation-' + this._relationCount;
+ } else {
+ relationId = [
+ match.requires.name + ':' + match.requires.type,
+ match.provides.name + ':' + match.provides.type
+ ].join(' ');
+ }
// The ordering of requires and provides is stable in Juju Core, and not
// specified in PyJuju.
var endpoints = Y.Array.map(
[match.requires, match.provides],
function(endpoint) {
- var result = [];
- result.push(endpoint.name);
- result.push({name: endpoint.type});
return [endpoint.name, {name: endpoint.type}];
});
« no previous file with comments | « app/store/env/base.js ('k') | app/store/env/sandbox.js » ('j') | no next file with comments »

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