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: bac@canonical.com-20121107202920-50s16uzbny3umrv7
+New revision: matthew.scott@canonical.com-20121109212441-efee0kgm986rl41q
Index: app/views/environment.js
=== modified file 'app/views/environment.js'
--- app/views/environment.js 2012-11-01 13:21:53 +0000
+++ app/views/environment.js 2012-11-09 21:24:41 +0000
@@ -466,6 +466,8 @@
if (self.longClickTimer) {
self.longClickTimer.cancel();
}
+
+ // Translate the service (and, potentially, menu).
d.x += d3.event.dx;
d.y += d3.event.dy;
d3.select(this).attr('transform', function(d, i) {
@@ -474,11 +476,15 @@
if (self.get('active_service') === d) {
self.updateServiceMenuLocation();
}
+
+ // Clear any state while dragging.
self.get('container').all('.environment-menu.active')
.removeClass('active');
self.service_click_actions.toggleControlPanel(null, self);
self.cancelRelationBuild();
- updateLinks();
+
+ // Update relation lines for just this service.
+ updateLinkEndpoints(d);
}
})
.on('dragend', function(d, i) {
@@ -487,6 +493,39 @@
}
});
+ /**
+ * Update relation line endpoints for a given service.
+ *
+ * @method updateLinkEndpoints
+ * @param {Object} service The service module that has been moved.
+ */
+ function updateLinkEndpoints(service) {
+ Y.each(Y.Array.filter(self.rel_pairs, function(relation) {
+ return relation.source() === service ||
+ relation.target() === service;
+ }), function(relation) {
+ var rel_group = d3.select('#' + relation.id),
+ connectors = relation.source()
+ .getConnectorPair(relation.target()),
+ s = connectors[0],
+ t = connectors[1];
+ rel_group.select('line')
+ .attr('x1', s[0])
+ .attr('y1', s[1])
+ .attr('x2', t[0])
+ .attr('y2', t[1]);
+ rel_group.select('.rel-label')
+ .attr('transform', function(d) {
+ // XXX: This has to happen on update, not enter
+ return 'translate(' +
+ [Math.max(s[0], t[0]) -
+ Math.abs((s[0] - t[0]) / 2),
+ Math.max(s[1], t[1]) -
+ Math.abs((s[1] - t[1]) / 2)] + ')';
+ });
+ });
+ }
+
// Generate a node for each service, draw it as a rect with
// labels for service and charm.
var node = this.node;
@@ -601,8 +640,7 @@
.text(function(d) {return d.display_name; });
label.insert('rect', 'text')
.attr('width', function(d) {
- return (Y.one(this.parentNode)
- .one('text').getClientRect() || {width: 0}).width + 10;
+ return d.display_name.length * 10 + 10;
})
.attr('height', 20)
.attr('x', function() {
@@ -787,11 +825,12 @@
var status_chart_arc = d3.svg.arc()
.innerRadius(0)
.outerRadius(function(d) {
- // Make sure it's exactly as wide as the mask
+ // Make sure it's exactly as wide as the mask with a bit
+ // of leeway for the border.
return parseInt(
d3.select(this.parentNode)
.select('image')
- .attr('width'), 10) / 2;
+ .attr('width'), 10) / 2.05;
});
var status_chart_layout = d3.layout.pie()
Index: app/assets/svgs/service_health_mask.svg
=== modified file 'app/assets/svgs/service_health_mask.svg'
--- app/assets/svgs/service_health_mask.svg 2012-09-28 18:35:16 +0000
+++ app/assets/svgs/service_health_mask.svg 2012-11-05 18:02:28 +0000
@@ -20,11 +20,11 @@
enable-background="new 0 0 1024 768"
xml:space="preserve"
inkscape:version="0.48.3.1 r9886"
- sodipodi:docname="service_module (old) (copy).svg">image/svg+xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ x1="292.55029"
+ y1="555.5"
+ x2="292.55029"
+ y2="452.5"
+ gradientTransform="matrix(1,0,0,-1,219,871.5)">
+ id="stop73" />
+ id="stop75" />
-
+
+
+
+
+
+
+
+ x1="288.6055"
+ y1="482.74899"
+ x2="297.93829"
+ y2="535.41443"
+ gradientTransform="matrix(1,0,0,-1,219,871.5)">
+ id="stop111" />
+ id="stop113" />
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+ x1="292.55029"
+ y1="555.5"
+ x2="292.55029"
+ y2="452.5"
+ gradientTransform="matrix(1,0,0,-1,219,871.5)">
+ id="stop141" />
+ id="stop143" />
+ d="m 511.55,317 c 27.892,0 50.5,22.609 50.5,50.5 0,27.891 -22.61,50.5 -50.5,50.5 -27.89,0 -50.5,-22.609 -50.5,-50.5 0,-27.891 22.609,-50.5 50.5,-50.5 m 0,-1 c -28.396,0 -51.5,23.103 -51.5,51.5 0,28.397 23.104,51.5 51.5,51.5 28.397,0 51.5,-23.103 51.5,-51.5 0,-28.397 -23.103,-51.5 -51.5,-51.5 l 0,0 z"
+ id="path145"
+ inkscape:connector-curvature="0"
+ style="fill:url(#SVGID_11_)" />
+
+
+
+
+
+
\ No newline at end of file
Index: app/assets/svgs/service_module.svg
=== modified file 'app/assets/svgs/service_module.svg'
--- app/assets/svgs/service_module.svg 2012-09-28 18:34:26 +0000
+++ app/assets/svgs/service_module.svg 2012-11-05 18:02:28 +0000
@@ -7,23 +7,32 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
- width="264"
- height="269.793"
- viewBox="0 0 264 269.793"
+ width="223.959"
+ height="266.793"
+ viewBox="0 0 223.959 266.793"
enable-background="new 0 0 1024 768"
xml:space="preserve"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="service_module.svg">image/svg+xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ x1="292.55029"
+ y1="397.33401"
+ x2="292.55029"
+ y2="619.29303"
+ gradientTransform="matrix(1,0,0,-1,219,871.5)">
+ id="stop36" />
+ id="stop38" />
+ id="stop40" />
+ id="stop42" />
+ id="stop44" />
-
+ x1="292.55029"
+ y1="396.33401"
+ x2="292.55029"
+ y2="620.29303"
+ gradientTransform="matrix(1,0,0,-1,219,871.5)">
+ id="stop49" />
+ id="stop51" />
+ id="stop53" />
+ id="stop55" />
+ id="stop57" />
-
+
+
+ id="stop64" />
+ id="stop66" />
+
+ x1="288.6055"
+ y1="482.74899"
+ x2="297.93829"
+ y2="535.41443"
+ gradientTransform="matrix(1,0,0,-1,219,871.5)">
+ id="stop111" />
+ id="stop113" />
+
\ No newline at end of file