~juju-gui/juju-gui/trunk

« back to all changes in this revision

Viewing changes to app/views/topology/relation.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:
420
420
              .attr('y2', d3.event.y);
421
421
      }
422
422
    },
423
 
 
424
 
 
425
423
    addRelationDragEnd: function() {
426
424
      // Get the line, the endpoint service, and the target <rect>.
427
425
      var self = this;
606
604
 
607
605
      if (endpoints && endpoints.length === 1) {
608
606
        // Create a relation with the only available endpoint.
609
 
        var ep = endpoints[0],
610
 
                endpoints_item = [
611
 
                  [ep[0].service, {
612
 
                    name: ep[0].name,
613
 
                    role: 'server' }],
614
 
                  [ep[1].service, {
615
 
                    name: ep[1].name,
616
 
                    role: 'client' }]];
 
607
        var ep = endpoints[0];
 
608
        var endpoints_item = [
 
609
          [ep[0].service,
 
610
           { name: ep[0].name,
 
611
             role: 'server' }],
 
612
          [ep[1].service,
 
613
           { name: ep[1].name,
 
614
             role: 'client' }]];
617
615
        view.addRelationEnd(endpoints_item, view, context);
618
616
        return;
619
617
      }