Merge pull request #7050 from JakubOnderka/cluster-relation

fix: [galaxy] GalaxyClusterRelation doesn't have Org and Orgc
pull/7062/head
Jakub Onderka 2021-02-21 17:05:52 +01:00 committed by GitHub
commit 2ec82ebea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View File

@ -4669,8 +4669,7 @@ class EventsController extends AppController
$this->loadModel('GalaxyCluster'); $this->loadModel('GalaxyCluster');
$clusters = $this->GalaxyCluster->fetchGalaxyClusters($this->Auth->user(), array('conditions' => array('GalaxyCluster.id' => $clusterIds)), $full=true); $clusters = $this->GalaxyCluster->fetchGalaxyClusters($this->Auth->user(), array('conditions' => array('GalaxyCluster.id' => $clusterIds)), $full=true);
App::uses('ClusterRelationsGraphTool', 'Tools'); App::uses('ClusterRelationsGraphTool', 'Tools');
$grapher = new ClusterRelationsGraphTool(); $grapher = new ClusterRelationsGraphTool($this->Auth->user(), $this->GalaxyCluster);
$grapher->construct($this->Auth->user(), $this->GalaxyCluster);
$relations = $grapher->getNetwork($clusters, $keepNotLinkedClusters=true, $includeReferencingRelation=true); $relations = $grapher->getNetwork($clusters, $keepNotLinkedClusters=true, $includeReferencingRelation=true);
if ($this->_isRest()) { if ($this->_isRest()) {
return $this->RestResponse->viewData($relations, $this->response->type()); return $this->RestResponse->viewData($relations, $this->response->type());

View File

@ -586,8 +586,7 @@ class GalaxiesController extends AppController
'conditions' => array('Galaxy.id' => $galaxyId) 'conditions' => array('Galaxy.id' => $galaxyId)
)); ));
App::uses('ClusterRelationsGraphTool', 'Tools'); App::uses('ClusterRelationsGraphTool', 'Tools');
$grapher = new ClusterRelationsGraphTool(); $grapher = new ClusterRelationsGraphTool($this->Auth->user(), $this->Galaxy->GalaxyCluster);
$grapher->construct($this->Auth->user(), $this->Galaxy->GalaxyCluster);
$relations = $grapher->getNetwork($clusters); $relations = $grapher->getNetwork($clusters);
if ($this->_isRest()) { if ($this->_isRest()) {
return $this->RestResponse->viewData($relations, $this->response->type()); return $this->RestResponse->viewData($relations, $this->response->type());

View File

@ -1,15 +1,14 @@
<?php <?php
class ClusterRelationsGraphTool class ClusterRelationsGraphTool
{ {
private $GalaxyCluster = false; private $GalaxyCluster;
private $user = false; private $user;
private $lookup = array(); private $lookup = array();
public function construct($user, $GalaxyCluster) public function __construct(array $user, GalaxyCluster $GalaxyCluster)
{ {
$this->GalaxyCluster = $GalaxyCluster; $this->GalaxyCluster = $GalaxyCluster;
$this->user = $user; $this->user = $user;
return true;
} }
/** /**
@ -75,7 +74,7 @@
'conditions' => array( 'conditions' => array(
'referenced_galaxy_cluster_uuid' => $cluster['GalaxyCluster']['uuid'] 'referenced_galaxy_cluster_uuid' => $cluster['GalaxyCluster']['uuid']
), ),
'contain' => array('Org', 'Orgc', 'SharingGroup'), 'contain' => array('SharingGroup'),
)); ));
if (!empty($referencingRelations)) { if (!empty($referencingRelations)) {
foreach ($referencingRelations as $relation) { foreach ($referencingRelations as $relation) {