fix: [galaxy:editCluster] Correctly update galaxyElements

pull/6120/head
mokaddem 2020-04-21 10:11:26 +02:00
parent ed74adf399
commit eecd539b0a
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
3 changed files with 8 additions and 3 deletions

View File

@ -325,7 +325,7 @@ class GalaxyClustersController extends AppController
if ($cluster['GalaxyCluster']['default']) {
throw new MethodNotAllowedException('Default galaxy cluster cannot be edited');
}
$this->GalaxyCluster->data = array('GalaxyCluster' => $cluster['GalaxyCluster']);
$this->GalaxyCluster->data = array('GalaxyCluster' => $cluster['GalaxyCluster'], 'GalaxyElement' => $cluster['GalaxyElement']);
$this->loadModel('Attribute');
$distributionLevels = $this->Attribute->distributionLevels;
@ -391,6 +391,7 @@ class GalaxyClustersController extends AppController
}
}
} else {
$this->GalaxyCluster->data['GalaxyCluster']['elements'] = json_encode($this->GalaxyCluster->data['GalaxyElement']);
$this->GalaxyCluster->data['GalaxyCluster']['authors'] = json_encode($this->GalaxyCluster->data['GalaxyCluster']['authors']);
$this->request->data = $this->GalaxyCluster->data;
}

View File

@ -183,7 +183,11 @@ class GalaxyCluster extends AppModel
$fieldList = array('value', 'description', 'version', 'source', 'authors', 'distribution', 'sharing_group_id', 'default');
$saveSuccess = $this->save($cluster, array('fieldList' => $fieldList));
if ($saveSuccess) {
$this->GalaxyElement->updateElements($cluster['GalaxyCluster']['id'], $cluster['GalaxyCluster']['id'], $cluster['GalaxyCluster']['elements']);
$elementsToSave = array();
foreach ($cluster['GalaxyCluster']['elements'] as $element) { // transform cluster into Galaxy meta format
$elementsToSave[$element['key']] = $element['value'];
}
$this->GalaxyElement->updateElements($cluster['GalaxyCluster']['id'], $cluster['GalaxyCluster']['id'], $elementsToSave);
} else {
foreach($this->validationErrors as $validationError) {
$errors[] = $validationError[0];

View File

@ -2528,7 +2528,7 @@ table tr:hover .down-expand-button {
position: absolute;
right: 0px;
top: 100px;
max-width: 600px;
max-width: 400px;
}
.widgetTitle {