Merge lp:~makyo/juju-gui/add-rel-improvements into lp:juju-gui/experimental

Proposed by Madison Scott-Clary
Status: Merged
Merged at revision: 233
Proposed branch: lp:~makyo/juju-gui/add-rel-improvements
Merge into: lp:juju-gui/experimental
Diff against target: 183 lines (+55/-37)
2 files modified
app/views/environment.js (+52/-37)
test/test_environment_view.js (+3/-0)
To merge this branch: bzr merge lp:~makyo/juju-gui/add-rel-improvements
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+131542@code.launchpad.net

Description of the change

Add-relation improvements

UX improvements per Jovan: draglines should start with the long-click as an indicator that the user will be dragging a line; draglines should be on top of all services/lines, as they are currently the most important thing the user is working with; and draglines should be used when adding a relation from the service menu as well, showing that a relation will be created.

https://codereview.appspot.com/6786050/

To post a comment you must log in.
Revision history for this message
Madison Scott-Clary (makyo) wrote :
Download full text (5.2 KiB)

Reviewers: mp+131542_code.launchpad.net,

Message:
Please take a look.

Description:
Add-relation improvements

UX improvements per Jovan: draglines should start with the long-click as
an indicator that the user will be dragging a line; draglines should be
on top of all services/lines, as they are currently the most important
thing the user is working with; and draglines should be used when adding
a relation from the service menu as well, showing that a relation will
be created.

https://code.launchpad.net/~makyo/juju-gui/add-rel-improvements/+merge/131542

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M app/views/environment.js
   M test/test_environment_view.js

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: test/test_environment_view.js
=== modified file 'test/test_environment_view.js'
--- test/test_environment_view.js 2012-10-20 18:16:19 +0000
+++ test/test_environment_view.js 2012-10-26 07:54:00 +0000
@@ -339,6 +339,9 @@
           container.all('.selectable-service')
                 .size()
                 .should.equal(2);
+ container.all('.dragline')
+ .size()
+ .should.equal(1);
           service.next().simulate('click');
           container.all('.selectable-service').size()
              .should.equal(0);

Index: app/views/environment.js
=== modified file 'app/views/environment.js'
--- app/views/environment.js 2012-10-26 06:35:16 +0000
+++ app/views/environment.js 2012-10-26 07:48:26 +0000
@@ -33,6 +33,8 @@
                var box = this.get('active_service'),
                    service = this.serviceForBox(box),
                    context = this.get('active_context');
+ this.addRelationDragStart.call(this, box, context);
+ this.clickAddRelation = true;
                this.service_click_actions
                          .toggleControlPanel(box, this, context);
                this.service_click_actions
@@ -81,6 +83,12 @@
                if (!d.containsPoint(mouse_coords, self.zoom)) {
                  return;
                }
+
+ // Do not fire if we're on the same service.
+ if (d === self.get('addRelationStart_service')) {
+ return;
+ }
+
                self.set('potential_drop_point_service', d);
                self.set('potential_drop_point_rect', rect);
                self.addSVGClass(rect, 'hover');
@@ -162,6 +170,17 @@

container.all('.environment-menu.active').removeClass('active');
                self.service_click_actions.toggleControlPanel(null, self);
                self.cancelRelationBuild();
+ },
+ mousemove: function(d, self) {
+ // If we're clicking to add a relation, make sure a dragline
+ // follows the mouse cursor.
+ ...

Read more...

208. By Madison Scott-Clary

Add-relation improvements

209. By Madison Scott-Clary

Add-relation improvements

210. By Madison Scott-Clary

Add-relation improvements

Revision history for this message
Madison Scott-Clary (makyo) wrote :
Revision history for this message
Gary Poster (gary) wrote :

Hi Matt. This looks like it will be a step in a good direction. I just went for a cruise around the UX for a second before I looked at the code, and I saw a few things that you might want to address, or at least run past Jovan, before a more thorough review.

 - the two experiences of starting from long-click and starting from the service menu are different in ways that surprise me, and in at least one case seems like at error. In general I prefer the long-click behavior.
   * lines started from the service menu can go crazy when you hover over things that are not a target service. For example, try hovering over a relationship name. For me, the line then goes from the service start point to [0, 0]. I see other similar issues that I won't clarify now, but if you can't dupe I'll be happy to provide more details and screenshots. (This does not happen with long-click.)
   * lines started from the service menu cannot go over the service, unlike the change you made for long-click. I think they ought to be the same.

Also, unrelatedly but concerningly, I discovered bug 1072433. That looks pretty critical, but it is in the trunk. I put that in the kanban board.

I'm going to stop the review for now until I hear back from you on how you want to handle my UX observations.

Thanks,

Gary

Revision history for this message
Madison Scott-Clary (makyo) wrote :

On 10/28/2012 08:53 PM, Gary Poster wrote:
> Hi Matt. This looks like it will be a step in a good direction. I just went for a cruise around the UX for a second before I looked at the code, and I saw a few things that you might want to address, or at least run past Jovan, before a more thorough review.
>
> - the two experiences of starting from long-click and starting from the service menu are different in ways that surprise me, and in at least one case seems like at error. In general I prefer the long-click behavior.
> * lines started from the service menu can go crazy when you hover over things that are not a target service. For example, try hovering over a relationship name. For me, the line then goes from the service start point to [0, 0]. I see other similar issues that I won't clarify now, but if you can't dupe I'll be happy to provide more details and screenshots. (This does not happen with long-click.)
> * lines started from the service menu cannot go over the service, unlike the change you made for long-click. I think they ought to be the same.
>
> Also, unrelatedly but concerningly, I discovered bug 1072433. That looks pretty critical, but it is in the trunk. I put that in the kanban board.
>
> I'm going to stop the review for now until I hear back from you on how you want to handle my UX observations.
>
> Thanks,
>
> Gary
Thanks for the catch - looks like mousemove events aren't bubbling how I
thought they would, and I was working on a mostly empty environment.
I'll investigate all these points.

211. By Madison Scott-Clary

Add-relation improvements

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/views/environment.js'
--- app/views/environment.js 2012-10-29 10:01:29 +0000
+++ app/views/environment.js 2012-10-30 08:16:22 +0000
@@ -33,6 +33,8 @@
33 var box = this.get('active_service'),33 var box = this.get('active_service'),
34 service = this.serviceForBox(box),34 service = this.serviceForBox(box),
35 context = this.get('active_context');35 context = this.get('active_context');
36 this.addRelationDragStart.call(this, box, context);
37 this.clickAddRelation = true;
36 this.service_click_actions38 this.service_click_actions
37 .toggleControlPanel(box, this, context);39 .toggleControlPanel(box, this, context);
38 this.service_click_actions40 this.service_click_actions
@@ -81,6 +83,12 @@
81 if (!d.containsPoint(mouse_coords, self.zoom)) {83 if (!d.containsPoint(mouse_coords, self.zoom)) {
82 return;84 return;
83 }85 }
86
87 // Do not fire if we're on the same service.
88 if (d === self.get('addRelationStart_service')) {
89 return;
90 }
91
84 self.set('potential_drop_point_service', d);92 self.set('potential_drop_point_service', d);
85 self.set('potential_drop_point_rect', rect);93 self.set('potential_drop_point_rect', rect);
86 self.addSVGClass(rect, 'hover');94 self.addSVGClass(rect, 'hover');
@@ -121,6 +129,13 @@
121 self.dragline.attr('class',129 self.dragline.attr('class',
122 'relation pending-relation dragline dragging');130 'relation pending-relation dragline dragging');
123 }131 }
132 },
133 mousemove: function(d, self) {
134 if (self.clickAddRelation) {
135 var container = self.get('container'),
136 node = container.one('#canvas rect:first-child');
137 self.rectMousemove.call(node.getDOMNode(), d, self);
138 }
124 }139 }
125 },140 },
126 '.sub-rel-block': {141 '.sub-rel-block': {
@@ -152,7 +167,14 @@
152167
153 // Relation Related168 // Relation Related
154 '.rel-label': {169 '.rel-label': {
155 click: 'relationClick'170 click: 'relationClick',
171 mousemove: function(d, self) {
172 if (self.clickAddRelation) {
173 var container = self.get('container'),
174 node = container.one('#canvas rect:first-child');
175 self.rectMousemove.call(node.getDOMNode(), d, self);
176 }
177 }
156 },178 },
157179
158 // Canvas related180 // Canvas related
@@ -162,7 +184,8 @@
162 container.all('.environment-menu.active').removeClass('active');184 container.all('.environment-menu.active').removeClass('active');
163 self.service_click_actions.toggleControlPanel(null, self);185 self.service_click_actions.toggleControlPanel(null, self);
164 self.cancelRelationBuild();186 self.cancelRelationBuild();
165 }187 },
188 mousemove: 'rectMousemove'
166 }189 }
167 },190 },
168191
@@ -184,19 +207,6 @@
184 // we have the correct event in d3.event for d3.mouse().207 // we have the correct event in d3.event for d3.mouse().
185 d3.event = e;208 d3.event = e;
186209
187 // Flash an indicator around the center of the service block.
188 var center = d.getCenter();
189 self.vis.append('circle')
190 .attr('cx', center[0])
191 .attr('cy', center[1])
192 .attr('r', 100)
193 .attr('class', 'mouse-down-indicator')
194 .transition()
195 .duration(750)
196 .ease('bounce')
197 .attr('r', 0)
198 .remove();
199
200 // Start the process of adding a relation210 // Start the process of adding a relation
201 self.addRelationDragStart.call(self, d, this);211 self.addRelationDragStart.call(self, d, this);
202 }, [d, evt], false);212 }, [d, evt], false);
@@ -409,6 +419,18 @@
409 self.removeRelationConfirm(d, this, self);419 self.removeRelationConfirm(d, this, self);
410 },420 },
411421
422 rectMousemove: function(d, self) {
423 // If we're clicking to add a relation, make sure a dragline
424 // follows the mouse cursor.
425 if (self.clickAddRelation) {
426 var mouse = d3.mouse(this);
427 d3.event.x = mouse[0];
428 d3.event.y = mouse[1];
429 self.addRelationDrag
430 .call(self, self.get('addRelationStart_service'), this);
431 }
432 },
433
412 /*434 /*
413 * Sync view models with current db.models.435 * Sync view models with current db.models.
414 */436 */
@@ -1030,22 +1052,25 @@
10301052
1031 addRelationDragStart: function(d, context) {1053 addRelationDragStart: function(d, context) {
1032 // Create a pending drag-line behind services.1054 // Create a pending drag-line behind services.
1033 var dragline = this.vis.insert('line', '.service')1055 var dragline = this.vis.append('line')
1034 .attr('class', 'relation pending-relation dragline dragging'),1056 .attr('class', 'relation pending-relation dragline dragging'),
1035 self = this;1057 self = this;
10361058
1037 // Start the line in the middle of the service.1059 // Start the line between the cursor and the nearest connector
1038 var point = d.getCenter();1060 // point on the service.
1039 dragline.attr('x1', point[0])1061 var mouse = d3.mouse(Y.one('svg').getDOMNode());
1040 .attr('y1', point[1])1062 self.cursorBox = views.BoundingBox();
1041 .attr('x2', point[0])1063 self.cursorBox.pos = {x: mouse[0], y: mouse[1], w: 0, h: 0};
1042 .attr('y2', point[1]);1064 var point = self.cursorBox.getConnectorPair(d);
1065 dragline.attr('x1', point[0][0])
1066 .attr('y1', point[0][1])
1067 .attr('x2', point[1][0])
1068 .attr('y2', point[1][1]);
1043 self.dragline = dragline;1069 self.dragline = dragline;
1044 self.cursorBox = views.BoundingBox();
10451070
1046 // Start the add-relation process.1071 // Start the add-relation process.
1047 self.service_click_actions1072 self.service_click_actions
1048 .addRelationStart(d, self, context);1073 .addRelationStart(d, self, context);
1049 },1074 },
10501075
1051 addRelationDrag: function(d, context) {1076 addRelationDrag: function(d, context) {
@@ -1142,6 +1167,7 @@
1142 this.dragline.remove();1167 this.dragline.remove();
1143 this.dragline = null;1168 this.dragline = null;
1144 }1169 }
1170 this.clickAddRelation = null;
1145 this.set('currentServiceClickAction', 'toggleControlPanel');1171 this.set('currentServiceClickAction', 'toggleControlPanel');
1146 this.show(this.vis.selectAll('.service'))1172 this.show(this.vis.selectAll('.service'))
1147 .classed('selectable-service', false);1173 .classed('selectable-service', false);
@@ -1500,19 +1526,8 @@
1500 return a[0].name + a[1].name < b[0].name + b[1].name;1526 return a[0].name + a[1].name < b[0].name + b[1].name;
1501 });1527 });
15021528
1503 // Create a pending line if it doesn't exist, as in the case of1529 // Stop rubberbanding on mousemove.
1504 // clicking to add relation.1530 view.clickAddRelation = null;
1505 if (!view.dragline) {
1506 var dragline = view.vis.insert('line', '.service')
1507 .attr('class', 'relation pending-relation dragline'),
1508 points = m.getConnectorPair(
1509 view.get('addRelationStart_service'));
1510 dragline.attr('x1', points[0][0])
1511 .attr('y1', points[0][1])
1512 .attr('x2', points[1][0])
1513 .attr('y2', points[1][1]);
1514 view.dragline = dragline;
1515 }
15161531
1517 // Display menu with available endpoints.1532 // Display menu with available endpoints.
1518 var menu = container.one('#ambiguous-relation-menu');1533 var menu = container.one('#ambiguous-relation-menu');
15191534
=== modified file 'test/test_environment_view.js'
--- test/test_environment_view.js 2012-10-25 09:52:10 +0000
+++ test/test_environment_view.js 2012-10-30 08:16:22 +0000
@@ -339,6 +339,9 @@
339 container.all('.selectable-service')339 container.all('.selectable-service')
340 .size()340 .size()
341 .should.equal(2);341 .should.equal(2);
342 container.all('.dragline')
343 .size()
344 .should.equal(1);
342 service.next().simulate('click');345 service.next().simulate('click');
343 container.all('.selectable-service').size()346 container.all('.selectable-service').size()
344 .should.equal(0);347 .should.equal(0);

Subscribers

People subscribed via source and target branches