Update `machineDefault::getMachineWorkingInformation` to send *ETREE*
This commit is contained in:
parent
05d1ef50e0
commit
ba4cb04925
|
@ -6,4 +6,5 @@
|
||||||
*.lock
|
*.lock
|
||||||
/vendor/
|
/vendor/
|
||||||
/phpunit/coverage
|
/phpunit/coverage
|
||||||
.vscode
|
.vscode
|
||||||
|
TODO
|
|
@ -462,14 +462,14 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* RETOURNE L'E-TREE D'UN GROUPE DE MACHINES
|
/* RETOURNE LES E-TREES D'UN GROUPE DE MACHINES
|
||||||
*
|
*
|
||||||
* @id_machine_cluster<int> UID du groupe de machine
|
* @id_machine_cluster<int> UID du groupe de machine
|
||||||
*
|
*
|
||||||
* @return e-tree<Array> E-tree du groupe de machines
|
* @return etrees<Array> E-trees du groupe de machines
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getEtree($params){
|
public static function getEtrees($params){
|
||||||
extract($params);
|
extract($params);
|
||||||
|
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@
|
||||||
|
|
||||||
/* [3] On retourne la liste
|
/* [3] On retourne la liste
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
return [ 'etree' => $answer ];
|
return [ 'etrees' => $answer ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -553,6 +553,49 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* [6] On envoie les e-tree de la machine
|
||||||
|
=========================================================*/
|
||||||
|
$etrees = [];
|
||||||
|
|
||||||
|
/* (1) On essaie de récupérer les etree de la machine*/
|
||||||
|
$mc_req = new Request('machineDefault/getClusters', ['id_machine' => $id_machine]);
|
||||||
|
|
||||||
|
$mc_res = $mc_req->dispatch();
|
||||||
|
|
||||||
|
/* (2) Si on arrive à récupérer les clusters */
|
||||||
|
if( $mc_res->error->get() == Err::Success ){
|
||||||
|
|
||||||
|
/* (3) Pour chaque cluster, on récupère les e-trees */
|
||||||
|
foreach($mc_res->get('clusters') as $cluster){
|
||||||
|
|
||||||
|
/* (4) On les e-trees du cluster */
|
||||||
|
$etree_req = new Request('clusterDefault/getEtrees', [
|
||||||
|
'id_machine_cluster' => $cluster['id_machine_cluster']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$etree_res = $etree_req->dispatch();
|
||||||
|
|
||||||
|
/* (5) Si erreur, on passe */
|
||||||
|
if( $etree_res->error->get() != Err::Success )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* (6) Sinon -> On entregistre les e-trees */
|
||||||
|
foreach($etree_res->get('etrees') as $etree){
|
||||||
|
$etree_value = $etree['name'].'-'.$etree['daemon'];
|
||||||
|
|
||||||
|
/* (7) Si pas déja entregistré -> on l'ajoute */
|
||||||
|
if( !in_array($etrees, $etree_name) )
|
||||||
|
$etrees[] = $etree_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [N] Retourne les données
|
/* [N] Retourne les données
|
||||||
|
@ -561,7 +604,8 @@
|
||||||
'actions' => $sorted_actions,
|
'actions' => $sorted_actions,
|
||||||
'states' => $globalStates,
|
'states' => $globalStates,
|
||||||
'chips' => $chips,
|
'chips' => $chips,
|
||||||
'permissions' => $indexed_permissions
|
'permissions' => $indexed_permissions,
|
||||||
|
'etrees' => $etrees
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$twig->addFunction(new \Twig_Function('f_options', function($id_cluster){
|
$twig->addFunction(new \Twig_Function('f_options', function($id_cluster){
|
||||||
$modReq = new Request('clusterDefault/getEtree', [
|
$modReq = new Request('clusterDefault/getEtrees', [
|
||||||
'id_machine_cluster' => (int) $id_cluster
|
'id_machine_cluster' => (int) $id_cluster
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
if( $modRes->error->get() != Err::Success )
|
if( $modRes->error->get() != Err::Success )
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
return $modRes->get('etree');
|
return $modRes->get('etrees');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$twig->addFunction(new \Twig_Function('f_options', function($id_cluster){
|
$twig->addFunction(new \Twig_Function('f_options', function($id_cluster){
|
||||||
$modReq = new Request('clusterDefault/getEtree', [
|
$modReq = new Request('clusterDefault/getEtrees', [
|
||||||
'id_machine_cluster' => (int) $id_cluster
|
'id_machine_cluster' => (int) $id_cluster
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
if( $modRes->error->get() != Err::Success )
|
if( $modRes->error->get() != Err::Success )
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
return $modRes->get('etree');
|
return $modRes->get('etrees');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -516,14 +516,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"POST::getEtree": {
|
"POST::getEtrees": {
|
||||||
"description": "Retourne l'e-tree d'un groupe de machines",
|
"description": "Retourne les e-trees d'un groupe de machines",
|
||||||
"permissions": [["admin"]],
|
"permissions": [["admin"]],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"id_machine_cluster": { "description": "UID du groupe de machines", "type": "id" }
|
"id_machine_cluster": { "description": "UID du groupe de machines", "type": "id" }
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
"modules": { "description": "E-tree du groupe", "type": "array<mixed>" }
|
"etrees": { "description": "E-trees du groupe", "type": "array<mixed>" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue