Merge lp:~rharding/juju-gui/qa-ant-remove-bottom into lp:juju-gui/experimental

Proposed by Richard Harding
Status: Merged
Merged at revision: 1147
Proposed branch: lp:~rharding/juju-gui/qa-ant-remove-bottom
Merge into: lp:juju-gui/experimental
Diff against target: 482 lines (+1/-300)
14 files modified
app/app.js (+1/-10)
app/modules-debug.js (+0/-4)
app/templates/landscape-controls.partial (+0/-17)
app/templates/overview.handlebars (+0/-3)
app/views/environment.js (+0/-2)
app/views/topology/bundle.js (+0/-2)
app/views/topology/landscape.js (+0/-73)
app/views/topology/service.js (+0/-50)
app/views/topology/topology.js (+0/-1)
app/views/utils.js (+0/-32)
lib/views/browser/main.less (+0/-4)
lib/views/browser/vars.less (+0/-1)
test/test_environment_view.js (+0/-39)
test/test_landscape.js (+0/-62)
To merge this branch: bzr merge lp:~rharding/juju-gui/qa-ant-remove-bottom
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+191846@code.launchpad.net

Description of the change

Removal of the bottom landscape bar

You will see the bottom bar has been removed from the dom with all connected
commands. I did not move the controls as there was no direction too. Simply
deleted them. Removed the element of the stylesheet that set the Charm
Browser's bottom value and removed the SASS var with the height of the bottom
bar.

https://codereview.appspot.com/14960044/

To post a comment you must log in.
Revision history for this message
Richard Harding (rharding) wrote :

Reviewers: mp+191846_code.launchpad.net,

Message:
Please take a look.

Description:
Removal of the bottom landscape bar

You will see the bottom bar has been removed from the dom with all
connected
commands. I did not move the controls as there was no direction too.
Simply
deleted them. Removed the element of the stylesheet that set the Charm
Browser's bottom value and removed the SASS var with the height of the
bottom
bar.

https://code.launchpad.net/~rharding/juju-gui/qa-ant-remove-bottom/+merge/191846

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/14960044/

Affected files (+3, -300 lines):
   A [revision details]
   M app/app.js
   M app/modules-debug.js
   D app/templates/landscape-controls.partial
   M app/templates/overview.handlebars
   M app/views/environment.js
   M app/views/topology/bundle.js
   D app/views/topology/landscape.js
   M app/views/topology/service.js
   M app/views/topology/topology.js
   M app/views/utils.js
   M lib/views/browser/main.less
   M lib/views/browser/vars.less
   M test/test_environment_view.js
   M test/test_landscape.js

Revision history for this message
Jeff Pihach (hatch) wrote :

The removal looks good thanks for all the work! Before this lands I
would like to have a discussion as to what the long term goal of this
removal and the landscape integration is to see if we should save some
of this code or remove even more.

QA NOT OK
When viewing the browser in 'Browse' mode there is a white bar across
the bottom of the page.

There is a large white gap when viewing search results in 'Browse' mode:

http://localhost:8888/fullscreen/search/?categories=app-servers&text=

Without the footer the url/status indicator in chrome covers part of the
token when hovering over the tokens.

https://codereview.appspot.com/14960044/diff/1/app/views/topology/service.js
File app/views/topology/service.js (left):

https://codereview.appspot.com/14960044/diff/1/app/views/topology/service.js#oldcode183
app/views/topology/service.js:183:
'/juju-ui/assets/images/landscape_restart_round.png';
These assets should probably be removed from the file system.

https://codereview.appspot.com/14960044/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/app.js'
2--- app/app.js 2013-10-17 15:14:27 +0000
3+++ app/app.js 2013-10-18 17:31:13 +0000
4@@ -388,10 +388,6 @@
5 // Create a client side database to store state.
6 this.db = new models.Database();
7
8- // Optional Landscape integration helper.
9- this.landscape = new views.Landscape();
10- this.landscape.set('db', this.db);
11-
12 // Set up a new modelController instance.
13 this.modelController = new juju.ModelController({
14 db: this.db,
15@@ -673,7 +669,7 @@
16 }
17 Y.each(
18 [this.env, this.db, this.notifications,
19- this.landscape, this.endpointsController],
20+ this.endpointsController],
21 function(o) {
22 if (o && o.destroy) {
23 o.detachAll();
24@@ -728,9 +724,6 @@
25 _dbChangedHandler: function() {
26 var active = this.get('activeView');
27
28- // Update Landscape annotations.
29- this.landscape.update();
30-
31 // Regardless of which view we are rendering,
32 // update the env view on db change.
33 if (this.views.environment.instance) {
34@@ -1095,7 +1088,6 @@
35 var options = {
36 getModelURL: Y.bind(this.getModelURL, this),
37 nsRouter: this.nsRouter,
38- landscape: this.landscape,
39 endpointsController: this.endpointsController,
40 useDragDropImport: this.get('sandbox'),
41 db: this.db,
42@@ -1360,7 +1352,6 @@
43 'juju-view-environment',
44 'juju-view-login',
45 'juju-view-onboarding',
46- 'juju-landscape',
47 'juju-websocket-logging',
48 'io',
49 'json-parse',
50
51=== modified file 'app/modules-debug.js'
52--- app/modules-debug.js 2013-10-10 11:44:44 +0000
53+++ app/modules-debug.js 2013-10-18 17:31:13 +0000
54@@ -210,10 +210,6 @@
55 fullpath: '/juju-ui/views/topology/service.js'
56 },
57
58- 'juju-topology-landscape': {
59- fullpath: '/juju-ui/views/topology/landscape.js'
60- },
61-
62 'juju-topology-importexport': {
63 fullpath: '/juju-ui/views/topology/importexport.js'
64 },
65
66=== removed file 'app/templates/landscape-controls.partial'
67--- app/templates/landscape-controls.partial 2013-03-26 21:17:14 +0000
68+++ app/templates/landscape-controls.partial 1970-01-01 00:00:00 +0000
69@@ -1,17 +0,0 @@
70-<div class="landscape-controls">
71- <div class="logo-tab">
72- <a><i class="sprite landscape_logo"></i></a>
73- </div>
74- <div class="machine-control control">
75- <i class="sprite dotted_divider icon-divider"></i>
76- <a><i class="sprite landscape-icon landscape_machine"></i></a>
77- </div>
78- <div class="updates-control control">
79- <i class="sprite dotted_divider icon-divider"></i>
80- <a><i class="sprite landscape-icon landscape_updates"></i></a>
81- </div>
82- <div class="restart-control control">
83- <i class="sprite dotted_divider icon-divider"></i>
84- <a><i class="sprite landscape-icon landscape_restart"></i></a>
85- </div>
86-</div>
87
88=== modified file 'app/templates/overview.handlebars'
89--- app/templates/overview.handlebars 2013-09-19 16:27:07 +0000
90+++ app/templates/overview.handlebars 2013-10-18 17:31:13 +0000
91@@ -28,9 +28,6 @@
92 </div>
93 {{> right-sidebar }}
94 </div>
95- <div id="overview-tasks" class="bottom-navbar">
96- {{> landscape-controls }}
97- </div>
98 <div id="rmrelation-modal-panel"></div>
99 <div id="rmsubrelation-modal-panel"></div>
100 </div>
101
102=== modified file 'app/views/environment.js'
103--- app/views/environment.js 2013-09-30 16:43:28 +0000
104+++ app/views/environment.js 2013-10-18 17:31:13 +0000
105@@ -350,7 +350,6 @@
106 getInspector: Y.bind(this.getInspector, this),
107 setInspector: Y.bind(this.setInspector, this),
108 createServiceInspector: Y.bind(this.createServiceInspector, this),
109- landscape: this.get('landscape'),
110 getModelURL: this.get('getModelURL'),
111 container: container,
112 endpointsController: this.get('endpointsController'),
113@@ -360,7 +359,6 @@
114 topo.addModule(views.PanZoomModule);
115 topo.addModule(views.ViewportModule);
116 topo.addModule(views.RelationModule);
117- topo.addModule(views.LandscapeModule);
118
119 topo.addTarget(this);
120 this.topo = topo;
121
122=== modified file 'app/views/topology/bundle.js'
123--- app/views/topology/bundle.js 2013-10-10 00:38:45 +0000
124+++ app/views/topology/bundle.js 2013-10-18 17:31:13 +0000
125@@ -154,8 +154,6 @@
126 if (node.empty()) {
127 return;
128 }
129- var topo = this.get('component'),
130- landscape = topo.get('landscape');
131
132 // Apply Position Annotations
133 // This is done after the services_boxes
134
135=== removed file 'app/views/topology/landscape.js'
136--- app/views/topology/landscape.js 2013-06-05 16:58:11 +0000
137+++ app/views/topology/landscape.js 1970-01-01 00:00:00 +0000
138@@ -1,73 +0,0 @@
139-/*
140-This file is part of the Juju GUI, which lets users view and manage Juju
141-environments within a graphical interface (https://launchpad.net/juju-gui).
142-Copyright (C) 2012-2013 Canonical Ltd.
143-
144-This program is free software: you can redistribute it and/or modify it under
145-the terms of the GNU Affero General Public License version 3, as published by
146-the Free Software Foundation.
147-
148-This program is distributed in the hope that it will be useful, but WITHOUT
149-ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
150-SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
151-General Public License for more details.
152-
153-You should have received a copy of the GNU Affero General Public License along
154-with this program. If not, see <http://www.gnu.org/licenses/>.
155-*/
156-
157-'use strict';
158-
159-/**
160- * Provide the LandscapeModule class.
161- *
162- * @module topology
163- * @submodule topology.landscape
164- */
165-
166-YUI.add('juju-topology-landscape', function(Y) {
167- var views = Y.namespace('juju.views'),
168- models = Y.namespace('juju.models'),
169- d3ns = Y.namespace('d3');
170-
171- /**
172- * Handle Landscape integration within a Topology.
173- *
174- * @class LandscapeModule
175- */
176- var LandscapeModule = Y.Base.create('LandscapeModule', d3ns.Module, [], {
177- /**
178- * Update Landscape links as needed.
179- *
180- * @method update
181- * @return {undefined} Nothing.
182- */
183- update: function() {
184- var topo = this.get('component');
185- var db = topo.get('db');
186- var env = db.environment;
187- var container = this.get('container');
188-
189- views.utils.updateLandscapeBottomBar(topo.get('landscape'), env, env,
190- container);
191- }
192- }, {
193- ATTRS: {
194- /**
195- @property {d3ns.Component} component
196- */
197- component: {}
198- }
199-
200- });
201- views.LandscapeModule = LandscapeModule;
202-}, '0.1.0', {
203- requires: [
204- 'node',
205- 'event',
206- 'd3-components',
207- 'juju-models',
208- 'juju-env',
209- 'juju-view-utils'
210- ]
211-});
212
213=== modified file 'app/views/topology/service.js'
214--- app/views/topology/service.js 2013-10-17 17:01:32 +0000
215+++ app/views/topology/service.js 2013-10-18 17:31:13 +0000
216@@ -71,7 +71,6 @@
217 }
218 var self = this,
219 topo = this.get('component'),
220- landscape = topo.get('landscape'),
221 service_scale = this.service_scale,
222 service_scale_width = this.service_scale_width,
223 service_scale_height = this.service_scale_height;
224@@ -169,55 +168,6 @@
225 'x': 64,
226 'y': 47 * 0.8});
227
228- // Landscape badge
229- if (landscape) {
230- node.each(function(d) {
231- var landscapeAsset;
232- var securityBadge = landscape.getLandscapeBadge(
233- d.model, 'security', 'round');
234- var rebootBadge = landscape.getLandscapeBadge(
235- d.model, 'reboot', 'round');
236-
237- if (securityBadge && rebootBadge) {
238- landscapeAsset =
239- '/juju-ui/assets/images/landscape_restart_round.png';
240- } else if (securityBadge) {
241- landscapeAsset =
242- '/juju-ui/assets/images/landscape_security_round.png';
243- } else if (rebootBadge) {
244- landscapeAsset =
245- '/juju-ui/assets/images/landscape_restart_round.png';
246- }
247- if (landscapeAsset === undefined) {
248- // Remove any existing badge.
249- d3.select(this).select('.landscape-badge').remove();
250- } else {
251- var existing = Y.one(this).one('.landscape-badge'),
252- curr_href, target;
253-
254- if (!existing) {
255- existing = d3.select(this).append('image');
256- existing.attr({
257- 'class': 'landscape-badge',
258- 'width': 32,
259- 'height': 32
260- });
261- }
262- existing = d3.select(this).select('.landscape-badge');
263- existing.attr({
264- 'x': 13,
265- 'y': 79
266- });
267-
268- // Only set 'xlink:href' if not already set to the new value,
269- // thus avoiding redundant requests to the server. #1182135
270- curr_href = existing.attr('xlink:href');
271- if (curr_href !== landscapeAsset) {
272- existing.attr({'xlink:href': landscapeAsset});
273- }
274- }
275- });
276- }
277 // The following are sizes in pixels of the SVG assets used to
278 // render a service, and are used to in calculating the vertical
279 // positioning of text down along the service block.
280
281=== modified file 'app/views/topology/topology.js'
282--- app/views/topology/topology.js 2013-10-15 22:51:35 +0000
283+++ app/views/topology/topology.js 2013-10-18 17:31:13 +0000
284@@ -297,7 +297,6 @@
285 'juju-topology-relation',
286 'juju-topology-panzoom',
287 'juju-topology-viewport',
288- 'juju-topology-landscape',
289 'juju-topology-importexport',
290 'juju-topology-utils'
291 ]
292
293=== modified file 'app/views/utils.js'
294--- app/views/utils.js 2013-10-15 19:33:04 +0000
295+++ app/views/utils.js 2013-10-18 17:31:13 +0000
296@@ -398,38 +398,6 @@
297 });
298 };
299
300- utils.updateLandscapeBottomBar = function(landscape, env, model, container) {
301- // Landscape annotations are stored in a unit's annotations, but just on
302- // the object in the case of services/environment.
303- var annotations = model.annotations ? model.annotations : model;
304- var envAnnotations = env.get ? env.get('annotations') : env;
305- var controls = container.one('.landscape-controls').hide();
306- var machine = controls.one('.machine-control').hide();
307- var updates = controls.one('.updates-control').hide();
308- var restart = controls.one('.restart-control').hide();
309-
310- if (envAnnotations['landscape-url']) {
311- controls.show();
312- var baseLandscapeURL = landscape.getLandscapeURL(model);
313- if (baseLandscapeURL) {
314- machine.show();
315- machine.one('a').setAttribute('href', baseLandscapeURL);
316-
317- if (annotations['landscape-security-upgrades']) {
318- updates.show();
319- updates.one('a').setAttribute('href',
320- landscape.getLandscapeURL(model, 'security'));
321- }
322-
323- if (annotations['landscape-needs-reboot']) {
324- restart.show();
325- restart.one('a').setAttribute('href',
326- landscape.getLandscapeURL(model, 'reboot'));
327- }
328- }
329- }
330- };
331-
332 function _addAlertMessage(container, alertClass, message) {
333 var div = container.one('#message-area');
334
335
336=== modified file 'lib/views/browser/main.less'
337--- lib/views/browser/main.less 2013-09-24 21:10:50 +0000
338+++ lib/views/browser/main.less 2013-10-18 17:31:13 +0000
339@@ -42,10 +42,6 @@
340 background-color: #fff;
341 background-image: none;
342 }
343- .bws-view-data,
344- #bws-sidebar {
345- bottom: @canvas-footer-nav-height;
346- }
347 #bws-fullscreen,
348 #bws-sidebar .bws-content {
349 overflow-x: hidden;
350
351=== modified file 'lib/views/browser/vars.less'
352--- lib/views/browser/vars.less 2013-08-13 00:35:01 +0000
353+++ lib/views/browser/vars.less 2013-10-18 17:31:13 +0000
354@@ -15,6 +15,5 @@
355 @bws-corner: @border-radius;
356 @bws-groove-dark: #c9cbc8;
357 @bws-groove-light: #f4f2f3;
358-@canvas-footer-nav-height: 50px;
359 @tabview-right-padding: 70px;
360 @tabview-left-padding: 80px;
361\ No newline at end of file
362
363=== modified file 'test/test_environment_view.js'
364--- test/test_environment_view.js 2013-10-17 16:54:10 +0000
365+++ test/test_environment_view.js 2013-10-18 17:31:13 +0000
366@@ -644,45 +644,6 @@
367 view.update();
368 });
369
370- it('must be able to use Landscape annotations', function() {
371- var landscape = new views.Landscape();
372- var wordpress = db.services.getById('wordpress');
373- landscape.set('db', db);
374- // Mock out enough of the annotations to
375- // allow a full render with landscape data.
376- db.environment.set('annotations', {
377- 'landscape-url': 'http://host',
378- 'landscape-computers': '/foo',
379- 'landscape-reboot-alert-url': '+reboot'
380- });
381- db.environment['landscape-needs-reboot'] = true;
382- db.services.each(function(s) {
383- s.set('annotations', {
384- 'landscape-computers': '/service'
385- });
386- });
387- wordpress['landscape-needs-reboot'] = true;
388- wordpress['landscape-security-upgrades'] = false;
389-
390- var view = new views.environment({
391- container: container,
392- db: db,
393- env: env,
394- landscape: landscape,
395- store: fakeStore
396- }).render();
397-
398- var rebootItem = container.one('.landscape-controls .restart-control');
399- rebootItem.one('a').get('href').should.equal('http://host/foo+reboot');
400-
401- // Test that we can match a single badge rendered on the wordpress
402- // service.
403- var wpNode = view.topo.modules.ServiceModule.getServiceNode('wordpress');
404- var hasBadge = d3.select(wpNode).select('.landscape-badge');
405- hasBadge[0][0].should.not.equal(null);
406- });
407-
408-
409 it('must be able to render subordinate relation indicators',
410 function() {
411 new views.environment({
412
413=== modified file 'test/test_landscape.js'
414--- test/test_landscape.js 2013-09-26 22:03:11 +0000
415+++ test/test_landscape.js 2013-10-18 17:31:13 +0000
416@@ -147,66 +147,4 @@
417 mysql['landscape-security-upgrades'].should.equal(false);
418 });
419
420- it('should build the bottom-bar properly', function() {
421- var env = db.environment;
422- var mysql = db.services.getById('mysql');
423- var unit = mysql.get('units').item(0);
424- var partial = Y.Handlebars.partials['landscape-controls'];
425- Y.one('body').append('<div id="test-node"></div>');
426- var node = Y.one('#test-node');
427- node.append(partial());
428-
429- views.utils.updateLandscapeBottomBar(landscape, env, env, node,
430- 'environment');
431-
432- // We should have the logo.
433- node.one('.logo-tab i').hasClass('landscape_logo').should.equal(true);
434- // We should have the correct URL for the machines.
435- node.one('.machine-control a').get('href').should
436- .equal('http://landscape.example.com/computers/criteria/environment:test/');
437- // We should have visible controls.
438- node.one('.updates-control').getStyle('display').should.equal('block');
439- node.one('.restart-control').getStyle('display').should.equal('block');
440-
441- views.utils.updateLandscapeBottomBar(landscape, env, mysql, node,
442- 'service');
443-
444- // We should have the correct URL for the machines.
445- node.one('.machine-control a').get('href').should.equal('http://' +
446- 'landscape.example.com/computers/criteria/environment:test+service:mysql/');
447- // We should have visible restart but not update controls.
448- node.one('.updates-control').getStyle('display').should.equal('none');
449- node.one('.restart-control').getStyle('display').should.equal('block');
450-
451- // We handle missing annotations on a service.
452- mysql.set('annotations', {});
453- landscape.update();
454- views.utils.updateLandscapeBottomBar(landscape, env, mysql, node,
455- 'service');
456- node.one('.machine-control').getStyle('display').should.equal('none');
457-
458- // We handle normal unit annotations.
459- unit.annotations = {'landscape-computer': '+unit:mysql-0'};
460- landscape.update();
461-
462- views.utils.updateLandscapeBottomBar(landscape, env, unit, node,
463- 'unit');
464-
465- // We should have the correct URL for the machines.
466- node.one('.machine-control a').get('href').should.equal('http://' +
467- 'landscape.example.com/computers/criteria/environment:test+unit:mysql-0/');
468- // We should have no visible controls.
469- node.one('.updates-control').getStyle('display').should.equal('none');
470- node.one('.restart-control').getStyle('display').should.equal('none');
471-
472- // We handle completely missing annotations on a unit.
473- delete unit.annotations;
474- landscape.update();
475- views.utils.updateLandscapeBottomBar(landscape, env, unit, node,
476- 'unit');
477- node.one('.machine-control').getStyle('display').should.equal('none');
478-
479- node.remove();
480- });
481-
482 });

Subscribers

People subscribed via source and target branches