LEFT | RIGHT |
1 /* | 1 /* |
2 This file is part of the Juju GUI, which lets users view and manage Juju | 2 This file is part of the Juju GUI, which lets users view and manage Juju |
3 environments within a graphical interface (https://launchpad.net/juju-gui). | 3 environments within a graphical interface (https://launchpad.net/juju-gui). |
4 Copyright (C) 2012-2013 Canonical Ltd. | 4 Copyright (C) 2012-2013 Canonical Ltd. |
5 | 5 |
6 This program is free software: you can redistribute it and/or modify it under | 6 This program is free software: you can redistribute it and/or modify it under |
7 the terms of the GNU Affero General Public License version 3, as published by | 7 the terms of the GNU Affero General Public License version 3, as published by |
8 the Free Software Foundation. | 8 the Free Software Foundation. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, but WITHOUT | 10 This program is distributed in the hope that it will be useful, but WITHOUT |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 message: 'Successfully deployed the requested service.', | 636 message: 'Successfully deployed the requested service.', |
637 level: 'info' | 637 level: 'info' |
638 }) | 638 }) |
639 ); | 639 ); |
640 // Update the annotations with the box's x/y coordinates if | 640 // Update the annotations with the box's x/y coordinates if |
641 // they have been set by dragging the ghost. | 641 // they have been set by dragging the ghost. |
642 if (ghostService.get('dragged')) { | 642 if (ghostService.get('dragged')) { |
643 env.update_annotations( | 643 env.update_annotations( |
644 serviceName, 'service', | 644 serviceName, 'service', |
645 { 'gui-x': ghostService.get('x'), | 645 { 'gui-x': ghostService.get('x'), |
646 'gui-y': ghostService.get('y') }); | 646 'gui-y': ghostService.get('y') }, |
| 647 function() { |
| 648 // Make sure that annotations are set on the ghost |
| 649 // service before they come back from the delta to |
| 650 // prevent the service from jumping to the middle of |
| 651 // the canvas and back. |
| 652 var annotations = ghostService.get('annotations'); |
| 653 if (!annotations) { |
| 654 annotations = {}; |
| 655 } |
| 656 Y.mix(annotations, { |
| 657 'gui-x': ghostService.get('x'), |
| 658 'gui-y': ghostService.get('y') |
| 659 }); |
| 660 ghostService.set('annotations', annotations); |
| 661 // The x/y attributes need to be removed to prevent |
| 662 // lingering position problems after the service is |
| 663 // positioned by the update code. |
| 664 ghostService.removeAttr('x'); |
| 665 ghostService.removeAttr('y'); |
| 666 }); |
647 } | 667 } |
648 // Update the ghost service to match the configuration. | 668 // Update the ghost service to match the configuration. |
649 ghostService.setAttrs({ | 669 ghostService.setAttrs({ |
650 id: serviceName, | 670 id: serviceName, |
651 charm: charm.get('id'), | 671 charm: charm.get('id'), |
652 unit_count: 0, // No units yet. | 672 unit_count: 0, // No units yet. |
653 loaded: false, | 673 loaded: false, |
654 pending: false, | 674 pending: false, |
655 config: config | 675 config: config |
656 }); | 676 }); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 'event-key', | 977 'event-key', |
958 'event-outside', | 978 'event-outside', |
959 'widget-anim', | 979 'widget-anim', |
960 'overlay', | 980 'overlay', |
961 'dom-core', | 981 'dom-core', |
962 'juju-models', | 982 'juju-models', |
963 'event-resize', | 983 'event-resize', |
964 'gallery-ellipsis' | 984 'gallery-ellipsis' |
965 ] | 985 ] |
966 }); | 986 }); |
LEFT | RIGHT |