@@ -88,26 +88,26 @@ describe('USSOLoginLink', () => {
it('can render a button link with custom content', () => {
const component = jsTestUtils.shallowRender(
-
+
Scooby Doo
- , true);
+ , true);
const output = component.getRenderOutput();
assert.equal(output.props.children[0].props.children, 'Scooby Doo');
});
it('can render a text link with custom content', () => {
const component = jsTestUtils.shallowRender(
-
+
Scooby Doo
- , true);
+ , true);
const output = component.getRenderOutput();
assert.equal(output.props.children[0].props.children, 'Scooby Doo');
});
@@ -115,9 +115,9 @@ describe('USSOLoginLink', () => {
it('calls loginToController on click for button link', () => {
const loginToController = sinon.stub();
const output = testUtils.renderIntoDocument(
-
, true);
+
, true);
testUtils.Simulate.click(
testUtils.findRenderedDOMComponentWithTag(output, 'button'));
assert.equal(loginToController.callCount, 1);
diff --git a/jujugui/static/gui/src/app/d3-components/d3-components.js b/jujugui/static/gui/src/app/d3-components/d3-components.js
index ba2358bf06..5934253b4e 100644
--- a/jujugui/static/gui/src/app/d3-components/d3-components.js
+++ b/jujugui/static/gui/src/app/d3-components/d3-components.js
@@ -52,7 +52,7 @@ YUI.add('d3-components', function(Y) {
initializer: function() {
this.events = Y.mix(this.events, this._defaultEvents,
- false, undefined, 0, true);
+ false, undefined, 0, true);
},
@@ -182,7 +182,7 @@ YUI.add('d3-components', function(Y) {
}
if (typeof(result.callback) !== 'function') {
console.error('Unable to resolve a proper callback for',
- selector, handler, module.name, result);
+ selector, handler, module.name, result);
return;
}
// Set up binding context for callback.
diff --git a/jujugui/static/gui/src/app/extensions/app-cookies-extension.js b/jujugui/static/gui/src/app/extensions/app-cookies-extension.js
index 81e149bbf1..5c944e545a 100644
--- a/jujugui/static/gui/src/app/extensions/app-cookies-extension.js
+++ b/jujugui/static/gui/src/app/extensions/app-cookies-extension.js
@@ -98,7 +98,7 @@ YUI.add('app-cookies-extension', function(Y) {
content={content}
dismiss={this.close.bind(this)}
extraClasses="p-notification--center-bottom" />,
- document.getElementById('cookie-container'));
+ document.getElementById('cookie-container'));
},
/**
@@ -106,7 +106,7 @@ YUI.add('app-cookies-extension', function(Y) {
*/
_removeNotification: function() {
ReactDOM.unmountComponentAtNode(
- document.getElementById('cookie-container'));
+ document.getElementById('cookie-container'));
},
/**
diff --git a/jujugui/static/gui/src/app/extensions/autodeploy-extension.js b/jujugui/static/gui/src/app/extensions/autodeploy-extension.js
index f688b18dbf..d39829fba4 100644
--- a/jujugui/static/gui/src/app/extensions/autodeploy-extension.js
+++ b/jujugui/static/gui/src/app/extensions/autodeploy-extension.js
@@ -130,7 +130,7 @@ YUI.add('autodeploy-extension', function(Y) {
var createdMachineName = createdMachine.name;
if (createdMachineName) {
machine = db.machines.updateModelId(
- machine, createdMachineName, true);
+ machine, createdMachineName, true);
// We need to revive the model so that the change event triggers
// the token UI to re-render.
var machineModel = db.machines.revive(machine);
diff --git a/jujugui/static/gui/src/app/jujulib/charmstore.js b/jujugui/static/gui/src/app/jujulib/charmstore.js
index 82dc41f9c1..f89bc4537a 100644
--- a/jujugui/static/gui/src/app/jujulib/charmstore.js
+++ b/jujugui/static/gui/src/app/jujulib/charmstore.js
@@ -126,7 +126,7 @@ var module = module;
// Create shallow copies of objects for the copy.
var copy =
(typeof obj[key] === 'object' && obj[key] !== null) ?
- JSON.parse(JSON.stringify(obj[key])) : obj[key];
+ JSON.parse(JSON.stringify(obj[key])) : obj[key];
host[newKey] = copy;
if (typeof obj[key] === 'object' && obj[key] !== null) {
// Decrement exclude by one if it exists.
@@ -503,7 +503,7 @@ var module = module;
*/
getBundleYAML: function(id, callback) {
this.getEntity(
- id, this._getBundleYAMLResponse.bind(this, callback));
+ id, this._getBundleYAMLResponse.bind(this, callback));
},
/**
diff --git a/jujugui/static/gui/src/app/jujulib/index.js b/jujugui/static/gui/src/app/jujulib/index.js
index ea16d8252d..ef7b1732cb 100644
--- a/jujugui/static/gui/src/app/jujulib/index.js
+++ b/jujugui/static/gui/src/app/jujulib/index.js
@@ -27,7 +27,7 @@ var module = module;
*/
const serializeObject = function(obj) {
return Object.keys(obj).map(p =>
- `${encodeURIComponent(p)}=${encodeURIComponent(obj[p])}`).join('&');
+ `${encodeURIComponent(p)}=${encodeURIComponent(obj[p])}`).join('&');
};
/**
@param {Function} callback The callback to wrap.
diff --git a/jujugui/static/gui/src/app/jujulib/plans.js b/jujugui/static/gui/src/app/jujulib/plans.js
index 92bae679c5..5e5fa1e0a3 100644
--- a/jujugui/static/gui/src/app/jujulib/plans.js
+++ b/jujugui/static/gui/src/app/jujulib/plans.js
@@ -48,7 +48,7 @@ var module = module;
first parameter and an authorization object as its second.
*/
authorizePlan: function(uuid, charmUrl, applicationName, planUrl, budget,
- limit, callback) {
+ limit, callback) {
const url = this.url + '/plan/authorize';
const body = JSON.stringify({
'env-uuid': uuid,
diff --git a/jujugui/static/gui/src/app/jujulib/reconnecting-websocket.js b/jujugui/static/gui/src/app/jujulib/reconnecting-websocket.js
index c1d9b41c7b..81fd422f5c 100644
--- a/jujugui/static/gui/src/app/jujulib/reconnecting-websocket.js
+++ b/jujugui/static/gui/src/app/jujulib/reconnecting-websocket.js
@@ -56,7 +56,7 @@ var module = module;
function ReconnectingWebSocket(url, protocols) {
- // These can be altered by calling code.
+ // These can be altered by calling code.
this.debug = false;
this.reconnectInterval = 1000;
this.timeoutInterval = 2000;
@@ -124,7 +124,7 @@ var module = module;
if (!reconnectAttempt && !timedOut) {
if (self.debug || ReconnectingWebSocket.debugAll) {
console.debug(
- 'ReconnectingWebSocket', 'onclose reconnect', url);
+ 'ReconnectingWebSocket', 'onclose reconnect', url);
}
self.onclose(event);
}
diff --git a/jujugui/static/gui/src/app/jujulib/test-charmstore.js b/jujugui/static/gui/src/app/jujulib/test-charmstore.js
index a7c5c1933d..01070717af 100644
--- a/jujugui/static/gui/src/app/jujulib/test-charmstore.js
+++ b/jujugui/static/gui/src/app/jujulib/test-charmstore.js
@@ -328,8 +328,8 @@ describe('jujulib charmstore', function() {
var transform = sinon.stub(charmstore, '_transformQueryResults');
charmstore.search({}, 'cb');
assert.equal(
- charmstore.bakery.get.callCount, 1,
- 'sendGetRequest not called');
+ charmstore.bakery.get.callCount, 1,
+ 'sendGetRequest not called');
var requestArgs = charmstore.bakery.get.lastCall.args;
var successCb = requestArgs[2];
assert.equal(requestArgs[0], 'path');
@@ -365,15 +365,15 @@ describe('jujulib charmstore', function() {
charmstore.list('test-author', 'cb', 'bundle');
var qs = generatePath.lastCall.args[1];
assert.equal(qs.indexOf('type=bundle') > -1, true,
- 'bundle not set in query string');
+ 'bundle not set in query string');
});
it('calls to make a valid charmstore list request', function() {
var transform = sinon.stub(charmstore, '_transformQueryResults');
charmstore.list('test-author', 'cb');
assert.equal(
- charmstore.bakery.get.callCount, 1,
- 'sendGetRequest not called');
+ charmstore.bakery.get.callCount, 1,
+ 'sendGetRequest not called');
var requestArgs = charmstore.bakery.get.lastCall.args;
var successCb = requestArgs[2];
assert.equal(requestArgs[0], 'path');
@@ -386,7 +386,7 @@ describe('jujulib charmstore', function() {
describe('getDiagramURL', function() {
it('can generate a URL for a bundle diagram', function() {
assert.equal(charmstore.getDiagramURL('apache2'),
- 'local/v5/apache2/diagram.svg');
+ 'local/v5/apache2/diagram.svg');
});
});
@@ -414,7 +414,7 @@ describe('jujulib charmstore', function() {
it('_getBundleYAMLResponse fetches yaml file contents', function() {
charmstore._getBundleYAMLResponse(
- cb, null, [{ deployerFileUrl: 'deployer file' }]);
+ cb, null, [{ deployerFileUrl: 'deployer file' }]);
var requestArgs = charmstore.bakery.get.lastCall.args;
assert.equal(requestArgs[0], 'deployer file');
// Should be the anon success callback handler.
@@ -449,7 +449,7 @@ describe('jujulib charmstore', function() {
assert.equal(requestArgs[0], 'local/v5/precise/ghost-5/expand-id');
// Call the makeRequest success handler simulating a response object;
requestArgs[2](null,
- {target: { responseText: '[{"Id": "cs:precise/ghost-4"}]'}});
+ {target: { responseText: '[{"Id": "cs:precise/ghost-4"}]'}});
});
it('calls the failure handler for json parse failures', function(done) {
@@ -463,7 +463,7 @@ describe('jujulib charmstore', function() {
charmstore.getAvailableVersions('cs:precise/ghost-5', cb);
// Call the makeRequest success handler simulating a response object;
charmstore.bakery.get.lastCall.args[2](null,
- {target: { responseText: '[notvalidjson]'}});
+ {target: { responseText: '[notvalidjson]'}});
});
});
@@ -487,7 +487,7 @@ describe('jujulib charmstore', function() {
assert.equal(requestArgs[0], 'local/v5/whoami');
// Call the makeRequest success handler simulating a response object;
requestArgs[2](null,
- {target: { responseText: '{"User": "test", "Groups": []}'}});
+ {target: { responseText: '{"User": "test", "Groups": []}'}});
});
it('calls the failure handler for json parse failures', function(done) {
@@ -501,7 +501,7 @@ describe('jujulib charmstore', function() {
charmstore.whoami(cb);
// Call the makeRequest success handler simulating a response object;
charmstore.bakery.get.lastCall.args[2](
- {target: { responseText: '[notvalidjson]'}});
+ {target: { responseText: '[notvalidjson]'}});
});
});
@@ -542,7 +542,7 @@ describe('jujulib charmstore', function() {
charmstore.getEntity('cs:foobar', sinon.stub());
var path = charmstore.bakery.get.lastCall.args[0];
assert.equal(path.indexOf('cs:'), -1,
- 'The string "cs:" should not be found in the path');
+ 'The string "cs:" should not be found in the path');
});
it('calls the correct path', function() {
diff --git a/jujugui/static/gui/src/app/models/bundle.js b/jujugui/static/gui/src/app/models/bundle.js
index e69ae4754a..ddd2c0e702 100644
--- a/jujugui/static/gui/src/app/models/bundle.js
+++ b/jujugui/static/gui/src/app/models/bundle.js
@@ -108,7 +108,7 @@ YUI.add('juju-bundle-models', function(Y) {
parsedServices.push({
id: id,
iconPath: utils.getIconPath(id, false),
- url: '', // XXX implement once determined how to handle links
+ url: '', // XXX implement once determined how to handle links
displayName: name.replace('-', ' ')
});
}
diff --git a/jujugui/static/gui/src/app/models/charm.js b/jujugui/static/gui/src/app/models/charm.js
index 207cc1a1d8..87f1505078 100644
--- a/jujugui/static/gui/src/app/models/charm.js
+++ b/jujugui/static/gui/src/app/models/charm.js
@@ -140,7 +140,7 @@ YUI.add('juju-charm-models', function(Y) {
sync: function(action, options, callback) {
if (action !== 'read') {
throw (
- 'Only use the "read" action; "' + action + '" not supported.');
+ 'Only use the "read" action; "' + action + '" not supported.');
}
if (utils.isValue(options.get_charm)) {
// This is an env.
@@ -211,8 +211,8 @@ YUI.add('juju-charm-models', function(Y) {
// Otherwise sort by package name, then by owner, then by revision.
} else {
return (
- (this.get('package_name').localeCompare(
- other.get('package_name'))) ||
+ (this.get('package_name').localeCompare(
+ other.get('package_name'))) ||
(owner ? owner.localeCompare(otherOwner) : 0) ||
(this.get('revision') - other.get('revision')));
}
@@ -467,8 +467,8 @@ YUI.add('juju-charm-models', function(Y) {
var result = (
// Prefer case-insensitive sort, but honor case when
// string match in a case-insensitive comparison.
- segmentA.localeCompare(
- segmentB, undefined, {sensitivity: 'accent'}) ||
+ segmentA.localeCompare(
+ segmentB, undefined, {sensitivity: 'accent'}) ||
segmentA.localeCompare(segmentB));
if (result) {
return result;
diff --git a/jujugui/static/gui/src/app/models/endpoints.js b/jujugui/static/gui/src/app/models/endpoints.js
index 6ed6c83b0e..15727a542f 100644
--- a/jujugui/static/gui/src/app/models/endpoints.js
+++ b/jujugui/static/gui/src/app/models/endpoints.js
@@ -101,7 +101,7 @@ YUI.add('juju-endpoints', function(Y) {
// Every non subordinate service implicitly provides this.
if (!appIsSubordinate) {
provides.push(convert(
- appId, {'interface': 'juju-info', 'name': 'juju-info'}));
+ appId, {'interface': 'juju-info', 'name': 'juju-info'}));
}
// Now check every other application to see if it can be a valid target.
db.services.each(target => {
diff --git a/jujugui/static/gui/src/app/models/entity-extension.js b/jujugui/static/gui/src/app/models/entity-extension.js
index 7eca855a59..1556c77893 100644
--- a/jujugui/static/gui/src/app/models/entity-extension.js
+++ b/jujugui/static/gui/src/app/models/entity-extension.js
@@ -75,7 +75,7 @@ YUI.add('entity-extension', function(Y) {
promulgated: attrs.is_approved,
revision_id: attrs.revision_id,
revisions: attrs.revisions,
- special: attrs.special, // XXX Not currently implemented.
+ special: attrs.special, // XXX Not currently implemented.
type: type,
url: attrs.url
};
diff --git a/jujugui/static/gui/src/app/models/handlers.js b/jujugui/static/gui/src/app/models/handlers.js
index 86fc89954e..36872a2bd4 100644
--- a/jujugui/static/gui/src/app/models/handlers.js
+++ b/jujugui/static/gui/src/app/models/handlers.js
@@ -367,9 +367,9 @@ YUI.add('juju-delta-handlers', function(Y) {
// corresponding application is added to the db. In this case, wait for
// the application delta to arrive before adding a relation.
console.log(
- 'relation change', change.key,
- 'delayed, waiting for missing application',
- applicationName);
+ 'relation change', change.key,
+ 'delayed, waiting for missing application',
+ applicationName);
var hooks = applicationChangedHooks[applicationName] || [];
hooks.push(processRelation);
applicationChangedHooks[applicationName] = hooks;
diff --git a/jujugui/static/gui/src/app/models/model-controller.js b/jujugui/static/gui/src/app/models/model-controller.js
index 0ea204c978..763a6825ee 100644
--- a/jujugui/static/gui/src/app/models/model-controller.js
+++ b/jujugui/static/gui/src/app/models/model-controller.js
@@ -76,21 +76,21 @@ YUI.add('model-controller', function(Y) {
env = this.get('env');
return this._getPromise(
- charmId, this._charmPromises,
- function(resolve, reject) {
- var charm = db.charms.getById(charmId);
- if (charm && charm.loaded) {
- resolve(charm);
- } else {
- charm = db.charms.add({url: charmId}).load(env,
- // If views are bound to the charm model, firing "update" is
- // unnecessary, and potentially even mildly harmful.
- function(err, data) {
- db.fireEvent('update');
- resolve(db.charms.getById(charmId));
- });
- }
- });
+ charmId, this._charmPromises,
+ function(resolve, reject) {
+ var charm = db.charms.getById(charmId);
+ if (charm && charm.loaded) {
+ resolve(charm);
+ } else {
+ charm = db.charms.add({url: charmId}).load(env,
+ // If views are bound to the charm model, firing "update" is
+ // unnecessary, and potentially even mildly harmful.
+ function(err, data) {
+ db.fireEvent('update');
+ resolve(db.charms.getById(charmId));
+ });
+ }
+ });
},
/**
@@ -105,34 +105,34 @@ YUI.add('model-controller', function(Y) {
env = this.get('env');
return this._getPromise(
- serviceId, this._servicePromises,
- function(resolve, reject) {
- // `this` points to the serviceList
- var service = db.services.getById(serviceId);
- // If the service and all data has already been loaded, or if the
- // service is pending, resolve.
- if (service && (service.get('loaded') || service.get('pending'))) {
- resolve(service);
- return;
- }
- if (!service || !service.get('loaded')) {
- env.getApplicationConfig(serviceId, function(result) {
- if (result.err) {
- // The service doesn't exist
- reject(result);
- } else {
- var service = db.services.getById(result.applicationName);
- service.setAttrs({
- config: result.result.config,
- constraints: result.result.constraints,
- loaded: true,
- series: result.result.series
- });
- resolve(service);
- }
- });
- }
- });
+ serviceId, this._servicePromises,
+ function(resolve, reject) {
+ // `this` points to the serviceList
+ var service = db.services.getById(serviceId);
+ // If the service and all data has already been loaded, or if the
+ // service is pending, resolve.
+ if (service && (service.get('loaded') || service.get('pending'))) {
+ resolve(service);
+ return;
+ }
+ if (!service || !service.get('loaded')) {
+ env.getApplicationConfig(serviceId, function(result) {
+ if (result.err) {
+ // The service doesn't exist
+ reject(result);
+ } else {
+ var service = db.services.getById(result.applicationName);
+ service.setAttrs({
+ config: result.result.config,
+ constraints: result.result.constraints,
+ loaded: true,
+ series: result.result.series
+ });
+ resolve(service);
+ }
+ });
+ }
+ });
},
/**
@@ -146,14 +146,14 @@ YUI.add('model-controller', function(Y) {
var mController = this;
return this._getPromise(
- serviceId, this._serviceCharmPromises,
- function(resolve, reject) {
- mController.getService(serviceId).then(function(service) {
- mController.getCharm(service.get('charm')).then(function(charm) {
- resolve({service: service, charm: charm});
- }, reject);
+ serviceId, this._serviceCharmPromises,
+ function(resolve, reject) {
+ mController.getService(serviceId).then(function(service) {
+ mController.getCharm(service.get('charm')).then(function(charm) {
+ resolve({service: service, charm: charm});
}, reject);
- });
+ }, reject);
+ });
}
}, {
diff --git a/jujugui/static/gui/src/app/models/models.js b/jujugui/static/gui/src/app/models/models.js
index 4542862102..60ba2bff0d 100644
--- a/jujugui/static/gui/src/app/models/models.js
+++ b/jujugui/static/gui/src/app/models/models.js
@@ -206,10 +206,10 @@ YUI.add('juju-models', function(Y) {
// This allows the databinding engine to react to a relation change on
// any of this services relations.
this._events.push(
- this.get('relations').on(
- ['*:change', '*:add', '*:remove'], function(e) {
- this.set('relationChangeTrigger', e);
- }, this));
+ this.get('relations').on(
+ ['*:change', '*:add', '*:remove'], function(e) {
+ this.set('relationChangeTrigger', e);
+ }, this));
},
/**
@@ -230,8 +230,8 @@ YUI.add('juju-models', function(Y) {
// done by anything but this method so that it says as representation of
// the config options as juju sees it.
this.set(
- 'environmentConfig',
- Y.merge(this.get('environmentConfig'), changeConfig));
+ 'environmentConfig',
+ Y.merge(this.get('environmentConfig'), changeConfig));
// Update the config property with the appropriate values.
this.set('config', combined);
},
@@ -693,7 +693,7 @@ YUI.add('juju-models', function(Y) {
annotations: {},
pending: true,
charm: charmId,
- unit_count: 0, // No units yet.
+ unit_count: 0, // No units yet.
loaded: false,
subordinate: charm.get('is_subordinate'),
config: config
@@ -1067,7 +1067,7 @@ YUI.add('juju-models', function(Y) {
add: function(models, allowed) {
if (!allowed && this.get('preventDirectChanges')) {
throw new Error(
- 'direct calls to units.add() are not allowed: ' +
+ 'direct calls to units.add() are not allowed: ' +
'use db.addUnits() instead'
);
}
@@ -1093,7 +1093,7 @@ YUI.add('juju-models', function(Y) {
remove: function(models, allowed) {
if (!allowed && this.get('preventDirectChanges')) {
throw new Error(
- 'direct calls to units.remove() are not allowed: ' +
+ 'direct calls to units.remove() are not allowed: ' +
'use db.removeUnits() instead'
);
}
@@ -1184,7 +1184,7 @@ YUI.add('juju-models', function(Y) {
units_for_service.each(function(unit) {
var state = utils.determineCategoryType(
- utils.simplifyState(unit, serviceLife));
+ utils.simplifyState(unit, serviceLife));
if (aggregate_map[state] === undefined) {
aggregate_map[state] = 1;
} else {
@@ -1875,7 +1875,7 @@ YUI.add('juju-models', function(Y) {
var relationModel, matching;
this.some(function(relation) {
matching = this.compareRelationEndpoints(
- relation.get('endpoints'), endpoints);
+ relation.get('endpoints'), endpoints);
if (matching) {
relationModel = relation;
return true;
@@ -1955,30 +1955,30 @@ YUI.add('juju-models', function(Y) {
ep_matched = false;
return this.some(
- function(rel) {
- svc_matched = ep_matched = false;
+ function(rel) {
+ svc_matched = ep_matched = false;
- // Match endpoint and svc name across endpoints of a relation.
- rel.get('endpoints').forEach(rep => {
- if (ep.type !== rel.get('interface')) {
- return;
- }
- if (!ep_matched) {
- ep_matched = (ep.service === rep[0] &&
+ // Match endpoint and svc name across endpoints of a relation.
+ rel.get('endpoints').forEach(rep => {
+ if (ep.type !== rel.get('interface')) {
+ return;
+ }
+ if (!ep_matched) {
+ ep_matched = (ep.service === rep[0] &&
ep.name === rep[1].name);
- }
- if (svc_name && !svc_matched && rep[0] === svc_name) {
- svc_matched = true;
- }
- });
-
- if (!svc_name && ep_matched) {
- return true;
- } else if (svc_name && ep_matched && svc_matched) {
- return true;
}
- return false;
+ if (svc_name && !svc_matched && rep[0] === svc_name) {
+ svc_matched = true;
+ }
});
+
+ if (!svc_name && ep_matched) {
+ return true;
+ } else if (svc_name && ep_matched && svc_matched) {
+ return true;
+ }
+ return false;
+ });
},
get_relations_for_service: function(service, asList) {
@@ -2075,7 +2075,7 @@ YUI.add('juju-models', function(Y) {
modelList = modelId[0];
modelId = modelId[1];
return (modelList === model.name) && (
- modelId === modelKey);
+ modelId === modelKey);
}
return false;
});
@@ -2361,7 +2361,7 @@ YUI.add('juju-models', function(Y) {
const machinePlacement = this._mapServicesToMachines(this.machines);
result.relations = this._generateRelationSpec(this.relations);
result.machines = this._generateMachineSpec(
- machinePlacement, this.machines, applications);
+ machinePlacement, this.machines, applications);
return result;
},
@@ -2734,7 +2734,7 @@ YUI.add('juju-models', function(Y) {
*/
findRelatedServices: function(service, asArray) {
var relationData = relationUtils.getRelationDataForService(this, service);
- var related = [service.get('name')]; // Add own name to related list.
+ var related = [service.get('name')]; // Add own name to related list.
// Compile the list of related services.
relationData.forEach(function(relation) {
// Some relations (e.g., peer relations) may not have the far endpoint
@@ -2832,11 +2832,11 @@ YUI.add('juju-models', function(Y) {
this.machines.each(function(machine) {
var units = this.units.filterByMachine(machine.id, true);
var keepVisible = this._highlightedServices.some(
- function(highlightedService) {
- return units.some(function(unit) {
- return unit.service === highlightedService;
- });
+ function(highlightedService) {
+ return units.some(function(unit) {
+ return unit.service === highlightedService;
});
+ });
// If we no longer have any services highlighted then we want to show
// all machine tokens.
if (this._highlightedServices.length < 1) {
diff --git a/jujugui/static/gui/src/app/state/state.js b/jujugui/static/gui/src/app/state/state.js
index 4f78dca458..4b39470b5e 100644
--- a/jujugui/static/gui/src/app/state/state.js
+++ b/jujugui/static/gui/src/app/state/state.js
@@ -130,10 +130,10 @@ const State = class State {
if (query) {
processed.query = {};
query.split('&')
- .forEach(section => {
- const parts = section.split('=');
- processed.query[parts[0]] = parts[1];
- });
+ .forEach(section => {
+ const parts = section.split('=');
+ processed.query[parts[0]] = parts[1];
+ });
}
const hash = splitURL[3];
if (hash) {
diff --git a/jujugui/static/gui/src/app/state/test-state.js b/jujugui/static/gui/src/app/state/test-state.js
index 6def7f6bd2..f578253de6 100644
--- a/jujugui/static/gui/src/app/state/test-state.js
+++ b/jujugui/static/gui/src/app/state/test-state.js
@@ -639,12 +639,12 @@ describe('State', () => {
assert.deepEqual(
state._parseSearch(
'k8s/core', {tags: 'ops,db', series: 'yakkety'}, {}), {
- search: {
- series: 'yakkety',
- tags: ['ops', 'db'],
- text: 'k8s/core'
- }
- });
+ search: {
+ series: 'yakkety',
+ tags: ['ops', 'db'],
+ text: 'k8s/core'
+ }
+ });
});
});
diff --git a/jujugui/static/gui/src/app/store/endpoints.js b/jujugui/static/gui/src/app/store/endpoints.js
index 96ac36f17d..a8f2ac73a7 100644
--- a/jujugui/static/gui/src/app/store/endpoints.js
+++ b/jujugui/static/gui/src/app/store/endpoints.js
@@ -39,9 +39,9 @@ YUI.add('juju-endpoints-controller', function(Y) {
* @class EndpointsController
*/
var EndpointsController = Y.Base.create('EndpointsController',
- Y.Base, [], {
+ Y.Base, [], {
- /**
+ /**
* Tell `Y.Base` that it should create ad hoc attributes for
* config properties.
*
@@ -52,76 +52,76 @@ YUI.add('juju-endpoints-controller', function(Y) {
* @since 3.5.0
*/
- _allowAdHocAttrs: true,
+ _allowAdHocAttrs: true,
- /**
+ /**
* @method initializer
* @param {Object} cfg Application configuration data.
*/
- initializer: function(cfg) {
- this._subscriptions = [];
- this.endpointsMap = {};
- },
+ initializer: function(cfg) {
+ this._subscriptions = [];
+ this.endpointsMap = {};
+ },
- /**
+ /**
* Bind events for endpoint processing.
*
* @method bind
* @return {undefined} Nothing.
*/
- bind: function() {
- var db = this.get('db');
-
- // Event handlers for endpoint management.
- this._subscriptions.push(
- db.services.after('add', this.serviceAddHandler, this));
- this._subscriptions.push(
- db.services.after('remove', this.serviceRemoveHandler, this));
- this._subscriptions.push(
- db.services.after('*:pendingChange', this.serviceChangeHandler,
- this));
- this._subscriptions.push(
- db.services.after('*:charmChange', this.serviceChangeHandler,
- this));
- this._subscriptions.push(
- db.services.after('reset', this.reset, this));
-
- },
-
- /**
+ bind: function() {
+ var db = this.get('db');
+
+ // Event handlers for endpoint management.
+ this._subscriptions.push(
+ db.services.after('add', this.serviceAddHandler, this));
+ this._subscriptions.push(
+ db.services.after('remove', this.serviceRemoveHandler, this));
+ this._subscriptions.push(
+ db.services.after('*:pendingChange', this.serviceChangeHandler,
+ this));
+ this._subscriptions.push(
+ db.services.after('*:charmChange', this.serviceChangeHandler,
+ this));
+ this._subscriptions.push(
+ db.services.after('reset', this.reset, this));
+
+ },
+
+ /**
* Unbind events for endpoint processing.
*
* @method unbind
* @return {undefined} Nothing.
*/
- unbind: function() {
- this._subscriptions.forEach(sub => {
- sub.detach();
- });
- this._subscriptions = [];
- },
-
- /**
+ unbind: function() {
+ this._subscriptions.forEach(sub => {
+ sub.detach();
+ });
+ this._subscriptions = [];
+ },
+
+ /**
* Destroy this controller
*
* @method destructor
* @return {undefined} Nothing.
*/
- destructor: function() {
- this.unbind();
- },
+ destructor: function() {
+ this.unbind();
+ },
- /**
+ /**
* Reset the endpoints map.
*
* @method reset
* @return {undefined} Nothing.
*/
- reset: function() {
- this.endpointsMap = {};
- },
+ reset: function() {
+ this.endpointsMap = {};
+ },
- /**
+ /**
Generic handler for a service event. If it is not pending,
make sure we have a charm. If the charm has loaded, set or update
the service's endpoints; otherwise, make that happen once the load
@@ -131,35 +131,35 @@ YUI.add('juju-endpoints-controller', function(Y) {
@param {object} service A service model.
@return {undefined} Nothing.
*/
- handleServiceEvent: function(service) {
- // If the service is not a ghost (that is, 'pending' is false),
- // process it.
- var mController = this.get('modelController'),
- servicePromise = mController.getServiceWithCharm(
- service.get('id')),
- self = this;
-
- servicePromise.then(function(data) {
- data.service.set('subordinate', data.charm.get('is_subordinate'));
- self.addServiceToEndpointsMap(
- data.service.get('id'), data.charm);
- }, function(err) {
- console.warn('Unable to fetch service information', err);
- });
- },
-
- /**
+ handleServiceEvent: function(service) {
+ // If the service is not a ghost (that is, 'pending' is false),
+ // process it.
+ var mController = this.get('modelController'),
+ servicePromise = mController.getServiceWithCharm(
+ service.get('id')),
+ self = this;
+
+ servicePromise.then(function(data) {
+ data.service.set('subordinate', data.charm.get('is_subordinate'));
+ self.addServiceToEndpointsMap(
+ data.service.get('id'), data.charm);
+ }, function(err) {
+ console.warn('Unable to fetch service information', err);
+ });
+ },
+
+ /**
* Handle event for a service being added to the services modellist.
*
* @method serviceAddHandler
* @param {Object} evt The event, containing a model object.
* @return {undefined} Nothing.
*/
- serviceAddHandler: function(evt) {
- this.handleServiceEvent(evt.model);
- },
+ serviceAddHandler: function(evt) {
+ this.handleServiceEvent(evt.model);
+ },
- /**
+ /**
* Handle event for a service transitioning from a ghost to a corporeal
* object as indicated by the 'pending' attribute becoming false. Also
* handles changes in the service's charm.
@@ -168,23 +168,23 @@ YUI.add('juju-endpoints-controller', function(Y) {
* @param {Object} evt The event, containing the service as the target.
* @return {undefined} Nothing.
*/
- serviceChangeHandler: function(evt) {
- this.handleServiceEvent(evt.target);
- },
+ serviceChangeHandler: function(evt) {
+ this.handleServiceEvent(evt.target);
+ },
- /**
+ /**
* Handle event for a service removal.
*
* @method serviceRemoveHandler
* @param {Object} evt The event, containing the service as the target.
* @return {undefined} Nothing.
*/
- serviceRemoveHandler: function(evt) {
- var svcName = evt.model.get('id');
- delete this.endpointsMap[svcName];
- },
+ serviceRemoveHandler: function(evt) {
+ var svcName = evt.model.get('id');
+ delete this.endpointsMap[svcName];
+ },
- /**
+ /**
* Flatten the relation metadata.
*
* @method flatten
@@ -192,25 +192,25 @@ YUI.add('juju-endpoints-controller', function(Y) {
* @return {List} A list of objects, where each entry is a hash with a
* 'name' key and the key value pairs from the metadata.
*/
- flatten: function(meta) {
- var result = [];
- var rel;
- if (utils.isValue(meta)) {
-
- Object.keys(meta).forEach(ko => {
- const vo = meta[ko];
- rel = {};
- rel.name = ko;
- Object.keys(vo).forEach(ki => {
- rel[ki] = vo[ki];
- });
- result.push(rel);
+ flatten: function(meta) {
+ var result = [];
+ var rel;
+ if (utils.isValue(meta)) {
+
+ Object.keys(meta).forEach(ko => {
+ const vo = meta[ko];
+ rel = {};
+ rel.name = ko;
+ Object.keys(vo).forEach(ki => {
+ rel[ki] = vo[ki];
});
- }
- return result;
- },
+ result.push(rel);
+ });
+ }
+ return result;
+ },
- /**
+ /**
* Add the service and charm to the endpoints map.
*
* @method addServiceToEndpointsMap
@@ -218,40 +218,40 @@ YUI.add('juju-endpoints-controller', function(Y) {
* @param {Object} charm The charm for the service.
* @return {undefined} Nothing.
*/
- addServiceToEndpointsMap: function(svcName, charm) {
- this.endpointsMap[svcName] = {};
- this.endpointsMap[svcName].provides =
+ addServiceToEndpointsMap: function(svcName, charm) {
+ this.endpointsMap[svcName] = {};
+ this.endpointsMap[svcName].provides =
this.flatten(charm.get('provides'));
- this.endpointsMap[svcName].requires =
+ this.endpointsMap[svcName].requires =
this.flatten(charm.get('requires'));
- // this was added to be able to test that the endpoint
- // was successful with the new promises
- /**
+ // this was added to be able to test that the endpoint
+ // was successful with the new promises
+ /**
Fired after an endpoint was added to the endpointsMap property
@event endpointMapAdded
*/
- document.dispatchEvent(new Event('endpointMapAdded'));
- }
- }, {
- /**
+ document.dispatchEvent(new Event('endpointMapAdded'));
+ }
+ }, {
+ /**
Reference to the client db.
@attribute db
@type {Y.Base}
@default undefined
*/
- db: {},
+ db: {},
- /**
+ /**
Reference to the modelController instance
@attribute modelController
@type {Y.juju.ModelController}
@default undefined
*/
- modelController: {}
- });
+ modelController: {}
+ });
juju.EndpointsController = EndpointsController;
diff --git a/jujugui/static/gui/src/app/store/env/api.js b/jujugui/static/gui/src/app/store/env/api.js
index ac79a17ff2..8ef454efe5 100644
--- a/jujugui/static/gui/src/app/store/env/api.js
+++ b/jujugui/static/gui/src/app/store/env/api.js
@@ -970,8 +970,8 @@ YUI.add('juju-env-api', function(Y) {
var webHandler = this.get('webHandler');
// TODO frankban: allow macaroons based auth here.
webHandler.sendPostRequest(
- path, headers, file, tags.build(tags.USER, credentials.user),
- credentials.password, progress, callback);
+ path, headers, file, tags.build(tags.USER, credentials.user),
+ credentials.password, progress, callback);
},
/**
@@ -988,7 +988,7 @@ YUI.add('juju-env-api', function(Y) {
getLocalCharmFileUrl: function(charmUrl, filename) {
const credentials = this.get('user').model;
const path = _getCharmAPIPath(
- this.get('modelUUID'), 'url=' + charmUrl + '&file=' + filename);
+ this.get('modelUUID'), 'url=' + charmUrl + '&file=' + filename);
const webHandler = this.get('webHandler');
// TODO frankban: allow macaroons based auth here.
return webHandler.getUrl(
@@ -1030,8 +1030,8 @@ YUI.add('juju-env-api', function(Y) {
var headers = Object.create(null);
// TODO frankban: allow macaroons based auth here.
webHandler.sendGetRequest(
- path, headers, tags.build(tags.USER, credentials.user),
- credentials.password, progress, callback);
+ path, headers, tags.build(tags.USER, credentials.user),
+ credentials.password, progress, callback);
},
/**
@@ -1064,7 +1064,7 @@ YUI.add('juju-env-api', function(Y) {
getLocalCharmFileContents: function(
charmUrl, filename, progress, callback) {
var path = _getCharmAPIPath(
- this.get('modelUUID'), 'url=' + charmUrl + '&file=' + filename);
+ this.get('modelUUID'), 'url=' + charmUrl + '&file=' + filename);
this._jujuHttpGet(path, progress, callback);
},
@@ -1751,7 +1751,7 @@ YUI.add('juju-env-api', function(Y) {
@method add_unit
*/
add_unit: function(
- applicationName, numUnits, toMachine, callback, options) {
+ applicationName, numUnits, toMachine, callback, options) {
if (options && options.immediate) {
this._add_unit(applicationName, numUnits, toMachine, callback);
return;
diff --git a/jujugui/static/gui/src/app/store/env/controller-api.js b/jujugui/static/gui/src/app/store/env/controller-api.js
index dec1734073..eb830e1c77 100644
--- a/jujugui/static/gui/src/app/store/env/controller-api.js
+++ b/jujugui/static/gui/src/app/store/env/controller-api.js
@@ -852,7 +852,7 @@ YUI.add('juju-controller-api', function(Y) {
}, handler);
},
- /**
+ /**
List all models the user can access on the current controller.
@method listModels
@@ -1144,7 +1144,7 @@ YUI.add('juju-controller-api', function(Y) {
return tags.parse(tags.CREDENTIAL, credentialTag);
});
const displayNames = names.map(
- name => this._parseCredentialName(name));
+ name => this._parseCredentialName(name));
return {
names: names,
displayNames: displayNames
diff --git a/jujugui/static/gui/src/app/store/env/web-handler.js b/jujugui/static/gui/src/app/store/env/web-handler.js
index b22bd4d00a..6c8a59c21a 100644
--- a/jujugui/static/gui/src/app/store/env/web-handler.js
+++ b/jujugui/static/gui/src/app/store/env/web-handler.js
@@ -66,11 +66,11 @@ YUI.add('juju-env-web-handler', function(Y) {
@return {Object} The asynchronous request instance.
*/
sendPostRequest: function(path, headers, data, username, password,
- withCredentials, progressCallback,
- completedCallback) {
+ withCredentials, progressCallback,
+ completedCallback) {
var xhr = this._createRequest(
- path, 'POST', headers, username, password, withCredentials,
- progressCallback, completedCallback);
+ path, 'POST', headers, username, password, withCredentials,
+ progressCallback, completedCallback);
// Send the POST data.
xhr.send(data);
return xhr;
@@ -93,11 +93,11 @@ YUI.add('juju-env-web-handler', function(Y) {
@return {Object} The asynchronous request instance.
*/
sendPutRequest: function(path, headers, data, username, password,
- withCredentials, progressCallback,
- completedCallback) {
+ withCredentials, progressCallback,
+ completedCallback) {
var xhr = this._createRequest(
- path, 'PUT', headers, username, password, withCredentials,
- progressCallback, completedCallback);
+ path, 'PUT', headers, username, password, withCredentials,
+ progressCallback, completedCallback);
// Send the PUT data.
xhr.send(data);
return xhr;
@@ -120,11 +120,11 @@ YUI.add('juju-env-web-handler', function(Y) {
@return {Object} The asynchronous request instance.
*/
sendPatchRequest: function(path, headers, data, username, password,
- withCredentials, progressCallback,
- completedCallback) {
+ withCredentials, progressCallback,
+ completedCallback) {
var xhr = this._createRequest(
- path, 'PATCH', headers, username, password, withCredentials,
- progressCallback, completedCallback);
+ path, 'PATCH', headers, username, password, withCredentials,
+ progressCallback, completedCallback);
// Send the PATCH data.
xhr.send(data);
return xhr;
@@ -145,10 +145,10 @@ YUI.add('juju-env-web-handler', function(Y) {
@return {Object} The asynchronous request instance.
*/
sendGetRequest: function(path, headers, username, password, withCredentials,
- progressCallback, completedCallback) {
+ progressCallback, completedCallback) {
var xhr = this._createRequest(
- path, 'GET', headers, username, password, withCredentials,
- progressCallback, completedCallback);
+ path, 'GET', headers, username, password, withCredentials,
+ progressCallback, completedCallback);
// Send the GET request.
xhr.send();
return xhr;
@@ -169,11 +169,11 @@ YUI.add('juju-env-web-handler', function(Y) {
@return {Object} The asynchronous request instance.
*/
sendDeleteRequest: function(path, headers, username, password,
- withCredentials, progressCallback,
- completedCallback) {
+ withCredentials, progressCallback,
+ completedCallback) {
var xhr = this._createRequest(
- path, 'DELETE', headers, username, password, withCredentials,
- progressCallback, completedCallback);
+ path, 'DELETE', headers, username, password, withCredentials,
+ progressCallback, completedCallback);
// Send the GET request.
xhr.send();
return xhr;
@@ -267,13 +267,13 @@ YUI.add('juju-env-web-handler', function(Y) {
@return {Object} The asynchronous request instance.
*/
_createRequest: function(path, method, headers, username, password,
- withCredentials, progressCallback,
- completedCallback) {
+ withCredentials, progressCallback,
+ completedCallback) {
var xhr = new XMLHttpRequest({});
// Set up the event handlers.
var progressHandler = this._createProgressHandler(progressCallback);
var completedHandler = this._createCompletedHandler(
- completedCallback, progressHandler, xhr);
+ completedCallback, progressHandler, xhr);
xhr.addEventListener('progress', progressHandler, false);
xhr.addEventListener('error', completedHandler, false);
xhr.addEventListener('load', completedHandler, false);
diff --git a/jujugui/static/gui/src/app/utils/bakery-utils.js b/jujugui/static/gui/src/app/utils/bakery-utils.js
index 31852a60d2..52ed11990e 100644
--- a/jujugui/static/gui/src/app/utils/bakery-utils.js
+++ b/jujugui/static/gui/src/app/utils/bakery-utils.js
@@ -92,11 +92,11 @@ YUI.add('bakery-utils', function(Y) {
const url = error.Info.VisitURL;
const holder = document.getElementById('login-notification');
const content = (
-
+
To proceed with the authentication, please accept the pop up
window or
click here.
- );
+ );
let dismiss = null;
if (stateGetter().root !== 'login') {
dismiss = () => {
diff --git a/jujugui/static/gui/src/app/utils/bundle-importer.js b/jujugui/static/gui/src/app/utils/bundle-importer.js
index 47a25c7e88..4228bcc7a5 100644
--- a/jujugui/static/gui/src/app/utils/bundle-importer.js
+++ b/jujugui/static/gui/src/app/utils/bundle-importer.js
@@ -193,11 +193,11 @@ YUI.add('bundle-importer', function(Y) {
record.requires.forEach(function(requiredRecordId) {
requires.push(requiredRecordId);
this._collectRequires(
- records,
- records.filter(function(r) {
- return r.id === requiredRecordId;
- })[0],
- requires);
+ records,
+ records.filter(function(r) {
+ return r.id === requiredRecordId;
+ })[0],
+ requires);
}, this);
}
return requires;
@@ -306,7 +306,7 @@ YUI.add('bundle-importer', function(Y) {
var method = this['_execute_' + record.method];
if (typeof method === 'function') {
this['_execute_' + record.method](
- record, this._executeDryRun.bind(this, records));
+ record, this._executeDryRun.bind(this, records));
} else {
this.db.notifications.add({
title: 'Unknown method type',
@@ -696,18 +696,18 @@ YUI.add('bundle-importer', function(Y) {
display_name: 'pending'
});
this.modelAPI.add_relation(
- endpoints[0], endpoints[1],
- function(evt) {
- this.db.relations.create({
- relation_id: evt.result.id,
- type: evt.result['interface'],
- endpoints: endpoints,
- pending: false,
- scope: evt.result.scope
- });
- this.db.relations.remove(pendingRelation);
- }.bind(this),
- {modelId: pendingRelation.get('id')});
+ endpoints[0], endpoints[1],
+ function(evt) {
+ this.db.relations.create({
+ relation_id: evt.result.id,
+ type: evt.result['interface'],
+ endpoints: endpoints,
+ pending: false,
+ scope: evt.result.scope
+ });
+ this.db.relations.remove(pendingRelation);
+ }.bind(this),
+ {modelId: pendingRelation.get('id')});
next();
},
diff --git a/jujugui/static/gui/src/app/utils/changes-utils.js b/jujugui/static/gui/src/app/utils/changes-utils.js
index cf53cd2f1e..098ced1789 100644
--- a/jujugui/static/gui/src/app/utils/changes-utils.js
+++ b/jujugui/static/gui/src/app/utils/changes-utils.js
@@ -101,12 +101,12 @@ YUI.add('changes-utils', function(Y) {
@param {Object} changeSet The current environment change set.
*/
ChangesUtils.generateAllChangeDescriptions = function(services, units,
- changeSet) {
+ changeSet) {
var changes = [],
change;
Object.keys(changeSet).forEach(function(key) {
change = this.generateChangeDescription(
- services, units, changeSet[key]);
+ services, units, changeSet[key]);
if (change) {
changes.push(change);
}
@@ -124,7 +124,7 @@ YUI.add('changes-utils', function(Y) {
@param {Bool} skipTime optional, used for testing, don't generate time.
*/
ChangesUtils.generateChangeDescription = function(services, units, change,
- skipTime) {
+ skipTime) {
var changeItem = {};
if (change && change.command) {
@@ -160,7 +160,7 @@ YUI.add('changes-utils', function(Y) {
return;
}
var ghostService = services.getById(
- change.command.options.modelId);
+ change.command.options.modelId);
changeItem.icon = ghostService.get('icon');
changeItem.description = ' ' + ghostService.get('name') +
' has been added to the model.';
@@ -172,7 +172,7 @@ YUI.add('changes-utils', function(Y) {
break;
case '_add_unit':
var service = this.getServiceByUnitId(
- change.command.options.modelId, services, units);
+ change.command.options.modelId, services, units);
changeItem.icon = 'changes-units-added';
var units = change.command.args[1],
msg;
@@ -207,7 +207,7 @@ YUI.add('changes-utils', function(Y) {
break;
case '_add_relation':
var serviceList = this.getRealRelationEndpointNames(
- change.command.args, services);
+ change.command.args, services);
changeItem.icon = 'changes-relation-added';
changeItem.description = change.command.args[0][1].name +
' relation added between ' +
@@ -223,7 +223,7 @@ YUI.add('changes-utils', function(Y) {
break;
case '_addMachines':
var machineType = change.command.args[0][0].parentId ?
- 'container' : 'machine';
+ 'container' : 'machine';
changeItem.icon = 'changes-' + machineType + '-created';
changeItem.description = change.command.args[0].length +
' ' + machineType +
@@ -232,7 +232,7 @@ YUI.add('changes-utils', function(Y) {
break;
case '_destroyMachines':
var machineType = change.command.args[0][0].indexOf('/') !== -1 ?
- 'container' : 'machine';
+ 'container' : 'machine';
changeItem.icon = 'changes-' + machineType + '-destroyed';
changeItem.description = change.command.args[0].length +
' ' + machineType +
diff --git a/jujugui/static/gui/src/app/utils/environment-change-set.js b/jujugui/static/gui/src/app/utils/environment-change-set.js
index fe863022f4..00d75d591b 100644
--- a/jujugui/static/gui/src/app/utils/environment-change-set.js
+++ b/jujugui/static/gui/src/app/utils/environment-change-set.js
@@ -916,8 +916,8 @@ YUI.add('environment-change-set', function(Y) {
dirtyFields = dirtyFields.concat(Object.keys(changedFields));
service.set(DIRTYFIELDS, dirtyFields);
service.set(
- 'config',
- Y.mix(service.get('config'), changedFields, true, null, null, true));
+ 'config',
+ Y.mix(service.get('config'), changedFields, true, null, null, true));
// XXX Jeff - We may want to flatten this into the deploy service
// command on 'commit' if there is a queued service for this command.
// We will want to flatten multiple setConfig calls to the same service
@@ -1003,8 +1003,8 @@ YUI.add('environment-change-set', function(Y) {
if (command.method === '_add_relation') {
// If there is a matching ecs relation then remove it from the queue.
if (relations.compareRelationEndpoints(
- [command.args[0], command.args[1]],
- argsEndpoints)) {
+ [command.args[0], command.args[1]],
+ argsEndpoints)) {
ghosted = true;
this._removeExistingRecord(key);
// Remove the relation from the relations db. Even the ghost
@@ -1245,7 +1245,7 @@ YUI.add('environment-change-set', function(Y) {
var newParentId = results[0].machines[0].name;
this.args[0].forEach(function(param) {
param.parentId = param.parentId.replace(
- currentParentId, newParentId);
+ currentParentId, newParentId);
});
}
}
diff --git a/jujugui/static/gui/src/app/utils/relation-utils.js b/jujugui/static/gui/src/app/utils/relation-utils.js
index 4ef450dc68..97da08cfab 100644
--- a/jujugui/static/gui/src/app/utils/relation-utils.js
+++ b/jujugui/static/gui/src/app/utils/relation-utils.js
@@ -31,11 +31,11 @@ YUI.add('relation-utils', function(Y) {
*/
var generateHash = function(value) {
return value.split('').reduce(
- function(hash, character) {
- hash = ((hash << 5) - hash) + character.charCodeAt(0);
- return hash & hash;
- },
- 0
+ function(hash, character) {
+ hash = ((hash << 5) - hash) + character.charCodeAt(0);
+ return hash & hash;
+ },
+ 0
);
};
RelationUtils.generateHash = generateHash;
@@ -54,7 +54,7 @@ YUI.add('relation-utils', function(Y) {
var generateSafeDOMId = function(value, parentId) {
parentId = parentId || '';
return (
- 'e-' + value.replace(/\W/g, '_') + '-' +
+ 'e-' + value.replace(/\W/g, '_') + '-' +
generateHash(value + parentId));
};
RelationUtils.generateSafeDOMId = generateSafeDOMId;
@@ -179,10 +179,10 @@ YUI.add('relation-utils', function(Y) {
result.service = db.services.getById(result.name);
if (result.service) {
result.charm = db.charms.getById(
- result.service.get('charm'));
+ result.service.get('charm'));
if (!result.charm) {
console.warn('Failed to load charm',
- result.charm, db.charms.size(), db.charms.get('id'));
+ result.charm, db.charms.size(), db.charms.get('id'));
}
} else {
console.warn('failed to resolve service', result.name);
@@ -318,7 +318,7 @@ YUI.add('relation-utils', function(Y) {
decorated._endpointHasError = function(service) {
// Find the endpoints pertinent to each end of the service.
var endpoint = this.endpoints[0][0] === service.id ?
- this.endpoints[0] : this.endpoints[1];
+ this.endpoints[0] : this.endpoints[1];
// Search the units belonging to the source service for pertinent units
// in error.
// Repeat the search for the target service's units. This relies
@@ -492,7 +492,7 @@ YUI.add('relation-utils', function(Y) {
collections[key].relations.push(relation);
} else {
collections[key] = new RelationCollection(
- relation.source, relation.target, [relation]);
+ relation.source, relation.target, [relation]);
}
});
// Dump just the collections; the keys are not needed for the data that
@@ -627,7 +627,7 @@ YUI.add('relation-utils', function(Y) {
!existing.some(existingRelation =>
relation[0].name === existingRelation.far.name ||
relation[1].name === existingRelation.near.name
- ));
+ ));
return availableEndpoints;
};
@@ -642,7 +642,7 @@ YUI.add('relation-utils', function(Y) {
*/
RelationUtils.getRelatableApplications = function(db, endpoints) {
return Object.keys(endpoints)
- .map(appName => db.services.getById(appName));
+ .map(appName => db.services.getById(appName));
};
window.juju.utils.RelationUtils = RelationUtils;
diff --git a/jujugui/static/gui/src/app/utils/zip-utils.js b/jujugui/static/gui/src/app/utils/zip-utils.js
index 7ba17afac4..9c7d5d5e4f 100644
--- a/jujugui/static/gui/src/app/utils/zip-utils.js
+++ b/jujugui/static/gui/src/app/utils/zip-utils.js
@@ -49,14 +49,14 @@ YUI.add('zip-utils', function(Y) {
*/
var getEntries = function(file, callback, errback) {
zip.createReader(
- new zip.BlobReader(file),
- function(reader) {
- reader.getEntries(function(entries) {
- callback(entries);
- reader.close();
- });
- },
- errback
+ new zip.BlobReader(file),
+ function(reader) {
+ reader.getEntries(function(entries) {
+ callback(entries);
+ reader.close();
+ });
+ },
+ errback
);
};
module.getEntries = getEntries;
@@ -161,7 +161,7 @@ YUI.add('zip-utils', function(Y) {
});
} catch (err) {
console.error(
- 'zip.TextWriter error reading ' + entry.filename + ': ' + err);
+ 'zip.TextWriter error reading ' + entry.filename + ': ' + err);
}
});
};
diff --git a/jujugui/static/gui/src/app/views/bundle-import-notifications.js b/jujugui/static/gui/src/app/views/bundle-import-notifications.js
index 53bd6231b2..aea34824bc 100644
--- a/jujugui/static/gui/src/app/views/bundle-import-notifications.js
+++ b/jujugui/static/gui/src/app/views/bundle-import-notifications.js
@@ -58,13 +58,13 @@ YUI.add('bundle-import-notifications', function(Y) {
// Start watching scheduled/in progress bundle deployments.
if (status === 'scheduled' || status === 'started') {
ns.BundleNotifications._watchDeployment(
- change.deploymentId, env, db);
+ change.deploymentId, env, db);
return;
}
// Notify bundle deployment errors occurred in the last hour.
if (change.err && change.time >= timestamp) {
ns.BundleNotifications._notifyDeploymentChange(
- db, change.deploymentId, status, change.err);
+ db, change.deploymentId, status, change.err);
}
// If none of the previous blocks detect any changes then ignore
// successfully completed/old/canceled deployments.
@@ -156,7 +156,7 @@ YUI.add('bundle-import-notifications', function(Y) {
var newChange = data.Changes[data.Changes.length - 1];
// Notify the new deployment change.
ns.BundleNotifications._notifyDeploymentChange(
- db, newChange.DeploymentId, newChange.Status, newChange.Error);
+ db, newChange.DeploymentId, newChange.Status, newChange.Error);
// If the status is 'completed' then we're done watching this.
if (newChange.Status === 'completed') {
// There's nothing else to see here.
diff --git a/jujugui/static/gui/src/app/views/environment.js b/jujugui/static/gui/src/app/views/environment.js
index 03eab4f9ed..bf1614289d 100644
--- a/jujugui/static/gui/src/app/views/environment.js
+++ b/jujugui/static/gui/src/app/views/environment.js
@@ -79,19 +79,19 @@ YUI.add('juju-view-environment', function(Y) {
EnvironmentView.superclass.render.apply(this, arguments);
ReactDOM.render(
,
- container);
+ container);
this._rendered = true;
}
topo = this.createTopology();
topo.recordSubscription(
- 'ServiceModule',
- db.services.after('remove',
- this.updateHelpIndicator.bind(this)));
+ 'ServiceModule',
+ db.services.after('remove',
+ this.updateHelpIndicator.bind(this)));
topo.recordSubscription(
- 'ServiceModule',
- db.services.after('add', this.updateHelpIndicator.bind(this)));
+ 'ServiceModule',
+ db.services.after('add', this.updateHelpIndicator.bind(this)));
topo.render();
this.boundRenderedHandler = this.updateHelpIndicator.bind(this);
diff --git a/jujugui/static/gui/src/app/views/ghost-deployer-extension.js b/jujugui/static/gui/src/app/views/ghost-deployer-extension.js
index ef53b0a7a3..2686fa4f2d 100644
--- a/jujugui/static/gui/src/app/views/ghost-deployer-extension.js
+++ b/jujugui/static/gui/src/app/views/ghost-deployer-extension.js
@@ -132,12 +132,12 @@ YUI.add('ghost-deployer-extension', function(Y) {
// removes the ghost unit from the database. The real unit should then
// be created reacting to the mega-watcher changes.
this.env.add_unit(
- ghostServiceId, // The service to which the unit is added.
- 1, // Add a single unit.
- null, // For now the unit is unplaced.
- this._addUnitCallback.bind(this, ghostUnit), // The callback.
- // Options used by ECS, ignored by environment.
- {modelId: unitId}
+ ghostServiceId, // The service to which the unit is added.
+ 1, // Add a single unit.
+ null, // For now the unit is unplaced.
+ this._addUnitCallback.bind(this, ghostUnit), // The callback.
+ // Options used by ECS, ignored by environment.
+ {modelId: unitId}
);
}
this.state.changeState({
diff --git a/jujugui/static/gui/src/app/views/landscape.js b/jujugui/static/gui/src/app/views/landscape.js
index baed75d883..70859302e0 100644
--- a/jujugui/static/gui/src/app/views/landscape.js
+++ b/jujugui/static/gui/src/app/views/landscape.js
@@ -77,7 +77,7 @@ YUI.add('juju-landscape', function(Y) {
//
// Iterate each landscape annotation.
['landscape-security-upgrades', 'landscape-needs-reboot'].forEach(
- annotationName => {
+ annotationName => {
// Iterate each service, we do this so we can rollup
// when no unit in the services set has the annotation.
// This is needed to be able to detect and clear annotations
@@ -85,20 +85,20 @@ YUI.add('juju-landscape', function(Y) {
// are cleared.
// The inner loop uses .some allowing it to stop on the
// first true value.
- var serviceFlagged = false;
- db.services.toArray().forEach(service => {
+ var serviceFlagged = false;
+ db.services.toArray().forEach(service => {
/*jslint bitwise: true*/
// The above lint is needed to allow a |= expression
// to pass the linter.
- serviceFlagged |= service[annotationName] = service.get('units').some(
+ serviceFlagged |= service[annotationName] = service.get('units').some(
unit => {
var annotations = unit.annotations;
return Boolean(
- annotations && annotations[annotationName]);
+ annotations && annotations[annotationName]);
});
+ });
+ env[annotationName] = Boolean(serviceFlagged);
});
- env[annotationName] = Boolean(serviceFlagged);
- });
return this;
},
diff --git a/jujugui/static/gui/src/app/views/topology/panzoom.js b/jujugui/static/gui/src/app/views/topology/panzoom.js
index 240258892e..b8474cc960 100644
--- a/jujugui/static/gui/src/app/views/topology/panzoom.js
+++ b/jujugui/static/gui/src/app/views/topology/panzoom.js
@@ -69,9 +69,9 @@ YUI.add('juju-topology-panzoom', function(Y) {
options = topo.options;
this.toScale = d3.scale.linear()
- .domain([options.minZoom, options.maxZoom])
- .range([options.minZoom, options.maxZoom])
- .clamp(true);
+ .domain([options.minZoom, options.maxZoom])
+ .range([options.minZoom, options.maxZoom])
+ .clamp(true);
},
/**
diff --git a/jujugui/static/gui/src/app/views/topology/relation.js b/jujugui/static/gui/src/app/views/topology/relation.js
index bf43f73680..4e37773465 100644
--- a/jujugui/static/gui/src/app/views/topology/relation.js
+++ b/jujugui/static/gui/src/app/views/topology/relation.js
@@ -261,7 +261,7 @@ YUI.add('juju-topology-relation', function(Y) {
return;
}
var decoratedRelation = relationUtils.DecoratedRelation(
- relation, source, target);
+ relation, source, target);
// Copy the relation type to the box.
decorated.push(decoratedRelation);
}
@@ -306,15 +306,15 @@ YUI.add('juju-topology-relation', function(Y) {
}).forEach(relation => {
// Select only the pertinent relation groups.
var rel_group = topo.vis.select(
- '#' + relationUtils.generateSafeDOMId(relation.id, parentId));
+ '#' + relationUtils.generateSafeDOMId(relation.id, parentId));
var connectors = relation.source.getConnectorPair(relation.target);
var s = connectors[0];
var t = connectors[1];
rel_group.select('line')
- .attr('x1', s[0])
- .attr('y1', s[1])
- .attr('x2', t[0])
- .attr('y2', t[1]);
+ .attr('x1', s[0])
+ .attr('y1', s[1])
+ .attr('x2', t[0])
+ .attr('y2', t[1]);
});
},
@@ -345,34 +345,34 @@ YUI.add('juju-topology-relation', function(Y) {
})
.classed('rel-group', true);
enter.append('svg:line', 'g.service')
- .attr('class', function(d) {
- // Style relation lines differently depending on status.
- return 'relation ' + d.aggregatedStatus;
- });
+ .attr('class', function(d) {
+ // Style relation lines differently depending on status.
+ return 'relation ' + d.aggregatedStatus;
+ });
// The knob connecting the relation line with the FROM service block
enter.append('circle')
- .attr({
- 'cx': 0,
- 'cy': 0,
- 'r': 4,
- 'class': function(d) {
- // Style relation connector differently depending on status.
- return 'connector1 ' + d.aggregatedStatus;
- }
- });
+ .attr({
+ 'cx': 0,
+ 'cy': 0,
+ 'r': 4,
+ 'class': function(d) {
+ // Style relation connector differently depending on status.
+ return 'connector1 ' + d.aggregatedStatus;
+ }
+ });
// The knob connecting the relation line with the TO service block
enter.append('circle')
- .attr({
- 'cx': 0,
- 'cy': 0,
- 'r': 4,
- 'class': function(d) {
- // Style relation connector differently depending on status.
- return 'connector2 ' + d.aggregatedStatus;
- }
- });
+ .attr({
+ 'cx': 0,
+ 'cy': 0,
+ 'r': 4,
+ 'class': function(d) {
+ // Style relation connector differently depending on status.
+ return 'connector2 ' + d.aggregatedStatus;
+ }
+ });
enter.append('g')
.classed('rel-indicator', true)
.append('image')
@@ -390,16 +390,16 @@ YUI.add('juju-topology-relation', function(Y) {
g.filter(function(d) {
var currStatus = d3.select(this).select('image')
- .attr('xlink:href') || '';
+ .attr('xlink:href') || '';
currStatus = currStatus.split('relation-icon-')
- .reverse()[0]
- .split('.')[0];
+ .reverse()[0]
+ .split('.')[0];
return currStatus !== d.aggregatedStatus;
})
.selectAll('image')
.attr('xlink:href', function(d) {
return (
- basePath + '/assets/svgs/relation-icon-' +
+ basePath + '/assets/svgs/relation-icon-' +
d.aggregatedStatus + '.svg');
});
return g;
@@ -407,7 +407,7 @@ YUI.add('juju-topology-relation', function(Y) {
drawRelation: function(relation) {
var connectors = relation.source
- .getConnectorPair(relation.target);
+ .getConnectorPair(relation.target);
var s = connectors[0];
var t = connectors[1];
var link = d3.select(this).select('line');
@@ -418,14 +418,14 @@ YUI.add('juju-topology-relation', function(Y) {
var tRadius = (relation.target.w / 2) - 4;
link
- .attr('x1', s[0])
- .attr('y1', s[1])
- .attr('x2', t[0])
- .attr('y2', t[1])
- .attr('class', function(d) {
- // Style relation lines differently depending on status.
- return 'relation ' + relation.aggregatedStatus;
- });
+ .attr('x1', s[0])
+ .attr('y1', s[1])
+ .attr('x2', t[0])
+ .attr('y2', t[1])
+ .attr('class', function(d) {
+ // Style relation lines differently depending on status.
+ return 'relation ' + relation.aggregatedStatus;
+ });
// Calculate the angle in radians from both service block
var deg = Math.atan2(s[1] - t[1], s[0] - t[0]);
@@ -504,8 +504,8 @@ YUI.add('juju-topology-relation', function(Y) {
mouseMoveHandler: function(evt) {
const container = this.getContainer();
this.mousemove.call(
- container.querySelector('.zoom-plane'),
- null, this);
+ container.querySelector('.zoom-plane'),
+ null, this);
},
snapToService: function(evt) {
@@ -525,14 +525,14 @@ YUI.add('juju-topology-relation', function(Y) {
// the two services.
if (this.dragline) {
var connectors = d.getConnectorPair(
- this.get('addRelationStart_service'));
+ this.get('addRelationStart_service'));
var s = connectors[0];
var t = connectors[1];
this.dragline.select('line').attr('x1', t[0])
- .attr('y1', t[1])
- .attr('x2', s[0])
- .attr('y2', s[1])
- .attr('class', 'relation pending-relation dragline');
+ .attr('y1', t[1])
+ .attr('x2', s[0])
+ .attr('y2', s[1])
+ .attr('class', 'relation pending-relation dragline');
this.draglineOverService = true;
}
},
@@ -542,7 +542,7 @@ YUI.add('juju-topology-relation', function(Y) {
if (this.dragline) {
this.dragline.select('line').attr('class',
- 'relation pending-relation dragline dragging');
+ 'relation pending-relation dragline dragging');
this.draglineOverService = false;
this.clickAddRelation = true;
this.get('component').buildingRelation = true;
@@ -562,9 +562,9 @@ YUI.add('juju-topology-relation', function(Y) {
// Create a pending drag-line.
var vis = this.get('component').vis;
var dragline = vis.insert('g', ':first-child')
- .attr('class', 'drag-relation-group');
+ .attr('class', 'drag-relation-group');
dragline.insert('line')
- .attr('class', 'relation pending-relation dragline dragging');
+ .attr('class', 'relation pending-relation dragline dragging');
dragline.append('circle')
.attr('class', 'dragline__indicator')
.attr({
@@ -592,17 +592,17 @@ YUI.add('juju-topology-relation', function(Y) {
var imagePos = (point[0][0] - 8) + ', ' + (point[0][1] - 8);
dragline.select('line')
- .classed('dragline__line', true)
- .attr('x1', point[0][0])
- .attr('y1', point[0][1])
- .attr('x2', point[1][0])
- .attr('y2', point[1][1]);
+ .classed('dragline__line', true)
+ .attr('x1', point[0][0])
+ .attr('y1', point[0][1])
+ .attr('x2', point[1][0])
+ .attr('y2', point[1][1]);
dragline.select('circle')
- .attr('cx', point[0][0])
- .attr('cy', point[0][1]);
+ .attr('cx', point[0][0])
+ .attr('cy', point[0][1]);
dragline.select('image')
- .attr('transform',
- 'translate(' + imagePos + ')');
+ .attr('transform',
+ 'translate(' + imagePos + ')');
this.dragline = dragline;
vis.select('.plus-service').classed('fade', true);
// Start the add-relation process.
@@ -644,16 +644,16 @@ YUI.add('juju-topology-relation', function(Y) {
var connectors = this.cursorBox.getConnectorPair(d),
s = connectors[1];
this.dragline.select('line')
- .attr('x1', s[0])
- .attr('y1', s[1])
- .attr('x2', mouseX)
- .attr('y2', mouseY);
+ .attr('x1', s[0])
+ .attr('y1', s[1])
+ .attr('x2', mouseX)
+ .attr('y2', mouseY);
this.dragline.select('circle')
- .attr('cx', mouseX)
- .attr('cy', mouseY);
+ .attr('cx', mouseX)
+ .attr('cy', mouseY);
this.dragline.select('image')
- .attr('transform',
- 'translate(' + imagePos + ')');
+ .attr('transform',
+ 'translate(' + imagePos + ')');
}
},
@@ -868,11 +868,11 @@ YUI.add('juju-topology-relation', function(Y) {
// all services as selectable and then
// removes the invalid ones.
var sel = vis.selectAll('.service')
- .classed('selectable-service', true)
- .filter(function(d) {
- return (d.id in invalidRelationTargets &&
+ .classed('selectable-service', true)
+ .filter(function(d) {
+ return (d.id in invalidRelationTargets &&
d.id !== service.get('id'));
- });
+ });
document.dispatchEvent(new CustomEvent('topo.fade', {
detail: [{
selection: sel,
@@ -909,7 +909,7 @@ YUI.add('juju-topology-relation', function(Y) {
*/
ambiguousAddRelationCheck: function(m, view, context) {
var endpoints = view.get(
- 'addRelationStart_possibleEndpoints')[m.id];
+ 'addRelationStart_possibleEndpoints')[m.id];
var topo = view.get('component');
if (endpoints && endpoints.length === 1) {
@@ -961,9 +961,9 @@ YUI.add('juju-topology-relation', function(Y) {
serviceName = handle.service;
if (serviceName.indexOf('$') > 0) {
displayName = topo.get('db').services
- .getById(serviceName)
- .get('displayName')
- .replace(/^\(/, '').replace(/\)$/, '');
+ .getById(serviceName)
+ .get('displayName')
+ .replace(/^\(/, '').replace(/\)$/, '');
} else {
displayName = serviceName;
}
diff --git a/jujugui/static/gui/src/app/views/topology/service.js b/jujugui/static/gui/src/app/views/topology/service.js
index d7c76c5a17..b0193079de 100644
--- a/jujugui/static/gui/src/app/views/topology/service.js
+++ b/jujugui/static/gui/src/app/views/topology/service.js
@@ -53,7 +53,7 @@ YUI.add('juju-topology-service', function(Y) {
var visibleServices = db.services.visible();
views.toBoundingBoxes(
- this, visibleServices, topo.service_boxes, env);
+ this, visibleServices, topo.service_boxes, env);
// Store the size of the visibleServices model list because it gets
// reset below.
var serviceCount = visibleServices.size();
@@ -139,7 +139,7 @@ YUI.add('juju-topology-service', function(Y) {
node.filter(function(d) {
return d.subordinate;
})
- .classed('subordinate', true);
+ .classed('subordinate', true);
// Size the node for drawing.
node.attr({
@@ -249,13 +249,13 @@ YUI.add('juju-topology-service', function(Y) {
.select('.sub-rel-block').empty() &&
d.subordinate;
})
- .insert('g', ':first-child')
- .attr('class', 'sub-rel-block')
- .attr('transform', function(d) {
- // Position the block so that the relation indicator will
- // appear at the right connector.
- return 'translate(' + [d.w - 5, d.h / 2 - 26] + ')';
- });
+ .insert('g', ':first-child')
+ .attr('class', 'sub-rel-block')
+ .attr('transform', function(d) {
+ // Position the block so that the relation indicator will
+ // appear at the right connector.
+ return 'translate(' + [d.w - 5, d.h / 2 - 26] + ')';
+ });
subRelationIndicator.append('line')
.attr({
@@ -299,26 +299,26 @@ YUI.add('juju-topology-service', function(Y) {
charm_label_padding = 150;
node.select('.name')
- .attr({'style': function(d) {
- // Programmatically size the font.
- // Number derived from service assets:
- // font-size 22px when asset is 224px.
- return 'font-size:' + d.h *
+ .attr({'style': function(d) {
+ // Programmatically size the font.
+ // Number derived from service assets:
+ // font-size 22px when asset is 224px.
+ return 'font-size:' + d.h *
(name_size / service_height) + 'px';
- },
- 'x': function(d) { return d.w / 2; },
- 'y': function(d) {
- // Number derived from service assets:
- // padding-top 26px when asset is 224px.
- return d.h * (name_padding / service_height) + d.h *
+ },
+ 'x': function(d) { return d.w / 2; },
+ 'y': function(d) {
+ // Number derived from service assets:
+ // padding-top 26px when asset is 224px.
+ return d.h * (name_padding / service_height) + d.h *
(name_size / service_height) / 2;
- }
- });
+ }
+ });
node.select('.name').text(
- function(d) {
- return self.truncateServiceName(d);
- });
+ function(d) {
+ return self.truncateServiceName(d);
+ });
node.select('.charm-label').attr({
'style': function(d) {
@@ -627,11 +627,11 @@ YUI.add('juju-topology-service', function(Y) {
}
box.tapped = true;
this.serviceClick.call(
- node,
- box,
- this,
- // Specifying the event type to avoid d3.mouse() error
- 'touch'
+ node,
+ box,
+ this,
+ // Specifying the event type to avoid d3.mouse() error
+ 'touch'
);
},
@@ -937,9 +937,9 @@ YUI.add('juju-topology-service', function(Y) {
*/
_extractCharmMetadata: function(file, topo, env, db) {
ziputils.getEntries(
- file,
- this._findCharmEntries.bind(this, file, topo, env, db),
- this._zipExtractionError.bind(this, db, topo, file));
+ file,
+ this._findCharmEntries.bind(this, file, topo, env, db),
+ this._zipExtractionError.bind(this, db, topo, file));
},
/**
@@ -984,9 +984,9 @@ YUI.add('juju-topology-service', function(Y) {
*/
_readCharmEntries: function(file, topo, env, db, entries) {
ziputils.readCharmEntries(
- entries,
- this._checkForExistingServices.bind(this, file, topo, env, db),
- this._zipExtractionError.bind(this, db, topo, file));
+ entries,
+ this._checkForExistingServices.bind(this, file, topo, env, db),
+ this._zipExtractionError.bind(this, db, topo, file));
},
/**
@@ -1098,14 +1098,14 @@ YUI.add('juju-topology-service', function(Y) {
});
var charmstore = topo.get('charmstore');
charmstore.getBundleYAML(
- entityData.id.replace('cs:', ''),
- function(error, bundleYAML) {
- if (error) {
- console.error(error);
- return;
- }
- topo.get('bundleImporter').importBundleYAML(bundleYAML);
- }.bind(this));
+ entityData.id.replace('cs:', ''),
+ function(error, bundleYAML) {
+ if (error) {
+ console.error(error);
+ return;
+ }
+ topo.get('bundleImporter').importBundleYAML(bundleYAML);
+ }.bind(this));
}
}
},
@@ -1303,8 +1303,8 @@ YUI.add('juju-topology-service', function(Y) {
if (includeTransition) {
selection = selection.transition()
- .duration(500)
- .ease('elastic');
+ .duration(500)
+ .ease('elastic');
}
selection.attr('transform', function(d, i) {
@@ -1353,9 +1353,9 @@ YUI.add('juju-topology-service', function(Y) {
if (!this.dragBehavior) {
this.dragBehavior = d3.behavior.drag()
- .on('dragstart', function(d) { self.dragstart.call(this, d, self);})
- .on('drag', function(d) { self.drag.call(this, d, self);})
- .on('dragend', function(d) { self.dragend.call(this, d, self);});
+ .on('dragstart', function(d) { self.dragstart.call(this, d, self);})
+ .on('drag', function(d) { self.drag.call(this, d, self);})
+ .on('dragend', function(d) { self.dragend.call(this, d, self);});
}
//Process any changed data.
@@ -1395,10 +1395,10 @@ YUI.add('juju-topology-service', function(Y) {
// new_service_boxes are those w/o current x/y pos and no
// annotations.
var new_service_boxes = Object.keys(topo.service_boxes).map(
- k => topo.service_boxes[k]).filter(function(boundingBox) {
- // In the case where a model has been removed from the database
- // and update runs before exit, boundingBox.model will be empty;
- // these can automatically be ignored.
+ k => topo.service_boxes[k]).filter(function(boundingBox) {
+ // In the case where a model has been removed from the database
+ // and update runs before exit, boundingBox.model will be empty;
+ // these can automatically be ignored.
if (boundingBox.model) {
var annotations = boundingBox.model.get('annotations');
return (isNaN(boundingBox.x) &&
@@ -1433,16 +1433,16 @@ YUI.add('juju-topology-service', function(Y) {
// Set the size of the visualization to the size of the
// viewport (unscaledPack discards this, but it is
// convention).
- .size([width, height])
- // Set the value function for the size of each child node
- // to the number of units within that node.
- .value(function(d) { return Math.max(d.unit_count, 1); })
- // Set the padding space around each node.
- .padding(300)
- // Set a sensible radius to prevent nodes from overlapping.
- .radius(50)
- // Run the pack layout on the new service boxes.
- .nodes({children: new_service_boxes});
+ .size([width, height])
+ // Set the value function for the size of each child node
+ // to the number of units within that node.
+ .value(function(d) { return Math.max(d.unit_count, 1); })
+ // Set the padding space around each node.
+ .padding(300)
+ // Set a sensible radius to prevent nodes from overlapping.
+ .radius(50)
+ // Run the pack layout on the new service boxes.
+ .nodes({children: new_service_boxes});
if (new_service_boxes.length <
Object.keys(topo.service_boxes).length) {
// If we have new services that do not have x/y coords and are
@@ -1483,12 +1483,12 @@ YUI.add('juju-topology-service', function(Y) {
// enter
node
- .enter().append('g')
- .attr({
- 'pointer-events': 'all', // IE needs this.
- 'class': function(d) {
- return (d.subordinate ? 'subordinate ' : '') + 'service';
- }})
+ .enter().append('g')
+ .attr({
+ 'pointer-events': 'all', // IE needs this.
+ 'class': function(d) {
+ return (d.subordinate ? 'subordinate ' : '') + 'service';
+ }})
.call(this.dragBehavior)
.call(self.createServiceNode, self)
.attr('transform', function(d) { return d.translateStr; });
@@ -1595,15 +1595,15 @@ YUI.add('juju-topology-service', function(Y) {
// Draw a relation button.
var relationButton = node.filter(function(d) {
return d3.select(this)
- .select('.relation-button').empty();
+ .select('.relation-button').empty();
})
- .insert('g', ':first-child')
- .attr('class', 'relation-button')
- .attr('transform', function(d) {
- // Position the block so that the relation indicator will
- // appear at the top.
- return 'translate(' + [d.subordinate ? 65 : 95, 30] + ')';
- });
+ .insert('g', ':first-child')
+ .attr('class', 'relation-button')
+ .attr('transform', function(d) {
+ // Position the block so that the relation indicator will
+ // appear at the top.
+ return 'translate(' + [d.subordinate ? 65 : 95, 30] + ')';
+ });
relationButton.append('line')
.attr({
@@ -1686,18 +1686,18 @@ YUI.add('juju-topology-service', function(Y) {
.classed('service-block', true);
node.append('image')
- .classed('service-icon', true)
- .attr({
- 'xlink:href': function(d) {
- return d.icon;
- },
- width: 96,
- height: 96,
- transform: function(d) {
- return (d.subordinate ? 'translate(17, 17)' : 'translate(47, 47)');
- },
- 'clip-path': function(d) { return 'url(#clip-mask)'; }
- });
+ .classed('service-icon', true)
+ .attr({
+ 'xlink:href': function(d) {
+ return d.icon;
+ },
+ width: 96,
+ height: 96,
+ transform: function(d) {
+ return (d.subordinate ? 'translate(17, 17)' : 'translate(47, 47)');
+ },
+ 'clip-path': function(d) { return 'url(#clip-mask)'; }
+ });
// Manually attach the touchstart event (see method for details)
node.each(function(data) {
@@ -1775,7 +1775,7 @@ YUI.add('juju-topology-service', function(Y) {
if (evt.highlightRelated) {
var service = topo.service_boxes[serviceNames[0]].model;
var relationData = relationUtils.getRelationDataForService(
- topo.get('db'), service);
+ topo.get('db'), service);
relationData.forEach(function(relation) {
serviceNames.push(relation.far.service);
});
@@ -1805,7 +1805,7 @@ YUI.add('juju-topology-service', function(Y) {
if (evt.unhighlightRelated) {
var service = topo.service_boxes[serviceNames[0]].model;
var relationData = relationUtils.getRelationDataForService(
- topo.get('db'), service);
+ topo.get('db'), service);
relationData.forEach(function(relation) {
serviceNames.push(relation.far.service);
});
diff --git a/jujugui/static/gui/src/app/views/topology/topology.js b/jujugui/static/gui/src/app/views/topology/topology.js
index b4b7da1044..caf7085303 100644
--- a/jujugui/static/gui/src/app/views/topology/topology.js
+++ b/jujugui/static/gui/src/app/views/topology/topology.js
@@ -129,25 +129,25 @@ YUI.add('juju-topology', function(Y) {
var base = canvas.select('.topology-canvas');
if (base.empty()) {
base = canvas.append('div')
- .classed('topology-canvas', true);
+ .classed('topology-canvas', true);
}
// Cache the canvas element for style modifications.
this.set('canvas', container.querySelector('.topology-canvas'));
svg = base.append('svg:svg')
- .attr('width', width)
- .attr('height', height)
- .attr('class', 'the-canvas');
+ .attr('width', width)
+ .attr('height', height)
+ .attr('class', 'the-canvas');
this.svg = svg;
this.zoomPlane = svg.append('rect')
- .attr('class', 'zoom-plane')
- .attr('width', width)
- .attr('height', height)
- .attr('pointer-events', 'all')
- .call(this.zoom)
- .on('dblclick.zoom', null);
+ .attr('class', 'zoom-plane')
+ .attr('width', width)
+ .attr('height', height)
+ .attr('pointer-events', 'all')
+ .call(this.zoom)
+ .on('dblclick.zoom', null);
vis = svg.append('svg:g');
this.vis = vis;
@@ -192,9 +192,9 @@ YUI.add('juju-topology', function(Y) {
.split(',');
plus
.attr('transform',
- 'translate('
+ 'translate('
+ [d3.event.dx + parseInt(oldCoords[0], 10),
- d3.event.dy + parseInt(oldCoords[1], 10)] + ')');
+ d3.event.dy + parseInt(oldCoords[1], 10)] + ')');
});
plusIndicator.call(plusDrag);
}
@@ -245,19 +245,19 @@ YUI.add('juju-topology', function(Y) {
.nice();
this.zoom.x(this.xScale)
- .y(this.yScale)
- .scaleExtent([this.options.minZoom, this.options.maxZoom])
- .on('zoom', evt => {
- document.dispatchEvent(new CustomEvent('topo.zoom', {
- detail: [d3.event]
- }));
- // If the canvas has actually been moved then set the flag.
- self.zoomed = true;
- })
- .on('zoomend', function(evt) {
- // Reset the flag for checking if the canvas has been moved.
- self.zoomed = false;
- });
+ .y(this.yScale)
+ .scaleExtent([this.options.minZoom, this.options.maxZoom])
+ .on('zoom', evt => {
+ document.dispatchEvent(new CustomEvent('topo.zoom', {
+ detail: [d3.event]
+ }));
+ // If the canvas has actually been moved then set the flag.
+ self.zoomed = true;
+ })
+ .on('zoomend', function(evt) {
+ // Reset the flag for checking if the canvas has been moved.
+ self.zoomed = false;
+ });
},
/*
@@ -313,7 +313,7 @@ YUI.add('juju-topology', function(Y) {
service.set('annotations', annotations);
} else {
this.get('env').update_annotations(
- box.id, 'application', {'gui-x': box.x, 'gui-y': box.y});
+ box.id, 'application', {'gui-x': box.x, 'gui-y': box.y});
box.inDrag = views.DRAG_ENDING;
}
}
diff --git a/jujugui/static/gui/src/app/views/topology/utils.js b/jujugui/static/gui/src/app/views/topology/utils.js
index a67f9ee850..2f22f01347 100644
--- a/jujugui/static/gui/src/app/views/topology/utils.js
+++ b/jujugui/static/gui/src/app/views/topology/utils.js
@@ -67,7 +67,7 @@ YUI.add('juju-topology-utils', function(Y) {
var furthestDistance = 0, furthestVertex = [0, 0];
hull.forEach(vertex => {
var distance = Math.sqrt(
- Math.pow(vertex[0], 2) +
+ Math.pow(vertex[0], 2) +
Math.pow(vertex[1], 2));
if (distance >= furthestDistance) {
furthestDistance = distance;
@@ -92,9 +92,9 @@ YUI.add('juju-topology-utils', function(Y) {
// Pad to the right of the right-most existing service.
return [
(vertices[0][0] > vertices[1][0] ?
- vertices[0][0] : vertices[1][0]) + padding,
+ vertices[0][0] : vertices[1][0]) + padding,
(vertices[0][1] > vertices[1][1] ?
- vertices[0][1] : vertices[1][1])
+ vertices[0][1] : vertices[1][1])
];
default:
// Pad to the right of the convex hull of existing services
diff --git a/jujugui/static/gui/src/app/views/utils.js b/jujugui/static/gui/src/app/views/utils.js
index 93bcf9616a..523b40f13c 100644
--- a/jujugui/static/gui/src/app/views/utils.js
+++ b/jujugui/static/gui/src/app/views/utils.js
@@ -229,7 +229,7 @@ YUI.add('juju-view-utils', function(Y) {
*/
function substitute(stringOrFunction, number) {
var string = typeof stringOrFunction === 'function' ?
- stringOrFunction(number, distanceMillis) : stringOrFunction,
+ stringOrFunction(number, distanceMillis) : stringOrFunction,
value = (l.numbers && l.numbers[number]) || number;
return string.replace(/%d/i, value);
}
@@ -447,7 +447,7 @@ YUI.add('juju-view-utils', function(Y) {
right: [
this.x + this.w - (margins && (margins.right * this.w) || 0),
this.y + (this.h / 2) - (
- margins && (margins.bottom * this.h / 2 -
+ margins && (margins.bottom * this.h / 2 -
margins.top * this.h / 2) || 0)
],
bottom: [
@@ -457,7 +457,7 @@ YUI.add('juju-view-utils', function(Y) {
left: [
this.x + (margins && (margins.left * this.w) || 0),
this.y + (this.h / 2) - (
- margins && (margins.bottom * this.h / 2 -
+ margins && (margins.bottom * this.h / 2 -
margins.top * this.h / 2) || 0)
]
};
@@ -571,21 +571,21 @@ YUI.add('juju-view-utils', function(Y) {
}
});
services.each(
- function(service) {
- var id = service.get('id');
- if (result[id] !== undefined) {
- result[id].model = service;
- } else {
- result[id] = new BoundingBox(module, service);
- }
- if (!service.get('icon') && service.get('charm')) {
- var icon;
- var charmId = service.get('charm');
- icon = utils.getIconPath(charmId, null, env);
- service.set('icon', icon);
- }
- result[id].icon = service.get('icon');
+ function(service) {
+ var id = service.get('id');
+ if (result[id] !== undefined) {
+ result[id].model = service;
+ } else {
+ result[id] = new BoundingBox(module, service);
+ }
+ if (!service.get('icon') && service.get('charm')) {
+ var icon;
+ var charmId = service.get('charm');
+ icon = utils.getIconPath(charmId, null, env);
+ service.set('icon', icon);
}
+ result[id].icon = service.get('icon');
+ }
);
return result;
};
@@ -638,7 +638,7 @@ YUI.add('juju-view-utils', function(Y) {
// In order to support Safari 7 the type of this blob needs
// to be text/plain instead of it's actual type of application/yaml.
var exportBlob = new Blob([exportData],
- {type: 'text/plain;charset=utf-8'});
+ {type: 'text/plain;charset=utf-8'});
var envName = db.environment.get('name');
saveAs(exportBlob, this._genereateBundleExportFileName(envName));
},
@@ -750,9 +750,9 @@ YUI.add('juju-view-utils', function(Y) {
serviceUnitAnnotation = serviceOrUnit.annotations;
}
annotation = (
- serviceUnitAnnotation &&
+ serviceUnitAnnotation &&
serviceUnitAnnotation['landscape-computer']
- );
+ );
if (!annotation) {
console.warn('Unit missing the landscape-computer annotation!');
return undefined;
@@ -898,7 +898,7 @@ YUI.add('juju-view-utils', function(Y) {
@param {Object} constraints The constraints to create the new machines with.
*/
utils.createMachinesPlaceUnits = function(
- db, env, service, numUnits, constraints) {
+ db, env, service, numUnits, constraints) {
let machine;
let parentId = null;
let containerType =null;
@@ -912,8 +912,8 @@ YUI.add('juju-view-utils', function(Y) {
db.machines.remove(machine);
}.bind(this, machine), { modelId: machine.id});
env.placeUnit(
- utils.addGhostAndEcsUnits(db, env, service, 1)[0],
- machine.id);
+ utils.addGhostAndEcsUnits(db, env, service, 1)[0],
+ machine.id);
}
};
@@ -948,7 +948,7 @@ YUI.add('juju-view-utils', function(Y) {
// canvas.
if (serviceName.indexOf('$') > 0) {
displayName = service.get('displayName')
- .replace(/^\(/, '').replace(/\)$/, '');
+ .replace(/^\(/, '').replace(/\)$/, '');
} else {
displayName = serviceName;
}
@@ -963,11 +963,11 @@ YUI.add('juju-view-utils', function(Y) {
subordinate: service.get('subordinate')
});
env.add_unit(
- serviceName,
- 1,
- null,
- removeGhostAddUnitCallback.bind(null, ghostUnit, db, callback),
- {modelId: unitId});
+ serviceName,
+ 1,
+ null,
+ removeGhostAddUnitCallback.bind(null, ghostUnit, db, callback),
+ {modelId: unitId});
units.push(ghostUnit);
}
return units;
@@ -1007,8 +1007,8 @@ YUI.add('juju-view-utils', function(Y) {
utils.destroyService = function(db, env, service, callback) {
if (service.name === 'service') {
env.destroyApplication(service.get('id'),
- utils._destroyServiceCallback.bind(this, service, db, callback),
- {modelId: null});
+ utils._destroyServiceCallback.bind(this, service, db, callback),
+ {modelId: null});
} else if (service.get('pending')) {
db.services.remove(service);
service.destroy();
@@ -1180,7 +1180,7 @@ YUI.add('juju-view-utils', function(Y) {
// escaped the forward slashes and removed the negative-lookbehind, which JS
// does not support. See line 46 in Gruber's gist; that's the line/feature
// I had to take out.
- var URL_RE = /\b((?:(?:https?|ftp):(?:\/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|Ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)\/)(?:[^\s()<>{}\[\]]+|\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\))+(?:\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])|(?:[a-z0-9]+(?:[.\-][a-z0-9]+)*[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|Ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)\b\/?(?!@)))/ig; // eslint-disable-line max-len
+ var URL_RE = /\b((?:(?:https?|ftp):(?:\/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|Ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)\/)(?:[^\s()<>{}\[\]]+|\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\))+(?:\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])|(?:[a-z0-9]+(?:[.\-][a-z0-9]+)*[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|Ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)\b\/?(?!@)))/ig; // eslint-disable-line max-len
/**
Convert plain text links to anchor tags.
@@ -1704,12 +1704,12 @@ YUI.add('juju-view-utils', function(Y) {
message: (
Need help? Read more about credentials in
+ href="https://jujucharms.com/docs/stable/credentials"
+ target="_blank" title="Cloud credentials help">credentials in
general or setting up
+ href="https://jujucharms.com/docs/stable/help-google"
+ target="_blank"
+ title="Help using the Google Compute Engine public cloud">setting up
GCE credentials.
)
@@ -1737,11 +1737,11 @@ YUI.add('juju-view-utils', function(Y) {
message: (
Need help? Read more about credentials in
+ href="https://jujucharms.com/docs/stable/credentials"
+ target="_blank" title="Cloud credentials help">credentials in
general or setting up
+ href="https://jujucharms.com/docs/stable/help-azure" target="_blank"
+ title="Help using the Microsoft Azure public cloud">setting up
Azure credentials.
)
@@ -1767,11 +1767,11 @@ YUI.add('juju-view-utils', function(Y) {
message: (
Need help? Read more about credentials in
+ href="https://jujucharms.com/docs/stable/credentials"
+ target="_blank" title="Cloud credentials help">credentials in
general or setting up
+ href="https://jujucharms.com/docs/stable/help-aws" target="_blank"
+ title="Help using the Amazon Web Service public cloud">setting up
AWS credentials.
)
diff --git a/jujugui/static/gui/src/test/factory.js b/jujugui/static/gui/src/test/factory.js
index c91967237b..73a4d9e5eb 100644
--- a/jujugui/static/gui/src/test/factory.js
+++ b/jujugui/static/gui/src/test/factory.js
@@ -63,7 +63,7 @@ YUI(GlobalConfig).add('juju-tests-factory', function(Y) {
callback(null, xhr);
} else {
xhr.target.responseText = JSON.stringify(
- {message: 'Unable to load charm ' + path});
+ {message: 'Unable to load charm ' + path});
callback('bad wolf', xhr);
}
}
diff --git a/jujugui/static/gui/src/test/required-props.js b/jujugui/static/gui/src/test/required-props.js
index 2033acb777..d34a69e07b 100644
--- a/jujugui/static/gui/src/test/required-props.js
+++ b/jujugui/static/gui/src/test/required-props.js
@@ -5,7 +5,7 @@
// Validate prop type errors.
beforeEach(function() {
- spyOn(console, 'error').and.callThrough(); // eslint-disable-line no-undef
+ spyOn(console, 'error').and.callThrough(); // eslint-disable-line no-undef
});
afterEach(function() {
diff --git a/jujugui/static/gui/src/test/test_app.js b/jujugui/static/gui/src/test/test_app.js
index 26bd709a1c..da4972b005 100644
--- a/jujugui/static/gui/src/test/test_app.js
+++ b/jujugui/static/gui/src/test/test_app.js
@@ -216,9 +216,9 @@ describe('App', function() {
assert.equal(app.get('charmstore').url, 'http://1.2.3.4/v5');
window.juju_config.charmstoreURL = 'it broke';
assert.equal(
- app.get('charmstore').url,
- 'http://1.2.3.4/v5',
- 'It should only ever create a single instance of the charmstore');
+ app.get('charmstore').url,
+ 'http://1.2.3.4/v5',
+ 'It should only ever create a single instance of the charmstore');
});
});
@@ -249,11 +249,11 @@ describe('App', function() {
// that the DOM exists when it initializes.
container = testUtils.makeAppContainer();
Y = YUI(GlobalConfig).use(
- ['juju-gui', 'juju-tests-utils', 'juju-view-utils', 'juju-views'],
- function(Y) {
- juju = Y.namespace('juju');
- done();
- });
+ ['juju-gui', 'juju-tests-utils', 'juju-view-utils', 'juju-views'],
+ function(Y) {
+ juju = Y.namespace('juju');
+ done();
+ });
});
beforeEach(function() {
@@ -464,11 +464,11 @@ describe('App', function() {
}, this);
determineFileTypeStub = sinon.stub(
- app, '_determineFileType').returns('zip');
+ app, '_determineFileType').returns('zip');
renderDragOverStub = sinon.stub(
- app, '_renderDragOverNotification');
+ app, '_renderDragOverNotification');
dragTimerControlStub = sinon.stub(
- app, '_dragleaveTimerControl');
+ app, '_dragleaveTimerControl');
this._cleanups.concat([
determineFileTypeStub.restore,
renderDragOverStub.restore,
@@ -711,10 +711,10 @@ describe('App', function() {
before(function(done) {
Y = YUI(GlobalConfig).use(['juju-gui', 'juju-tests-utils'],
- function(Y) {
- juju = Y.namespace('juju');
- done();
- });
+ function(Y) {
+ juju = Y.namespace('juju');
+ done();
+ });
});
beforeEach(function() {
@@ -952,7 +952,7 @@ describe('App', function() {
assert.equal(app.db.fireSignal, 'update', 'db was not updated.');
var topo = app.views.environment.instance.topo;
assert.isTrue(topo.modules.ServiceModule.centerOnLoad,
- 'canvas centering was not reset.');
+ 'canvas centering was not reset.');
});
it('clears and resets the env, db, and ecs on change', function() {
@@ -964,7 +964,7 @@ describe('App', function() {
assert.equal(app.db.fireSignal, 'update', 'db was not updated.');
var topo = app.views.environment.instance.topo;
assert.isTrue(topo.modules.ServiceModule.centerOnLoad,
- 'canvas centering was not reset.');
+ 'canvas centering was not reset.');
});
it('can not clear and reset the db, and ecs on change', function() {
@@ -1181,9 +1181,9 @@ describe('App', function() {
before(function(done) {
Y = YUI(GlobalConfig).use(
- ['juju-gui'], function(Y) {
- done();
- });
+ ['juju-gui'], function(Y) {
+ done();
+ });
});
beforeEach(function() {
diff --git a/jujugui/static/gui/src/test/test_app_renderer_extension.js b/jujugui/static/gui/src/test/test_app_renderer_extension.js
index 47450c3501..663c05afac 100644
--- a/jujugui/static/gui/src/test/test_app_renderer_extension.js
+++ b/jujugui/static/gui/src/test/test_app_renderer_extension.js
@@ -40,13 +40,13 @@ describe('App Renderer Extension', function() {
beforeEach(function() {
Renderer = Y.Base.create(
- 'apprenderer', Y.Base, [juju.AppRenderer], {}, {
- ATTRS: {
- gisf: {
- value: false
- }
+ 'apprenderer', Y.Base, [juju.AppRenderer], {}, {
+ ATTRS: {
+ gisf: {
+ value: false
}
- });
+ }
+ });
renderer = new Renderer();
// React method stubs.
renderStub = sinon.stub(ReactDOM, 'render');
@@ -115,7 +115,7 @@ describe('App Renderer Extension', function() {
renderer._renderBreadcrumb({showEnvSwitcher: showEnvSwitcher});
var props = createElementStub.lastCall.args[1];
assert.equal(props['showEnvSwitcher'], showEnvSwitcher,
- 'The showEnvSwitcher prop was not set properly.');
+ 'The showEnvSwitcher prop was not set properly.');
});
it('hides the switcher when controllerAPI is not set', function() {
@@ -123,7 +123,7 @@ describe('App Renderer Extension', function() {
renderer._renderBreadcrumb();
var props = createElementStub.lastCall.args[1];
assert.equal(props['showEnvSwitcher'], false,
- 'The showEnvSwitcher prop was not set properly.');
+ 'The showEnvSwitcher prop was not set properly.');
});
it('hides the switcher when facade versions are not set', function() {
@@ -131,7 +131,7 @@ describe('App Renderer Extension', function() {
renderer._renderBreadcrumb();
var props = createElementStub.lastCall.args[1];
assert.equal(props['showEnvSwitcher'], false,
- 'The showEnvSwitcher prop was not set properly.');
+ 'The showEnvSwitcher prop was not set properly.');
});
it('shows the switcher when gisf is true', function() {
@@ -139,7 +139,7 @@ describe('App Renderer Extension', function() {
renderer._renderBreadcrumb();
var props = createElementStub.lastCall.args[1];
assert.equal(props['showEnvSwitcher'], true,
- 'The showEnvSwitcher prop was not set properly.');
+ 'The showEnvSwitcher prop was not set properly.');
});
});
});
diff --git a/jujugui/static/gui/src/test/test_autodeploy_extension.js b/jujugui/static/gui/src/test/test_autodeploy_extension.js
index 2222d4a344..7041bf8469 100644
--- a/jujugui/static/gui/src/test/test_autodeploy_extension.js
+++ b/jujugui/static/gui/src/test/test_autodeploy_extension.js
@@ -32,7 +32,7 @@ describe('Autodeploy Extension', function() {
beforeEach(function() {
Widget = Y.Base.create(
- 'autodeployer', Y.Base, [juju.widgets.AutodeployExtension], {});
+ 'autodeployer', Y.Base, [juju.widgets.AutodeployExtension], {});
widget = new Widget();
setAttrsStub = sinon.stub();
reviveStub = sinon.stub().returns({
@@ -79,12 +79,12 @@ describe('Autodeploy Extension', function() {
};
widget._autoPlaceUnits();
assert.equal(filterStub.called, true,
- 'did not query DB for unplaced units');
+ 'did not query DB for unplaced units');
assert.equal(createStub.callCount, units.length,
- 'did not create a machine for each unit');
+ 'did not create a machine for each unit');
assert.deepEqual(createStub.lastCall.args, [null, null, 'xenial', null]);
assert.equal(placeStub.callCount, units.length,
- 'did not place each unit');
+ 'did not place each unit');
var allArgs = placeStub.args;
units.forEach(function(expectedUnit, index) {
var actualUnit = allArgs[index][0],
@@ -114,9 +114,9 @@ describe('Autodeploy Extension', function() {
env.addMachines = addStub;
widget._createMachine();
assert.equal(addStub.calledOnce, true,
- 'machine not added');
+ 'machine not added');
assert.deepEqual(addStub.lastCall.args[2], {modelId: id},
- 'incorrect machine ID');
+ 'incorrect machine ID');
});
it('handles response errors when creating new machines', function() {
@@ -132,14 +132,14 @@ describe('Autodeploy Extension', function() {
db.notifications = {add: notifyStub};
widget._onMachineCreated({}, response);
assert.equal(notifyStub.calledOnce, true,
- 'error notification not added to the DB');
+ 'error notification not added to the DB');
var notification = notifyStub.lastCall.args[0];
assert.equal(notification.title, 'Error creating the new machine',
- 'unexpected error title');
+ 'unexpected error title');
assert.equal(notification.message.indexOf(message) > 0, true,
- 'unexpected error message');
+ 'unexpected error message');
assert.equal(removeStub.calledOnce, true,
- 'did not remove machine');
+ 'did not remove machine');
});
it('handles machine errors when creating new machines', function() {
@@ -154,14 +154,14 @@ describe('Autodeploy Extension', function() {
db.notifications = {add: notifyStub};
widget._onMachineCreated({}, response);
assert.equal(notifyStub.calledOnce, true,
- 'error notification not added to the DB');
+ 'error notification not added to the DB');
var notification = notifyStub.lastCall.args[0];
assert.equal(notification.title.indexOf('Error creating machine') === 0,
- true, 'unexpected error title');
+ true, 'unexpected error title');
assert.equal(notification.message.indexOf(message) > 0, true,
- 'unexpected error message');
+ 'unexpected error message');
assert.equal(removeStub.calledOnce, true,
- 'did not remove machine');
+ 'did not remove machine');
});
it('properly sets up the model when creating new machine', function() {
@@ -172,8 +172,8 @@ describe('Autodeploy Extension', function() {
widget._onMachineCreated({}, response);
assert.equal(db.machines.updateModelId.callCount, 1);
assert.deepEqual(
- db.machines.updateModelId.lastCall.args,
- [{}, 'test/lxc/0', true]);
+ db.machines.updateModelId.lastCall.args,
+ [{}, 'test/lxc/0', true]);
assert.equal(setAttrsStub.callCount, 1);
assert.deepEqual(
setAttrsStub.lastCall.args,
diff --git a/jujugui/static/gui/src/test/test_bundle_import_notifications.js b/jujugui/static/gui/src/test/test_bundle_import_notifications.js
index 435e894d11..f8e7f97dbb 100644
--- a/jujugui/static/gui/src/test/test_bundle_import_notifications.js
+++ b/jujugui/static/gui/src/test/test_bundle_import_notifications.js
@@ -25,11 +25,11 @@ with this program. If not, see
.
before(function(done) {
YUI(GlobalConfig).use(
- 'bundle-import-notifications',
- function(Y) {
- ns = Y.namespace('juju');
- done();
- });
+ 'bundle-import-notifications',
+ function(Y) {
+ ns = Y.namespace('juju');
+ done();
+ });
});
beforeEach(function() {
@@ -149,7 +149,7 @@ with this program. If not, see
.
it('notifies an error', function() {
bundleNotifications._notifyDeploymentChange(
- db, 42, 'completed', 'bad wolf');
+ db, 42, 'completed', 'bad wolf');
assertNotification({
title: 'Updated status for deployment id: 42',
message: 'An error occurred while deploying the bundle: bad wolf',
diff --git a/jujugui/static/gui/src/test/test_bundle_importer.js b/jujugui/static/gui/src/test/test_bundle_importer.js
index f013b08cdb..b8031421b9 100644
--- a/jujugui/static/gui/src/test/test_bundle_importer.js
+++ b/jujugui/static/gui/src/test/test_bundle_importer.js
@@ -107,9 +107,9 @@ describe('Bundle Importer', function() {
var asText = sinon.stub();
var generate = sinon.stub(
bundleImporter, '_generateFileReader').returns({
- onload: '',
- readAsText: asText
- });
+ onload: '',
+ readAsText: asText
+ });
var hideNotification = sinon.stub();
bundleImporter.hideDragOverNotification = hideNotification;
var onload = sinon.stub(bundleImporter, '_fileReaderOnload');
@@ -265,7 +265,7 @@ describe('Bundle Importer', function() {
it('properly sorts a recordSet', function() {
var data = utils.loadFixture(
- 'data/wordpress-bundle-recordset.json', true);
+ 'data/wordpress-bundle-recordset.json', true);
var sorted = bundleImporter._sortDryRunRecords(data);
var order = [
'addCharm-0', 'deploy-1', 'setAnnotations-2',
@@ -288,7 +288,7 @@ describe('Bundle Importer', function() {
];
var execute = sinon.stub(bundleImporter, '_executeRecord');
var notification = sinon.stub(
- bundleImporter.db.notifications, 'add');
+ bundleImporter.db.notifications, 'add');
this._cleanups.push(notification.restore);
bundleImporter._executeDryRun(sortedRecords);
const args = execute.lastCall.args;
@@ -310,7 +310,7 @@ describe('Bundle Importer', function() {
callback(null, entityId);
};
var data = utils.loadFixture(
- 'data/wordpress-bundle-recordset.json', true);
+ 'data/wordpress-bundle-recordset.json', true);
const handler = () => {
document.removeEventListener('topo.bundleImportComplete', handler);
// Cleans up internals.
@@ -333,7 +333,7 @@ describe('Bundle Importer', function() {
assert.equal(db.units.item(0).service, db.services.item(0).get('id'));
assert.equal(db.units.item(0).displayName, 'haproxy/0');
assert.equal(db.services.item(1).get('charm'),
- 'cs:precise/wordpress-27');
+ 'cs:precise/wordpress-27');
assert.equal(db.units.item(1).service, db.services.item(1).get('id'));
assert.equal(db.units.item(1).displayName, 'wordpress/0');
assert.equal(db.services.item(2).get('charm'), 'cs:precise/mysql-51');
@@ -358,11 +358,11 @@ describe('Bundle Importer', function() {
db.services.item(2).get('id')
];
assert.equal(
- db.relations.item(0).get('id'),
- `pending-$deploy-1:reverseproxy${id[0]}$deploy-4:website${id[1]}`);
+ db.relations.item(0).get('id'),
+ `pending-$deploy-1:reverseproxy${id[0]}$deploy-4:website${id[1]}`);
assert.equal(
- db.relations.item(1).get('id'),
- `pending-$deploy-4:db${id[1]}$deploy-7:db${id[2]}`);
+ db.relations.item(1).get('id'),
+ `pending-$deploy-4:db${id[1]}$deploy-7:db${id[2]}`);
// Expose
assert.equal(db.services.item(0).get('exposed'), false);
assert.equal(db.services.item(1).get('exposed'), false);
@@ -381,7 +381,7 @@ describe('Bundle Importer', function() {
charm: 'cs:precise/haproxy-35'
}));
var data = utils.loadFixture(
- 'data/wordpress-bundle-recordset.json', true);
+ 'data/wordpress-bundle-recordset.json', true);
const handler = () => {
document.removeEventListener('topo.bundleImportComplete', handler);
assert.equal(db.services.item(0).get('name'), 'haproxy');
@@ -394,7 +394,7 @@ describe('Bundle Importer', function() {
it('sets up the correct model (v3 colocation)', function() {
var data = utils.loadFixture(
- 'data/wordpress-bundle-v3-recordset.json', true);
+ 'data/wordpress-bundle-v3-recordset.json', true);
bundleImporter.importBundleDryRun(data);
assert.equal(db.services.size(), 2);
assert.equal(db.units.size(), 2);
diff --git a/jujugui/static/gui/src/test/test_changes_utils.js b/jujugui/static/gui/src/test/test_changes_utils.js
index 792244c672..8e7d7b46c6 100644
--- a/jujugui/static/gui/src/test/test_changes_utils.js
+++ b/jujugui/static/gui/src/test/test_changes_utils.js
@@ -58,7 +58,7 @@ describe('ChangesUtils', function() {
it('returns the service', function() {
addEntities(db);
var service = changesUtils.getServiceByUnitId('django/0',
- db.services, db.units);
+ db.services, db.units);
assert.strictEqual(service.get('id'), 'django');
});
@@ -222,11 +222,11 @@ describe('ChangesUtils', function() {
}];
// This method needs to be stubbed out for the add relation path.
var endpointNames = sinon.stub(
- changesUtils, 'getRealRelationEndpointNames').returns(['foo', 'baz']);
+ changesUtils, 'getRealRelationEndpointNames').returns(['foo', 'baz']);
this._cleanups.push(endpointNames.restore);
tests.forEach(function(test) {
var change = changesUtils.generateChangeDescription(
- db.services, db.units, test.change, true);
+ db.services, db.units, test.change, true);
assert.equal(change.icon, test.icon);
assert.equal(change.description, test.msg);
if (test.timestamp) {
@@ -239,12 +239,12 @@ describe('ChangesUtils', function() {
it('can generate descriptions for all the changes in the ecs', function() {
var stubDescription = sinon.stub(
- changesUtils,
- 'generateChangeDescription');
+ changesUtils,
+ 'generateChangeDescription');
this._cleanups.push(stubDescription.restore);
ecs.changeSet = { foo: { index: 0 }, bar: { index: 0 } };
changesUtils.generateAllChangeDescriptions(
- db.services, db.units, ecs.changeSet);
+ db.services, db.units, ecs.changeSet);
assert.equal(stubDescription.callCount, 2);
});
diff --git a/jujugui/static/gui/src/test/test_console.js b/jujugui/static/gui/src/test/test_console.js
index 27859c271b..13a36b64a0 100644
--- a/jujugui/static/gui/src/test/test_console.js
+++ b/jujugui/static/gui/src/test/test_console.js
@@ -22,11 +22,11 @@ describe('application console', function() {
var consoleManager;
before(function(done) {
YUI(GlobalConfig).use(['juju-views', 'juju-view-utils', 'juju-tests-utils'],
- function(Y) {
- consoleManager = Y.namespace('juju.views.utils')
- .consoleManager();
- done();
- });
+ function(Y) {
+ consoleManager = Y.namespace('juju.views.utils')
+ .consoleManager();
+ done();
+ });
});
afterEach(function() {
diff --git a/jujugui/static/gui/src/test/test_controller_api.js b/jujugui/static/gui/src/test/test_controller_api.js
index c9a299d623..ccf939b6be 100644
--- a/jujugui/static/gui/src/test/test_controller_api.js
+++ b/jujugui/static/gui/src/test/test_controller_api.js
@@ -854,7 +854,7 @@ describe('Controller API', function() {
assert.strictEqual(result1.owner, 'admin@local');
assert.strictEqual(result1.isAlive, true, 'unexpected zombie model');
assert.strictEqual(result1.isController, false,
- 'unexpected controller model');
+ 'unexpected controller model');
const result2 = models[1];
assert.strictEqual(result2.id, id2);
assert.strictEqual(result2.name, 'model2');
@@ -871,7 +871,7 @@ describe('Controller API', function() {
assert.strictEqual(result2.owner, 'dalek@skaro');
assert.strictEqual(result2.isAlive, false, 'unexpected alive model');
assert.strictEqual(result2.isController, false,
- 'unexpected controller model');
+ 'unexpected controller model');
assert.equal(conn.messages.length, 1);
assert.deepEqual(conn.last_message(), {
type: 'ModelManager',
@@ -1014,7 +1014,7 @@ describe('Controller API', function() {
assert.strictEqual(result.owner, 'admin@local');
assert.strictEqual(result.isAlive, true, 'unexpected zombie model');
assert.strictEqual(result.isController, false,
- 'unexpected controller model');
+ 'unexpected controller model');
assert.deepEqual(
result.lastConnection, new Date('2000-01-01T00:00:00Z'));
assert.equal(conn.messages.length, 2);
@@ -1111,7 +1111,7 @@ describe('Controller API', function() {
assert.strictEqual(result1.owner, 'dalek@local');
assert.strictEqual(result1.isAlive, false, 'unexpected alive model');
assert.strictEqual(result1.isController, false,
- 'unexpected admin model');
+ 'unexpected admin model');
assert.strictEqual(result1.lastConnection, null);
const result2 = models[1];
assert.strictEqual(result2.err, undefined);
@@ -1130,7 +1130,7 @@ describe('Controller API', function() {
assert.strictEqual(result2.owner, 'who@local');
assert.strictEqual(result2.isAlive, true, 'unexpected zombie model');
assert.strictEqual(result2.isController, false,
- 'unexpected controller model');
+ 'unexpected controller model');
assert.strictEqual(result2.lastConnection, null);
const result3 = models[2];
assert.strictEqual(result3.err, undefined);
@@ -1149,7 +1149,7 @@ describe('Controller API', function() {
assert.strictEqual(result3.owner, 'cyberman@local');
assert.strictEqual(result3.isAlive, true, 'unexpected zombie model');
assert.strictEqual(result3.isController, false,
- 'unexpected controller model');
+ 'unexpected controller model');
assert.strictEqual(result3.lastConnection, null);
assert.equal(conn.messages.length, 2);
assert.deepEqual(conn.messages[0], {
diff --git a/jujugui/static/gui/src/test/test_d3_components.js b/jujugui/static/gui/src/test/test_d3_components.js
index 4e4c5102c9..26f53eeff7 100644
--- a/jujugui/static/gui/src/test/test_d3_components.js
+++ b/jujugui/static/gui/src/test/test_d3_components.js
@@ -124,39 +124,39 @@ describe('d3-components', function() {
});
it('should allow event bindings through the use of a declarative object',
- function() {
- comp = new NS.Component();
- comp.setAttrs({container: container});
-
- // Change test module to use rich captures on some events.
- // This defines a phase for click (before, after, on (default))
- // and also shows an inline callback (which is discouraged but allowed)
- modA = new TestModule();
- modA.events.scene['.thing'] = {
- click: {phase: 'after',
- callback: 'afterThing'},
- dblclick: {phase: 'on',
- callback: function(evt) {
- state.dbldbl = true;
- }}};
- modA.afterThing = function(evt) {
- state.clicked = true;
- };
- comp.addModule(modA);
- comp.render();
-
- document.querySelector('.thing').click();
- state.clicked.should.equal(true);
-
- const event = new MouseEvent('dblclick', {
- 'view': window,
- 'bubbles': true,
- 'cancelable': true
- });
- document.querySelector('.thing').dispatchEvent(event);
- state.dbldbl.should.equal(true);
-
- });
+ function() {
+ comp = new NS.Component();
+ comp.setAttrs({container: container});
+
+ // Change test module to use rich captures on some events.
+ // This defines a phase for click (before, after, on (default))
+ // and also shows an inline callback (which is discouraged but allowed)
+ modA = new TestModule();
+ modA.events.scene['.thing'] = {
+ click: {phase: 'after',
+ callback: 'afterThing'},
+ dblclick: {phase: 'on',
+ callback: function(evt) {
+ state.dbldbl = true;
+ }}};
+ modA.afterThing = function(evt) {
+ state.clicked = true;
+ };
+ comp.addModule(modA);
+ comp.render();
+
+ document.querySelector('.thing').click();
+ state.clicked.should.equal(true);
+
+ const event = new MouseEvent('dblclick', {
+ 'view': window,
+ 'bubbles': true,
+ 'cancelable': true
+ });
+ document.querySelector('.thing').dispatchEvent(event);
+ state.dbldbl.should.equal(true);
+
+ });
it('should correctly handle synthetic event bindings', function(done) {
comp = new NS.Component();
@@ -183,7 +183,7 @@ describe('d3-components', function() {
compB.render();
assert.notEqual(compA.events.TestModule.subscriptions[1].callable,
- compB.events.TestModule.subscriptions[1].callable);
+ compB.events.TestModule.subscriptions[1].callable);
// Cleanup
compA.unbind();
@@ -193,34 +193,34 @@ describe('d3-components', function() {
});
it('should support basic rendering from all modules',
- function() {
- var modA = new TestModule(),
- modB = new TestModule();
-
- comp = new NS.Component();
- // Give each of these a render method that adds to container
- modA.name = 'moda';
- modA.render = function() {
- const node = document.createElement('div');
- node.setAttribute('id', 'fromA');
- this.get('container').appendChild(node);
- };
-
- modB.name = 'modb';
- modB.render = function() {
- const node = document.createElement('div');
- node.setAttribute('id', 'fromB');
- this.get('container').appendChild(node);
- };
-
- comp.setAttrs({container: container});
- comp.addModule(modA)
+ function() {
+ var modA = new TestModule(),
+ modB = new TestModule();
+
+ comp = new NS.Component();
+ // Give each of these a render method that adds to container
+ modA.name = 'moda';
+ modA.render = function() {
+ const node = document.createElement('div');
+ node.setAttribute('id', 'fromA');
+ this.get('container').appendChild(node);
+ };
+
+ modB.name = 'modb';
+ modB.render = function() {
+ const node = document.createElement('div');
+ node.setAttribute('id', 'fromB');
+ this.get('container').appendChild(node);
+ };
+
+ comp.setAttrs({container: container});
+ comp.addModule(modA)
.addModule(modB);
- comp.render();
- viewUtils.isValue(document.querySelector('#fromA')).should.equal(true);
- viewUtils.isValue(document.querySelector('#fromB')).should.equal(true);
- });
+ comp.render();
+ viewUtils.isValue(document.querySelector('#fromA')).should.equal(true);
+ viewUtils.isValue(document.querySelector('#fromB')).should.equal(true);
+ });
it('should support d3 event bindings post render', function() {
comp = new NS.Component();
diff --git a/jujugui/static/gui/src/test/test_endpoints.js b/jujugui/static/gui/src/test/test_endpoints.js
index ea3343644e..77ebb97ce3 100644
--- a/jujugui/static/gui/src/test/test_endpoints.js
+++ b/jujugui/static/gui/src/test/test_endpoints.js
@@ -115,10 +115,10 @@ describe('Relation endpoints logic', function() {
app.endpointsController.endpointsMap = sample_endpoints;
var service = db.services.getById('mediawiki'),
available_svcs = Object.keys(models.getEndpoints(
- service, app.endpointsController));
+ service, app.endpointsController));
available_svcs.sort();
available_svcs.should.eql(
- ['memcached', 'mysql', 'puppet', 'rsyslog-forwarder-ha']);
+ ['memcached', 'mysql', 'puppet', 'rsyslog-forwarder-ha']);
});
it('should find valid targets including subordinates', function() {
@@ -130,7 +130,7 @@ describe('Relation endpoints logic', function() {
available_svcs = Object.keys(available);
available_svcs.sort();
available_svcs.should.eql(
- ['mediawiki', 'puppet', 'rsyslog-forwarder-ha', 'wordpress']);
+ ['mediawiki', 'puppet', 'rsyslog-forwarder-ha', 'wordpress']);
});
it('should find multi-series subordinates with matching series', function() {
@@ -153,7 +153,7 @@ describe('Relation endpoints logic', function() {
const available_svcs = Object.keys(available);
available_svcs.sort();
available_svcs.should.eql(
- ['mediawiki', 'puppet', 'rsyslog-forwarder-ha', 'wordpress']);
+ ['mediawiki', 'puppet', 'rsyslog-forwarder-ha', 'wordpress']);
});
it('should match app series if it is a multi-series subordinate', function() {
@@ -190,19 +190,19 @@ describe('Relation endpoints logic', function() {
// it can establish with mysql.
available.mediawiki.should.eql([
[{name: 'db', service: 'mysql', type: 'mysql'},
- {name: 'slave', service: 'mediawiki', type: 'mysql'}],
+ {name: 'slave', service: 'mediawiki', type: 'mysql'}],
[{name: 'db', service: 'mysql', type: 'mysql'},
- {name: 'db', service: 'mediawiki', type: 'mysql'}]
+ {name: 'db', service: 'mediawiki', type: 'mysql'}]
]);
// Demonstrate the inverse retrieval of the same.
available = models.getEndpoints(
- db.services.getById('mediawiki'), app.endpointsController);
+ db.services.getById('mediawiki'), app.endpointsController);
available.mysql.should.eql([
[{name: 'slave', service: 'mediawiki', type: 'mysql'},
- {name: 'db', service: 'mysql', type: 'mysql'}],
+ {name: 'db', service: 'mysql', type: 'mysql'}],
[{name: 'db', service: 'mediawiki', type: 'mysql'},
- {name: 'db', service: 'mysql', type: 'mysql'}]
+ {name: 'db', service: 'mysql', type: 'mysql'}]
]);
});
@@ -378,13 +378,13 @@ describe('Endpoints map', function() {
});
it('should add a service to the map, neither provides nor requires',
- function() {
- controller.endpointsMap = {};
- controller.addServiceToEndpointsMap('wordpress', charm);
- controller.endpointsMap.should.eql({wordpress: {
- requires: [],
- provides: []}});
- });
+ function() {
+ controller.endpointsMap = {};
+ controller.addServiceToEndpointsMap('wordpress', charm);
+ controller.endpointsMap.should.eql({wordpress: {
+ requires: [],
+ provides: []}});
+ });
it('should reset the map', function() {
var testmap = {'columbus': 'sailed the ocean blue'};
@@ -443,7 +443,7 @@ describe('Endpoints map handlers', function() {
});
env.connect();
_renderComponents = sinon.stub(
- Y.juju.App.prototype, '_renderComponents');
+ Y.juju.App.prototype, '_renderComponents');
app = new Y.juju.App({
baseUrl: 'http://example.com/',
env: env,
@@ -480,83 +480,83 @@ describe('Endpoints map handlers', function() {
});
it('should update endpoints map when pending services are added',
- function(done) {
- var applicationName = 'wordpress';
- var charmUrl = 'cs:precise/wordpress-2';
- app.db.charms.add({id: charmUrl});
- var charm = app.db.charms.getById(charmUrl);
- destroyMe.push(charm);
- charm.loaded = true;
-
- const handler = () => {
- controller.endpointsMap.should.eql({wordpress: {
- requires: [],
- provides: []}});
- // This will hang forever if the endpoint map doesn't update.
- document.removeEventListener('endpointMapAdded', handler);
- done();
- };
- document.addEventListener('endpointMapAdded', handler);
- app.db.services.add({
- id: applicationName,
- pending: true,
- loaded: true,
- charmstore: factory.makeFakeCharmstore(),
- charm: charmUrl
- });
- });
+ function(done) {
+ var applicationName = 'wordpress';
+ var charmUrl = 'cs:precise/wordpress-2';
+ app.db.charms.add({id: charmUrl});
+ var charm = app.db.charms.getById(charmUrl);
+ destroyMe.push(charm);
+ charm.loaded = true;
+
+ const handler = () => {
+ controller.endpointsMap.should.eql({wordpress: {
+ requires: [],
+ provides: []}});
+ // This will hang forever if the endpoint map doesn't update.
+ document.removeEventListener('endpointMapAdded', handler);
+ done();
+ };
+ document.addEventListener('endpointMapAdded', handler);
+ app.db.services.add({
+ id: applicationName,
+ pending: true,
+ loaded: true,
+ charmstore: factory.makeFakeCharmstore(),
+ charm: charmUrl
+ });
+ });
it('should update endpoints map when non-pending services are added',
- function(done) {
- var applicationName = 'wordpress';
- var charmUrl = 'cs:precise/wordpress-2';
- app.db.charms.add({id: charmUrl});
- var charm = app.db.charms.getById(charmUrl);
- destroyMe.push(charm);
- charm.loaded = true;
-
- const handler = () => {
- controller.endpointsMap.should.eql({wordpress: {
- requires: [],
- provides: []}});
- // This will hang forever if the endpoint map doesn't update.
- document.removeEventListener('endpointMapAdded', handler);
- done();
- };
- document.addEventListener('endpointMapAdded', handler);
- app.db.services.add({
- id: applicationName,
- pending: false,
- loaded: true,
- charmstore: factory.makeFakeCharmstore(),
- charm: charmUrl
- });
- });
+ function(done) {
+ var applicationName = 'wordpress';
+ var charmUrl = 'cs:precise/wordpress-2';
+ app.db.charms.add({id: charmUrl});
+ var charm = app.db.charms.getById(charmUrl);
+ destroyMe.push(charm);
+ charm.loaded = true;
+
+ const handler = () => {
+ controller.endpointsMap.should.eql({wordpress: {
+ requires: [],
+ provides: []}});
+ // This will hang forever if the endpoint map doesn't update.
+ document.removeEventListener('endpointMapAdded', handler);
+ done();
+ };
+ document.addEventListener('endpointMapAdded', handler);
+ app.db.services.add({
+ id: applicationName,
+ pending: false,
+ loaded: true,
+ charmstore: factory.makeFakeCharmstore(),
+ charm: charmUrl
+ });
+ });
it('updates subordinate value when non-pending services are added',
- function(done) {
- var applicationName = 'puppet';
- var charmUrl = 'cs:precise/puppet-2';
- app.db.charms.add({id: charmUrl, is_subordinate: true});
- var charm = app.db.charms.getById(charmUrl);
- destroyMe.push(charm);
- charm.loaded = true;
-
- const handler = () => {
- var svc = app.db.services.getById(applicationName);
- assert.isTrue(svc.get('subordinate'));
- destroyMe.push(svc);
- document.removeEventListener('endpointMapAdded', handler);
- done();
- };
- document.addEventListener('endpointMapAdded', handler);
- app.db.services.add({
- id: applicationName,
- pending: false,
- loaded: true,
- charm: charmUrl
- });
+ function(done) {
+ var applicationName = 'puppet';
+ var charmUrl = 'cs:precise/puppet-2';
+ app.db.charms.add({id: charmUrl, is_subordinate: true});
+ var charm = app.db.charms.getById(charmUrl);
+ destroyMe.push(charm);
+ charm.loaded = true;
+
+ const handler = () => {
+ var svc = app.db.services.getById(applicationName);
+ assert.isTrue(svc.get('subordinate'));
+ destroyMe.push(svc);
+ document.removeEventListener('endpointMapAdded', handler);
+ done();
+ };
+ document.addEventListener('endpointMapAdded', handler);
+ app.db.services.add({
+ id: applicationName,
+ pending: false,
+ loaded: true,
+ charm: charmUrl
});
+ });
it('should remove service from endpoints map when it is deleted', function() {
var applicationName = 'wordpress';
@@ -676,28 +676,28 @@ describe('Application config handlers', function() {
};
it('should not call Application.Get when a pending service is added',
- function() {
- var charmUrl = 'cs:precise/wordpress-2';
- app.db.services.add({
- id: 'wordpress',
- pending: true,
- charm: charmUrl});
- assert.equal(0, conn.messages.length);
- });
+ function() {
+ var charmUrl = 'cs:precise/wordpress-2';
+ app.db.services.add({
+ id: 'wordpress',
+ pending: true,
+ charm: charmUrl});
+ assert.equal(0, conn.messages.length);
+ });
it('should call Application.Get when non-pending services are added',
- function() {
- var applicationName = 'wordpress';
- var charmUrl = 'cs:precise/wordpress-2';
- var charm = app.db.charms.add({id: charmUrl});
- destroyMe.push(charm);
- charm.loaded = true;
- app.db.services.add({
- id: applicationName,
- pending: false,
- charm: charmUrl});
- assertServiceGetCalled();
- });
+ function() {
+ var applicationName = 'wordpress';
+ var charmUrl = 'cs:precise/wordpress-2';
+ var charm = app.db.charms.add({id: charmUrl});
+ destroyMe.push(charm);
+ charm.loaded = true;
+ app.db.services.add({
+ id: applicationName,
+ pending: false,
+ charm: charmUrl});
+ assertServiceGetCalled();
+ });
it('should call Application.Get when a charm changes', function() {
var applicationName = 'wordpress';
diff --git a/jujugui/static/gui/src/test/test_entity_extension.js b/jujugui/static/gui/src/test/test_entity_extension.js
index de050f3a1d..1bf779d647 100644
--- a/jujugui/static/gui/src/test/test_entity_extension.js
+++ b/jujugui/static/gui/src/test/test_entity_extension.js
@@ -58,13 +58,13 @@ describe('Entity Extension', function() {
it('parses owner from the ID', function() {
assert.equal('owner', entityModel.ownerFromId(),
- 'owner was not extracted properly from the ID');
+ 'owner was not extracted properly from the ID');
});
it('defaults to charmers when owner is not in ID', function() {
entityModel.set('id', 'foobar');
assert.equal('charmers', entityModel.ownerFromId(),
- 'default owner was not set to "charmers"');
+ 'default owner was not set to "charmers"');
});
it('converts a charm to an entity POJO', function() {
@@ -98,7 +98,7 @@ describe('Entity Extension', function() {
};
assert.deepEqual(expected, entity,
- 'charm POJO did not match expected object');
+ 'charm POJO did not match expected object');
});
it('converts a bundle to an entity POJO', function() {
@@ -139,7 +139,7 @@ describe('Entity Extension', function() {
unitCount: 5
};
assert.deepEqual(expected, entity,
- 'bundle POJO did not match expected object');
+ 'bundle POJO did not match expected object');
});
it('uses the staticURL for bundle asset if available', function() {
@@ -157,7 +157,7 @@ describe('Entity Extension', function() {
var entity = entityModel.toEntity();
assert.deepEqual(
entity.iconPath,
- 'static/static/gui/build/app/assets/images/non-sprites/bundle.svg');
+ 'static/static/gui/build/app/assets/images/non-sprites/bundle.svg');
});
it('uses the correct name for the canonical-kubernetes bundle', function() {
diff --git a/jujugui/static/gui/src/test/test_env_api.js b/jujugui/static/gui/src/test/test_env_api.js
index 87671db0da..715fa68aa9 100644
--- a/jujugui/static/gui/src/test/test_env_api.js
+++ b/jujugui/static/gui/src/test/test_env_api.js
@@ -257,14 +257,14 @@ with this program. If not, see
.
it('converts integer constraints', function() {
var constraints = env.prepareConstraints(
- {'root-disk': '800', 'cpu-cores': '4', mem: '2000'});
+ {'root-disk': '800', 'cpu-cores': '4', mem: '2000'});
assert.deepEqual(
- constraints, {'root-disk': 800, 'cpu-cores': 4, mem: 2000});
+ constraints, {'root-disk': 800, 'cpu-cores': 4, mem: 2000});
});
it('removes integer constraints with invalid values', function() {
var constraints = env.prepareConstraints(
- {'cpu-power': 'four kquad', 'cpu-cores': 'tons', mem: 2000});
+ {'cpu-power': 'four kquad', 'cpu-cores': 'tons', mem: 2000});
assert.deepEqual(constraints, {mem: 2000});
});
@@ -286,7 +286,7 @@ with this program. If not, see
.
it('removes unexpected constraints', function() {
var constraints = env.prepareConstraints(
- {arch: 'i386', invalid: 'not-a-constraint'});
+ {arch: 'i386', invalid: 'not-a-constraint'});
assert.deepEqual(constraints, {arch: 'i386'});
});
@@ -312,7 +312,7 @@ with this program. If not, see
.
it('converts tags with spaces', function() {
var constraints = env.prepareConstraints(
- {tags: 'first tag, second tag'});
+ {tags: 'first tag, second tag'});
assert.deepEqual(constraints, {tags: ['first-tag', 'second-tag']});
});
@@ -1107,26 +1107,26 @@ with this program. If not, see
.
const mockWebHandler = {sendPostRequest: sinon.stub()};
env.set('webHandler', mockWebHandler);
env.uploadLocalCharm(
- 'a zip file', 'trusty',
- function() {return 'progress';},
- function() {return 'completed';});
+ 'a zip file', 'trusty',
+ function() {return 'progress';},
+ function() {return 'completed';});
// Ensure the web handler's sendPostRequest method has been called with
// the expected arguments.
assert.strictEqual(mockWebHandler.sendPostRequest.callCount, 1);
const lastArguments = mockWebHandler.sendPostRequest.lastCall.args;
assert.strictEqual(lastArguments.length, 7);
assert.strictEqual(
- lastArguments[0],
- '/juju-core/model/this-is-a-uuid/charms?series=trusty'); // Path.
+ lastArguments[0],
+ '/juju-core/model/this-is-a-uuid/charms?series=trusty'); // Path.
assert.deepEqual(
- lastArguments[1], {'Content-Type': 'application/zip'}); // Headers.
+ lastArguments[1], {'Content-Type': 'application/zip'}); // Headers.
assert.strictEqual(lastArguments[2], 'a zip file'); // Zip file object.
assert.strictEqual(lastArguments[3], 'user-user@local'); // User name.
assert.strictEqual(lastArguments[4], 'password'); // Password.
assert.strictEqual(
- lastArguments[5](), 'progress'); // Progress callback.
+ lastArguments[5](), 'progress'); // Progress callback.
assert.strictEqual(
- lastArguments[6](), 'completed'); // Completed callback.
+ lastArguments[6](), 'completed'); // Completed callback.
});
});
@@ -1136,7 +1136,7 @@ with this program. If not, see
.
const mockWebHandler = {getUrl: sinon.stub().returns('myurl')};
env.set('webHandler', mockWebHandler);
const url = env.getLocalCharmFileUrl(
- 'local:trusty/django-42', 'icon.svg');
+ 'local:trusty/django-42', 'icon.svg');
assert.strictEqual(url, 'myurl');
// Ensure the web handler's getUrl method has been called with the
// expected arguments.
@@ -1176,9 +1176,9 @@ with this program. If not, see
.
const mockWebHandler = {sendGetRequest: sinon.stub()};
env.set('webHandler', mockWebHandler);
env.listLocalCharmFiles(
- 'local:trusty/django-42',
- function() {return 'progress';},
- function() {return 'completed';});
+ 'local:trusty/django-42',
+ function() {return 'progress';},
+ function() {return 'completed';});
// Ensure the web handler's sendGetRequest method has been called with
// the expected arguments.
assert.strictEqual(mockWebHandler.sendGetRequest.callCount, 1);
@@ -1191,9 +1191,9 @@ with this program. If not, see
.
assert.strictEqual(lastArguments[2], 'user-user@local'); // User name.
assert.strictEqual(lastArguments[3], 'password'); // Password.
assert.strictEqual(
- lastArguments[4](), 'progress'); // Progress callback.
+ lastArguments[4](), 'progress'); // Progress callback.
assert.strictEqual(
- lastArguments[5](), 'completed'); // Completed callback.
+ lastArguments[5](), 'completed'); // Completed callback.
});
});
@@ -1204,9 +1204,9 @@ with this program. If not, see
.
const mockWebHandler = {sendGetRequest: sinon.stub()};
env.set('webHandler', mockWebHandler);
env.getLocalCharmFileContents(
- 'local:trusty/django-42', 'hooks/install',
- function() {return 'progress';},
- function() {return 'completed';});
+ 'local:trusty/django-42', 'hooks/install',
+ function() {return 'progress';},
+ function() {return 'completed';});
// Ensure the web handler's sendGetRequest method has been called with
// the expected arguments.
assert.strictEqual(mockWebHandler.sendGetRequest.callCount, 1);
@@ -1219,9 +1219,9 @@ with this program. If not, see
.
assert.strictEqual(lastArguments[2], 'user-user@local'); // User name.
assert.strictEqual(lastArguments[3], 'password'); // Password.
assert.strictEqual(
- lastArguments[4](), 'progress'); // Progress callback.
+ lastArguments[4](), 'progress'); // Progress callback.
assert.strictEqual(
- lastArguments[5](), 'completed'); // Completed callback.
+ lastArguments[5](), 'completed'); // Completed callback.
});
});
@@ -1909,7 +1909,7 @@ with this program. If not, see
.
it('adds a machine with the given series and constraints', function() {
var constraints = {'cpu-cores': 4, 'mem': 4000};
env.addMachines([{series: 'trusty', constraints: constraints}], null,
- {immediate: true});
+ {immediate: true});
var expectedMsg = {
'request-id': 1,
type: 'Client',
@@ -1945,8 +1945,8 @@ with this program. If not, see
.
it('adds a saucy container to a specific machine', function() {
env.addMachines(
- [{containerType: 'lxc', parentId: '42', series: 'saucy'}],
- null, {immediate: true});
+ [{containerType: 'lxc', parentId: '42', series: 'saucy'}],
+ null, {immediate: true});
var expectedMsg = {
'request-id': 1,
type: 'Client',
@@ -2083,7 +2083,7 @@ with this program. If not, see
.
it('removes multiple machines/containers', function() {
env.destroyMachines(['1', '47', '42/lxc/0'], null, null,
- {immediate: true});
+ {immediate: true});
assertDestroyMachinesRequestSent(['1', '47', '42/lxc/0'], false);
});
@@ -2214,9 +2214,9 @@ with this program. If not, see
.
it('successfully sets annotation', function() {
var err;
env.update_annotations('mysql', 'application', {'mykey': 'myvalue'},
- function(data) {
- err = data.err;
- });
+ function(data) {
+ err = data.err;
+ });
// Mimic response.
conn.msg({
'request-id': 1,
@@ -2244,9 +2244,9 @@ with this program. If not, see
.
it('successfully removes annotations', function() {
var err;
env.remove_annotations('mysql', 'application', ['key1', 'key2'],
- function(data) {
- err = data.err;
- });
+ function(data) {
+ err = data.err;
+ });
// Mimic response.
conn.msg({
'request-id': 1,
@@ -2316,9 +2316,9 @@ with this program. If not, see
.
it('correctly handles errors from removing annotations', function() {
var err;
env.remove_annotations('haproxy', 'application', ['key1', 'key2'],
- function(data) {
- err = data.err;
- });
+ function(data) {
+ err = data.err;
+ });
// Mimic response.
conn.msg({
'request-id': 1,
@@ -3162,8 +3162,8 @@ with this program. If not, see
.
var providerFeatures = Y.juju.environments.providerFeatures;
providers.forEach(function(provider) {
assert.equal(
- Array.isArray(providerFeatures[provider].supportedContainerTypes),
- true);
+ Array.isArray(providerFeatures[provider].supportedContainerTypes),
+ true);
});
});
diff --git a/jujugui/static/gui/src/test/test_env_change_set.js b/jujugui/static/gui/src/test/test_env_change_set.js
index 60bb0cc999..be715b3a84 100644
--- a/jujugui/static/gui/src/test/test_env_change_set.js
+++ b/jujugui/static/gui/src/test/test_env_change_set.js
@@ -94,7 +94,7 @@ describe('Environment Change Set', function() {
ecs._updateChangesetFromResults({key: 'bar-1'}, null);
assert.isTrue(
- ecs.changeSet['foo-1'].command.onParentResults.calledOnce);
+ ecs.changeSet['foo-1'].command.onParentResults.calledOnce);
});
});
@@ -149,14 +149,14 @@ describe('Environment Change Set', function() {
cs = ecs.changeSet;
ecs._updateChangesetFromResults({key: key}, null);
assert.equal(
- cs['addUnits-1'].command.onParentResults.calledOnce,
- true,
- 'subrecord not updated'
+ cs['addUnits-1'].command.onParentResults.calledOnce,
+ true,
+ 'subrecord not updated'
);
assert.equal(
- cs['addUnits-2'].command.onParentResults.calledOnce,
- false,
- 'non-child record updated'
+ cs['addUnits-2'].command.onParentResults.calledOnce,
+ false,
+ 'non-child record updated'
);
});
});
@@ -177,7 +177,7 @@ describe('Environment Change Set', function() {
it('creates a new record of the specified type', function() {
var command = { foo: 'foo' };
var wrapCallback = sinon.stub(
- ecs, '_wrapCallback').returns(command);
+ ecs, '_wrapCallback').returns(command);
this._cleanups.push(wrapCallback.restore);
var key = ecs._createNewRecord('service', command);
assert.equal(wrapCallback.calledOnce, true);
@@ -204,7 +204,7 @@ describe('Environment Change Set', function() {
it('adds supplied parent records to the new record', function() {
var command = { foo: 'foo' };
var wrapCallback = sinon.stub(
- ecs, '_wrapCallback').returns(command);
+ ecs, '_wrapCallback').returns(command);
this._cleanups.push(wrapCallback.restore);
var parent = ['service-123'];
var key = ecs._createNewRecord('service', command, parent);
@@ -423,7 +423,7 @@ describe('Environment Change Set', function() {
// XXX assert.deepEqual does not seem to play well with arrays
// of objects. Slack card on board - Makyo 2014-04-23
assert.equal(filterStub.calledOnce, true,
- 'no call to find unplaced units');
+ 'no call to find unplaced units');
assert.equal(JSON.stringify(result), JSON.stringify([
[
{
@@ -496,7 +496,7 @@ describe('Environment Change Set', function() {
assert.equal(execute.callCount, 1);
assert.equal(ecs.currentIndex, 1, 'Current index not incremented');
assert.equal(ecs.changeSet['service-123'].index, 1,
- 'uncommitted record\'s index changed');
+ 'uncommitted record\'s index changed');
});
it('passes the commit index through an event', function() {
@@ -914,9 +914,9 @@ describe('Environment Change Set', function() {
assert.equal(stubRemove.calledOnce, true, 'remove not called');
assert.equal(stubDestroy.calledOnce, true, 'destroy not called');
assert.equal(
- stubRemoveUnits.calledOnce, true, 'remove units not called');
+ stubRemoveUnits.calledOnce, true, 'remove units not called');
assert.equal(db.relations.remove.calledOnce, true,
- 'remove relations not called');
+ 'remove relations not called');
assert.deepEqual(ecs.changeSet, {});
});
@@ -1044,7 +1044,7 @@ describe('Environment Change Set', function() {
it('removes records for queued uncommitted machines', function() {
var stubDestroy = sinon.stub(
- ecs, '_destroyQueuedMachine');
+ ecs, '_destroyQueuedMachine');
this._cleanups.push(stubDestroy.restore);
ecs.get('db').machines = {
detachAll: function() {},
@@ -1354,9 +1354,9 @@ describe('Environment Change Set', function() {
// The first add_unit argument has been updated with the new service
// name.
assert.strictEqual(command.args[0], 'my-service',
- 'service name not set properly');
+ 'service name not set properly');
assert.equal(command.options.modelId, 'my-service/3',
- 'options model id not updated');
+ 'options model id not updated');
});
});
@@ -1473,11 +1473,11 @@ describe('Environment Change Set', function() {
assert.equal(record.command.method, '_add_relation');
assert.equal(record.command.args.length, 3);
assert.deepEqual(
- record.command.args[0],
- ['serviceId1$', ['db', 'client']]);
+ record.command.args[0],
+ ['serviceId1$', ['db', 'client']]);
assert.deepEqual(
- record.command.args[1],
- ['serviceId2$', ['db', 'server']]);
+ record.command.args[1],
+ ['serviceId2$', ['db', 'server']]);
assert.equal(typeof record.command.args[2], 'function');
assert.equal(typeof record.command.onParentResults, 'function');
assert.equal(record.executed, false);
@@ -1545,8 +1545,8 @@ describe('Environment Change Set', function() {
assert.equal(typeof ecsRecord.command.args[2], 'function');
assert.equal(ecsRecord.command.method, '_remove_relation');
assert.deepEqual(
- db.relations.getRelationFromEndpoints.lastCall.args[0],
- ['args1', 'args2']);
+ db.relations.getRelationFromEndpoints.lastCall.args[0],
+ ['args1', 'args2']);
assert.equal(setStub.calledOnce, true);
assert.deepEqual(setStub.lastCall.args, ['deleted', true]);
});
@@ -1727,7 +1727,7 @@ describe('Environment Change Set', function() {
// Remove the options param off of the end and compare to that. as it
// should be removed before env.deploy is called.
assert.deepEqual(
- setConfigArgs, Array.prototype.slice.call(args, 0, -1));
+ setConfigArgs, Array.prototype.slice.call(args, 0, -1));
// make sure that we don't add it to the changeSet.
assert.equal(lazySetConfig.callCount, 0);
});
@@ -1738,11 +1738,11 @@ describe('Environment Change Set', function() {
var callback = sinon.stub();
ecs.changeSet.foo = {};
assert.throws(
- // this is using bind instead of apply because of how the
- // assert.throws assertion operates.
- envObj.set_config.bind(
- envObj, 'foo', {}, callback, { immediate: true}),
- 'You cannot immediately set config on a queued application');
+ // this is using bind instead of apply because of how the
+ // assert.throws assertion operates.
+ envObj.set_config.bind(
+ envObj, 'foo', {}, callback, { immediate: true}),
+ 'You cannot immediately set config on a queued application');
assert.equal(envObj._set_config.callCount, 0);
// make sure that we don't add it to the changeSet.
assert.equal(lazySetConfig.callCount, 0);
@@ -1915,7 +1915,7 @@ describe('Environment Change Set', function() {
// Mock the validateUnitPlacement function: without errors the function
// returns null.
mockValidateUnitPlacement = sinon.stub(
- ecs, 'validateUnitPlacement').returns(null);
+ ecs, 'validateUnitPlacement').returns(null);
this._cleanups.push(mockValidateUnitPlacement.restore);
// Set up a base changeset: tests can override this value if required.
ecs.changeSet = {
@@ -2019,8 +2019,8 @@ describe('Environment Change Set', function() {
ecs.changeSet = {};
var err = ecs.placeUnit(unit, machineId);
assert.strictEqual(
- err,
- 'attempted to place a unit which has not been added: django/42');
+ err,
+ 'attempted to place a unit which has not been added: django/42');
});
});
@@ -2069,7 +2069,7 @@ describe('Environment Change Set', function() {
machines.getById('0').series = 'trusty';
var err = ecs.validateUnitPlacement(unit, '0', db);
assert.strictEqual(
- err, 'unable to place a utopic unit on the trusty machine 0');
+ err, 'unable to place a utopic unit on the trusty machine 0');
});
it('checks the series of a machine with existing units', function() {
@@ -2082,8 +2082,8 @@ describe('Environment Change Set', function() {
});
var err = ecs.validateUnitPlacement(unit, '0', db);
assert.strictEqual(
- err,
- 'machine 0 already includes units with a different series: trusty');
+ err,
+ 'machine 0 already includes units with a different series: trusty');
});
});
diff --git a/jujugui/static/gui/src/test/test_environment_view.js b/jujugui/static/gui/src/test/test_environment_view.js
index 256b0f90d8..3dc1de5d79 100644
--- a/jujugui/static/gui/src/test/test_environment_view.js
+++ b/jujugui/static/gui/src/test/test_environment_view.js
@@ -268,7 +268,7 @@ with this program. If not, see
.
db.onDelta({detail: {data: Y.clone(environment_delta)}});
db.fireEvent = sinon.stub();
var charmData = testUtils.loadFixture('data/mysql-api-response.json',
- true);
+ true);
charm = new models.Charm(charmData.charm);
db.charms.add(charm);
view = new views.environment({
@@ -369,22 +369,22 @@ with this program. If not, see
.
});
it('must render services blocks correctly',
- function() {
- // Create an instance of EnvironmentView with custom env
- var view = new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- });
- view.render();
- const serviceBlock = container.querySelector(
- '.service').querySelector('.service-block');
- serviceBlock.getAttribute('r').should.equal('90');
- serviceBlock.getAttribute('cy').should.equal('95');
- serviceBlock.getAttribute('cx').should.equal('95');
+ function() {
+ // Create an instance of EnvironmentView with custom env
+ var view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
});
+ view.render();
+ const serviceBlock = container.querySelector(
+ '.service').querySelector('.service-block');
+ serviceBlock.getAttribute('r').should.equal('90');
+ serviceBlock.getAttribute('cy').should.equal('95');
+ serviceBlock.getAttribute('cx').should.equal('95');
+ });
it('properly renders the create relation icon', function() {
// Create an instance of EnvironmentView with custom env
@@ -455,60 +455,60 @@ with this program. If not, see
.
// Ensure the environment view loads properly
it('must be able to render service blocks and relations',
- function() {
- // Create an instance of EnvironmentView with custom env
- var view = new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- });
- view.render();
- container.querySelectorAll('.service').length.should.equal(4);
+ function() {
+ // Create an instance of EnvironmentView with custom env
+ var view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ });
+ view.render();
+ container.querySelectorAll('.service').length.should.equal(4);
- // Count all the real relations.
- (container.querySelectorAll('.relation').length -
+ // Count all the real relations.
+ (container.querySelectorAll('.relation').length -
container.querySelectorAll('.pending-relation').length)
- .should.equal(2);
+ .should.equal(2);
- // Count all the subordinate relations.
- container.querySelectorAll('.rel-group .relation.subordinate').length
- .should.equal(1);
+ // Count all the subordinate relations.
+ container.querySelectorAll('.rel-group .relation.subordinate').length
+ .should.equal(1);
- // Verify that the paths render 'properly' where this
- // means no NaN in the paths
- var line = container.querySelector('.relation');
- ['x1', 'y1', 'x2', 'y2'].forEach(e => {
- isNaN(parseInt(line.getAttribute(e), 10)).should.equal(false);
- });
-
- // Verify that the node id has been munged as expected from the
- // relation id. This is particularly important for Juju Core.
- var node = container.querySelector(
- '#' + relationUtils.generateSafeDOMId(
- 'puppet:juju-info wordpress:juju-info', getParentId(view)));
- assert.isNotNull(node);
- assert.isDefined(node);
+ // Verify that the paths render 'properly' where this
+ // means no NaN in the paths
+ var line = container.querySelector('.relation');
+ ['x1', 'y1', 'x2', 'y2'].forEach(e => {
+ isNaN(parseInt(line.getAttribute(e), 10)).should.equal(false);
});
+ // Verify that the node id has been munged as expected from the
+ // relation id. This is particularly important for Juju Core.
+ var node = container.querySelector(
+ '#' + relationUtils.generateSafeDOMId(
+ 'puppet:juju-info wordpress:juju-info', getParentId(view)));
+ assert.isNotNull(node);
+ assert.isDefined(node);
+ });
+
it('must be able to render subordinate and normal services',
- function(done) {
- // Create an instance of EnvironmentView with custom env
- var view = new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- });
- view.render();
- container.querySelectorAll('.service').length.should.equal(4);
- container.querySelectorAll(
- '.subordinate.service').length.should.equal(1);
+ function(done) {
+ // Create an instance of EnvironmentView with custom env
+ var view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ });
+ view.render();
+ container.querySelectorAll('.service').length.should.equal(4);
+ container.querySelectorAll(
+ '.subordinate.service').length.should.equal(1);
- done();
- }
+ done();
+ }
);
it('must be able to render service icons', function(done) {
@@ -635,7 +635,7 @@ with this program. If not, see
.
view.update();
validateRelationCount(container.querySelector('.subordinate.service'),
- relationModule, 2).should.equal(true);
+ relationModule, 2).should.equal(true);
});
it('must not duplicate nodes when services are added', function() {
@@ -679,131 +679,131 @@ with this program. If not, see
.
});
it('must resize the service health graph properly when units are added',
- function() {
- new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- });
- var tmp_data = {
- result: [
- ['machine', 'add', {
- 'agent-state': 'running',
- 'instance-state': 'running',
- 'id': 1,
- 'instance-id': 'local',
- 'dns-name': 'localhost'
- }],
- ['unit', 'add', {
- 'machine': 1,
- 'agent-state': 'started',
- 'public-address': '192.168.122.114',
- 'id': 'wordpress/1'
- }]
- ],
- op: 'delta'
- };
+ function() {
+ new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ });
+ var tmp_data = {
+ result: [
+ ['machine', 'add', {
+ 'agent-state': 'running',
+ 'instance-state': 'running',
+ 'id': 1,
+ 'instance-id': 'local',
+ 'dns-name': 'localhost'
+ }],
+ ['unit', 'add', {
+ 'machine': 1,
+ 'agent-state': 'started',
+ 'public-address': '192.168.122.114',
+ 'id': 'wordpress/1'
+ }]
+ ],
+ op: 'delta'
+ };
- function chartSizedProperly(serviceNode) {
- var node = d3.select(serviceNode);
- var outerRadius = node.attr('data-outerradius');
- var maskWidth = node.select('.service-health-mask')
- .attr('width');
- return parseFloat(outerRadius) === parseFloat(maskWidth) / 2.05;
- }
+ function chartSizedProperly(serviceNode) {
+ var node = d3.select(serviceNode);
+ var outerRadius = node.attr('data-outerradius');
+ var maskWidth = node.select('.service-health-mask')
+ .attr('width');
+ return parseFloat(outerRadius) === parseFloat(maskWidth) / 2.05;
+ }
- container.querySelectorAll('.service').forEach(service => {
- chartSizedProperly(service).should.equal(true);
- });
+ container.querySelectorAll('.service').forEach(service => {
+ chartSizedProperly(service).should.equal(true);
+ });
- db.onDelta({detail: { data: tmp_data }});
+ db.onDelta({detail: { data: tmp_data }});
- container.querySelectorAll('.service').forEach(service => {
- chartSizedProperly(service).should.equal(true);
- });
- }
+ container.querySelectorAll('.service').forEach(service => {
+ chartSizedProperly(service).should.equal(true);
+ });
+ }
);
it('must recalculate relation endpoints when services are resized',
- function() {
- new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- }).render();
- var tmp_data = {
- result: [
- ['machine', 'add', {
- 'agent-state': 'running',
- 'instance-state': 'running',
- 'id': 1,
- 'instance-id': 'local',
- 'dns-name': 'localhost'
- }],
- ['machine', 'add', {
- 'agent-state': 'running',
- 'instance-state': 'running',
- 'id': 2,
- 'instance-id': 'local',
- 'dns-name': 'localhost'
- }],
- ['unit', 'add', {
- 'machine': 1,
- 'agent-state': 'started',
- 'public-address': '192.168.122.114',
- 'id': 'wordpress/1'
- }],
- ['unit', 'add', {
- 'machine': 2,
- 'agent-state': 'started',
- 'public-address': '192.168.122.114',
- 'id': 'wordpress/2'
- }]
- ],
- op: 'delta'
- };
+ function() {
+ new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ }).render();
+ var tmp_data = {
+ result: [
+ ['machine', 'add', {
+ 'agent-state': 'running',
+ 'instance-state': 'running',
+ 'id': 1,
+ 'instance-id': 'local',
+ 'dns-name': 'localhost'
+ }],
+ ['machine', 'add', {
+ 'agent-state': 'running',
+ 'instance-state': 'running',
+ 'id': 2,
+ 'instance-id': 'local',
+ 'dns-name': 'localhost'
+ }],
+ ['unit', 'add', {
+ 'machine': 1,
+ 'agent-state': 'started',
+ 'public-address': '192.168.122.114',
+ 'id': 'wordpress/1'
+ }],
+ ['unit', 'add', {
+ 'machine': 2,
+ 'agent-state': 'started',
+ 'public-address': '192.168.122.114',
+ 'id': 'wordpress/2'
+ }]
+ ],
+ op: 'delta'
+ };
- function floor(o) {
- return Math.floor(parseFloat(o.toString()));
- }
- function cmp(a, b) {
- return floor(a) === floor(b);
- }
- // Ensure that line endpoints match with calculated endpoints.
- function endpointsCalculatedProperly(relation) {
- var node = d3.select(relation);
- var line = node.select('line');
- var boxpair = node.datum();
- var connectors = boxpair.source
- .getConnectorPair(boxpair.target);
-
- return cmp(line.attr('x1'), connectors[0][0]) &&
+ function floor(o) {
+ return Math.floor(parseFloat(o.toString()));
+ }
+ function cmp(a, b) {
+ return floor(a) === floor(b);
+ }
+ // Ensure that line endpoints match with calculated endpoints.
+ function endpointsCalculatedProperly(relation) {
+ var node = d3.select(relation);
+ var line = node.select('line');
+ var boxpair = node.datum();
+ var connectors = boxpair.source
+ .getConnectorPair(boxpair.target);
+
+ return cmp(line.attr('x1'), connectors[0][0]) &&
cmp(line.attr('y1'), connectors[0][1]) &&
cmp(line.attr('x2'), connectors[1][0]) &&
cmp(line.attr('y2'), connectors[1][1]);
- }
+ }
- // Ensure that endpoints match for all services before any
- // service is resized.
- container.querySelectorAll('.rel-group').forEach(relationGroup => {
- endpointsCalculatedProperly(relationGroup)
- .should.equal(true);
- });
+ // Ensure that endpoints match for all services before any
+ // service is resized.
+ container.querySelectorAll('.rel-group').forEach(relationGroup => {
+ endpointsCalculatedProperly(relationGroup)
+ .should.equal(true);
+ });
- // Resize the wordpress service.
- db.onDelta({detail: { data: tmp_data }});
+ // Resize the wordpress service.
+ db.onDelta({detail: { data: tmp_data }});
- // Ensure that endpoints still match for all services, now that
- // one service has been resized. This is the real test here.
- container.querySelectorAll('.rel-group').forEach(relationGroup => {
- endpointsCalculatedProperly(relationGroup)
- .should.equal(true);
- });
- }
+ // Ensure that endpoints still match for all services, now that
+ // one service has been resized. This is the real test here.
+ container.querySelectorAll('.rel-group').forEach(relationGroup => {
+ endpointsCalculatedProperly(relationGroup)
+ .should.equal(true);
+ });
+ }
);
it('must be able to place new services properly', function() {
@@ -892,8 +892,8 @@ with this program. If not, see
.
view.update();
assert.notDeepEqual(
- view.topo.service_boxes.wordpressa.center,
- view.topo.service_boxes.wordpressb.center);
+ view.topo.service_boxes.wordpressa.center,
+ view.topo.service_boxes.wordpressb.center);
});
it('must be able to use position annotations', function() {
@@ -956,82 +956,82 @@ with this program. If not, see
.
});
it('must be able to render subordinate relation indicators',
- function() {
- new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- }).render();
- var rel_block = container.querySelector('.sub-rel-count');
-
- // Get the contents of the subordinate relation count; YUI cannot
- // get this directly as the node is not an HTMLElement, so use
- // native SVG methods.
- rel_block.firstChild.nodeValue.should.equal('1');
- }
+ function() {
+ new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ }).render();
+ var rel_block = container.querySelector('.sub-rel-count');
+
+ // Get the contents of the subordinate relation count; YUI cannot
+ // get this directly as the node is not an HTMLElement, so use
+ // native SVG methods.
+ rel_block.firstChild.nodeValue.should.equal('1');
+ }
);
// Ensure that sizes are computed properly
it('must be able to compute rect sizes based on the svg and' +
' viewport size',
- function() {
- var view = new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- }).render();
- // Attach the view to the DOM so that sizes get set properly
- // from the viewport (only available from DOM).
- view.rendered();
-
- var svg = document.querySelector('.the-canvas');
-
- parseInt(svg.querySelector('g').getAttribute('height'), 10)
- .should.equal(
- parseInt(window.getComputedStyle(svg).getPropertyValue('height'), 10));
- parseInt(svg.querySelector('g').getAttribute('width'), 10)
- .should.equal(
- parseInt(window.getComputedStyle(svg).getPropertyValue('width'), 10));
- }
+ function() {
+ var view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ }).render();
+ // Attach the view to the DOM so that sizes get set properly
+ // from the viewport (only available from DOM).
+ view.rendered();
+
+ var svg = document.querySelector('.the-canvas');
+
+ parseInt(svg.querySelector('g').getAttribute('height'), 10)
+ .should.equal(
+ parseInt(window.getComputedStyle(svg).getPropertyValue('height'), 10));
+ parseInt(svg.querySelector('g').getAttribute('width'), 10)
+ .should.equal(
+ parseInt(window.getComputedStyle(svg).getPropertyValue('width'), 10));
+ }
);
// Ensure that sizes are computed properly
it('must be able to compute sizes by the viewport with a minimum',
- function() {
- // The height of a navbar is used in calculating the viewport size,
- // so add a temporary one to the DOM
- const navbar = document.createElement('div');
- navbar.classList.add('header-banner');
- navbar.style.height = '70px';
- document.body.appendChild(navbar);
- const viewport = document.createElement('div');
- viewport.setAttribute('id', 'viewport');
- viewport.style.width = '800px';
- document.body.appendChild(viewport);
- var view = new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- }).render();
- // Attach the view to the DOM so that sizes get set properly
- // from the viewport (only available from DOM).
- view.rendered();
- var svg = container.querySelector('.the-canvas'),
- canvas = container.querySelector('.topology');
- // We have to hide the canvas so it does not affect our calculations.
- canvas.style.display = 'none';
- parseInt(svg.getAttribute('height'), 10)
+ function() {
+ // The height of a navbar is used in calculating the viewport size,
+ // so add a temporary one to the DOM
+ const navbar = document.createElement('div');
+ navbar.classList.add('header-banner');
+ navbar.style.height = '70px';
+ document.body.appendChild(navbar);
+ const viewport = document.createElement('div');
+ viewport.setAttribute('id', 'viewport');
+ viewport.style.width = '800px';
+ document.body.appendChild(viewport);
+ var view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ }).render();
+ // Attach the view to the DOM so that sizes get set properly
+ // from the viewport (only available from DOM).
+ view.rendered();
+ var svg = container.querySelector('.the-canvas'),
+ canvas = container.querySelector('.topology');
+ // We have to hide the canvas so it does not affect our calculations.
+ canvas.style.display = 'none';
+ parseInt(svg.getAttribute('height'), 10)
.should.be.above(199);
- // Destroy the navbar
- navbar.remove(true);
- viewport.remove(true);
- }
+ // Destroy the navbar
+ navbar.remove(true);
+ viewport.remove(true);
+ }
);
function assertClassPresent(cssClass) {
@@ -1041,13 +1041,13 @@ with this program. If not, see
.
return d.id === 'mysql:db wordpress:db';
});
assert.equal(relation.classed(cssClass), true,
- 'relation does not have the ' + cssClass + ' class');
+ 'relation does not have the ' + cssClass + ' class');
var services = vis.selectAll('.service');
var service = services.filter(function(d) {
return d.id === 'mysql';
});
assert.equal(service.classed(cssClass), true,
- 'service does not have the ' + cssClass + ' class');
+ 'service does not have the ' + cssClass + ' class');
}
it('should show services and relations', function(done) {
@@ -1064,104 +1064,104 @@ with this program. If not, see
.
});
it('must be able to add a relation from the service menu',
- function() {
- var view = new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- }).render();
- var serviceNode = container.querySelector('.service'),
- add_rel = container.querySelector('.relation-button__link');
- var service = d3.select(serviceNode).datum();
- var endpoints = {},
- serviceName = serviceNode.getAttribute('data-name'),
- nextServiceName = serviceNode.nextSibling.getAttribute(
- 'data-name');
- endpoints[nextServiceName] = [
- [{
- service: serviceName,
- name: 'relName',
- type: 'relType'
- }, {
- service: nextServiceName,
- name: 'relName',
- type: 'relType'
- }]];
- // Add a mock charm for the service.
- var charm = { id: service.charm, loaded: false };
- var charm2 = { id: 'cs:precise/mediawiki-3', loaded: false };
- db.charms.add(charm);
- db.charms.add(charm2);
- charm = db.charms.getById(service.charm);
- charm.loaded = true;
- // Mock endpoints
- var existing = models.getEndpoints;
- models.getEndpoints = function() {
- return endpoints;
- };
-
- // Toggle the service menu for the Add Relation button.
- var module = view.topo.modules.RelationModule;
- var sm = view.topo.modules.ServiceModule;
-
- sm.showServiceDetails(service, {
- fire: function() {},
- get: sinon.stub().withArgs('state').returns(
- {changeState: sinon.stub()})
- });
- // Mock an event object so that d3.mouse does not throw a NPE.
- d3.event = {};
- add_rel.dispatchEvent(click);
- container.querySelectorAll('.selectable-service')
- .length
- .should.equal(2);
- container.querySelectorAll('.dragline')
- .length
- .should.equal(1);
-
- // Start the process of adding a relation.
- module.ambiguousAddRelationCheck(
- d3.select(serviceNode.nextSibling).datum(),
- module,
- serviceNode.nextSibling);
- container.querySelectorAll('.selectable-service').length
- .should.equal(0);
- // The database is initialized with three relations in beforeEach.
- assert.equal(4, db.relations.size());
- // restore original getEndpoints function
- models.getEndpoints = existing;
- view.destroy();
- });
+ function() {
+ var view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ }).render();
+ var serviceNode = container.querySelector('.service'),
+ add_rel = container.querySelector('.relation-button__link');
+ var service = d3.select(serviceNode).datum();
+ var endpoints = {},
+ serviceName = serviceNode.getAttribute('data-name'),
+ nextServiceName = serviceNode.nextSibling.getAttribute(
+ 'data-name');
+ endpoints[nextServiceName] = [
+ [{
+ service: serviceName,
+ name: 'relName',
+ type: 'relType'
+ }, {
+ service: nextServiceName,
+ name: 'relName',
+ type: 'relType'
+ }]];
+ // Add a mock charm for the service.
+ var charm = { id: service.charm, loaded: false };
+ var charm2 = { id: 'cs:precise/mediawiki-3', loaded: false };
+ db.charms.add(charm);
+ db.charms.add(charm2);
+ charm = db.charms.getById(service.charm);
+ charm.loaded = true;
+ // Mock endpoints
+ var existing = models.getEndpoints;
+ models.getEndpoints = function() {
+ return endpoints;
+ };
+
+ // Toggle the service menu for the Add Relation button.
+ var module = view.topo.modules.RelationModule;
+ var sm = view.topo.modules.ServiceModule;
+
+ sm.showServiceDetails(service, {
+ fire: function() {},
+ get: sinon.stub().withArgs('state').returns(
+ {changeState: sinon.stub()})
+ });
+ // Mock an event object so that d3.mouse does not throw a NPE.
+ d3.event = {};
+ add_rel.dispatchEvent(click);
+ container.querySelectorAll('.selectable-service')
+ .length
+ .should.equal(2);
+ container.querySelectorAll('.dragline')
+ .length
+ .should.equal(1);
+
+ // Start the process of adding a relation.
+ module.ambiguousAddRelationCheck(
+ d3.select(serviceNode.nextSibling).datum(),
+ module,
+ serviceNode.nextSibling);
+ container.querySelectorAll('.selectable-service').length
+ .should.equal(0);
+ // The database is initialized with three relations in beforeEach.
+ assert.equal(4, db.relations.size());
+ // restore original getEndpoints function
+ models.getEndpoints = existing;
+ view.destroy();
+ });
it('must be able to remove a relation between services',
- function(done) {
- var oldRemove = env.remove_relation;
- let remove_called = false;
- env.remove_relation = function() {
- remove_called = true;
- env.remove_relation = oldRemove;
- done();
- };
- var view = new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- }).render();
-
- var relation = container.querySelector(
- '#' +
+ function(done) {
+ var oldRemove = env.remove_relation;
+ let remove_called = false;
+ env.remove_relation = function() {
+ remove_called = true;
+ env.remove_relation = oldRemove;
+ done();
+ };
+ var view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ }).render();
+
+ var relation = container.querySelector(
+ '#' +
relationUtils.generateSafeDOMId(
'mysql:db wordpress:db', getParentId(view)) +
' .rel-indicator');
- relation.dispatchEvent(click);
- const menu = container.querySelector('#relation-menu');
- menu.querySelector('.relation-remove').dispatchEvent(click);
- assert.isTrue(remove_called);
- });
+ relation.dispatchEvent(click);
+ const menu = container.querySelector('#relation-menu');
+ menu.querySelector('.relation-remove').dispatchEvent(click);
+ assert.isTrue(remove_called);
+ });
it('builds a menu of relations in a collection', function() {
db.onDelta({detail: {data: additionalRelations}});
@@ -1176,8 +1176,8 @@ with this program. If not, see
.
// Single relation
var relation = container.querySelector(
- '#' + relationUtils.generateSafeDOMId('mysql:db wordpress:db',
- getParentId(view)) +
+ '#' + relationUtils.generateSafeDOMId('mysql:db wordpress:db',
+ getParentId(view)) +
' .rel-indicator'),
menu;
relation.dispatchEvent(click);
@@ -1192,13 +1192,13 @@ with this program. If not, see
.
// Assert that relation module is storing the menu state for rerendering.
assert.equal(module.get('relationMenuActive'), true);
assert.equal(module.get('relationMenuRelation').id,
- 'mysql:db wordpress:db');
+ 'mysql:db wordpress:db');
// Multiple relations
relation = container.querySelector(
- '#' +
+ '#' +
relationUtils.generateSafeDOMId('mysql:db mediawiki:db',
- getParentId(view)) +
+ getParentId(view)) +
' .rel-indicator');
relation.dispatchEvent(click);
menu = container.querySelector('#relation-menu');
@@ -1300,11 +1300,11 @@ with this program. If not, see
.
}).render();
// This stops the simulate() call later on from causing a 'script error'
container.insertAdjacentHTML('beforeend',
- '');
+ '');
// Single relation.
var relation = container.querySelector(
- '#' + relationUtils.generateSafeDOMId('mysql:db wordpress:db',
- getParentId(view)) +
+ '#' + relationUtils.generateSafeDOMId('mysql:db wordpress:db',
+ getParentId(view)) +
' .rel-indicator'),
menu;
@@ -1325,90 +1325,90 @@ with this program. If not, see
.
});
it('must not remove a deployed subordinate relation between services',
- function() {
- view = new views.environment({
- container: container,
- db: db,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- }).render();
- assert.equal(db.notifications.size(), 0);
-
- // Get a subordinate relation.
- var relation = container.querySelector(
+ function() {
+ view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ }).render();
+ assert.equal(db.notifications.size(), 0);
+
+ // Get a subordinate relation.
+ var relation = container.querySelector(
'#' + relationUtils.generateSafeDOMId(
- 'puppet:juju-info wordpress:juju-info',
- getParentId(view)) +
+ 'puppet:juju-info wordpress:juju-info',
+ getParentId(view)) +
' .rel-indicator'),
- menu;
+ menu;
- relation.dispatchEvent(click);
- menu = container.querySelector('#relation-menu');
- menu.querySelector('.relation-remove').click();
- assert.equal(db.notifications.size(), 1);
- });
+ relation.dispatchEvent(click);
+ menu = container.querySelector('#relation-menu');
+ menu.querySelector('.relation-remove').click();
+ assert.equal(db.notifications.size(), 1);
+ });
it('should remove a pending subordinate relation between services',
- function() {
- view = new views.environment({
- container: container,
+ function() {
+ view = new views.environment({
+ container: container,
+ db: db,
+ env: env,
+ charmstore: fakeStore,
+ state: {changeState: sinon.stub()}
+ }).render();
+ db.relations.item(1).set('pending', true);
+
+ // Get a subordinate relation.
+ const relation = container.querySelector(
+ '#' + relationUtils.generateSafeDOMId(
+ 'puppet:juju-info wordpress:juju-info',
+ getParentId(view)) +
+ ' .rel-indicator');
+ relation.dispatchEvent(click);
+ const menu = container.querySelector('#relation-menu');
+ menu.querySelector('.relation-remove').dispatchEvent(click);
+ assert.equal(db.notifications.size(), 0);
+ });
+
+ it('should stop creating a relation if the background is clicked',
+ function() {
+ var db = new models.Database(),
+ endpointsMap = {'service-1': {requires: [], provides: []}};
+ var fauxController = new Y.Base();
+ fauxController.endpointsMap = endpointsMap;
+ fauxController.set('db', db);
+ var view = new views.environment(
+ { container: container,
db: db,
+ endpointsController: fauxController,
env: env,
charmstore: fakeStore,
state: {changeState: sinon.stub()}
- }).render();
- db.relations.item(1).set('pending', true);
-
- // Get a subordinate relation.
- const relation = container.querySelector(
- '#' + relationUtils.generateSafeDOMId(
- 'puppet:juju-info wordpress:juju-info',
- getParentId(view)) +
- ' .rel-indicator');
- relation.dispatchEvent(click);
- const menu = container.querySelector('#relation-menu');
- menu.querySelector('.relation-remove').dispatchEvent(click);
- assert.equal(db.notifications.size(), 0);
- });
-
- it('should stop creating a relation if the background is clicked',
- function() {
- var db = new models.Database(),
- endpointsMap = {'service-1': {requires: [], provides: []}};
- var fauxController = new Y.Base();
- fauxController.endpointsMap = endpointsMap;
- fauxController.set('db', db);
- var view = new views.environment(
- { container: container,
- db: db,
- endpointsController: fauxController,
- env: env,
- charmstore: fakeStore,
- state: {changeState: sinon.stub()}
- });
- var service = new models.Service({
- id: 'service-1',
- charm: 'precise/mysql-1'
});
-
- db.services.add([service]);
- view.render();
-
- // If the user has clicked on the "Add Relation" menu item...
- var module = view.topo.modules.RelationModule;
- var sm = view.topo.modules.ServiceModule;
- var topo = module.get('component');
- module.startRelation(service);
- assert.isTrue(topo.buildingRelation);
- // ...clicking on the background causes the relation drag to stop.
- sm.backgroundClicked();
- assert.isFalse(topo.buildingRelation);
- view.destroy();
- db.destroy();
- fauxController.destroy();
+ var service = new models.Service({
+ id: 'service-1',
+ charm: 'precise/mysql-1'
});
+ db.services.add([service]);
+ view.render();
+
+ // If the user has clicked on the "Add Relation" menu item...
+ var module = view.topo.modules.RelationModule;
+ var sm = view.topo.modules.ServiceModule;
+ var topo = module.get('component');
+ module.startRelation(service);
+ assert.isTrue(topo.buildingRelation);
+ // ...clicking on the background causes the relation drag to stop.
+ sm.backgroundClicked();
+ assert.isFalse(topo.buildingRelation);
+ view.destroy();
+ db.destroy();
+ fauxController.destroy();
+ });
+
it('stores relations in collections', function() {
db.onDelta({detail: {data: additionalRelations}});
var view = new views.environment({
@@ -1426,7 +1426,7 @@ with this program. If not, see
.
// Only one line is drawn (that is, there are four container relations,
// but only three lines on the canvas).
assert.equal(view.topo.vis.selectAll('.relation').size(),
- module.relations.length);
+ module.relations.length);
assert.equal(module.relations.length, 3);
assert.equal(db.relations.filter(function(relation) {
return relation.get('scope') !== 'container';
@@ -1449,26 +1449,26 @@ with this program. If not, see
.
describe('onboarding integration with the environment', function() {
it('shows/hides the integrated button when a service is added',
- function() {
- db = new models.Database();
- view.set('db', db);
- view.render().rendered();
- var includedPlus = view.topo.vis.select('.included-plus');
- var helpText = container.querySelector('.environment-help');
- assert.equal(false, includedPlus.classed('show'));
- assert.equal(false, helpText.classList.contains('shrink'));
-
- var service = new models.Service({
- id: 'service-1',
- charm: 'precise/mysql-1'
- });
- db.services.add([service]);
-
- assert.equal(true, includedPlus.classed('show'));
- assert.equal(true, helpText.classList.contains('shrink'));
- view.destroy();
- }
- );
+ function() {
+ db = new models.Database();
+ view.set('db', db);
+ view.render().rendered();
+ var includedPlus = view.topo.vis.select('.included-plus');
+ var helpText = container.querySelector('.environment-help');
+ assert.equal(false, includedPlus.classed('show'));
+ assert.equal(false, helpText.classList.contains('shrink'));
+
+ var service = new models.Service({
+ id: 'service-1',
+ charm: 'precise/mysql-1'
+ });
+ db.services.add([service]);
+
+ assert.equal(true, includedPlus.classed('show'));
+ assert.equal(true, helpText.classList.contains('shrink'));
+ view.destroy();
+ }
+ );
});
});
@@ -1478,12 +1478,12 @@ with this program. If not, see
.
before(function(done) {
YUI(GlobalConfig).use(
['juju-views', 'juju-models', 'charmstore-api', 'juju-view-utils'],
- function(Y) {
- views = Y.namespace('juju.views');
- models = Y.namespace('juju.models');
- viewUtils = Y.namespace('juju.views.utils');
- done();
- });
+ function(Y) {
+ views = Y.namespace('juju.views');
+ models = Y.namespace('juju.models');
+ viewUtils = Y.namespace('juju.views.utils');
+ done();
+ });
});
beforeEach(function() {
@@ -1497,35 +1497,35 @@ with this program. If not, see
.
});
it('must be able to get us nearest connectors when snapping to poles',
- function() {
+ function() {
- var b1 = views.BoundingBox(module, service),
- b2 = views.BoundingBox(module, service);
+ var b1 = views.BoundingBox(module, service),
+ b2 = views.BoundingBox(module, service);
- // raw property access
- b1.x = 0; b1.y = 0;
- b1.w = 100; b1.h = 200;
+ // raw property access
+ b1.x = 0; b1.y = 0;
+ b1.w = 100; b1.h = 200;
- // Use pos to set b2
- b2.pos = {x: 200, y: 300, w: 100, h: 200};
+ // Use pos to set b2
+ b2.pos = {x: 200, y: 300, w: 100, h: 200};
- b1.xy.should.eql([0, 0]);
- b2.wh.should.eql([100, 200]);
+ b1.xy.should.eql([0, 0]);
+ b2.wh.should.eql([100, 200]);
- viewUtils.snapToPoles = true;
+ viewUtils.snapToPoles = true;
- b1.getNearestConnector([0, 0]);
+ b1.getNearestConnector([0, 0]);
- b1.getNearestConnector(b2).should
+ b1.getNearestConnector(b2).should
.eql(b1.connectors.bottom);
- b2.getNearestConnector(b1).should
+ b2.getNearestConnector(b1).should
.eql(b2.connectors.top);
- b1.getConnectorPair(b2).should.eql([
- b1.connectors.bottom,
- b2.connectors.top]);
- });
+ b1.getConnectorPair(b2).should.eql([
+ b1.connectors.bottom,
+ b2.connectors.top]);
+ });
it('must be able to get us nearest connectors when centering',
function() {
@@ -1546,10 +1546,10 @@ with this program. If not, see
.
viewUtils.snapToPoles = false;
b1.getNearestConnector(b2).should
- .eql(b1.connectors.center);
+ .eql(b1.connectors.center);
b2.getNearestConnector(b1).should
- .eql(b2.connectors.center);
+ .eql(b2.connectors.center);
});
it('must be able to tell if a point is inside a box', function() {
@@ -1561,28 +1561,28 @@ with this program. If not, see
.
});
it('must be able to save and restore old position information',
- function() {
- var b1 = views.BoundingBox(module, service),
- b2 = views.BoundingBox(module, service);
+ function() {
+ var b1 = views.BoundingBox(module, service),
+ b2 = views.BoundingBox(module, service);
- // raw property access
- b1.x = 0; b1.y = 0;
- b1.w = 100; b1.h = 200;
+ // raw property access
+ b1.x = 0; b1.y = 0;
+ b1.w = 100; b1.h = 200;
- // Use pos to set b2
- b2.pos = {x: 200, y: 300, w: 100, h: 200};
+ // Use pos to set b2
+ b2.pos = {x: 200, y: 300, w: 100, h: 200};
- // Update using property.
- b1.x = 100;
- b1.x.should.equal(100);
- b1.px.should.equal(0);
+ // Update using property.
+ b1.x = 100;
+ b1.x.should.equal(100);
+ b1.px.should.equal(0);
- // Update using position.
- b2.pos = {x: 300};
- b2.x.should.equal(300);
- b2.px.should.equal(200);
+ // Update using position.
+ b2.pos = {x: 300};
+ b2.x.should.equal(300);
+ b2.px.should.equal(200);
- });
+ });
it('must be able to access model attributes', function() {
var b1 = new views.BoundingBox(module, service);
@@ -1595,57 +1595,57 @@ with this program. If not, see
.
});
it('must be able to update position data and not touch model data',
- function() {
- var b1 = views.BoundingBox(module, service);
- b1.x = 0; b1.y = 0;
- b1.w = 100; b1.h = 200;
- b1.id.should.equal('mediawiki');
-
- // X/Y updated, other keys ignored
- b1.pos = {x: 100, y: 100, id: 'blubber'};
- b1.x.should.equal(100);
- b1.id.should.equal('mediawiki');
- });
+ function() {
+ var b1 = views.BoundingBox(module, service);
+ b1.x = 0; b1.y = 0;
+ b1.w = 100; b1.h = 200;
+ b1.id.should.equal('mediawiki');
+
+ // X/Y updated, other keys ignored
+ b1.pos = {x: 100, y: 100, id: 'blubber'};
+ b1.x.should.equal(100);
+ b1.id.should.equal('mediawiki');
+ });
it('must be able to map from sequence of models to boundingboxes',
- function() {
- var services = new models.ServiceList();
- services.add([{id: 'mysql'},
- {id: 'haproxy'},
- {id: 'memcache'},
- {id: 'wordpress'}]);
-
- services.size().should.equal(4);
- var boxes = views.toBoundingBoxes(module, services);
- boxes.mysql.id.should.equal('mysql');
- boxes.wordpress.id.should.equal('wordpress');
- });
+ function() {
+ var services = new models.ServiceList();
+ services.add([{id: 'mysql'},
+ {id: 'haproxy'},
+ {id: 'memcache'},
+ {id: 'wordpress'}]);
+
+ services.size().should.equal(4);
+ var boxes = views.toBoundingBoxes(module, services);
+ boxes.mysql.id.should.equal('mysql');
+ boxes.wordpress.id.should.equal('wordpress');
+ });
it('must be able to update boxes with new model data',
- function() {
- var services = new models.ServiceList();
- services.add([{id: 'mysql', exposed: false},
- {id: 'haproxy'},
- {id: 'memcache'},
- {id: 'wordpress'}]);
-
- services.size().should.equal(4);
- var boxes = views.toBoundingBoxes(module, services);
- var mysql = services.getById('mysql');
-
- boxes.mysql.exposed.should.equal(false);
- mysql.set('exposed', true);
-
- // The third argument here implies an update.
- views.toBoundingBoxes(module, services, boxes);
- boxes.mysql.exposed.should.equal(true);
- });
+ function() {
+ var services = new models.ServiceList();
+ services.add([{id: 'mysql', exposed: false},
+ {id: 'haproxy'},
+ {id: 'memcache'},
+ {id: 'wordpress'}]);
+
+ services.size().should.equal(4);
+ var boxes = views.toBoundingBoxes(module, services);
+ var mysql = services.getById('mysql');
+
+ boxes.mysql.exposed.should.equal(false);
+ mysql.set('exposed', true);
+
+ // The third argument here implies an update.
+ views.toBoundingBoxes(module, services, boxes);
+ boxes.mysql.exposed.should.equal(true);
+ });
it('must cull removed services from the existing list', function() {
var services = new models.ServiceList();
services.add([{id: 'mysql', exposed: false},
- {id: 'memcache'},
- {id: 'wordpress'}]);
+ {id: 'memcache'},
+ {id: 'wordpress'}]);
var existing = {
'mysql': {},
'haproxy': {}, // This entry is stale and will be removed.
diff --git a/jujugui/static/gui/src/test/test_ghost_deployer_extension.js b/jujugui/static/gui/src/test/test_ghost_deployer_extension.js
index e94f496061..4bc79931f5 100644
--- a/jujugui/static/gui/src/test/test_ghost_deployer_extension.js
+++ b/jujugui/static/gui/src/test/test_ghost_deployer_extension.js
@@ -33,35 +33,35 @@ describe('Ghost Deployer Extension', function() {
beforeEach(function() {
GhostDeployer = Y.Base.create(
- 'deployer', Y.Base, [juju.GhostDeployer], {
- views: {
- environment: {
- instance: {
- topo: {service_boxes: {}},
- createServiceInspector: sinon.stub()
- }
+ 'deployer', Y.Base, [juju.GhostDeployer], {
+ views: {
+ environment: {
+ instance: {
+ topo: {service_boxes: {}},
+ createServiceInspector: sinon.stub()
}
- },
- env: {
- deploy: sinon.stub(),
- add_unit: sinon.stub(),
- addCharm: sinon.stub(),
- addPendingResources: sinon.stub()
- },
- state: {
- changeState: sinon.stub()
}
- }, {
- ATTRS: {
- charmstore: {
- value: {
- bakery: {
- getMacaroon: sinon.stub().returns('cookies are better')
- }
+ },
+ env: {
+ deploy: sinon.stub(),
+ add_unit: sinon.stub(),
+ addCharm: sinon.stub(),
+ addPendingResources: sinon.stub()
+ },
+ state: {
+ changeState: sinon.stub()
+ }
+ }, {
+ ATTRS: {
+ charmstore: {
+ value: {
+ bakery: {
+ getMacaroon: sinon.stub().returns('cookies are better')
}
}
}
- });
+ }
+ });
ghostDeployer = new GhostDeployer();
var getMethod = sinon.stub();
ghostDeployer.db = {
@@ -359,8 +359,8 @@ describe('Ghost Deployer Extension', function() {
var notification = notifications.add.lastCall.args[0];
assert.equal(notification.title, 'Error adding unit django/42');
assert.equal(
- notification.message,
- 'Could not add the requested unit. Server responded with: bad wolf');
+ notification.message,
+ 'Could not add the requested unit. Server responded with: bad wolf');
assert.equal(notification.level, 'error');
});
@@ -373,8 +373,8 @@ describe('Ghost Deployer Extension', function() {
var notification = notifications.add.lastCall.args[0];
assert.equal(notification.title, 'Added unit django/42');
assert.equal(
- notification.message,
- 'Successfully created the requested unit.');
+ notification.message,
+ 'Successfully created the requested unit.');
assert.equal(notification.level, 'info');
});
diff --git a/jujugui/static/gui/src/test/test_landscape.js b/jujugui/static/gui/src/test/test_landscape.js
index 5da3ced767..867e22012c 100644
--- a/jujugui/static/gui/src/test/test_landscape.js
+++ b/jujugui/static/gui/src/test/test_landscape.js
@@ -65,26 +65,26 @@ describe('Landscape integration', function() {
var url;
url = landscape.getLandscapeURL(db.environment);
url.should.equal(
- 'http://landscape.example.com/computers/criteria/environment:test/');
+ 'http://landscape.example.com/computers/criteria/environment:test/');
url = landscape.getLandscapeURL(db.environment, 'security');
url.should.equal(
- 'http://landscape.example.com/computers/criteria/environment:test' +
+ 'http://landscape.example.com/computers/criteria/environment:test' +
'+alert:security-upgrades/packages/list?filter=security');
url = landscape.getLandscapeURL(db.environment, 'reboot');
url.should.equal(
- 'http://landscape.example.com/computers/criteria/environment:test' +
+ 'http://landscape.example.com/computers/criteria/environment:test' +
'+alert:computer-reboot/info#power');
url = landscape.getLandscapeURL(db.services.getById('mysql'));
url.should.equal(
- 'http://landscape.example.com/computers/criteria/' +
+ 'http://landscape.example.com/computers/criteria/' +
'environment:test+service:mysql/');
var units = db.services.getById('mysql').get('units');
url = landscape.getLandscapeURL(units.revive(units.item(0)));
url.should.equal(
- 'http://landscape.example.com/computers/criteria/' +
+ 'http://landscape.example.com/computers/criteria/' +
'environment:test+unit:mysql-0/');
});
diff --git a/jujugui/static/gui/src/test/test_model.js b/jujugui/static/gui/src/test/test_model.js
index cbb4cad01c..8de4217bdd 100644
--- a/jujugui/static/gui/src/test/test_model.js
+++ b/jujugui/static/gui/src/test/test_model.js
@@ -31,14 +31,14 @@ describe('test_model.js', function() {
it('must be able to create Charm', function() {
var charm = new models.Charm(
- {id: 'cs:~alt-bac/precise/openstack-dashboard-0'});
+ {id: 'cs:~alt-bac/precise/openstack-dashboard-0'});
charm.get('scheme').should.equal('cs');
charm.get('owner').should.equal('alt-bac');
charm.get('series').should.equal('precise');
charm.get('package_name').should.equal('openstack-dashboard');
charm.get('revision').should.equal(0);
charm.get('full_name').should.equal(
- '~alt-bac/precise/openstack-dashboard');
+ '~alt-bac/precise/openstack-dashboard');
});
it('must dedupe tags', () => {
@@ -58,19 +58,19 @@ describe('test_model.js', function() {
it('must accept charm ids without versions.', function() {
const charm = new models.Charm(
- {id: 'cs:~alt-bac/precise/openstack-dashboard'});
+ {id: 'cs:~alt-bac/precise/openstack-dashboard'});
assert.strictEqual(charm.get('revision'), null);
});
it('must accept charm ids with periods.', function() {
const charm = new models.Charm(
- {id: 'cs:~alt.bac/precise/openstack-dashboard-0'});
+ {id: 'cs:~alt.bac/precise/openstack-dashboard-0'});
assert.equal(charm.get('owner'), 'alt.bac');
});
it('must accept charm ids without series.', function() {
const charm = new models.Charm(
- {id: 'cs:~alt-bac/openstack-dashboard'});
+ {id: 'cs:~alt-bac/openstack-dashboard'});
assert.isUndefined(charm.get('series'));
});
@@ -86,7 +86,7 @@ describe('test_model.js', function() {
// Note that an earlier version of the parsing code did not handle
// hyphens in user names, so this test intentionally includes one.
const charm = new models.Charm(
- {id: 'cs:~marco-ceppi/precise/wordpress-17'});
+ {id: 'cs:~marco-ceppi/precise/wordpress-17'});
charm.get('full_name').should.equal('~marco-ceppi/precise/wordpress');
});
@@ -270,7 +270,7 @@ describe('test_model.js', function() {
beforeEach(function() {
db = new models.Database();
- db._highlightedServices = []; // needs to be explicitly emptied
+ db._highlightedServices = []; // needs to be explicitly emptied
db.machines.add([
{id: '0', hide: false},
{id: '1', hide: false}
@@ -294,14 +294,14 @@ describe('test_model.js', function() {
function assertHighlight(machineId, serviceId) {
var targetMachine = db.machines.getById(machineId);
assert.equal(targetMachine.hide, false,
- 'Target machine should not be hidden initially');
+ 'Target machine should not be hidden initially');
db.setMVVisibility(serviceId, true);
assert.equal(targetMachine.hide, false,
- 'Target machine should not be hidden after highlight');
+ 'Target machine should not be hidden after highlight');
db.machines.each(function(machine) {
if (machine.id !== machineId) {
assert.equal(machine.hide, true,
- 'All other machines should be hidden after highlight');
+ 'All other machines should be hidden after highlight');
}
});
}
@@ -342,7 +342,7 @@ describe('test_model.js', function() {
var service_unit = {id: 'mysql/0'};
var db = new models.Database();
var stub = sinon.stub(
- db.units, 'update_service_unit_aggregates');
+ db.units, 'update_service_unit_aggregates');
this._cleanups.push(stub.restore);
db.services.add({id: 'mysql'});
db.addUnits(service_unit);
@@ -388,38 +388,38 @@ describe('test_model.js', function() {
wordpress.get('units').add([wp0, wp1, wp2, wp3], true);
assert.deepEqual(mysql.get('units')
- .get_informative_states_for_service(mysql),
- [{'pending': 2}, {}]);
+ .get_informative_states_for_service(mysql),
+ [{'pending': 2}, {}]);
assert.deepEqual(wordpress.get('units')
- .get_informative_states_for_service(wordpress),
- [{'pending': 1, 'error': 3}, {
- mysql: 'db-relation-changed',
- wordpress: 'peer-relation-broken'
- }]);
+ .get_informative_states_for_service(wordpress),
+ [{'pending': 1, 'error': 3}, {
+ mysql: 'db-relation-changed',
+ wordpress: 'peer-relation-broken'
+ }]);
});
it('service unit list should update analytics when units are added',
- function() {
- var sl = new models.ServiceList();
- var mysql = new models.Service({id: 'mysql'});
- sl.add([mysql]);
- var my0 = {id: 'mysql/0', agent_state: 'pending'};
- var my1 = {id: 'mysql/1', agent_state: 'pending'};
- var sul = mysql.get('units');
-
- window._gaq.should.eql([]);
- sul.add([my0], true);
- sul.update_service_unit_aggregates(mysql);
- window._gaq.pop().should.eql(['_trackEvent', 'Service Stats', 'Update',
- 'mysql', 1]);
- sul.add([my1], true);
- sul.update_service_unit_aggregates(mysql);
- window._gaq.pop().should.eql(['_trackEvent', 'Service Stats', 'Update',
- 'mysql', 2]);
- // Calling update with no additions does not create a new trackEvent.
- sul.update_service_unit_aggregates(mysql);
- window._gaq.should.eql([]);
- });
+ function() {
+ var sl = new models.ServiceList();
+ var mysql = new models.Service({id: 'mysql'});
+ sl.add([mysql]);
+ var my0 = {id: 'mysql/0', agent_state: 'pending'};
+ var my1 = {id: 'mysql/1', agent_state: 'pending'};
+ var sul = mysql.get('units');
+
+ window._gaq.should.eql([]);
+ sul.add([my0], true);
+ sul.update_service_unit_aggregates(mysql);
+ window._gaq.pop().should.eql(['_trackEvent', 'Service Stats', 'Update',
+ 'mysql', 1]);
+ sul.add([my1], true);
+ sul.update_service_unit_aggregates(mysql);
+ window._gaq.pop().should.eql(['_trackEvent', 'Service Stats', 'Update',
+ 'mysql', 2]);
+ // Calling update with no additions does not create a new trackEvent.
+ sul.update_service_unit_aggregates(mysql);
+ window._gaq.should.eql([]);
+ });
it('services are instantiated with _dirtyFields property', function() {
var service = new models.Service();
@@ -437,42 +437,42 @@ describe('test_model.js', function() {
});
it('relation changes on service update relationChangeTrigger',
- function(done) {
- var service = new models.Service();
- var relations = service.get('relations');
- var handler = relations.on(
- '*:add', function() {
- // This means that it will update the aggregate
- // relations for databinding
- handler.detach();
- const relationChangeTrigger = service.get(
- 'relationChangeTrigger');
- assert.equal(
- typeof relationChangeTrigger === 'object' &&
+ function(done) {
+ var service = new models.Service();
+ var relations = service.get('relations');
+ var handler = relations.on(
+ '*:add', function() {
+ // This means that it will update the aggregate
+ // relations for databinding
+ handler.detach();
+ const relationChangeTrigger = service.get(
+ 'relationChangeTrigger');
+ assert.equal(
+ typeof relationChangeTrigger === 'object' &&
relationChangeTrigger !== null,
- true);
- done();
- });
- relations.add(new models.Relation());
- });
+ true);
+ done();
+ });
+ relations.add(new models.Relation());
+ });
it('service unit objects should parse the service name from unit id',
- function() {
- var service_unit = {id: 'mysql/0'};
- var db = new models.Database();
- db.services.add({id: 'mysql'});
- db.addUnits(service_unit);
- service_unit.service.should.equal('mysql');
- });
+ function() {
+ var service_unit = {id: 'mysql/0'};
+ var db = new models.Database();
+ db.services.add({id: 'mysql'});
+ db.addUnits(service_unit);
+ service_unit.service.should.equal('mysql');
+ });
it('service unit objects should report their number correctly',
- function() {
- var service_unit = {id: 'mysql/5'};
- var db = new models.Database();
- db.services.add({id: 'mysql'});
- db.addUnits(service_unit);
- service_unit.number.should.equal(5);
- });
+ function() {
+ var service_unit = {id: 'mysql/5'};
+ var db = new models.Database();
+ db.services.add({id: 'mysql'});
+ db.addUnits(service_unit);
+ service_unit.number.should.equal(5);
+ });
it('should display service names properly', function() {
var db = new models.Database(),
@@ -483,7 +483,7 @@ describe('test_model.js', function() {
assert.equal(longName.length, 19, 'name is not trucated');
var shortName = db.services.getById(shortId).get('displayName');
assert.equal(shortName.length, shortId.length,
- 'name does not match');
+ 'name does not match');
});
it('should display ghost service names properly', function() {
@@ -497,19 +497,19 @@ describe('test_model.js', function() {
var longName = db.services.getById(longId).get('displayName');
var shortName = db.services.getById(shortId).get('displayName');
assert.equal(longName.indexOf('('), 0,
- 'open paren not found');
+ 'open paren not found');
assert.equal(longName.lastIndexOf(')'), longName.length - 1,
- 'close paren not found');
+ 'close paren not found');
assert.equal(shortName.indexOf('('), 0,
- 'open paren not found');
+ 'open paren not found');
assert.equal(shortName.lastIndexOf(')'), shortName.length - 1,
- 'close paren not found');
+ 'close paren not found');
// add 2 to the expected length to account for the parenthesis
// that surround ghosted names
assert.equal(longName.length, 11 + 2,
- 'name is not trucated');
+ 'name is not trucated');
assert.equal(shortName.length, shortId.length + 2,
- 'name does not match');
+ 'name does not match');
});
it('must be able to resolve models by their name', function() {
@@ -543,7 +543,7 @@ describe('test_model.js', function() {
var mysql = new models.Service({id: 'mysql'});
db.services.add([mysql]);
assert.equal(mysql.get('units') instanceof models.ServiceUnitList,
- true);
+ true);
db.onDelta({detail: {data: {result: [
['unitInfo', 'add', {name: 'mysql/0'}],
['unitInfo', 'add', {name: 'mysql/1'}]
@@ -567,15 +567,15 @@ describe('test_model.js', function() {
var db = new models.Database(),
id = '0';
assert.equal(db.machines.size(), 0,
- 'the machine list is not be empty');
+ 'the machine list is not be empty');
db.onDelta({detail: {data: {result: [
['machineInfo', 'change', {id: id}]
]}}});
assert.equal(db.machines.size(), 1,
- 'the machines list did not have the expected size');
+ 'the machines list did not have the expected size');
var machine = db.machines.getById(id);
assert.notEqual(machine, undefined,
- 'the expected machine was not found in the database');
+ 'the expected machine was not found in the database');
});
it('should copy visibility flags from service to unit', function() {
@@ -592,11 +592,11 @@ describe('test_model.js', function() {
var unit = db.units.getById(id);
assert.notEqual(unit, null, 'Unit was not created');
assert.equal(unit.hide, service.get('hide'),
- 'Hide flags should match between unit and service');
+ 'Hide flags should match between unit and service');
assert.equal(unit.fade, service.get('fade'),
- 'Fade flags should match between unit and service');
+ 'Fade flags should match between unit and service');
assert.equal(unit.highlight, service.get('highlight'),
- 'Highlight flags should match between unit and service');
+ 'Highlight flags should match between unit and service');
});
it('should change machines when units change', function() {
@@ -610,63 +610,63 @@ describe('test_model.js', function() {
]}}});
var args = machinesStub.lastCall.args;
assert.equal(args[0], 'change',
- 'the expected action was not applied to machines');
+ 'the expected action was not applied to machines');
assert.equal(args[1].id, '0',
- 'the expected machine ID was not changed');
+ 'the expected machine ID was not changed');
});
it('should handle remove changes correctly',
- function() {
- var db = new models.Database();
- var mysql = db.services.add({id: 'mysql'});
- var my0 = {id: 'mysql/0', agent_state: 'pending'};
- var my1 = {id: 'mysql/1', agent_state: 'pending'};
- db.addUnits([my0, my1]);
- db.onDelta({detail: {data: {result: [
- ['unitInfo', 'remove', {
- name: 'mysql/1',
- application: 'mysql'
- }]
- ]}}});
- var names = mysql.get('units').get('id');
- names.length.should.equal(1);
- names[0].should.equal('mysql/0');
- });
+ function() {
+ var db = new models.Database();
+ var mysql = db.services.add({id: 'mysql'});
+ var my0 = {id: 'mysql/0', agent_state: 'pending'};
+ var my1 = {id: 'mysql/1', agent_state: 'pending'};
+ db.addUnits([my0, my1]);
+ db.onDelta({detail: {data: {result: [
+ ['unitInfo', 'remove', {
+ name: 'mysql/1',
+ application: 'mysql'
+ }]
+ ]}}});
+ var names = mysql.get('units').get('id');
+ names.length.should.equal(1);
+ names[0].should.equal('mysql/0');
+ });
it('should be able to reuse existing services with add',
- function() {
- var db = new models.Database();
- var my0 = new models.Service({id: 'mysql', exposed: true});
- db.services.add([my0]);
- db.onDelta({detail: {data: {result: [
- ['applicationInfo', 'add', {
- name: 'mysql',
- 'charm-url': 'cs:precise/mysql',
- exposed: false
- }]
- ]}}});
- my0.get('exposed').should.equal(false);
- });
+ function() {
+ var db = new models.Database();
+ var my0 = new models.Service({id: 'mysql', exposed: true});
+ db.services.add([my0]);
+ db.onDelta({detail: {data: {result: [
+ ['applicationInfo', 'add', {
+ name: 'mysql',
+ 'charm-url': 'cs:precise/mysql',
+ exposed: false
+ }]
+ ]}}});
+ my0.get('exposed').should.equal(false);
+ });
it('should be able to reuse existing units with add',
- // Units are special because they use the LazyModelList.
- function() {
- var db = new models.Database();
- db.services.add({id: 'mysql'});
- var my0 = {id: 'mysql/0', public_address: '1.2.3.4'};
- db.addUnits([my0]);
- db.onDelta({detail: {data: {result: [
- ['unitInfo', 'add', {
- name: 'mysql/0',
- 'public-address': '5.6.7.8'
- }]
- ]}}});
- my0.public_address.should.equal('5.6.7.8');
- });
+ // Units are special because they use the LazyModelList.
+ function() {
+ var db = new models.Database();
+ db.services.add({id: 'mysql'});
+ var my0 = {id: 'mysql/0', public_address: '1.2.3.4'};
+ db.addUnits([my0]);
+ db.onDelta({detail: {data: {result: [
+ ['unitInfo', 'add', {
+ name: 'mysql/0',
+ 'public-address': '5.6.7.8'
+ }]
+ ]}}});
+ my0.public_address.should.equal('5.6.7.8');
+ });
it('uses default handler for unknown deltas', function() {
var handler = sinon.stub(
- Y.juju.models.handlers, 'defaultHandler');
+ Y.juju.models.handlers, 'defaultHandler');
var db = new models.Database();
db.onDelta({detail: {data: {result: [
['fakeDelta', 'add', {}]
@@ -677,19 +677,19 @@ describe('test_model.js', function() {
// XXX - We no longer use relation_errors but this test should remain
// until it's completely removed from the codebase.
it.skip('should reset relation_errors',
- function() {
- var db = new models.Database();
- var my0 = {
- id: 'mysql/0',
- relation_errors: {'cache': ['memcached']}
- };
- db.addUnits([my0]);
- // Note that relation_errors is not set.
- db.onDelta({detail: {data: {result: [
- ['unit', 'change', {id: 'mysql/0'}]
- ]}}});
- my0.relation_errors.should.eql({});
- });
+ function() {
+ var db = new models.Database();
+ var my0 = {
+ id: 'mysql/0',
+ relation_errors: {'cache': ['memcached']}
+ };
+ db.addUnits([my0]);
+ // Note that relation_errors is not set.
+ db.onDelta({detail: {data: {result: [
+ ['unit', 'change', {id: 'mysql/0'}]
+ ]}}});
+ my0.relation_errors.should.eql({});
+ });
});
it('ServiceUnitList should accept a list of units at instantiation and ' +
@@ -704,84 +704,84 @@ describe('test_model.js', function() {
});
it('RelationList.has_relations.. should return true if rel found.',
- function() {
- var db = new models.Database(),
- rel0 = new models.Relation({
- id: 'relation-0',
- endpoints: [
- ['mediawiki', {name: 'cache', role: 'source'}],
- ['squid', {name: 'cache', role: 'front'}]],
- 'interface': 'cache'
- }),
- rel1 = new models.Relation({
- id: 'relation-4',
- endpoints: [
- ['something', {name: 'foo', role: 'bar'}],
- ['mysql', {name: 'la', role: 'lee'}]],
- 'interface': 'thing'
- });
- db.relations.add([rel0, rel1]);
- db.relations.has_relation_for_endpoint(
- {service: 'squid', name: 'cache', type: 'cache'}
- ).should.equal(true);
- db.relations.has_relation_for_endpoint(
- {service: 'mysql', name: 'la', type: 'thing'}
- ).should.equal(true);
- db.relations.has_relation_for_endpoint(
- {service: 'squid', name: 'cache', type: 'http'}
- ).should.equal(false);
-
- // We can also pass a service name which must match for the
- // same relation.
-
- db.relations.has_relation_for_endpoint(
- {service: 'squid', name: 'cache', type: 'cache'},
- 'kafka'
- ).should.equal(false);
-
- db.relations.has_relation_for_endpoint(
- {service: 'squid', name: 'cache', type: 'cache'},
- 'mediawiki'
- ).should.equal(true);
-
- });
+ function() {
+ var db = new models.Database(),
+ rel0 = new models.Relation({
+ id: 'relation-0',
+ endpoints: [
+ ['mediawiki', {name: 'cache', role: 'source'}],
+ ['squid', {name: 'cache', role: 'front'}]],
+ 'interface': 'cache'
+ }),
+ rel1 = new models.Relation({
+ id: 'relation-4',
+ endpoints: [
+ ['something', {name: 'foo', role: 'bar'}],
+ ['mysql', {name: 'la', role: 'lee'}]],
+ 'interface': 'thing'
+ });
+ db.relations.add([rel0, rel1]);
+ db.relations.has_relation_for_endpoint(
+ {service: 'squid', name: 'cache', type: 'cache'}
+ ).should.equal(true);
+ db.relations.has_relation_for_endpoint(
+ {service: 'mysql', name: 'la', type: 'thing'}
+ ).should.equal(true);
+ db.relations.has_relation_for_endpoint(
+ {service: 'squid', name: 'cache', type: 'http'}
+ ).should.equal(false);
+
+ // We can also pass a service name which must match for the
+ // same relation.
+
+ db.relations.has_relation_for_endpoint(
+ {service: 'squid', name: 'cache', type: 'cache'},
+ 'kafka'
+ ).should.equal(false);
+
+ db.relations.has_relation_for_endpoint(
+ {service: 'squid', name: 'cache', type: 'cache'},
+ 'mediawiki'
+ ).should.equal(true);
+
+ });
it('RelationList.get_relations_for_service should do what it says',
- function() {
- var db = new models.Database(),
- service = new models.Service({id: 'mysql', exposed: false}),
- rel0 = new models.Relation(
- { id: 'relation-0',
- endpoints:
+ function() {
+ var db = new models.Database(),
+ service = new models.Service({id: 'mysql', exposed: false}),
+ rel0 = new models.Relation(
+ { id: 'relation-0',
+ endpoints:
[['mediawiki', {name: 'cache', role: 'source'}],
- ['squid', {name: 'cache', role: 'front'}]],
- 'interface': 'cache' }),
- rel1 = new models.Relation(
- { id: 'relation-1',
- endpoints: [['wordpress', {
- role: 'peer', name: 'loadbalancer'}]],
- 'interface': 'reversenginx' }),
- rel2 = new models.Relation(
- { id: 'relation-2',
- endpoints: [['mysql', {name: 'db', role: 'db'}],
- ['mediawiki', {name: 'storage', role: 'app'}]],
- 'interface': 'db'}),
- rel3 = new models.Relation(
- { id: 'relation-3',
- endpoints:
+ ['squid', {name: 'cache', role: 'front'}]],
+ 'interface': 'cache' }),
+ rel1 = new models.Relation(
+ { id: 'relation-1',
+ endpoints: [['wordpress', {
+ role: 'peer', name: 'loadbalancer'}]],
+ 'interface': 'reversenginx' }),
+ rel2 = new models.Relation(
+ { id: 'relation-2',
+ endpoints: [['mysql', {name: 'db', role: 'db'}],
+ ['mediawiki', {name: 'storage', role: 'app'}]],
+ 'interface': 'db'}),
+ rel3 = new models.Relation(
+ { id: 'relation-3',
+ endpoints:
[['mysql', {role: 'peer', name: 'loadbalancer'}]],
- 'interface': 'mysql-loadbalancer' }),
- rel4 = new models.Relation(
- { id: 'relation-4',
- endpoints:
+ 'interface': 'mysql-loadbalancer' }),
+ rel4 = new models.Relation(
+ { id: 'relation-4',
+ endpoints:
[['something', {name: 'foo', role: 'bar'}],
- ['mysql', {name: 'la', role: 'lee'}]],
- 'interface': 'thing' });
- db.relations.add([rel0, rel1, rel2, rel3, rel4]);
- db.relations.get_relations_for_service(service).map(
- function(r) { return r.get('id'); })
- .should.eql(['relation-2', 'relation-3', 'relation-4']);
- });
+ ['mysql', {name: 'la', role: 'lee'}]],
+ 'interface': 'thing' });
+ db.relations.add([rel0, rel1, rel2, rel3, rel4]);
+ db.relations.get_relations_for_service(service).map(
+ function(r) { return r.get('id'); })
+ .should.eql(['relation-2', 'relation-3', 'relation-4']);
+ });
it('getRelationFromEndpoints returns relation using endpoints', function() {
var relations = new models.RelationList();
@@ -834,33 +834,33 @@ describe('test_model.js', function() {
];
assert.equal(
- relations.compareRelationEndpoints(
- [endpointSetA[0], endpointSetA[1]],
- [endpointSetB[0], endpointSetB[1]]),
- true, 'compare set 1 failed');
+ relations.compareRelationEndpoints(
+ [endpointSetA[0], endpointSetA[1]],
+ [endpointSetB[0], endpointSetB[1]]),
+ true, 'compare set 1 failed');
assert.equal(
- relations.compareRelationEndpoints(
- [endpointSetA[1], endpointSetA[0]],
- [endpointSetB[0], endpointSetB[1]]),
- true, 'compare set 2 failed');
+ relations.compareRelationEndpoints(
+ [endpointSetA[1], endpointSetA[0]],
+ [endpointSetB[0], endpointSetB[1]]),
+ true, 'compare set 2 failed');
assert.equal(
- relations.compareRelationEndpoints(
- [endpointSetA[0], endpointSetA[1]],
- [endpointSetB[1], endpointSetB[0]]),
- true, 'compare set 3 failed');
+ relations.compareRelationEndpoints(
+ [endpointSetA[0], endpointSetA[1]],
+ [endpointSetB[1], endpointSetB[0]]),
+ true, 'compare set 3 failed');
assert.equal(
- relations.compareRelationEndpoints(
- [endpointSetA[0], endpointSetA[0]],
- [endpointSetB[1], endpointSetB[1]]),
- false, 'compare set 4 failed');
+ relations.compareRelationEndpoints(
+ [endpointSetA[0], endpointSetA[0]],
+ [endpointSetB[1], endpointSetB[1]]),
+ false, 'compare set 4 failed');
// Compare endpoints that share the same origin but connect to different
// services on the other end. (e.g., wordpress related to both mysql and
// haproxy)
assert.equal(
- relations.compareRelationEndpoints(
- [endpointSetA[0], endpointSetA[0]],
- [endpointSetB[0], endpointSetB[1]]),
- false, 'compare set 4 failed');
+ relations.compareRelationEndpoints(
+ [endpointSetA[0], endpointSetA[0]],
+ [endpointSetB[0], endpointSetB[1]]),
+ false, 'compare set 4 failed');
});
it('must be able to reference the Environment model', function() {
@@ -1103,7 +1103,7 @@ describe('test_model.js', function() {
it('should not return units with partially matching ids', function() {
var resultingUnits = mapUnitIds(units.filterByMachine('1', true));
assert.equal(resultingUnits.indexOf('mysql/12'), -1,
- 'This item should not be returned');
+ 'This item should not be returned');
});
it('returns the container hosted units including children', function() {
@@ -1318,7 +1318,7 @@ describe('test_model.js', function() {
it('returns a display name for a container', function() {
assert.deepEqual(machines.createDisplayName('0/lxc/0'), '0/lxc/0');
assert.deepEqual(
- machines.createDisplayName('1/kvm/0/lxc/42'), '1/kvm/0/lxc/42');
+ machines.createDisplayName('1/kvm/0/lxc/42'), '1/kvm/0/lxc/42');
});
it('retrieves machine info parsing the bootstrap node name', function() {
@@ -1482,13 +1482,13 @@ describe('test_model.js', function() {
it('returns the children of a machine', function() {
assertMachinesNames(machines.filterByParent('1'), ['1/lxc/0']);
assertMachinesNames(
- machines.filterByParent('2'), ['2/kvm/0', '2/lxc/42']);
+ machines.filterByParent('2'), ['2/kvm/0', '2/lxc/42']);
});
it('returns the children of a container', function() {
assertMachinesNames(
- machines.filterByParent('2/kvm/0'),
- ['2/kvm/0/lxc/0', '2/kvm/0/lxc/1']);
+ machines.filterByParent('2/kvm/0'),
+ ['2/kvm/0/lxc/0', '2/kvm/0/lxc/1']);
});
it('returns an empty list if a machine has no children', function() {
@@ -1507,14 +1507,14 @@ describe('test_model.js', function() {
it('filters machines by machine ancestor', function() {
assertMachinesNames(machines.filterByAncestor('1'), ['1/lxc/0']);
assertMachinesNames(
- machines.filterByAncestor('2'),
- ['2/kvm/0', '2/lxc/42', '2/kvm/0/lxc/0', '2/kvm/0/lxc/1']);
+ machines.filterByAncestor('2'),
+ ['2/kvm/0', '2/lxc/42', '2/kvm/0/lxc/0', '2/kvm/0/lxc/1']);
});
it('filters machines by container ancestor', function() {
assertMachinesNames(
- machines.filterByAncestor('2/kvm/0'),
- ['2/kvm/0/lxc/0', '2/kvm/0/lxc/1']);
+ machines.filterByAncestor('2/kvm/0'),
+ ['2/kvm/0/lxc/0', '2/kvm/0/lxc/1']);
});
it('returns an empty list if no descendants are found', function() {
@@ -1600,23 +1600,23 @@ describe('test_model.js', function() {
});
it('throws an error if you do not pass get_charm',
- function() {
- var charm = new models.Charm({id: 'local:precise/foo-4'});
- try {
- charm.sync('read', {});
- assert.fail('Should have thrown an error');
- } catch (e) {
- e.should.equal(
- 'You must supply a get_charm function.');
- }
- try {
- charm.sync('read', {env: 42});
- assert.fail('Should have thrown an error');
- } catch (e) {
- e.should.equal(
- 'You must supply a get_charm function.');
- }
- });
+ function() {
+ var charm = new models.Charm({id: 'local:precise/foo-4'});
+ try {
+ charm.sync('read', {});
+ assert.fail('Should have thrown an error');
+ } catch (e) {
+ e.should.equal(
+ 'You must supply a get_charm function.');
+ }
+ try {
+ charm.sync('read', {env: 42});
+ assert.fail('Should have thrown an error');
+ } catch (e) {
+ e.should.equal(
+ 'You must supply a get_charm function.');
+ }
+ });
it('must send request to juju environment for local charms', function() {
var charm = new models.Charm({id: 'local:precise/foo-4'}).load(env);
@@ -1626,13 +1626,13 @@ describe('test_model.js', function() {
it('must handle success from local charm request', function(done) {
var charm = new models.Charm({id: 'local:precise/foo-4'}).load(
- env,
- function(err, response) {
- assert.strictEqual(err, false);
- assert.equal(charm.get('summary'), 'wowza');
- assert.strictEqual(charm.loaded, true);
- done();
- });
+ env,
+ function(err, response) {
+ assert.strictEqual(err, false);
+ assert.equal(charm.get('summary'), 'wowza');
+ assert.strictEqual(charm.loaded, true);
+ done();
+ });
var response = {
'request-id': conn.last_message()['request-id'],
response: {meta: {summary: 'wowza'}, config: {}}
@@ -1643,16 +1643,16 @@ describe('test_model.js', function() {
it('parses charm model options correctly', function(done) {
var charm = new models.Charm({id: 'local:precise/foo-4'}).load(
- env,
- function(err, response) {
- assert(!err);
- // This checks to make sure the parse mechanism is working properly
- // for both the old ane new charm browser.
- var option = charm.get('options').default_log;
- assert.equal('global', option['default']);
- assert.equal('Default log', option.description);
- done();
- });
+ env,
+ function(err, response) {
+ assert(!err);
+ // This checks to make sure the parse mechanism is working properly
+ // for both the old ane new charm browser.
+ var option = charm.get('options').default_log;
+ assert.equal('global', option['default']);
+ assert.equal('Default log', option.description);
+ done();
+ });
var response = {
'request-id': conn.last_message()['request-id'],
response: {
@@ -1672,13 +1672,13 @@ describe('test_model.js', function() {
it('must handle failure from local charm request', function(done) {
var charm = new models.Charm({id: 'local:precise/foo-4'}).load(
- env,
- function(err, response) {
- assert(err);
- assert(response.err);
- assert(!charm.loaded);
- done();
- });
+ env,
+ function(err, response) {
+ assert(err);
+ assert(response.err);
+ assert(!charm.loaded);
+ done();
+ });
var response = {
'request-id': conn.last_message()['request-id'],
error: 'error'
@@ -1799,7 +1799,7 @@ describe('test_model.js', function() {
};
instance = new models.Charm(data);
instance.get('providers').should.eql(
- {successes: ['ec2'], failures: ['local', 'openstack']});
+ {successes: ['ec2'], failures: ['local', 'openstack']});
});
it('has an entity type static property', function() {
@@ -2336,12 +2336,12 @@ describe('test_model.js', function() {
});
it('ignores machines with no units when determining placements',
- function() {
- var machine = { id: '0' };
- db.machines.add(machine);
- var placement = db._mapServicesToMachines(db.machines);
- assert.deepEqual(placement, {});
- });
+ function() {
+ var machine = { id: '0' };
+ db.machines.add(machine);
+ var placement = db._mapServicesToMachines(db.machines);
+ assert.deepEqual(placement, {});
+ });
it('annotates services with placement info', function() {
db.services.add({id: 'mysql', charm: 'precise/mysql-1'});
@@ -2570,7 +2570,7 @@ describe('test_model.js', function() {
it('creates and returns a new charm model instance', function() {
var charm = db.charms.addFromCharmData(
- metadata, 'trusty', 42, 'local', options);
+ metadata, 'trusty', 42, 'local', options);
// A new charm model instance has been created.
assert.strictEqual(db.charms.size(), 1);
// The newly created charm has been returned.
@@ -2581,9 +2581,9 @@ describe('test_model.js', function() {
it('creates different series and revisions of the same charm', function() {
var charm1 = db.charms.addFromCharmData(
- metadata, 'saucy', 42, 'local', options);
+ metadata, 'saucy', 42, 'local', options);
var charm2 = db.charms.addFromCharmData(
- metadata, 'trusty', 47, 'local', options);
+ metadata, 'trusty', 47, 'local', options);
// Two new charm model instance have been created.
assert.strictEqual(db.charms.size(), 2);
// The newly created charms have been returned.
@@ -2596,9 +2596,9 @@ describe('test_model.js', function() {
it('just retrieves the charm if it already exists', function() {
var charm1 = db.charms.addFromCharmData(
- metadata, 'trusty', 42, 'local', options);
+ metadata, 'trusty', 42, 'local', options);
var charm2 = db.charms.addFromCharmData(
- metadata, 'trusty', 42, 'local', options);
+ metadata, 'trusty', 42, 'local', options);
// Only one charm model instance has been actually created.
assert.strictEqual(db.charms.size(), 1);
// The original charm has been returned by the second call.
@@ -2614,7 +2614,7 @@ describe('test_model.js', function() {
metadata.requires = 'new-requires';
options = {'another-option': {}};
var charm = db.charms.addFromCharmData(
- metadata, 'trusty', 42, 'local', options);
+ metadata, 'trusty', 42, 'local', options);
// Only one charm model instance has been actually created.
assert.strictEqual(db.charms.size(), 1);
// The updated charm has been returned.
diff --git a/jujugui/static/gui/src/test/test_model_bundle.js b/jujugui/static/gui/src/test/test_model_bundle.js
index b1a5a9ac53..14b724c130 100644
--- a/jujugui/static/gui/src/test/test_model_bundle.js
+++ b/jujugui/static/gui/src/test/test_model_bundle.js
@@ -31,7 +31,7 @@ describe('Bundle initialization', function() {
it('must be able to create a bundle', function() {
var expected = '~bac/wiki/3/wiki';
var bundle = new models.Bundle(
- {id: expected});
+ {id: expected});
assert.equal(expected, bundle.get('id'));
});
@@ -52,7 +52,7 @@ describe('The bundle model', function() {
utils = Y.namespace('juju-tests.utils');
charmstore = new window.jujulib.charmstore('local/');
origData = charmstore._processEntityQueryData(
- utils.loadFixture('data/apiv5-bundle.json', true));
+ utils.loadFixture('data/apiv5-bundle.json', true));
done();
});
});
@@ -172,7 +172,7 @@ describe('The bundle model', function() {
it('parses full name-email string', function() {
instance = new models.Bundle();
var parts = instance.parseNameEmail(
- 'Jorge O. O\'Castro
');
+ 'Jorge O. O\'Castro ');
assert.deepEqual(['Jorge O. O\'Castro', 'jcastro@example.com'], parts);
});
diff --git a/jujugui/static/gui/src/test/test_model_controller.js b/jujugui/static/gui/src/test/test_model_controller.js
index 938874aab8..1de2fc9819 100644
--- a/jujugui/static/gui/src/test/test_model_controller.js
+++ b/jujugui/static/gui/src/test/test_model_controller.js
@@ -24,17 +24,17 @@ describe('Model Controller Promises', function() {
before(function(done) {
YUI(GlobalConfig).use(
- 'juju-charm-models', 'juju-models', 'juju-tests-factory',
- 'juju-tests-utils', 'juju-view-environment', 'model-controller',
- function(Y) {
- var goenv = Y.juju.environments.GoEnvironment;
- yui = Y;
- load = Y.juju.models.Charm.prototype.load;
- getApplicationConfig = goenv.prototype.getApplicationConfig;
- utils = Y.namespace('juju-tests.utils');
- factory = Y.namespace('juju-tests.factory');
- done();
- });
+ 'juju-charm-models', 'juju-models', 'juju-tests-factory',
+ 'juju-tests-utils', 'juju-view-environment', 'model-controller',
+ function(Y) {
+ var goenv = Y.juju.environments.GoEnvironment;
+ yui = Y;
+ load = Y.juju.models.Charm.prototype.load;
+ getApplicationConfig = goenv.prototype.getApplicationConfig;
+ utils = Y.namespace('juju-tests.utils');
+ factory = Y.namespace('juju-tests.factory');
+ done();
+ });
});
beforeEach(function() {
@@ -147,15 +147,15 @@ describe('Model Controller Promises', function() {
assert(promise instanceof Promise, true);
assert(!!db.charms.getById(charmId), true);
promise.then(
- function(charm) {
- assert(charm.get('id'), charmId);
- assert(!!db.charms.getById(charmId), true);
- done();
- },
- function() {
- assert.fail('This should not have failed.');
- done();
- });
+ function(charm) {
+ assert(charm.get('id'), charmId);
+ assert(!!db.charms.getById(charmId), true);
+ done();
+ },
+ function() {
+ assert.fail('This should not have failed.');
+ done();
+ });
});
it('will return a promise with a loaded charm', function(done) {
@@ -166,14 +166,14 @@ describe('Model Controller Promises', function() {
assert(promise instanceof Promise, true);
assert(db.charms.getById(charmId), null);
promise.then(
- function(charm) {
- assert(charm.get('package_name'), 'wordpress');
- done();
- },
- function() {
- assert.fail('This should not have failed.');
- done();
- });
+ function(charm) {
+ assert(charm.get('package_name'), 'wordpress');
+ done();
+ },
+ function() {
+ assert.fail('This should not have failed.');
+ done();
+ });
});
it('will return a promise with a stored loaded service', function(done) {
@@ -186,15 +186,15 @@ describe('Model Controller Promises', function() {
assert(promise instanceof Promise, true);
assert(!!db.services.getById(serviceId), true);
promise.then(
- function(service) {
- assert(service.get('id'), serviceId);
- assert(!!db.services.getById(serviceId), true);
- done();
- },
- function() {
- assert.fail('This should not have failed.');
- done();
- });
+ function(service) {
+ assert(service.get('id'), serviceId);
+ assert(!!db.services.getById(serviceId), true);
+ done();
+ },
+ function() {
+ assert.fail('This should not have failed.');
+ done();
+ });
});
@@ -206,15 +206,15 @@ describe('Model Controller Promises', function() {
assert(promise instanceof Promise, true);
assert(db.services.getById(serviceId), null);
promise.then(
- function(service) {
- assert(service.get('id'), serviceId);
- assert(!!db.services.getById(serviceId), true);
- done();
- },
- function() {
- assert.fail('This should not have failed.');
- done();
- });
+ function(service) {
+ assert(service.get('id'), serviceId);
+ assert(!!db.services.getById(serviceId), true);
+ done();
+ },
+ function() {
+ assert.fail('This should not have failed.');
+ done();
+ });
});
it('will reject the promise if the service does not exist', function(done) {
@@ -225,40 +225,40 @@ describe('Model Controller Promises', function() {
assert(promise instanceof Promise, true);
assert(db.services.getById(serviceId), null);
promise.then(
- function() {
- assert.fail('This should not have been successful.');
- done();
- },
- function(err) {
- assert(err.err, true);
- done();
- });
+ function() {
+ assert.fail('This should not have been successful.');
+ done();
+ },
+ function(err) {
+ assert(err.err, true);
+ done();
+ });
});
it('will return a promise with a loaded charm and service',
- function(done) {
- clobberLoad();
- clobberGetApplicationConfig();
- var serviceId = 'wordpress',
- charmId = 'cs:precise/wordpress-7';
- db.services.add({
- id: serviceId,
- loaded: true,
- charm: charmId
- });
- var promise = modelController.getServiceWithCharm(serviceId);
- assert(promise instanceof Promise, true);
- promise.then(
- function(result) {
- assert(result.service.get('id'), serviceId);
- assert(result.charm.get('id'), charmId);
- assert(!!db.services.getById(serviceId), true);
- assert(!!db.charms.getById(charmId), true);
- done();
- },
- function() {
- assert.fail('This should not have failed.');
- done();
- });
+ function(done) {
+ clobberLoad();
+ clobberGetApplicationConfig();
+ var serviceId = 'wordpress',
+ charmId = 'cs:precise/wordpress-7';
+ db.services.add({
+ id: serviceId,
+ loaded: true,
+ charm: charmId
});
+ var promise = modelController.getServiceWithCharm(serviceId);
+ assert(promise instanceof Promise, true);
+ promise.then(
+ function(result) {
+ assert(result.service.get('id'), serviceId);
+ assert(result.charm.get('id'), charmId);
+ assert(!!db.services.getById(serviceId), true);
+ assert(!!db.charms.getById(charmId), true);
+ done();
+ },
+ function() {
+ assert.fail('This should not have failed.');
+ done();
+ });
+ });
});
diff --git a/jujugui/static/gui/src/test/test_model_handlers.js b/jujugui/static/gui/src/test/test_model_handlers.js
index 5060024f48..44a5c5e554 100644
--- a/jujugui/static/gui/src/test/test_model_handlers.js
+++ b/jujugui/static/gui/src/test/test_model_handlers.js
@@ -1003,11 +1003,11 @@ describe('Juju delta handlers utilities', function() {
// Clean up application tags.
assert.equal('mysql', cleanUpEntityTags('application-mysql'));
assert.equal(
- 'buildbot-master', cleanUpEntityTags('application-buildbot-master'));
+ 'buildbot-master', cleanUpEntityTags('application-buildbot-master'));
// Clean up unit tags.
assert.equal('mysql/47', cleanUpEntityTags('unit-mysql-47'));
assert.equal(
- 'buildbot-master/0', cleanUpEntityTags('unit-buildbot-master-0'));
+ 'buildbot-master/0', cleanUpEntityTags('unit-buildbot-master-0'));
// Clean up machine tags.
assert.equal('0', cleanUpEntityTags('machine-0'));
assert.equal('42', cleanUpEntityTags('machine-42'));
diff --git a/jujugui/static/gui/src/test/test_panzoom.js b/jujugui/static/gui/src/test/test_panzoom.js
index d088b6c05f..67788e7480 100644
--- a/jujugui/static/gui/src/test/test_panzoom.js
+++ b/jujugui/static/gui/src/test/test_panzoom.js
@@ -58,41 +58,41 @@ describe('pan zoom module', function() {
// Test the zoom calculations.
it('should handle fractional values within the limit for rescale',
- function() {
- // Floor is used so the scale will round down.
- var evt =
+ function() {
+ // Floor is used so the scale will round down.
+ var evt =
{ scale: 0.609,
translate: [0, 0]};
- pz.rescale(evt);
- topo.get('scale').should.equal(0.609);
- var translate = evt.translate;
- var expected = 'translate(' + translate + ') scale(0.609)';
- vis.attr('transform').should.equal(expected);
- });
+ pz.rescale(evt);
+ topo.get('scale').should.equal(0.609);
+ var translate = evt.translate;
+ var expected = 'translate(' + translate + ') scale(0.609)';
+ vis.attr('transform').should.equal(expected);
+ });
it('should set an upper limit for rescale',
- function() {
- var evt =
+ function() {
+ var evt =
{ scale: 2.1,
translate: [0, 0]};
- pz.rescale(evt);
- topo.get('scale').should.equal(2.0);
- var translate = evt.translate;
- var expected = 'translate(' + translate + ') scale(2)';
- vis.attr('transform').should.equal(expected);
- });
+ pz.rescale(evt);
+ topo.get('scale').should.equal(2.0);
+ var translate = evt.translate;
+ var expected = 'translate(' + translate + ') scale(2)';
+ vis.attr('transform').should.equal(expected);
+ });
it('should set a lower limit for rescale',
- function() {
- var evt =
+ function() {
+ var evt =
{ scale: 0.2,
translate: [0, 0]};
- pz.rescale(evt);
- topo.get('scale').should.equal(0.25);
- var translate = evt.translate;
- var expected = 'translate(' + translate + ') scale(0.25)';
- vis.attr('transform').should.equal(expected);
- });
+ pz.rescale(evt);
+ topo.get('scale').should.equal(0.25);
+ var translate = evt.translate;
+ var expected = 'translate(' + translate + ') scale(0.25)';
+ vis.attr('transform').should.equal(expected);
+ });
it('must be able to handle zoom in/out events', function() {
const svg = viewContainer.querySelector('.the-canvas g');
diff --git a/jujugui/static/gui/src/test/test_relation_utils.js b/jujugui/static/gui/src/test/test_relation_utils.js
index 0b39f59ee5..5a48820d65 100644
--- a/jujugui/static/gui/src/test/test_relation_utils.js
+++ b/jujugui/static/gui/src/test/test_relation_utils.js
@@ -43,20 +43,20 @@ describe('RelationUtils', function() {
assert.isNumber(relationUtils.generateHash('qumquat'));
// It's stable.
assert.strictEqual(
- relationUtils.generateHash('kumquat'),
- relationUtils.generateHash('kumquat'));
+ relationUtils.generateHash('kumquat'),
+ relationUtils.generateHash('kumquat'));
// Different values hash differently.
assert.notEqual(
- relationUtils.generateHash('kumquat'),
- relationUtils.generateHash('qumquat'));
+ relationUtils.generateHash('kumquat'),
+ relationUtils.generateHash('qumquat'));
});
it('can generate safe relation ids', function() {
var relationId;
relationId = 'foo:Bar relation-00000006!@#';
assert.strictEqual(
- relationUtils.generateSafeDOMId(relationId),
- 'e-foo_Bar_relation_00000006___-' +
+ relationUtils.generateSafeDOMId(relationId),
+ 'e-foo_Bar_relation_00000006___-' +
relationUtils.generateHash(relationId));
});
@@ -64,11 +64,11 @@ describe('RelationUtils', function() {
var relationId;
relationId = 'foo:Bar relation-00000006!@#';
assert.notEqual(
- relationUtils.generateSafeDOMId(relationId, 'topo1'),
- relationUtils.generateSafeDOMId(relationId, 'topo2'));
+ relationUtils.generateSafeDOMId(relationId, 'topo1'),
+ relationUtils.generateSafeDOMId(relationId, 'topo2'));
assert.strictEqual(
- relationUtils.generateSafeDOMId(relationId, 'topo1'),
- 'e-foo_Bar_relation_00000006___-' +
+ relationUtils.generateSafeDOMId(relationId, 'topo1'),
+ 'e-foo_Bar_relation_00000006___-' +
relationUtils.generateHash(relationId + 'topo1'));
});
});
@@ -331,9 +331,9 @@ describe('RelationUtils', function() {
assert.strictEqual('global', result.scope, 'scope');
assert.strictEqual('relation-0000000002', result.id, 'id');
assert.strictEqual(
- relationUtils.generateSafeDOMId('relation-0000000002'),
- result.elementId,
- 'elementId'
+ relationUtils.generateSafeDOMId('relation-0000000002'),
+ result.elementId,
+ 'elementId'
);
assert.strictEqual('mydb:2', result.ident, 'ident');
assert.strictEqual('mysql', result.near.service, 'near service');
@@ -397,9 +397,9 @@ describe('RelationUtils', function() {
assert.strictEqual('global', result.scope, 'scope');
assert.strictEqual('mediawiki:db mysql:mydb', result.id, 'id');
assert.strictEqual(
- relationUtils.generateSafeDOMId('mediawiki:db mysql:mydb'),
- result.elementId,
- 'elementId'
+ relationUtils.generateSafeDOMId('mediawiki:db mysql:mydb'),
+ result.elementId,
+ 'elementId'
);
assert.strictEqual('mediawiki:db mysql:mydb', result.ident, 'ident');
assert.strictEqual('mysql', result.near.service, 'near service');
@@ -943,8 +943,8 @@ describe('RelationUtils', function() {
var applicationFrom = vals.applicationFrom || {};
var applicationTo = { get: function() { return vals.applicationToId; } };
var dataStub = sinon.stub(
- relationUtils, 'getRelationDataForService').returns(
- JSON.parse(vals.getRelationDataForService));
+ relationUtils, 'getRelationDataForService').returns(
+ JSON.parse(vals.getRelationDataForService));
context._cleanups.push(dataStub.restore);
return relationUtils.getAvailableEndpoints(
endpointsController, db, getEndpoints, applicationFrom, applicationTo);
diff --git a/jujugui/static/gui/src/test/test_service_module.js b/jujugui/static/gui/src/test/test_service_module.js
index 323befe875..bf45822fbd 100644
--- a/jujugui/static/gui/src/test/test_service_module.js
+++ b/jujugui/static/gui/src/test/test_service_module.js
@@ -72,31 +72,31 @@ describe('service module annotations', function() {
// Test the drag end handler.
it('should set location annotations on service block drag end',
- function() {
- var d =
+ function() {
+ var d =
{ id: 'wordpress',
inDrag: views.DRAG_ACTIVE,
x: 100.1,
y: 200.2};
- serviceModule.dragend(d, serviceModule);
- assert.isTrue(called);
- location['gui-x'].should.equal(100.1);
- location['gui-y'].should.equal(200.2);
- });
+ serviceModule.dragend(d, serviceModule);
+ assert.isTrue(called);
+ location['gui-x'].should.equal(100.1);
+ location['gui-y'].should.equal(200.2);
+ });
it('should not set annotations on drag end if building a relation',
- function() {
- var d =
+ function() {
+ var d =
{ id: 'wordpress',
x: 100.1,
y: 200.2};
- var topo = serviceModule.get('component');
- topo.buildingRelation = true;
- serviceModule.dragend(d, serviceModule);
- assert.isFalse(called);
- location['gui-x'].should.equal(0);
- location['gui-y'].should.equal(0);
- });
+ var topo = serviceModule.get('component');
+ topo.buildingRelation = true;
+ serviceModule.dragend(d, serviceModule);
+ assert.isFalse(called);
+ location['gui-x'].should.equal(0);
+ location['gui-y'].should.equal(0);
+ });
it('should clear the state when the event is fired', function() {
const topo = serviceModule.get('component');
@@ -305,15 +305,15 @@ describe.skip('service module events', function() {
serviceModule.highlight({serviceName: 'haproxy'});
assert.equal(topo.service_boxes.haproxy.highlighted, true);
assert.equal(topo.vis.select('.service-block-image').attr('href'),
- '/static/gui/build/app/assets/svgs/service_module_selected.svg');
+ '/static/gui/build/app/assets/svgs/service_module_selected.svg');
assert.notEqual(topo.vis.select('.service.highlight')[0][0],
- null, 'Highlight class not found');
+ null, 'Highlight class not found');
serviceModule.unhighlight({serviceName: 'haproxy'});
assert.equal(topo.service_boxes.haproxy.highlighted, false);
assert.equal(topo.vis.select('.service-block-image').attr('href'),
- '/static/gui/build/app/assets/svgs/service_module.svg');
+ '/static/gui/build/app/assets/svgs/service_module.svg');
assert.notEqual(topo.vis.select('.service.unhighlight')[0][0],
- null, 'Unhighlight class not found');
+ null, 'Unhighlight class not found');
});
it('should highlight and unhighlight related services', function() {
@@ -338,7 +338,7 @@ describe.skip('service module events', function() {
it('can generate a selection from a list of service names', function() {
assert.deepEqual(serviceModule.selectionFromServiceNames(['haproxy']),
- topo.vis.selectAll('.service'));
+ topo.vis.selectAll('.service'));
});
it('should display an indicator for pending services', function() {
@@ -370,7 +370,7 @@ describe.skip('service module events', function() {
serviceModule.update();
db.fire('bundleImportComplete', {services: [db.services.item(0)]});
assert.equal(stubFindCentroid.calledOnce, true,
- 'findCentroid not called');
+ 'findCentroid not called');
});
it('should deploy a service on charm token drop events', function(done) {
@@ -489,7 +489,7 @@ describe.skip('service module events', function() {
serviceModule.set('component', view.topo);
var extractCharmMetadata = sinon.stub(
- serviceModule, '_extractCharmMetadata');
+ serviceModule, '_extractCharmMetadata');
this._cleanups.push(extractCharmMetadata.restore);
serviceModule.canvasDropHandler(fakeEventObject);
@@ -522,7 +522,7 @@ describe.skip('service module events', function() {
serviceModule.set('component', view.topo);
var extractCharmMetadata = sinon.stub(
- serviceModule, '_extractCharmMetadata');
+ serviceModule, '_extractCharmMetadata');
this._cleanups.push(extractCharmMetadata.restore);
serviceModule.canvasDropHandler(fakeEventObject);
@@ -543,10 +543,10 @@ describe.skip('service module events', function() {
var getEntries = sinon.stub(Y.juju.ziputils, 'getEntries');
this._cleanups.push(getEntries.restore);
var findCharmEntries = sinon.stub(
- serviceModule, '_findCharmEntries');
+ serviceModule, '_findCharmEntries');
this._cleanups.push(findCharmEntries.restore);
var zipExtractionError = sinon.stub(
- serviceModule, '_zipExtractionError');
+ serviceModule, '_zipExtractionError');
this._cleanups.push(zipExtractionError);
serviceModule._extractCharmMetadata(fileObj, topoObj, envObj, dbObj);
@@ -589,10 +589,10 @@ describe.skip('service module events', function() {
it('finds the files in the zip', function() {
var entries = { metadata: 'foo' };
var findEntries = sinon.stub(
- Y.juju.ziputils, 'findCharmEntries').returns(entries);
+ Y.juju.ziputils, 'findCharmEntries').returns(entries);
this._cleanups.push(findEntries.restore);
var readEntries = sinon.stub(
- serviceModule, '_readCharmEntries');
+ serviceModule, '_readCharmEntries');
this._cleanups.push(readEntries.restore);
serviceModule._findCharmEntries(fileObj, topoObj, envObj, dbObj, {});
@@ -611,10 +611,10 @@ describe.skip('service module events', function() {
it('shows an error notification if there is no metadata.yaml', function() {
var entries = { foo: 'bar' };
var findEntries = sinon.stub(
- Y.juju.ziputils, 'findCharmEntries').returns(entries);
+ Y.juju.ziputils, 'findCharmEntries').returns(entries);
this._cleanups.push(findEntries.restore);
var readEntries = sinon.stub(
- serviceModule, '_readCharmEntries');
+ serviceModule, '_readCharmEntries');
this._cleanups.push(readEntries.restore);
serviceModule._findCharmEntries(fileObj, topoObj, envObj, dbObj, {});
@@ -639,10 +639,10 @@ describe.skip('service module events', function() {
var readEntries = sinon.stub(Y.juju.ziputils, 'readCharmEntries');
this._cleanups.push(readEntries.restore);
var existingServices = sinon.stub(
- serviceModule, '_checkForExistingServices');
+ serviceModule, '_checkForExistingServices');
this._cleanups.push(existingServices);
var extractionError = sinon.stub(
- serviceModule, '_zipExtractionError');
+ serviceModule, '_zipExtractionError');
serviceModule._readCharmEntries(fileObj, topoObj, envObj, dbObj, {});
@@ -682,7 +682,7 @@ describe.skip('service module events', function() {
jsYamlMock = sinon.stub(jsyaml, 'safeLoad').returns({ name: 'ghost' });
context._cleanups.push(jsYamlMock.restore);
showInspector = sinon.stub(
- serviceModule, '_showUpgradeOrNewInspector');
+ serviceModule, '_showUpgradeOrNewInspector');
context._cleanups.push(showInspector.restore);
deployCharm = sinon.stub(serviceModule, '_deployLocalCharm');
context._cleanups.push(deployCharm.restore);
@@ -701,7 +701,7 @@ describe.skip('service module events', function() {
dbObj = { services: { getServicesFromCharmName: getServicesStub }};
serviceModule._checkForExistingServices(
- fileObj, topoObj, envObj, dbObj, contentsObj);
+ fileObj, topoObj, envObj, dbObj, contentsObj);
sharedAssert();
@@ -716,7 +716,7 @@ describe.skip('service module events', function() {
dbObj = { services: { getServicesFromCharmName: getServicesStub }};
serviceModule._checkForExistingServices(
- fileObj, topoObj, envObj, dbObj, contentsObj);
+ fileObj, topoObj, envObj, dbObj, contentsObj);
sharedAssert();
@@ -850,8 +850,8 @@ describe('canvasDropHandler', function() {
// Calling both functions with arguments that result in an early-out is the
// easiest way to show that the one is just a shim around the other.
assert.equal(
- serviceModule.canvasDropHandler(evt),
- serviceModule._canvasDropHandler(files));
+ serviceModule.canvasDropHandler(evt),
+ serviceModule._canvasDropHandler(files));
});
it('halts the event so FF does not try to reload the page', function(done) {
diff --git a/jujugui/static/gui/src/test/test_topology.js b/jujugui/static/gui/src/test/test_topology.js
index 3f423f836d..69f0a4c553 100644
--- a/jujugui/static/gui/src/test/test_topology.js
+++ b/jujugui/static/gui/src/test/test_topology.js
@@ -100,12 +100,12 @@ describe('topology', function() {
}
it('should be able to create a topology with standard env view modules',
- function() {
- topo = createStandardTopo();
- topo.render();
- // Verify that we have built the default scene.
- viewUtils.isValue(topo.vis).should.equal(true);
- });
+ function() {
+ topo = createStandardTopo();
+ topo.render();
+ // Verify that we have built the default scene.
+ viewUtils.isValue(topo.vis).should.equal(true);
+ });
describe('servicePointOutside', function() {
var padding = 200;
diff --git a/jujugui/static/gui/src/test/test_topology_relation.js b/jujugui/static/gui/src/test/test_topology_relation.js
index ea802e664e..6193f4d942 100644
--- a/jujugui/static/gui/src/test/test_topology_relation.js
+++ b/jujugui/static/gui/src/test/test_topology_relation.js
@@ -25,12 +25,12 @@ describe('topology relation module', function() {
Y = YUI(GlobalConfig).use(
['juju-tests-utils', 'juju-topology', 'node', 'relation-utils',
'juju-models'],
- function(Y) {
- views = Y.namespace('juju.views');
- utils = Y.namespace('juju-tests.utils');
- models = Y.namespace('juju.models');
- done();
- });
+ function(Y) {
+ views = Y.namespace('juju.views');
+ utils = Y.namespace('juju-tests.utils');
+ models = Y.namespace('juju.models');
+ done();
+ });
});
beforeEach(function() {
@@ -91,23 +91,23 @@ describe('topology relation module', function() {
});
it('fires "changeState" topo event for clicking a relation endpoint',
- function() {
- const state = {
- changeState: sinon.stub()
- };
- var topo = {
- get: sinon.stub().withArgs('state').returns(state)
- };
- view.set('component', topo);
- const relation = document.createElement('div');
- relation.setAttribute('data-endpoint', 'one:two');
- view.inspectRelationClick.call(relation, undefined, view);
- assert.equal(state.changeState.callCount, 1);
- assert.deepEqual(state.changeState.args[0][0], {
- gui: {
- inspector: { id: 'one' }
- }});
- });
+ function() {
+ const state = {
+ changeState: sinon.stub()
+ };
+ var topo = {
+ get: sinon.stub().withArgs('state').returns(state)
+ };
+ view.set('component', topo);
+ const relation = document.createElement('div');
+ relation.setAttribute('data-endpoint', 'one:two');
+ view.inspectRelationClick.call(relation, undefined, view);
+ assert.equal(state.changeState.callCount, 1);
+ assert.deepEqual(state.changeState.args[0][0], {
+ gui: {
+ inspector: { id: 'one' }
+ }});
+ });
describe('updateRelationVisibility', function() {
it('is called on update', function() {
@@ -118,7 +118,7 @@ describe('topology relation module', function() {
var update = sinon.stub(view, 'updateLinks');
this._cleanups.push(update.restore);
var updateSubs = sinon.stub(
- view, 'updateSubordinateRelationsCount');
+ view, 'updateSubordinateRelationsCount');
this._cleanups.push(updateSubs.restore);
view.set('component', {
get: function() {
@@ -341,8 +341,8 @@ describe('topology relation module', function() {
set: set
};
var locate = sinon.stub(
- Y.juju.topology.utils, 'locateRelativePointOnCanvas').returns(
- ['locate1', 'locate2']);
+ Y.juju.topology.utils, 'locateRelativePointOnCanvas').returns(
+ ['locate1', 'locate2']);
this._cleanups.push(locate.restore);
view._positionAmbiguousRelationMenu(menu, topo, 'm', 'context');
diff --git a/jujugui/static/gui/src/test/test_topology_utils.js b/jujugui/static/gui/src/test/test_topology_utils.js
index d229b79923..ac08d043a6 100644
--- a/jujugui/static/gui/src/test/test_topology_utils.js
+++ b/jujugui/static/gui/src/test/test_topology_utils.js
@@ -23,10 +23,10 @@ describe('topology utils', function() {
before(function(done) {
YUI(GlobalConfig).use(['array-extras', 'juju-topology-utils'],
- function(Y) {
- utils = Y.namespace('juju.topology.utils');
- done();
- });
+ function(Y) {
+ utils = Y.namespace('juju.topology.utils');
+ done();
+ });
});
it('should translate service boxes to vertices', function() {
@@ -38,7 +38,7 @@ describe('topology utils', function() {
};
var mungedBoxes = utils.serviceBoxesToVertices(serviceBoxes);
assert.deepEqual(mungedBoxes,
- [[100, 100], [200, 100], [100, 200], [200, 200]]);
+ [[100, 100], [200, 100], [100, 200], [200, 200]]);
});
it('translates service boxes to centers coordinates', function() {
@@ -112,8 +112,8 @@ describe('topology utils', function() {
point_two = [13, 23];
assert.deepEqual(
- [6.5, 11.5],
- utils.findCenterPoint(point_one, point_two)
+ [6.5, 11.5],
+ utils.findCenterPoint(point_one, point_two)
);
});
@@ -122,8 +122,8 @@ describe('topology utils', function() {
point_two = [13.3, 23.54];
assert.deepEqual(
- [6.65, 11.77],
- utils.findCenterPoint(point_one, point_two)
+ [6.65, 11.77],
+ utils.findCenterPoint(point_one, point_two)
);
});
@@ -135,8 +135,8 @@ describe('topology utils', function() {
// X = 15 + 7.5 + 13
// Y = 20 * 1.5 + 23
assert.deepEqual(
- [35.5, 53],
- utils.locateRelativePointOnCanvas(endpoint, offset, scale)
+ [35.5, 53],
+ utils.locateRelativePointOnCanvas(endpoint, offset, scale)
);
});
@@ -152,11 +152,11 @@ describe('topology utils', function() {
var css = utils.getVisibilityClasses(trueFlag);
var label = trueFlag + 'ed: ';
assert.equal(css[trueFlag], true,
- label + trueFlag + ' should be true');
+ label + trueFlag + ' should be true');
flags.forEach(function(flag) {
if (trueFlag !== flag) {
assert.equal(css[flag], false,
- label + flag + ' should be false');
+ label + flag + ' should be false');
}
});
}
diff --git a/jujugui/static/gui/src/test/test_utils.js b/jujugui/static/gui/src/test/test_utils.js
index a59c80e6db..09e2c4a755 100644
--- a/jujugui/static/gui/src/test/test_utils.js
+++ b/jujugui/static/gui/src/test/test_utils.js
@@ -23,11 +23,11 @@ with this program. If not, see .
var views;
before(function(done) {
YUI(GlobalConfig).use(
- 'juju-view-utils',
- function(Y) {
- views = Y.namespace('juju.views');
- done();
- });
+ 'juju-view-utils',
+ function(Y) {
+ views = Y.namespace('juju.views');
+ done();
+ });
});
it('generates the correct export file name', function() {
@@ -295,7 +295,7 @@ describe('utilities', function() {
it('returns the security upgrade Landscape URL', function() {
var url = utils.getLandscapeURL(environment, null, 'security');
var expected = makeURL(
- '+alert:security-upgrades/packages/list?filter=security');
+ '+alert:security-upgrades/packages/list?filter=security');
assert.strictEqual(url, expected);
});
@@ -308,14 +308,14 @@ describe('utilities', function() {
it('returns the service reboot Landscape URL', function() {
var url = utils.getLandscapeURL(environment, service, 'reboot');
var expected = makeURL(
- '+service:django/+alert:computer-reboot/info#power');
+ '+service:django/+alert:computer-reboot/info#power');
assert.strictEqual(url, expected);
});
it('returns the service security upgrade Landscape URL', function() {
var url = utils.getLandscapeURL(environment, service, 'security');
var expected = makeURL(
- '+service:django/+alert:security-upgrades/packages/list' +
+ '+service:django/+alert:security-upgrades/packages/list' +
'?filter=security');
assert.strictEqual(url, expected);
});
@@ -329,14 +329,14 @@ describe('utilities', function() {
it('returns the unit reboot Landscape URL', function() {
var url = utils.getLandscapeURL(environment, unit, 'reboot');
var expected = makeURL(
- '+unit:django-42/+alert:computer-reboot/info#power');
+ '+unit:django-42/+alert:computer-reboot/info#power');
assert.strictEqual(url, expected);
});
it('returns the unit security upgrade Landscape URL', function() {
var url = utils.getLandscapeURL(environment, unit, 'security');
var expected = makeURL(
- '+unit:django-42/+alert:security-upgrades/packages/list' +
+ '+unit:django-42/+alert:security-upgrades/packages/list' +
'?filter=security');
assert.strictEqual(url, expected);
});
@@ -382,16 +382,16 @@ describe('utilities', function() {
it('returns a qualified charmstoreURL icon location', function() {
var path = utils.getIconPath('~paulgear/precise/quassel-core-2');
assert.equal(
- path,
- 'http://4.3.2.1/v5/~paulgear/precise/quassel-core-2/icon.svg');
+ path,
+ 'http://4.3.2.1/v5/~paulgear/precise/quassel-core-2/icon.svg');
});
it('handles charmstoreURL with no trailing slash', function() {
window.juju_config = {charmstoreURL: 'http://4.3.2.1'};
var path = utils.getIconPath('~paulgear/precise/quassel-core-2');
assert.equal(
- path,
- 'http://4.3.2.1/v5/~paulgear/precise/quassel-core-2/icon.svg');
+ path,
+ 'http://4.3.2.1/v5/~paulgear/precise/quassel-core-2/icon.svg');
});
});
@@ -455,7 +455,7 @@ describe('utilities', function() {
var callback = sinon.stub();
var units = utils.addGhostAndEcsUnits(
- db, env, service, unitCount, callback);
+ db, env, service, unitCount, callback);
// Test the db.addUnits call.
assert.equal(db.addUnits.callCount, 2, 'db addUnits not called');
var addUnitsArgs = db.addUnits.args;
@@ -499,21 +499,21 @@ describe('utilities', function() {
}
it('creates machines, units; places units; updates unit lists',
- function() {
- testScaleUp('myService');
- }
+ function() {
+ testScaleUp('myService');
+ }
);
it('creates machines, units; places units; updates unit lists (no units)',
- function() {
- testScaleUp('no-units');
- }
+ function() {
+ testScaleUp('no-units');
+ }
);
it('creates machines, units; places units; updates unit lists for ghosts',
- function() {
- testScaleUp('myGhostService$');
- }
+ function() {
+ testScaleUp('myGhostService$');
+ }
);
it('properly removes the ghost units on env add_unit callback', function() {
@@ -590,9 +590,9 @@ describe('utilities', function() {
add: function(attrs) {
// The notification has the required attributes.
assert.equal(attrs.hasOwnProperty('title'), true,
- 'Does not have a title');
+ 'Does not have a title');
assert.equal(attrs.hasOwnProperty('message'), true,
- 'Does not have a message');
+ 'Does not have a message');
// The service name is mentioned in the error message.
assert.notEqual(attrs.message.indexOf(APPNAME, -1));
assert.equal(attrs.level, 'important');
@@ -608,7 +608,7 @@ describe('utilities', function() {
assert.isTrue(notificationAdded);
// Check that relations were removed.
assert.equal(db.relations.remove.calledOnce, true,
- 'Remove relations not called');
+ 'Remove relations not called');
});
});
@@ -785,39 +785,39 @@ describe('utilities', function() {
},
{
text: 'www.domain.com',
- expected: 'www.domain.com' // eslint-disable-line max-len
+ expected: 'www.domain.com' // eslint-disable-line max-len
},
{
text: 'thisisareallylongdomainnamewithunder62parts.co',
- expected: 'thisisareallylongdomainnamewithunder62parts.co' // eslint-disable-line max-len
+ expected: 'thisisareallylongdomainnamewithunder62parts.co' // eslint-disable-line max-len
},
{
text: 'node-1.www4.example.com.jp',
- expected: 'node-1.www4.example.com.jp' // eslint-disable-line max-len
+ expected: 'node-1.www4.example.com.jp' // eslint-disable-line max-len
},
{
text: 'http://domain.com',
- expected: 'http://domain.com' // eslint-disable-line max-len
+ expected: 'http://domain.com' // eslint-disable-line max-len
},
{
text: 'ftp://foo.1.example.com.uk',
- expected: 'ftp://foo.1.example.com.uk' // eslint-disable-line max-len
+ expected: 'ftp://foo.1.example.com.uk' // eslint-disable-line max-len
},
{
text: 'example.com/?foo=bar',
- expected: 'example.com/?foo=bar' // eslint-disable-line max-len
+ expected: 'example.com/?foo=bar' // eslint-disable-line max-len
},
{
text: 'example.com/foo/bar?baz=true&something=%20alsotrue',
- expected: 'example.com/foo/bar?baz=true&something=%20alsotrue' // eslint-disable-line max-len
+ expected: 'example.com/foo/bar?baz=true&something=%20alsotrue' // eslint-disable-line max-len
},
{
- text: 'http://example.com/index?foo=bar', // eslint-disable-line max-len
- expected: 'http://example.com/index?foo=bar<script>alert(\'xss\')</script>' // eslint-disable-line max-len
+ text: 'http://example.com/index?foo=bar', // eslint-disable-line max-len
+ expected: 'http://example.com/index?foo=bar<script>alert(\'xss\')</script>' // eslint-disable-line max-len
},
{
text: 'http://example.com/foo"bar',
- expected: 'http://example.com/foo"bar' // eslint-disable-line max-len
+ expected: 'http://example.com/foo"bar' // eslint-disable-line max-len
},
{
text: 'Hi there John.Bob',
@@ -1333,25 +1333,25 @@ describe('utilities', function() {
it('can return a parsed query string', function() {
assert.deepEqual(utils.parseQueryString(
'http://example.com?one=1&two=2'), {
- one: '1',
- two: '2'
- });
+ one: '1',
+ two: '2'
+ });
});
it('can handle being passed only the querystring', function() {
assert.deepEqual(utils.parseQueryString(
'?one=1&two=2'), {
- one: '1',
- two: '2'
- });
+ one: '1',
+ two: '2'
+ });
});
it('can handle being passed a querystring without a "?"', function() {
assert.deepEqual(utils.parseQueryString(
'one=1&two=2'), {
- one: '1',
- two: '2'
- });
+ one: '1',
+ two: '2'
+ });
});
it('can handle a URL with no querystring', function() {
@@ -1367,17 +1367,17 @@ describe('utilities', function() {
it('can handle a URL with multiple question marks', function() {
assert.deepEqual(utils.parseQueryString(
'http://example.com??one=1&two=2'), {
- one: '1',
- two: '2'
- });
+ one: '1',
+ two: '2'
+ });
});
it('can handle a URL with multiple querystrings', function() {
assert.deepEqual(utils.parseQueryString(
'http://example.com?one=1&two=2?one=1&two=2'), {
- one: ['1', '1'],
- two: ['2', '2']
- });
+ one: ['1', '1'],
+ two: ['2', '2']
+ });
});
it('does not return empty values', function() {
diff --git a/jujugui/static/gui/src/test/test_viewport_module.js b/jujugui/static/gui/src/test/test_viewport_module.js
index 46b10545b8..22e0b9811e 100644
--- a/jujugui/static/gui/src/test/test_viewport_module.js
+++ b/jujugui/static/gui/src/test/test_viewport_module.js
@@ -24,11 +24,11 @@ describe('views.ViewportModule (Topology module)', function() {
var modules = ['node', 'juju-views', 'juju-tests-utils',
'juju-topology-viewport'];
YUI(GlobalConfig).use(modules,
- function(Y) {
- views = Y.namespace('juju.views');
- testUtils = Y.namespace('juju-tests').utils;
- done();
- });
+ function(Y) {
+ views = Y.namespace('juju.views');
+ testUtils = Y.namespace('juju-tests').utils;
+ done();
+ });
});
it('aborts a resize if the canvas is not available', function() {
@@ -101,11 +101,11 @@ describe('views.ViewportModule.setAllTheDimensions', function() {
var modules = ['node', 'juju-views', 'juju-tests-utils',
'juju-topology-viewport'];
YUI(GlobalConfig).use(modules,
- function(Y) {
- views = Y.namespace('juju.views');
- testUtils = Y.namespace('juju-tests').utils;
- done();
- });
+ function(Y) {
+ views = Y.namespace('juju.views');
+ testUtils = Y.namespace('juju-tests').utils;
+ done();
+ });
});
beforeEach(function() {
diff --git a/jujugui/static/gui/src/test/test_web_handler.js b/jujugui/static/gui/src/test/test_web_handler.js
index 82e59b2301..7cda617737 100644
--- a/jujugui/static/gui/src/test/test_web_handler.js
+++ b/jujugui/static/gui/src/test/test_web_handler.js
@@ -42,7 +42,7 @@ with this program. If not, see .
setRequestHeader: sinon.stub(context, 'setRequestHeader'),
send: sinon.stub(context, 'send'),
removeEventListener: sinon.stub(
- context, 'removeEventListener')
+ context, 'removeEventListener')
};
});
@@ -98,8 +98,8 @@ with this program. If not, see .
var data = 'a zip file object';
// Make a POST request.
webHandler.sendPostRequest(
- path, headers, data, 'user', 'passwd', false,
- function() {return 'progress';}, function() {return 'completed';});
+ path, headers, data, 'user', 'passwd', false,
+ function() {return 'progress';}, function() {return 'completed';});
// Ensure the xhr instance has been used properly.
assert.strictEqual(mockXhr.addEventListener.callCount, 3);
// Two events listeners are added, one for request's progress and one
@@ -128,7 +128,7 @@ with this program. If not, see .
var progressCallback = sinon.stub();
// Make a POST request.
webHandler.sendPostRequest(
- '/path/', {}, 'data', 'user', 'passwd', false, progressCallback);
+ '/path/', {}, 'data', 'user', 'passwd', false, progressCallback);
assertProgressHandled(progressCallback);
});
@@ -136,8 +136,8 @@ with this program. If not, see .
var completedCallback = sinon.stub();
// Make a POST request.
webHandler.sendPostRequest(
- '/path/', {}, 'data', 'user', 'passwd', false,
- function() {}, completedCallback);
+ '/path/', {}, 'data', 'user', 'passwd', false,
+ function() {}, completedCallback);
assertCompletedHandled(completedCallback);
});
@@ -151,8 +151,8 @@ with this program. If not, see .
var data = 'a zip file object';
// Make a POST request.
webHandler.sendPutRequest(
- path, headers, data, 'user', 'passwd', false,
- function() {return 'progress';}, function() {return 'completed';});
+ path, headers, data, 'user', 'passwd', false,
+ function() {return 'progress';}, function() {return 'completed';});
// Ensure the xhr instance has been used properly.
assert.strictEqual(mockXhr.addEventListener.callCount, 3);
// Two events listeners are added, one for request's progress and one
@@ -181,7 +181,7 @@ with this program. If not, see .
var progressCallback = sinon.stub();
// Make a POST request.
webHandler.sendPutRequest(
- '/path/', {}, 'data', 'user', 'passwd', false, progressCallback);
+ '/path/', {}, 'data', 'user', 'passwd', false, progressCallback);
assertProgressHandled(progressCallback);
});
@@ -189,8 +189,8 @@ with this program. If not, see .
var completedCallback = sinon.stub();
// Make a POST request.
webHandler.sendPutRequest(
- '/path/', {}, 'data', 'user', 'passwd', false,
- function() {}, completedCallback);
+ '/path/', {}, 'data', 'user', 'passwd', false,
+ function() {}, completedCallback);
assertCompletedHandled(completedCallback);
});
@@ -202,8 +202,8 @@ with this program. If not, see .
var path = '/juju-core/charms?url=local:trusty/django-42';
// Make a GET request.
webHandler.sendGetRequest(
- path, null, 'user', 'passwd', false,
- function() {return 'progress';}, function() {return 'completed';});
+ path, null, 'user', 'passwd', false,
+ function() {return 'progress';}, function() {return 'completed';});
// Ensure the xhr instance has been used properly.
assert.strictEqual(mockXhr.addEventListener.callCount, 3);
// Two events listeners are added, one for request's progress and one
@@ -231,7 +231,7 @@ with this program. If not, see .
var progressCallback = sinon.stub();
// Make a GET request.
webHandler.sendGetRequest(
- '/path/', {}, 'user', 'passwd', false, progressCallback);
+ '/path/', {}, 'user', 'passwd', false, progressCallback);
assertProgressHandled(progressCallback);
});
@@ -239,8 +239,8 @@ with this program. If not, see .
var completedCallback = sinon.stub();
// Make a GET request.
webHandler.sendGetRequest(
- '/path/', {}, 'user', 'passwd', false,
- function() {}, completedCallback);
+ '/path/', {}, 'user', 'passwd', false,
+ function() {}, completedCallback);
assertCompletedHandled(completedCallback);
});
@@ -254,8 +254,8 @@ with this program. If not, see .
var data = 'a zip file object';
// Make a PATCH request.
webHandler.sendPatchRequest(
- path, headers, data, 'user', 'passwd', false,
- function() {return 'progress';}, function() {return 'completed';});
+ path, headers, data, 'user', 'passwd', false,
+ function() {return 'progress';}, function() {return 'completed';});
// Ensure the xhr instance has been used properly.
assert.strictEqual(mockXhr.addEventListener.callCount, 3);
// Two events listeners are added, one for request's progress and one
@@ -284,7 +284,7 @@ with this program. If not, see .
var progressCallback = sinon.stub();
// Make a PATCH request.
webHandler.sendPatchRequest(
- '/path/', {}, 'data', 'user', 'passwd', false, progressCallback);
+ '/path/', {}, 'data', 'user', 'passwd', false, progressCallback);
assertProgressHandled(progressCallback);
});
@@ -292,8 +292,8 @@ with this program. If not, see .
var completedCallback = sinon.stub();
// Make a PATCH request.
webHandler.sendPatchRequest(
- '/path/', {}, 'data', 'user', 'passwd', false,
- function() {}, completedCallback);
+ '/path/', {}, 'data', 'user', 'passwd', false,
+ function() {}, completedCallback);
assertCompletedHandled(completedCallback);
});
});
diff --git a/jujugui/static/gui/src/test/utils.js b/jujugui/static/gui/src/test/utils.js
index d445291b52..f8a40cd3bd 100644
--- a/jujugui/static/gui/src/test/utils.js
+++ b/jujugui/static/gui/src/test/utils.js
@@ -27,13 +27,13 @@ YUI(GlobalConfig).add('juju-tests-utils', function(Y) {
// You must pass a context and it must be a valid object.
if (arguments.length < 1) {
throw (
- 'makeContainer requires a context in order to track containers' +
+ 'makeContainer requires a context in order to track containers' +
'to cleanup.');
}
if (typeof ctx !== 'object') {
throw (
- 'makeContainer requires a context in order to track containers' +
+ 'makeContainer requires a context in order to track containers' +
'to cleanup.');
}
From 75cffe496f29a65ec12458d37621fb08bb278e12 Mon Sep 17 00:00:00 2001
From: Jeff Pihach
Date: Thu, 15 Jun 2017 14:10:32 -0500
Subject: [PATCH 3/4] Eslint caught some more lint errors.
---
Makefile | 2 +-
.../app/components/inspector/config/test-config.js | 4 ++--
jujugui/static/gui/src/app/views/landscape.js | 12 ++++++------
jujugui/static/gui/src/app/views/utils.js | 7 ++++---
jujugui/static/gui/src/test/test_environment_view.js | 4 ++--
package.json | 2 +-
6 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index fad59d4c0d..788f266ca6 100644
--- a/Makefile
+++ b/Makefile
@@ -294,7 +294,7 @@ lint-python: $(FLAKE8)
.PHONY: lint-js
lint-js: $(NODE_MODULES)
- $(NODE_MODULES)/.bin/eslint --cache --rulesdir eslint-rules/ $(GUISRC)
+ $(NODE_MODULES)/.bin/eslint --rulesdir eslint-rules/ $(GUISRC)
.PHONY: lint-css
lint-css: $(NODE_MODULES)
diff --git a/jujugui/static/gui/src/app/components/inspector/config/test-config.js b/jujugui/static/gui/src/app/components/inspector/config/test-config.js
index 1f30bb0d0a..ceb7146034 100644
--- a/jujugui/static/gui/src/app/components/inspector/config/test-config.js
+++ b/jujugui/static/gui/src/app/components/inspector/config/test-config.js
@@ -1009,8 +1009,8 @@ describe('Configuration', function() {
onChange={instance._handleOnChange}
option={{
key: 'Application name',
- description: 'Specify a custom application name. The application' +
- ' name cannot be changed once it has been deployed.'
+ description: 'Specify a custom application name. The application'
+ + ' name cannot be changed once it has been deployed.'
}}
config="abc123$" />
{undefined}
diff --git a/jujugui/static/gui/src/app/views/landscape.js b/jujugui/static/gui/src/app/views/landscape.js
index 70859302e0..cea201f538 100644
--- a/jujugui/static/gui/src/app/views/landscape.js
+++ b/jujugui/static/gui/src/app/views/landscape.js
@@ -90,12 +90,12 @@ YUI.add('juju-landscape', function(Y) {
/*jslint bitwise: true*/
// The above lint is needed to allow a |= expression
// to pass the linter.
- serviceFlagged |= service[annotationName] = service.get('units').some(
- unit => {
- var annotations = unit.annotations;
- return Boolean(
- annotations && annotations[annotationName]);
- });
+ serviceFlagged |= service[annotationName] =
+ service.get('units').some(unit => {
+ var annotations = unit.annotations;
+ return Boolean(
+ annotations && annotations[annotationName]);
+ });
});
env[annotationName] = Boolean(serviceFlagged);
});
diff --git a/jujugui/static/gui/src/app/views/utils.js b/jujugui/static/gui/src/app/views/utils.js
index 523b40f13c..c5133cdf0b 100644
--- a/jujugui/static/gui/src/app/views/utils.js
+++ b/jujugui/static/gui/src/app/views/utils.js
@@ -1709,8 +1709,8 @@ YUI.add('juju-view-utils', function(Y) {
general or setting up
- GCE credentials.
+ title="Help using the Google Compute Engine public cloud">
+ setting up GCE credentials.
)
},
@@ -1740,7 +1740,8 @@ YUI.add('juju-view-utils', function(Y) {
href="https://jujucharms.com/docs/stable/credentials"
target="_blank" title="Cloud credentials help">credentials in
general or setting up
Azure credentials.
diff --git a/jujugui/static/gui/src/test/test_environment_view.js b/jujugui/static/gui/src/test/test_environment_view.js
index 3dc1de5d79..dbe125cd76 100644
--- a/jujugui/static/gui/src/test/test_environment_view.js
+++ b/jujugui/static/gui/src/test/test_environment_view.js
@@ -991,8 +991,8 @@ with this program. If not, see .
var svg = document.querySelector('.the-canvas');
parseInt(svg.querySelector('g').getAttribute('height'), 10)
- .should.equal(
- parseInt(window.getComputedStyle(svg).getPropertyValue('height'), 10));
+ .should.equal(parseInt(
+ window.getComputedStyle(svg).getPropertyValue('height'), 10));
parseInt(svg.querySelector('g').getAttribute('width'), 10)
.should.equal(
parseInt(window.getComputedStyle(svg).getPropertyValue('width'), 10));
diff --git a/package.json b/package.json
index f6a4ec1258..9e721d3f93 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"chai": "^3.5.0",
"diff": "^3.2.0",
"eslint": "^4.0.0",
- "eslint-plugin-react": "^7.1.0",
+ "eslint-plugin-react": "^6.10.3",
"expect.js": "^0.3.1",
"jasmine-core": "^2.4.1",
"karma": "^1.5.0",
From ed2e846997f57914362f6d6234f1af1b5ccc66cf Mon Sep 17 00:00:00 2001
From: Jeff Pihach
Date: Thu, 15 Jun 2017 14:33:59 -0500
Subject: [PATCH 4/4] Remove invalid entry in npm-shrinkwrap
---
npm-shrinkwrap.json | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
index 47aa5d3dd0..59e6bb58cb 100644
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -1569,20 +1569,6 @@
}
}
},
- "eslint-plugin-react": {
- "version": "7.1.0",
- "from": "eslint-plugin-react@7.1.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.1.0.tgz",
- "dev": true,
- "dependencies": {
- "doctrine": {
- "version": "2.0.0",
- "from": "doctrine@>=2.0.0 <3.0.0",
- "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz",
- "dev": true
- }
- }
- },
"eslint-scope": {
"version": "3.7.1",
"from": "eslint-scope@>=3.7.1 <4.0.0",