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

Delta Between Two Patch Sets: app/store/env/fakebackend.js

Issue 11110043: Implement the service constraints viewlet.
Left Patch Set: Implement the service constraints viewlet. Created 11 years, 9 months ago
Right Patch Set: Implement the service constraints viewlet. Created 11 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « [revision details] ('k') | app/templates/service-constraints-viewlet.handlebars » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 This file is part of the Juju GUI, which lets users view and manage Juju 2 This file is part of the Juju GUI, which lets users view and manage Juju
3 environments within a graphical interface (https://launchpad.net/juju-gui). 3 environments within a graphical interface (https://launchpad.net/juju-gui).
4 Copyright (C) 2012-2013 Canonical Ltd. 4 Copyright (C) 2012-2013 Canonical Ltd.
5 5
6 This program is free software: you can redistribute it and/or modify it under 6 This program is free software: you can redistribute it and/or modify it under
7 the terms of the GNU Affero General Public License version 3, as published by 7 the terms of the GNU Affero General Public License version 3, as published by
8 the Free Software Foundation. 8 the Free Software Foundation.
9 9
10 This program is distributed in the hope that it will be useful, but WITHOUT 10 This program is distributed in the hope that it will be useful, but WITHOUT
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 } 1067 }
1068 1068
1069 var existing = service.get('config'); 1069 var existing = service.get('config');
1070 if (!existing) { 1070 if (!existing) {
1071 existing = {}; 1071 existing = {};
1072 } 1072 }
1073 1073
1074 if (!config) { 1074 if (!config) {
1075 config = {}; 1075 config = {};
1076 } 1076 }
1077 // Merge new constraints in. 1077 // Merge new config in.
1078 existing = Y.mix(existing, config, true, undefined, 0, true); 1078 existing = Y.mix(existing, config, true, undefined, 0, true);
1079 //TODO: validate the config. 1079 //TODO: validate the config.
1080 // Reassign the attr. 1080 // Reassign the attr.
1081 service.set('config', existing); 1081 service.set('config', existing);
1082 // The callback indicates done, we can pass anything back. 1082 // The callback indicates done, we can pass anything back.
1083 this.changes.services[service.get('id')] = [service, true]; 1083 this.changes.services[service.get('id')] = [service, true];
1084 return {result: existing}; 1084 return {result: existing};
1085 }, 1085 },
1086 1086
1087 /** 1087 /**
(...skipping 17 matching lines...) Expand all
1105 } 1105 }
1106 1106
1107 var existing = service.get('constraints'); 1107 var existing = service.get('constraints');
1108 if (!existing) { 1108 if (!existing) {
1109 existing = {}; 1109 existing = {};
1110 } 1110 }
1111 1111
1112 if (Y.Lang.isArray(data)) { 1112 if (Y.Lang.isArray(data)) {
1113 Y.Array.each(data, function(i) { 1113 Y.Array.each(data, function(i) {
1114 var kv = i.split('='); 1114 var kv = i.split('=');
1115 if (kv[1]) { 1115 constraints[kv[0]] = kv[1];
1116 constraints[kv[0]] = kv[1];
1117 }
1118 }); 1116 });
1119 } else if (data) { 1117 } else if (data) {
1120 constraints = data; 1118 constraints = data;
1121 } 1119 }
1122 // Merge new constraints in. 1120 // Merge new constraints in.
1123 existing = Y.mix(existing, constraints, true, undefined, 0, true); 1121 existing = Y.mix(existing, constraints, true, undefined, 0, true);
1124 // TODO: Validate the constraints. 1122 // TODO: Validate the constraints.
1125 // Reassign the attr. 1123 // Reassign the attr.
1126 service.set('constraints', existing); 1124 service.set('constraints', existing);
1127 this.changes.services[service.get('id')] = [service, true]; 1125 this.changes.services[service.get('id')] = [service, true];
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 Y.namespace('juju.environments').FakeBackend = FakeBackend; 1388 Y.namespace('juju.environments').FakeBackend = FakeBackend;
1391 1389
1392 }, '0.1.0', { 1390 }, '0.1.0', {
1393 requires: [ 1391 requires: [
1394 'base', 1392 'base',
1395 'js-yaml', 1393 'js-yaml',
1396 'juju-models', 1394 'juju-models',
1397 'promise' 1395 'promise'
1398 ] 1396 ]
1399 }); 1397 });
LEFTRIGHT

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