Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(97)

Unified Diff: app/views/topology/topology.js

Issue 14695043: Redo Service Placement
Patch Set: Redo Service Placement Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/views/topology/service.js ('k') | app/views/utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/views/topology/topology.js
=== modified file 'app/views/topology/topology.js'
--- app/views/topology/topology.js 2013-10-04 18:37:47 +0000
+++ app/views/topology/topology.js 2013-10-15 22:51:35 +0000
@@ -186,7 +186,52 @@
return utils.pointOutside(
utils.serviceBoxesToVertices(existingBoxes),
this.get('servicePadding'));
+ },
+
+ /**
+ Show the menu for a given service
+
+ @method showMenu
+ @param {String} serviceId
+ */
+ showMenu: function(serviceId) {
+ var serviceModule = this.modules.ServiceModule;
+ if (!serviceModule) { return;}
+ var boxModel = this.service_boxes[serviceId];
+ serviceModule.showServiceMenu(boxModel);
+ },
+
+ /**
+ Record a new box position on the backend. This maintains the proper drag
+ state. This method also transitions the viewModel to a DRAG_ENDING state
+ with a timeout. During this window the box will behave as if its in a drag
+ state refusing annotation updates. This masks certain classes of races.
+
+ @method annotateBoxPosition
+ @param {Object} box.
+ @param {ms} timeout.
+ */
+ annotateBoxPosition: function(box, timeout) {
+ if (box.pending) { return; }
+ timeout = timeout || 1000;
+
+ // This can happen in some tests.
+ this.get('env').update_annotations(
+ box.id, 'service', {'gui-x': box.x, 'gui-y': box.y},
+ function() {
+ if (timeout) {
+ box.inDrag = views.DRAG_ENDING;
+ Y.later(timeout, box, function() {
+ // Provide (t) ms of protection from sending additional
+ // annotations or applying them locally.
+ box.inDrag = false;
+ });
+ } else {
+ box.inDrag = false;
+ }
+ });
}
+
}, {
ATTRS: {
/**
@@ -238,6 +283,7 @@
*/
views.DRAG_START = 1;
views.DRAG_ACTIVE = 2;
+ views.DRAG_ENDING = 3;
}, '0.1.0', {
requires: [
'd3',
« no previous file with comments | « app/views/topology/service.js ('k') | app/views/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b