* tsp-info parts added

This commit is contained in:
Dávid Danyi
2017-09-08 09:44:30 +02:00
parent efc6e7b0c4
commit d10ebb4931
7 changed files with 87 additions and 23 deletions

View File

@@ -11,9 +11,15 @@ use App\Service\VacationInfoCollectorService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Config\Config;
class TspInfoAction implements ServerMiddlewareInterface
{
/**
* @var Config
*/
private $config;
/**
* @var VacationInfoCollectorService
*/
@@ -39,12 +45,14 @@ class TspInfoAction implements ServerMiddlewareInterface
*/
private $jiraCollectorService;
public function __construct(VacationInfoCollectorService $vacationInfoCollectorService,
public function __construct(Config $config,
VacationInfoCollectorService $vacationInfoCollectorService,
TrInfoCollectorService $trInfoCollectorService,
JcatInfoCollectorService $jcatInfoCollectorService,
LabInfoCollectorService $labInfoCollectorService,
JiraCollectorService $jiraCollectorService)
{
$this->config = $config;
$this->vacationInfoCollectorService = $vacationInfoCollectorService;
$this->trInfoCollectorService = $trInfoCollectorService;
$this->jcatInfoCollectorService = $jcatInfoCollectorService;
@@ -56,17 +64,17 @@ class TspInfoAction implements ServerMiddlewareInterface
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return JsonCorsResponse
* @todo lab temperature data
*/
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
{
return new JsonCorsResponse([
'cameraUrls' => $this->config->get('url.eurestCameras')->toArray(),
'animGifs' => [],
'praGoals' => $this->trInfoCollectorService->getPraGoals(),
'trProgress' => $this->trInfoCollectorService->getProgressInfo(),
'trFlow' => $this->jcatInfoCollectorService->getTrFlow(),
'trProgressInfo' => $this->trInfoCollectorService->getProgressInfo(),
'trFlowErrors' => $this->jcatInfoCollectorService->getTrFlowErrors(),
'expedites' => $this->jiraCollectorService->getExpedites(),
'vacationInfo' => $this->vacationInfoCollectorService->isVacationSoon(),
'isVacationSoon' => $this->vacationInfoCollectorService->isVacationSoon(),
'labTemperature' => $this->labInfoCollectorService->getLabTemperatureData(),
]);
}