chg: [clusterRelations:view_relations] Started implementation of double

sided tree
pull/6120/head
mokaddem 2020-05-07 16:49:14 +02:00
parent d01b142582
commit 7328eb1ebd
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 14 additions and 4 deletions

View File

@ -832,7 +832,9 @@ class GalaxyClustersController extends AppController
$cluster = $cluster[0];
$existingRelations = $this->GalaxyCluster->GalaxyClusterRelation->getExistingRelationships();
$cluster = $this->GalaxyCluster->attachClusterToRelations($this->Auth->user(), $cluster);
$tree = array(array(
debug($existingRelations);
$treeRight = array(array(
'GalaxyCluster' => $cluster['GalaxyCluster'],
'children' => array()
));
@ -844,8 +846,14 @@ class GalaxyClustersController extends AppController
array('GalaxyCluster' => $relation['GalaxyCluster']),
)
);
$tree[0]['children'][] = $tmp;
$treeRight[0]['children'][] = $tmp;
}
$treeLeft = array();
$tree = array(
'right' => $treeRight,
'left' => $treeLeft,
);
$this->set('existingRelations', $existingRelations);
$this->set('cluster', $cluster);
$this->set('tree', $tree);

View File

@ -52,6 +52,8 @@ echo $this->element('genericElements/assetLoader', array(
<script>
var treeData = <?= json_encode($tree) ?>;
var treeRight = treeData.right;
var treeLeft = treeData.left;
var margin = {top: 10, right: 10, bottom: 10, left: 20};
var treeWidth, treeHeight;
var colors = d3.scale.category10();
@ -123,7 +125,7 @@ echo $this->element('genericElements/assetLoader', array(
treeWidth = $tree.width() - margin.right - margin.left;
treeHeight = $tree.height() - margin.top - margin.bottom;
var tree = d3.layout.tree(treeData)
var tree = d3.layout.tree(treeRight)
.size([treeHeight, treeWidth]);
var diagonal = function link(d) {
@ -139,7 +141,7 @@ echo $this->element('genericElements/assetLoader', array(
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var root = treeData[0];
var root = treeRight[0];
root.isRoot = true;
root.x0 = treeHeight / 2;
root.y0 = 0;