* result reformatted to new style in nightly

This commit is contained in:
Dávid Danyi 2017-03-29 14:26:51 +02:00
parent 9cd08908dc
commit 6e823bc0ea
2 changed files with 24 additions and 4 deletions

View File

@ -22,6 +22,6 @@ class NightlyByStreamsAction extends AbstractAction
public function getList(ServerRequestInterface $request, ResponseInterface $response, callable $next = null) public function getList(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)
{ {
return new JsonCorsResponse($this->ciExecutorService->getActiveNightlyConfiguration()); return new JsonCorsResponse($this->ciExecutorService->getActiveNightlyConfigurationByStream());
} }
} }

View File

@ -696,16 +696,36 @@ class CiExecutorService
public function getActiveNightlyConfigurationByNode(bool $forceReload = false) public function getActiveNightlyConfigurationByNode(bool $forceReload = false)
{ {
$activeNightlyByStream = $this->getActiveNightlyConfiguration($forceReload); $activeNightlyByStream = $this->getActiveNightlyConfiguration($forceReload);
$configByNodes = []; $reorderedConfig = [];
foreach ($activeNightlyByStream as $stream => $nodes) { foreach ($activeNightlyByStream as $stream => $nodes) {
foreach($nodes as $node) { foreach($nodes as $node) {
if(!isset($configByNodes[$node])) { $configByNodes[$node] = []; } if(!isset($reorderedConfig[$node])) { $reorderedConfig[$node] = []; }
array_push($configByNodes[$node], $stream); array_push($reorderedConfig[$node], $stream);
} }
} }
$configByNodes = [];
foreach ($reorderedConfig as $node => $streams) {
$configByNodes[] = [
'node' => $node,
'streams' => $streams,
];
}
return $configByNodes; return $configByNodes;
} }
public function getActiveNightlyConfigurationByStream(bool $forceReload = false)
{
$activeNightlyByStream = $this->getActiveNightlyConfiguration($forceReload);
$configByStream = [];
foreach ($activeNightlyByStream as $stream => $nodes) {
$configByStream[] = [
'stream' => $stream,
'nodes' => $nodes,
];
}
return $configByStream;
}
public function getActiveNightlyConfiguration(bool $forceReload = false) public function getActiveNightlyConfiguration(bool $forceReload = false)
{ {
$cache = $this->getCache(self::NIGHTLY_CACHE_KEY); $cache = $this->getCache(self::NIGHTLY_CACHE_KEY);