~juju-gui/juju-gui/trunk

« back to all changes in this revision

Viewing changes to app/views/topology/service.js

  • Committer: Brad Crittenden
  • Date: 2013-01-22 21:16:19 UTC
  • mfrom: (335.1.7 1102640)
  • Revision ID: bac@canonical.com-20130122211619-ysrhjb53rgwwuyz8
When adding a relation, the service menu is shown.

If adding a relation using the 'Build Relation' action from the service menu
on the originating service, the click on the target service produces two
events.  The dragend event is handled properly and sets up the relation.  Then
the click event calls serviceClick.

Attempts to use the stopPropagation, stopEvent, and preventDefault methods on
the d3.event did not produce the desired results.

This work-around is pretty hacky but it does work.  A more general solution
should be found.

Also, attempts to change the test 'must be able to add a relation from the
service menu' to simulate the click events and ensure the service menu was not
left displayed did not work.

This branch is submitted as is in an attempt to finish the last card blocking
the charm announcement.

R=bcsaller
CC=
https://codereview.appspot.com/7179049

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
      if (!d.containsPoint(mouse_coords, topo.zoom)) {
90
90
        return;
91
91
      }
 
92
      // serviceClick is being called after dragend is processed.  In those
 
93
      // cases the current click action should not be invoked.
 
94
      if (topo.ignoreServiceClick) {
 
95
        topo.ignoreServiceClick = false;
 
96
        return;
 
97
      }
92
98
      // Get the current click action
93
99
      var curr_click_action = context.get('currentServiceClickAction');
94
100
      // Fire the action named in the following scheme:
282
288
    dragend: function(d,  self) {
283
289
      var topo = self.get('component');
284
290
      if (topo.buildingRelation) {
 
291
        topo.ignoreServiceClick = true;
285
292
        topo.fire('addRelationDragEnd');
 
293
        //d3.event.sourceEvent.preventDefault();
286
294
      }
287
295
      else {
288
296
        if (!d.inDrag ||