fix: [galaxyCluster:view] Catch if cluster has no `extended_from`

pull/6120/head
mokaddem 2020-04-30 13:34:21 +02:00
parent dcc419275f
commit 312d23a9e0
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 14 additions and 1 deletions

View File

@ -214,7 +214,11 @@ class GalaxyClustersController extends AppController
$this->set('galaxy_id', $cluster['GalaxyCluster']['galaxy_id']);
$this->set('cluster', $cluster);
$this->set('defaultCluster', $cluster['GalaxyCluster']['default']);
$newVersionAvailable = $cluster['GalaxyCluster']['extended_from']['GalaxyCluster']['value'] > $cluster['GalaxyCluster']['extends_version'];
if (isset($cluster['GalaxyCluster']['extended_from'])) {
$newVersionAvailable = $cluster['GalaxyCluster']['extended_from']['GalaxyCluster']['value'] > $cluster['GalaxyCluster']['extends_version'];
} else {
$newVersionAvailable = false;
}
$this->set('newVersionAvailable', $newVersionAvailable);
}
}
@ -252,6 +256,7 @@ class GalaxyClustersController extends AppController
unset($origCluster['GalaxyElement'][$k]['galaxy_cluster_id']);
}
$this->request->data['GalaxyCluster']['elements'] = json_encode($origCluster['GalaxyElement']);
$this->request->data['GalaxyCluster']['elementsDict'] = $origCluster['GalaxyElement'];
$this->request->data['GalaxyCluster']['authors'] = json_encode($origCluster['GalaxyCluster']['authors']);
}
$this->set('origCluster', $origCluster);
@ -396,6 +401,7 @@ class GalaxyClustersController extends AppController
}
} else {
$this->GalaxyCluster->data['GalaxyCluster']['elements'] = json_encode($this->GalaxyCluster->data['GalaxyElement']);
$this->GalaxyCluster->data['GalaxyCluster']['elementsDict'] = $this->GalaxyCluster->data['GalaxyElement'];
$this->GalaxyCluster->data['GalaxyCluster']['authors'] = json_encode($this->GalaxyCluster->data['GalaxyCluster']['authors']);
$this->request->data = $this->GalaxyCluster->data;
}

View File

@ -1228,6 +1228,13 @@
'url' => '/galaxies/view/' . h($galaxy_id),
'text' => __('View Galaxy')
));
if ($menuItem === 'edit') {
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
'element_id' => 'view_cluster',
'url' => '/galaxy_clusters/view/' . h($clusterId),
'text' => __('View Cluster')
));
}
break;
case 'objectTemplates':