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

Side by Side Diff: app/views/ghost-inspector.js

Issue 11804043: Fix subordinate behavior in Juju Core
Patch Set: Fix subordinate behavior in Juju Core Created 11 years, 8 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:
View unified diff | Download patch
« no previous file with comments | « app/views/environment.js ('k') | app/views/inspector.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 */ 87 */
88 Y.namespace('juju.controller').ghostInspector = { 88 Y.namespace('juju.controller').ghostInspector = {
89 /** 89 /**
90 Handles deployment of the charm. 90 Handles deployment of the charm.
91 91
92 @method handleDeploy 92 @method handleDeploy
93 */ 93 */
94 deployCharm: function() { 94 deployCharm: function() {
95 var options = this.options, 95 var options = this.options,
96 container = options.container, 96 container = options.container,
97 model = options.model,
97 serviceName = container.one('input[name=service-name]').get('value'), 98 serviceName = container.one('input[name=service-name]').get('value'),
98 numUnits = parseInt( 99 isSubordinate = model.get('is_subordinate'),
99 container.one('input[name=number-units]').get('value'), 10), 100 numUnits = (
101 isSubordinate ? 0 :
102 parseInt(
103 container.one('input[name=number-units]').get('value'), 10)),
100 config; 104 config;
101 105
102 if (this.checkForExistingService(serviceName)) { 106 if (this.checkForExistingService(serviceName)) {
103 options.db.notifications.add( 107 options.db.notifications.add(
104 new models.Notification({ 108 new models.Notification({
105 title: 'Attempting to deploy service ' + serviceName, 109 title: 'Attempting to deploy service ' + serviceName,
106 message: 'A service with that name already exists.', 110 message: 'A service with that name already exists.',
107 level: 'error' 111 level: 'error'
108 })); 112 }));
109 return; 113 return;
110 } 114 }
111 115
112 // Check if a file has been uploaded and use that config. 116 // Check if a file has been uploaded and use that config.
113 if (this.configFileContent) { 117 if (this.configFileContent) {
114 config = null; 118 config = null;
115 } else { 119 } else {
116 config = utils.getElementsValuesMapping( 120 config = utils.getElementsValuesMapping(
117 container, '.service-config .config-field'); 121 container, '.service-config .config-field');
118 } 122 }
119 123
120 options.env.deploy( 124 options.env.deploy(
121 this.options.model.get('id'), 125 model.get('id'),
122 serviceName, config, this.configFileContent, 126 serviceName, config, this.configFileContent,
123 numUnits, Y.bind( 127 numUnits, Y.bind(
124 this._deployCallbackHandler, this, serviceName, config)); 128 this._deployCallbackHandler, this, serviceName, config));
125 }, 129 },
126 130
127 /** 131 /**
128 Checks the database for an existing service with the same name. 132 Checks the database for an existing service with the same name.
129 133
130 @method checkForExistingService 134 @method checkForExistingService
131 @param {String} serviceName of the new service to deploy. 135 @param {String} serviceName of the new service to deploy.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 loading: false, 249 loading: false,
246 config: config 250 config: config
247 }); 251 });
248 252
249 this.closeInspector(); 253 this.closeInspector();
250 } 254 }
251 255
252 }; 256 };
253 257
254 }); 258 });
OLDNEW
« no previous file with comments | « app/views/environment.js ('k') | app/views/inspector.js » ('j') | no next file with comments »

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