mirror of https://github.com/MISP/MISP
chg: [clusterRelations:view_relations] Started implementation of double
sided treepull/6120/head
parent
d01b142582
commit
7328eb1ebd
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue