public function detailsAction() { $processId = ProcessId::fromString($this->params('process_id')); $process = $this->processLogger->getLoggedProcess($processId); if (is_null($process)) { return $this->notFoundAction(); } $process['events'] = $this->convertToClientProcessEvents($this->processStreamReader->getStreamOfProcess($processId)); if (!isset($process['start_message']) || !isset($this->systemConfig->getProcessDefinitions()[$process['start_message']])) { return $this->incompleteAction($process); } $definition = $this->convertToClientProcess($process['start_message'], $this->systemConfig->getProcessDefinitions()[$process['start_message']], $this->systemConfig->getAllAvailableProcessingTypes()); $process = array_merge($process, $definition); $this->populateTaskEvents($process); $view = new ViewModel(['process' => $process, 'available_processing_types' => $this->getProcessingTypesForClient(), 'available_task_types' => \Prooph\Processing\Processor\Definition::getAllTaskTypes(), 'available_manipulation_scripts' => $this->scriptLocation->getScriptNames(), 'locations' => $this->locationTranslator->getLocations(), 'connectors' => array_values(Func::map($this->systemConfig->getConnectors(), function ($connector, $id) { $connector['id'] = $id; return $connector; }))]); $view->setTemplate('prooph/link/monitor/process-view/process-details-app'); $this->layout()->setVariable('includeRiotJs', true); return $view; }
/** * @param string $messageName * @param array $processConfig * @throws \InvalidArgumentException */ private function assertProcessConfig($messageName, array $processConfig) { if (!array_key_exists('name', $processConfig)) { throw new \InvalidArgumentException('Missing key name in config processing.processes.' . $messageName); } if (!array_key_exists('process_type', $processConfig)) { throw new \InvalidArgumentException('Missing key process_type in config processing.processes.' . $messageName); } if (!in_array($processConfig['process_type'], Definition::getAllProcessTypes())) { throw new \InvalidArgumentException('Process type is not valid in config processing.processes.' . $messageName); } if (!array_key_exists('tasks', $processConfig)) { throw new \InvalidArgumentException('Missing key tasks in config processing.processes.' . $messageName); } if (!is_array($processConfig['tasks'])) { throw new \InvalidArgumentException(sprintf('Config processing.processes.%s.tasks must be an array', $messageName)); } foreach ($processConfig['tasks'] as $i => $task) { $this->assertTaskConfig($messageName, $i, $task); } }