chg: [galaxyClusters:view_relation] Reuse already fetched relations

pull/6686/head
mokaddem 2020-12-04 09:48:53 +01:00
parent 46a9546cfb
commit 4c84f76542
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 11 additions and 20 deletions

View File

@ -967,7 +967,7 @@ class GalaxyClustersController extends AppController
if (!$this->request->is('ajax')) {
throw new MethodNotAllowedException('This function can only be reached via AJAX.');
}
$cluster = $this->GalaxyCluster->fetchIfAuthorized($this->Auth->user(), $id, 'view', $throwErrors=true, $full=true);
$cluster = $this->GalaxyCluster->fetchIfAuthorized($this->Auth->user(), $id, 'view', true, true);
$existingRelations = $this->GalaxyCluster->GalaxyClusterRelation->getExistingRelationships();
$cluster = $this->GalaxyCluster->attachClusterToRelations($this->Auth->user(), $cluster);
@ -978,12 +978,7 @@ class GalaxyClustersController extends AppController
$this->set('existingRelations', $existingRelations);
$this->set('cluster', $cluster);
$relations = $this->GalaxyCluster->GalaxyClusterRelation->fetchRelations($this->Auth->user(), array(
'conditions' => array(
'GalaxyClusterRelation.galaxy_cluster_uuid' => $cluster['GalaxyCluster']['uuid']
),
'contain' => array('SharingGroup', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
));
$relations = $cluster['GalaxyCluster']['GalaxyClusterRelation'];
$this->set('passedArgs', json_encode([]));
$this->set('relations', $relations);
$this->set('tree', $tree);

View File

@ -6,9 +6,8 @@
'fields' => array(
array(
'name' => __('Id'),
'sort' => 'id',
'class' => 'short',
'data_path' => 'GalaxyClusterRelation.id',
'data_path' => 'id',
),
array(
'name' => __('Default'),
@ -18,23 +17,21 @@
),
array(
'name' => __('Galaxy Cluster Target (galaxy :: cluster)'),
'sort' => 'TargetCluster.tag_name',
'element' => 'galaxy_cluster_link',
'data_path' => 'TargetCluster',
'data_path_relation' => 'GalaxyClusterRelation',
'url_params_data_paths' => 'TargetCluster.id',
'data_path' => 'GalaxyCluster',
'data_path_relation' => '',
'url_params_data_paths' => 'GalaxyCluster.id',
'url' => $baseurl . '/galaxy_clusters/view'
),
array(
'name' => __('Relationship Type'),
'sort' => 'type',
'class' => 'short',
'data_path' => 'GalaxyClusterRelation.referenced_galaxy_cluster_type',
'data_path' => 'referenced_galaxy_cluster_type',
),
array(
'name' => __('Relationship Tag'),
'class' => 'short',
'data_path' => 'GalaxyClusterRelationTag.{n}.Tag',
'data_path' => 'Tag',
'element' => 'tags',
'elementParams' => array(
'searchScope' => 'taxonomy'
@ -43,8 +40,7 @@
),
array(
'name' => __('Distribution'),
'sort' => 'distribution',
'data_path' => 'GalaxyClusterRelation.distribution',
'data_path' => 'distribution',
'element' => 'distribution_levels',
),
),
@ -53,7 +49,7 @@
'title' => 'Edit',
'url' => '/galaxy_cluster_relations/edit',
'url_params_data_paths' => array(
'GalaxyClusterRelation.id'
'id'
),
'icon' => 'edit',
'complex_requirement' => array(
@ -70,7 +66,7 @@
'title' => 'Delete',
'url' => '/galaxy_cluster_relations/delete',
'url_params_data_paths' => array(
'GalaxyClusterRelation.id'
'id'
),
'postLink' => true,
'postLinkConfirm' => __('Are you sure you want to delete the Relationship?'),