diff --git a/app/Model/GalaxyClusterRelation.php b/app/Model/GalaxyClusterRelation.php
index 304a0e1b2..9ab4d2d22 100644
--- a/app/Model/GalaxyClusterRelation.php
+++ b/app/Model/GalaxyClusterRelation.php
@@ -170,7 +170,7 @@ class GalaxyClusterRelation extends AppModel
foreach ($cluster['GalaxyClusterRelation'] as $k => $relation) {
if (!empty($relation['GalaxyClusterRelationTag'])) {
foreach ($relation['GalaxyClusterRelationTag'] as $relationTag) {
- $cluster['GalaxyClusterRelation'][$k]['Tag'] = $relationTag['Tag'];
+ $cluster['GalaxyClusterRelation'][$k]['Tag'][] = $relationTag['Tag'];
}
unset($cluster['GalaxyClusterRelation'][$k]['GalaxyClusterRelationTag']);
}
@@ -180,7 +180,7 @@ class GalaxyClusterRelation extends AppModel
foreach ($cluster['TargettingClusterRelation'] as $k => $relation) {
if (!empty($relation['GalaxyClusterRelationTag'])) {
foreach ($relation['GalaxyClusterRelationTag'] as $relationTag) {
- $cluster['TargettingClusterRelation'][$k]['Tag'] = $relationTag['Tag'];
+ $cluster['TargettingClusterRelation'][$k]['Tag'][] = $relationTag['Tag'];
}
unset($cluster['TargettingClusterRelation'][$k]['GalaxyClusterRelationTag']);
}
diff --git a/app/View/Elements/GalaxyClusters/view_relation_tree.ctp b/app/View/Elements/GalaxyClusters/view_relation_tree.ctp
index f6bc138c4..5312bc889 100644
--- a/app/View/Elements/GalaxyClusters/view_relation_tree.ctp
+++ b/app/View/Elements/GalaxyClusters/view_relation_tree.ctp
@@ -272,23 +272,30 @@ echo $this->element('genericElements/assetLoader', array(
.append("div")
.attr("class", "well well-small")
.style('padding', '4px 9px')
- // .attr("title", function(d) { return d.children ? "Version" : "= __('Latest version of the parent cluster') ?>" })
.html(function(d) { return d.Relation.referenced_galaxy_cluster_type; })
- paddingX = 6;
+ paddingX = 8;
gEnter.append("foreignObject")
.attr("height", 18)
.attr("y", 20)
- .attr("x", function(d) { return -(d.Relation.Tag !== undefined ? getTextWidth(d.Relation.Tag.name, {'white-space': 'nowrap', 'font-weight': 'bold'}) - 2*paddingX : 0)/2 + 'px'; })
- .attr("width", function(d) { return (d.Relation.Tag !== undefined ? getTextWidth(d.Relation.Tag.name, {'white-space': 'nowrap', 'font-weight': 'bold'}) + 2*paddingX : 0) + 'px'; })
+ .attr("x", function(d) { return -(d.Relation.Tag !== undefined ? getTextWidth(d.Relation.Tag, {'white-space': 'nowrap', 'font-weight': 'bold'}, 'name') - 2*paddingX : 0)/2 + 'px'; })
+ .attr("width", function(d) { return (d.Relation.Tag !== undefined ? getTextWidth(d.Relation.Tag, {'white-space': 'nowrap', 'font-weight': 'bold'}, 'name') + 2*paddingX : 0) + 'px'; })
.append("xhtml:div")
- .append("span")
- .attr("class", "tag")
- .style('white-space', 'nowrap')
- .style('background-color', function(d) {return d.Relation.Tag !== undefined ? d.Relation.Tag.colour : '';})
- .style('color', function(d) {return d.Relation.Tag !== undefined ? getTextColour(d.Relation.Tag.colour) : 'white';})
- // .attr("title", function(d) { return d.children ? "Version" : "= __('Latest version of the parent cluster') ?>" })
- .html(function(d) { return d.Relation.Tag !== undefined ? d.Relation.Tag.name : ''; })
+ .each(function(d) {
+ if (d.Relation.Tag !== undefined) {
+ d.Relation.Tag.forEach(tag => {
+ d3.select(this)
+ .append("span")
+ .attr("class", "tag")
+ .style('white-space', 'nowrap')
+ .style('background-color', tag.colour)
+ .style('color', getTextColour(tag.colour))
+ .style('display', 'inline')
+ .html(tag.name)
+ });
+ }
+ });
+
}
function drawLabel(gEnter, options) {
@@ -342,16 +349,31 @@ echo $this->element('genericElements/assetLoader', array(
}
}
- function getTextWidth(text, additionalStyle) {
+ function getTextWidth(text, additionalStyle, pathKey) {
var style = {visibility: 'hidden'};
if (additionalStyle !== undefined) {
style = $.extend(style, additionalStyle);
}
- var tmp = $('').text(text).css(style)
- $('body').append(tmp);
- var bcr = tmp[0].getBoundingClientRect()
- tmp.remove();
- return bcr.width;
+ var total = 0;
+ if (Array.isArray(text)) {
+ text.forEach(element => {
+ if (pathKey !== undefined) {
+ element = element[pathKey];
+ }
+ var tmp = $('').text(element).css(style)
+ $('body').append(tmp);
+ var bcr = tmp[0].getBoundingClientRect()
+ tmp.remove();
+ total += bcr.width;
+ });
+ } else {
+ var tmp = $('').text(text).css(style)
+ $('body').append(tmp);
+ var bcr = tmp[0].getBoundingClientRect()
+ tmp.remove();
+ total += bcr.width;
+ }
+ return total;
}
function nodeDbclick(d) {