mirror of https://github.com/MISP/MISP
chg: [galaxy] Renamed `reference` into `relation`
parent
01ec581a86
commit
31293d9b93
|
@ -526,7 +526,7 @@ class GalaxiesController extends AppController
|
|||
$this->set('galaxy_id', $galaxyId);
|
||||
}
|
||||
|
||||
public function referencesGraph($galaxyId)
|
||||
public function relationsGraph($galaxyId)
|
||||
{
|
||||
$clusters = $this->Galaxy->GalaxyCluster->fetchGalaxyClusters($this->Auth->user(), array('conditions' => array('GalaxyCluster.galaxy_id' => $galaxyId)), $full=true);
|
||||
if (empty($clusters)) {
|
||||
|
@ -536,12 +536,12 @@ class GalaxiesController extends AppController
|
|||
'recursive' => -1,
|
||||
'conditions' => array('Galaxy.id' => $galaxyId)
|
||||
));
|
||||
$references = array();
|
||||
$references = $this->Galaxy->generateReferenceGraph($this->Auth->user(), $clusters, $galaxy); // moved this to Lib/Tool
|
||||
$relations = array();
|
||||
$relations = $this->Galaxy->generateRelationsGraph($this->Auth->user(), $clusters, $galaxy); // moved this to Lib/Tool
|
||||
if ($this->_isRest()) {
|
||||
return $this->RestResponse->viewData($tree, $this->response->type());
|
||||
}
|
||||
$this->set('references', $references);
|
||||
$this->set('relations', $relations);
|
||||
$this->set('galaxy', $galaxy);
|
||||
$this->set('galaxy_id', $galaxyId);
|
||||
}
|
||||
|
|
|
@ -587,7 +587,7 @@ class Galaxy extends AppModel
|
|||
return $tree;
|
||||
}
|
||||
|
||||
function generateReferenceGraph($user, $clusters, $galaxy)
|
||||
function generateRelationsGraph($user, $clusters, $galaxy)
|
||||
{
|
||||
$nodes = array();
|
||||
$links = array();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<div>
|
||||
<h6>
|
||||
<a class="" href="<?= sprintf('%s/galaxies/view/%s/context:all', $baseurl, $galaxy_id) ?>">
|
||||
<i class="<?php echo $this->FontAwesome->findNamespace($galaxy['Galaxy']['icon']); ?> fa-arrow-left"></i>
|
||||
<i class="<?php echo $this->FontAwesome->findNamespace('arrow-left'); ?> fa-arrow-left"></i>
|
||||
<?= __('Back to galaxy') ?>
|
||||
</a>
|
||||
</h6>
|
||||
</h6>
|
||||
<h2><?= sprintf(__('%s galaxy cluster extensions'), h($galaxy['Galaxy']['name'])) ?></h2>
|
||||
<svg id="treeSVG" style="width: 100%; height: 100%; min-height: 600px;"></svg>
|
||||
</div>
|
||||
|
|
|
@ -3,13 +3,23 @@ echo $this->element('genericElements/assetLoader', array(
|
|||
'js' => array('d3')
|
||||
));
|
||||
?>
|
||||
<h6>
|
||||
<a class="" href="<?= sprintf('%s/galaxies/view/%s/context:all', $baseurl, $galaxy_id) ?>">
|
||||
<i class="<?php echo $this->FontAwesome->findNamespace('arrow-left'); ?> fa-arrow-left"></i>
|
||||
<?= __('Back to galaxy') ?>
|
||||
</a>
|
||||
</h6>
|
||||
<?php if (empty($relations)): ?>
|
||||
<div class="alert alert-info">
|
||||
<?= __('There are no relations in this Galaxy'); ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div style="border: 1px solid #ddd">
|
||||
<div id="graphContainer" style="height: 70vh;"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var graph = <?= json_encode($references) ?>;
|
||||
// console.log(graph);
|
||||
var graph = <?= json_encode($relations) ?>;
|
||||
var nodes, links;
|
||||
var width, height, margin;
|
||||
var vis, svg, plotting_area, force, container, zoom;
|
||||
|
@ -22,7 +32,9 @@ $(document).ready( function() {
|
|||
margin = {top: 5, right: 5, bottom: 5, left: 5},
|
||||
width = $('#graphContainer').width() - margin.left - margin.right,
|
||||
height = $('#graphContainer').height() - margin.top - margin.bottom;
|
||||
initGraph();
|
||||
if (graph.nodes.length > 0) {
|
||||
initGraph();
|
||||
}
|
||||
});
|
||||
|
||||
function initGraph() {
|
||||
|
@ -167,4 +179,5 @@ function drag(force) {
|
|||
.on("drag", dragmove)
|
||||
.on("dragend", dragend)
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
<?php endif; ?>
|
|
@ -35,8 +35,8 @@ $(document).ready(function () {
|
|||
$uri = "/galaxy_clusters/index/" . $galaxy['Galaxy']['id'];
|
||||
if (isset($passedArgsArray) && isset($passedArgsArray['context']) && $passedArgsArray['context'] == 'fork_tree') {
|
||||
$uri = '/galaxies/forkTree/' . $galaxy['Galaxy']['id'];
|
||||
} elseif (isset($passedArgsArray) && isset($passedArgsArray['context']) && $passedArgsArray['context'] == 'references') {
|
||||
$uri = '/galaxies/referencesGraph/' . $galaxy['Galaxy']['id'];
|
||||
} elseif (isset($passedArgsArray) && isset($passedArgsArray['context']) && $passedArgsArray['context'] == 'relations') {
|
||||
$uri = '/galaxies/relationsGraph/' . $galaxy['Galaxy']['id'];
|
||||
} elseif (isset($passedArgsArray) && isset($passedArgsArray['context'])) {
|
||||
$uri .= '/context:' . $passedArgsArray['context'];
|
||||
if (isset($passedArgsArray) && isset($passedArgsArray['searchall'])) {
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
'text' => __('View Fork Tree'),
|
||||
),
|
||||
array(
|
||||
'active' => $context === 'references',
|
||||
'url' => sprintf('%s/galaxies/view/%s/context:references', $baseurl, $galaxy_id),
|
||||
'text' => __('View Galaxy References'),
|
||||
'active' => $context === 'relations',
|
||||
'url' => sprintf('%s/galaxies/view/%s/context:relations', $baseurl, $galaxy_id),
|
||||
'text' => __('View Galaxy Relationships'),
|
||||
),
|
||||
)
|
||||
),
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<div id="matrix_container"></div>
|
||||
</div>
|
||||
<div class="row-fuild">
|
||||
<div id="references_container"></div>
|
||||
<div id="relations_container"></div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div id="elements_div" class="span8"></div>
|
||||
|
@ -95,8 +95,8 @@ $(document).ready(function () {
|
|||
$.get("/galaxy_clusters/viewGalaxyMatrix/<?php echo $cluster['GalaxyCluster']['id']; ?>", function(data) {
|
||||
$("#matrix_container").html(data);
|
||||
});
|
||||
$.get("/galaxy_clusters/viewReferences/<?php echo $cluster['GalaxyCluster']['id']; ?>", function(data) {
|
||||
$("#references_container").html(data);
|
||||
$.get("/galaxy_clusters/viewRelations/<?php echo $cluster['GalaxyCluster']['id']; ?>", function(data) {
|
||||
$("#relations_container").html(data);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue