diff --git a/Classes/Controller/BaseController.php b/Classes/Controller/BaseController.php index 8364f84..5b842d3 100644 --- a/Classes/Controller/BaseController.php +++ b/Classes/Controller/BaseController.php @@ -140,6 +140,7 @@ protected function createMenu() ['controller' => 'Sla', 'action' => 'list', 'label' => $this->getLabel('sla')], ['controller' => 'Tag', 'action' => 'list', 'label' => $this->getLabel('tag')], ['controller' => 'Statistic', 'action' => 'administration', 'label' => $this->getLabel('administration')], + ['controller' => 'Task', 'action' => 'list', 'label' => $this->getLabel('task')] ]; foreach ($actions as $action) { @@ -195,8 +196,10 @@ protected function getButtons() $addUserGroupButton = $buttonBar->makeLinkButton() ->setHref($uriBuilder->buildUriFromRoute('record_edit', $parameters)) ->setTitle($this->getLabel('createNew.client')) - ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-document-new', - Icon::SIZE_SMALL)); + ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon( + 'actions-document-new', + Icon::SIZE_SMALL + )); $buttonBar->addButton($addUserGroupButton, ButtonBar::BUTTON_POSITION_LEFT); // client single view @@ -210,16 +213,20 @@ protected function getButtons() $editClientButton = $buttonBar->makeLinkButton() ->setHref($uriBuilder->buildUriFromRoute('record_edit', $parameters)) ->setTitle($this->getLabel('edit.client')) - ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-open', - Icon::SIZE_SMALL)); + ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon( + 'actions-open', + Icon::SIZE_SMALL + )); $buttonBar->addButton($editClientButton, ButtonBar::BUTTON_POSITION_LEFT); // fetch client data $downloadClientDataButton = $buttonBar->makeLinkButton() ->setHref($this->getUriBuilder()->reset()->uriFor('fetch', ['client' => $clientId], 'Client')) ->setTitle($this->getLabel('fetchClient.link')) - ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-system-extension-download', - Icon::SIZE_SMALL)); + ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon( + 'actions-system-extension-download', + Icon::SIZE_SMALL + )); $buttonBar->addButton($downloadClientDataButton, ButtonBar::BUTTON_POSITION_LEFT); } } diff --git a/Classes/Controller/ClientController.php b/Classes/Controller/ClientController.php index de8a0c7..65e61e6 100644 --- a/Classes/Controller/ClientController.php +++ b/Classes/Controller/ClientController.php @@ -10,6 +10,7 @@ */ use T3Monitor\T3monitoring\Domain\Model\Client; +use T3Monitor\T3monitoring\Domain\Repository\TaskRepository; use T3Monitor\T3monitoring\Service\Import\ClientImport; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -19,6 +20,21 @@ class ClientController extends BaseController { + /** + * @var \T3Monitor\T3monitoring\Domain\Repository\TaskRepository + */ + protected $taskRepository = null; + + /** + * Constructor for new client controller objects + * + * @param TaskRepository $taskRepository The task repository + */ + public function __construct(TaskRepository $taskRepository) + { + $this->taskRepository = $taskRepository; + } + /** * Show client * @@ -35,6 +51,7 @@ public function showAction(Client $client = null) $this->view->assignMultiple([ 'client' => $client, + 'tasks' => $this->taskRepository->findByClientId($client->getUid()) ]); } diff --git a/Classes/Controller/TaskController.php b/Classes/Controller/TaskController.php new file mode 100644 index 0000000..6458f36 --- /dev/null +++ b/Classes/Controller/TaskController.php @@ -0,0 +1,42 @@ +taskRepository = $taskRepository; + } + + /** + * List action shows all tasks + * + * @return void + */ + protected function listAction(): void + { + $this->view->assignMultiple([ + 'tasks' => $this->taskRepository->findAll() + ]); + } +} diff --git a/Classes/Domain/Model/Client.php b/Classes/Domain/Model/Client.php index dbcef66..bbf7962 100644 --- a/Classes/Domain/Model/Client.php +++ b/Classes/Domain/Model/Client.php @@ -8,9 +8,12 @@ * LICENSE.txt file that was distributed with this source code. */ +use T3Monitor\T3monitoring\Domain\Repository\TaskRepository; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; -use TYPO3\CMS\Extbase\Persistence\ObjectStorage; /** * Client @@ -772,4 +775,16 @@ public function getExtraDangerAsArray() } return []; } + + /** + * Return the overall task status for a client. + * + * @return int + */ + public function getTaskStatus(): int + { + $objectManager = GeneralUtility::makeInstance(ObjectManager::class); + $taskRepository = $objectManager->get(TaskRepository::class); + return $taskRepository->getTaskStatusForClientId($this->uid); + } } diff --git a/Classes/Domain/Model/Task.php b/Classes/Domain/Model/Task.php new file mode 100644 index 0000000..41ea1b8 --- /dev/null +++ b/Classes/Domain/Model/Task.php @@ -0,0 +1,378 @@ +clientTaskUid; + } + + /** + * Set the uid of the task on the client system. + * + * @param int $clientTaskUid The uid of the tasks on the client system. + * + * @return void + */ + public function setClientTaskUid(int $clientTaskUid): void + { + $this->clientTaskUid = $clientTaskUid; + } + + /** + * Get the task description. + * + * @return string + */ + public function getDescription(): string + { + return $this->description; + } + + /** + * Set the task description. + * + * @param string $description The task description. + * + * @return void + */ + public function setDescription(string $description): void + { + $this->description = $description; + } + + /** + * Get the next execution timestamp + * + * @return int + */ + public function getNextexecution(): int + { + return $this->nextexecution; + } + + /** + * Set the next execution timestamp + * + * @param int $nextexecution The next execution timestamp + * + * @return void + */ + public function setNextexecution(int $nextexecution): void + { + $this->nextexecution = $nextexecution; + } + + /** + * Get the last execution timestamp + * + * @return int + */ + public function getLastexecution(): int + { + return $this->lastexecution; + } + + /** + * Set the last execution timestamp + * + * @param int $lastexecution The last execution timestamp + * + * @return void + */ + public function setLastexecution(int $lastexecution): void + { + $this->lastexecution = $lastexecution; + } + + /** + * Get the last execution failure error message + * + * @return string + */ + public function getLastexecutionFailure(): string + { + return $this->lastexecutionFailure; + } + + /** + * Set the last execution failure error message + * + * @param string $lastexecutionFailure The last execution failure error message + * + * @return void + */ + public function setLastexecutionFailure(string $lastexecutionFailure): void + { + $this->lastexecutionFailure = $lastexecutionFailure; + } + + /** + * Get the last execution context + * + * @return string + */ + public function getLastexecutionContext(): string + { + return $this->lastexecutionContext; + } + + /** + * Set the last execution context + * + * @param string $lastexecutionContext The last execution context + * + * @return void + */ + public function setLastexecutionContext(string $lastexecutionContext): void + { + $this->lastexecutionContext = $lastexecutionContext; + } + + /** + * Get the class + * + * @return string + */ + public function getClass(): string + { + return $this->class; + } + + /** + * Set the class + * + * @param string $class The task class + * + * @return void + */ + public function setClass(string $class): void + { + $this->class = $class; + } + + /** + * Get the multiple + * + * @return bool + */ + public function getMultiple(): bool + { + return $this->multiple; + } + + /** + * Set the multiple + * + * @param bool $multiple The task multiple + * + * @return void + */ + public function setMultiple(bool $multiple): void + { + $this->multiple = $multiple; + } + + /** + * Get the type + * + * @return int + */ + public function gettype(): int + { + return $this->type; + } + + /** + * Set the type + * + * @param int $type The task type + * + * @return void + */ + public function setType(int $type): void + { + $this->type = $type; + } + + /** + * Get the frequency + * + * @return string + */ + public function getFrequency(): string + { + return $this->frequency; + } + + /** + * Set the frequency + * + * @param string $frequency The task frequency + * + * @return void + */ + public function setFrequency(string $frequency): void + { + $this->frequency = $frequency; + } + + /** + * Get the attached client + * + * @return Client + */ + public function getClient(): Client + { + return $this->client; + } + + /** + * Set the attached client + * + * @param Client $client The attached client + * + * @return void + */ + public function setClient(Client $client): void + { + $this->client = $client; + } + + /** + * Explodes the class name and returns the last part + * + * @return string The last class part + */ + public function getClassShort(): string + { + $parts = explode('\\', $this->class); + return end($parts); + } + + /** + * Get whether the task is late or not + * + * @return bool + */ + public function getLate() + { + return $this->late; + } + + /** + * Set whether the task is late or not + * + * @param bool $late Whether the task is late or not + * + * @return self + */ + public function setLate(bool $late) + { + $this->late = $late; + + return $this; + } +} diff --git a/Classes/Domain/Repository/TaskRepository.php b/Classes/Domain/Repository/TaskRepository.php new file mode 100644 index 0000000..e0699a3 --- /dev/null +++ b/Classes/Domain/Repository/TaskRepository.php @@ -0,0 +1,89 @@ +setDefaultOrderings(['client' => QueryInterface::ORDER_ASCENDING]); + } + + /** + * Function returns all tasks for a specific clientId + * + * @param integer $clientId The id of the desired client + * + * @return array The tasks of this client + */ + public function findByClientId(int $clientId) + { + $query = $this->getQuery(); + $query->matching($query->equals('client', intval($clientId))); + $tasks = $query->execute()->toArray(); + return $tasks; + } + + /** + * Method returns the overall task status for a given client. + * Depending on the Function checks the overall task status. + * Depending on the tasks following return values are valid: + * - 0: All tasks are ok + * - 1: At least 1 task is late, no task is failing + * - 2: At least 1 task is failing + * + * @param integer $clientId + * @return void + */ + public function getTaskStatusForClientId(int $clientId) + { + $lateCount = 0; + $errorCount = 0; + + $query = $this->getQuery(); + $query->matching( + $query->logicalAnd( + $query->equals('client', intval($clientId)), + $query->logicalOr([ + $query->equals('late', 1), + $query->logicalNot($query->equals('lastexecution_failure', '')) + ]) + ) + ); + $errorTasks = $query->execute()->toArray(); + + if ($errorTasks) { + foreach ($errorTasks as $errorTask) { + if ($errorTask->getLate() == 1) { + $lateCount++; + } + if ($errorTask->getLastexecutionFailure() != '') { + $errorCount++; + } + } + + if ($errorCount) { + return 2; // Overall: Error + } + + if ($lateCount) { + return 1; // Overall: Warning + } + } else { + $query = $this->getQuery(); + $taskCount = $query->matching($query->equals('client', intval($clientId)))->count(); + if ($taskCount) { + return 3; // Overall: Ok + } + } + return 0; // OVerall: Empty + } +} diff --git a/Classes/Service/Import/ClientImport.php b/Classes/Service/Import/ClientImport.php index e88f1da..9dcb677 100644 --- a/Classes/Service/Import/ClientImport.php +++ b/Classes/Service/Import/ClientImport.php @@ -40,6 +40,9 @@ class ClientImport extends BaseImport /** @var EmailNotification */ protected $emailNotification; + /** @var TaskImport */ + protected $taskImporter = null; + /** * Constructor */ @@ -47,6 +50,7 @@ public function __construct() { $this->coreVersions = $this->getAllCoreVersions(); $this->emailNotification = GeneralUtility::makeInstance(EmailNotification::class); + $this->taskImporter = GeneralUtility::makeInstance(TaskImport::class); parent::__construct(); } @@ -131,6 +135,11 @@ protected function importSingleClient(array $row) ->getConnectionForTable(self::TABLE); $connection->update(self::TABLE, $update, ['uid' => (int)$row['uid']]); + // Import tasks --> if no json for tasks is given, only deletions + if ($json['tasks']) { + $this->taskImporter->importTasks($row, $json['tasks']); + } + $this->responseCount['success']++; } catch (Exception $e) { $this->handleError($row, $e); @@ -165,7 +174,8 @@ protected function handleError(array $client, Exception $error) $connection = GeneralUtility::makeInstance(ConnectionPool::class) ->getConnectionForTable(self::TABLE); - $connection->update(self::TABLE, + $connection->update( + self::TABLE, [ 'error_message' => $error->getMessage(), 'error_count' => $client['error_count'] + 1 @@ -246,9 +256,9 @@ protected function handleExtensionRelations($client, array $extensions = []) $whereClause = []; foreach ($extensions as $key => $data) { $whereClause[] = $queryBuilder->expr()->andX( - $queryBuilder->expr()->eq('version', $queryBuilder->createNamedParameter($data['version'])), - $queryBuilder->expr()->eq('name', $queryBuilder->createNamedParameter($key)) - ); + $queryBuilder->expr()->eq('version', $queryBuilder->createNamedParameter($data['version'])), + $queryBuilder->expr()->eq('name', $queryBuilder->createNamedParameter($key)) + ); } $existingExtensions = $queryBuilder diff --git a/Classes/Service/Import/TaskImport.php b/Classes/Service/Import/TaskImport.php new file mode 100644 index 0000000..fc41760 --- /dev/null +++ b/Classes/Service/Import/TaskImport.php @@ -0,0 +1,109 @@ + $client The client + * @param array ?$importTasks The client's scheduled tasks + * + * @return void + */ + public function importTasks(array $client, ?array $importTasks): void + { + $currentTasks = $this->getTasksForClient($client['uid']); + + $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(self::TABLE); + $connection->beginTransaction(); + try { + foreach ($importTasks as $importTask) { + $importTask['lastexecution'] = $importTask['lastexecution_time']; + unset($importTask['lastexecution_time']); + + $importTask['pid'] = $this->emConfiguration->getPid(); + + $importTask['client_task_uid'] = $importTask['uid']; + $importTask['tstamp'] = $GLOBALS['EXEC_TIME']; + $importTask['client'] = $client['uid']; + + if (isset($currentTasks[$importTask['uid']])) { + $importTaskUid = $importTask['uid']; + unset($importTask['uid']); + $connection->update( + self::TABLE, + $importTask, + [ + 'uid' => $currentTasks[$importTaskUid], + 'client' => $client['uid'] + ], + ); + unset($currentTasks[$importTaskUid]); + } else { + unset($importTask['uid']); + $importTask['crdate'] = $GLOBALS['EXEC_TIME']; + $connection->insert( + self::TABLE, + $importTask + ); + } + } + foreach ($currentTasks as $deleteTaskUid) { + $connection->delete( + self::TABLE, + ['uid' => (int)$deleteTaskUid], + [Connection::PARAM_INT] + ); + } + $connection->commit(); + } catch (\Exception $e) { + $connection->rollBack(); + throw $e; + } + } + + /** + * Returns the the uid and the client_task_uid of all tasks of + * a specific client. + * + * @param int $clientUid The uid of the client + * + * @return array Array holding the UIDs of the tasks in this database + */ + private function getTasksForClient(int $clientUid): array + { + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE); + $statement = $queryBuilder + ->select('uid', 'client_task_uid') + ->from(self::TABLE) + ->where( + $queryBuilder->expr()->eq('deleted', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)), + $queryBuilder->expr()->eq('client', $queryBuilder->createNamedParameter(intval($clientUid, \PDO::PARAM_INT))) + ) + ->execute(); + + if (is_object($statement)) { + $rows = $statement->fetchAll(); + $currentTasks = []; + foreach ($rows as $row) { + $currentTasks[$row['client_task_uid']] = $row['uid']; + } + return $currentTasks; + } + return []; + } +} diff --git a/Configuration/TCA/tx_t3monitoring_domain_model_client.php b/Configuration/TCA/tx_t3monitoring_domain_model_client.php index 180eb2e..6a0ce3c 100644 --- a/Configuration/TCA/tx_t3monitoring_domain_model_client.php +++ b/Configuration/TCA/tx_t3monitoring_domain_model_client.php @@ -33,7 +33,6 @@ 'paletteExtensions' => ['showitem' => 'extensions, --linebreak--, insecure_extensions, outdated_extensions,'], 'paletteDomain' => ['showitem' => 'domain, secret, --linebreak--, basic_auth_username, basic_auth_password, host_header, --linebreak--, ignore_cert_errors, force_ip_resolve'], 'paletteVersions' => ['showitem' => 'php_version, mysql_version'], - 'paletteDiskSpace' => ['showitem' => 'disk_total_space, disk_free_space'], ], 'columns' => [ 'hidden' => [ @@ -295,6 +294,6 @@ 'foreign_table' => 'tx_t3monitoring_domain_model_core', 'minitems' => 0, ], - ], + ] ], ]; diff --git a/Configuration/TCA/tx_t3monitoring_domain_model_task.php b/Configuration/TCA/tx_t3monitoring_domain_model_task.php new file mode 100644 index 0000000..1d6aaa3 --- /dev/null +++ b/Configuration/TCA/tx_t3monitoring_domain_model_task.php @@ -0,0 +1,148 @@ + [ + 'title' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task', + 'label' => 'description', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'delete' => 'deleted', + 'searchFields' => 'description, lastexecution_failure', + 'iconfile' => 'EXT:t3monitoring/Resources/Public/Icons/tx_t3monitoring_domain_model_task.svg', + ], + 'interface' => [ + 'showRecordFieldList' => 'client_task_uid, description, nextexecution, lastexecution, lastexecution_failure, lastexecution_context, class, multiple, type, frequency, client, late', + ], + 'types' => [ + '1' => [ + 'showitem' => 'client_task_uid, description, nextexecution, lastexecution, lastexecution_failure, lastexecution_context, class, multiple, type, frequency, client, late'], + ], + 'columns' => [ + 'client_task_uid' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.client_task_uid', + 'config' => [ + 'type' => 'input', + 'size' => 10, + 'eval' => 'trim,required', + 'readOnly' => 'true' + ], + ], + 'description' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.description', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'text', + 'default' => '', + 'enableRichtext' => 'false' + ], + ], + 'nextexecution' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.nextexecution', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'size' => 10, + 'default' => 0, + 'eval' => 'datetime' + ], + ], + 'lastexecution' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.lastexecution', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'size' => 10, + 'default' => 0, + 'eval' => 'datetime' + ], + ], + 'lastexecution_failure' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.lastexecution_failure', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'text', + 'default' => '' + ], + ], + 'lastexecution_context' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.lastexecution_context', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'class' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.class', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'type' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.type', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'select', + 'renderType' => 'selectSingle', + 'items' => [ + ['LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.type.1:', '1'], + ['LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.type.2', '2'], + ], + ], + ], + 'frequency' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.frequency', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'client' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.client', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'tx_t3monitoring_domain_model_client', + 'minitems' => 1, + 'maxitems' => 1 + ], + ], + 'late' => [ + 'exclude' => false, + 'label' => 'LLL:EXT:t3monitoring/Resources/Private/Language/locallang.xlf:tx_t3monitoring_domain_model_task.late', + 'config' => [ + 'readOnly' => 'true', + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + '0' => [ + '0' => '', + '1' => 'late', + 'labelChecked' => 'Enabled', + 'labelUnchecked' => 'Disabled' + ] + ] + ] + ] + ], +]; diff --git a/README.rst b/README.rst index f4e1c15..dcb0b4b 100644 --- a/README.rst +++ b/README.rst @@ -8,6 +8,7 @@ This extensions provides the possibility to monitor all of your TYPO3 installati - used TYPO3 version and if it is up to date - available TYPO3 extensions and if those are installed, insecure or if there are bugfix, minor or major updates - additional information like PHP & Mysql versions. +- overview and status of the client's scheduled tasks **Requirements** diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index e518b02..7395704 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -87,6 +87,14 @@ Sla Sla + + Alert on late tasks? + Benachrichtigung bei verspäteten Tasks? + + + Alert on error tasks? + Benachrichtigung bei fehlerhaften Tasks? + Extension Extension @@ -587,6 +595,106 @@ The data of the client has been successfully fetched! Die Daten des Clients wurden erfolgreich abgerufen! + + Task + Task + + + Task uid on client + Uid des Task am Client + + + Task description + Task Beschreibung + + + Next execution + Nächste Ausführung + + + Last execution + Letzte Ausführung + + + Error occured on last execution + Fehler bei der letzten Ausführung + + + Last execution context + Context der letzten Ausführung + + + Class + Klasse + + + Allow paralell execution + Paralelle Ausführung + + + Type + Typ + + + Single + Einmalig + + + Recurring + Widerkehrend + + + Frequency + Frequenz + + + Late + Verspätet + + + Client + Client + + + Scheduled tasks + Geplante Tasks + + + No scheduled tasks found + Keine geplanten Tasks gefunden + + + Scheduled tasks + Geplante Tasks + + + Scheduled tasks (%s) + Geplante Tasks (%s) + + + Error + Error + + + OK + OK + + + Tasks + Tasks + + + Client task Uid + Client Task Uid + + + There are no tasks for this client. + Es gibt keine "Geplanten Tasks" für diesen Client. + + + Available tasks + Vorhandene Tasks + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index a1824c2..1357ad9 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -96,6 +96,12 @@ Tag + + Alert on late tasks? + + + Alert on error tasks? + Extension @@ -497,6 +503,81 @@ The data of the client has been successfully fetched! + + Task + + + Task uid on client + + + Task description + + + Next execution + + + Last execution + + + Error occured on last execution + + + Last execution context + + + Class + + + Allow paralell execution + + + Type + + + Single + + + Recurring + + + Frequency + + + Late + + + Client + + + Scheduled tasks + + + No scheduled tasks found + + + Scheduled tasks + + + Scheduled tasks (%s) + + + Error + + + OK + + + Tasks + + + Task + + + There are no tasks for this client. + + + Available tasks + diff --git a/Resources/Private/Partials/Task/Table.html b/Resources/Private/Partials/Task/Table.html new file mode 100644 index 0000000..8e305c0 --- /dev/null +++ b/Resources/Private/Partials/Task/Table.html @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + warninginfo + + + + + + + + + + + + + + +
{f:translate(key:'tx_t3monitoring_domain_model_client')}Uid{f:translate(key:'tx_t3monitoring_domain_model_task.class')}{f:translate(key:'tx_t3monitoring_domain_model_task.type')}{f:translate(key:'tx_t3monitoring_domain_model_task.description')}{f:translate(key:'tx_t3monitoring_domain_model_task.frequency')}{f:translate(key:'tx_t3monitoring_domain_model_task.lastexecution')}{f:translate(key:'tx_t3monitoring_domain_model_task.nextexecution')}
+ + + + + + + + + + + + + + + + + + + + + + + + {task.client.title} + + + + + {task.clientTaskUid} + + {task.classShort} + + + + + + + + + + + + + + + {task.description} + + {task.frequency} + + + + {task.lastexecution} ({task.lastexecutionContext}) + + + - + + + + {task.nextexecution} +
\ No newline at end of file diff --git a/Resources/Private/Templates/Client/Show.html b/Resources/Private/Templates/Client/Show.html index a47dec5..d3d6bfd 100644 --- a/Resources/Private/Templates/Client/Show.html +++ b/Resources/Private/Templates/Client/Show.html @@ -218,6 +218,20 @@

+ + + +
+
+ {f:translate(key:'client.show.tasks.available')} ({tasks -> f:count()}) +
+ +
+
+ + + +
diff --git a/Resources/Private/Templates/Statistic/Index.html b/Resources/Private/Templates/Statistic/Index.html index 68a5513..9a7a07b 100644 --- a/Resources/Private/Templates/Statistic/Index.html +++ b/Resources/Private/Templates/Statistic/Index.html @@ -308,9 +308,11 @@ {f:translate(key:'tx_t3monitoring_domain_model_client')} {f:translate(key:'tx_t3monitoring_domain_model_client.domain')} {f:translate(key:'tx_t3monitoring_domain_model_client.status')} + {f:translate(key:'task.status')} {f:translate(key:'tx_t3monitoring_domain_model_sla')} {f:translate(key:'tx_t3monitoring_domain_model_tag')} {f:translate(key:'tx_t3monitoring_domain_model_core')} + PHP - - - @@ -360,6 +362,22 @@ + + + + - + + + + + + + + + + + + @@ -383,9 +401,17 @@ - + {client.core.version} + QUICK AND DIRTY ;-) + + danger + danger + success + + {client.phpVersion} + + + + +

{f:translate(key:'task.header')}

+ + +
+
+ {f:translate(key:'task.total', arguments:'{0:\'{tasks -> f:count()}\'}')} +
+ +
+
+ +
+ {f:translate(key:'task.notFound')} +
+
+
+
\ No newline at end of file diff --git a/Resources/Public/Icons/tx_t3monitoring_domain_model_task.svg b/Resources/Public/Icons/tx_t3monitoring_domain_model_task.svg new file mode 100644 index 0000000..1179843 --- /dev/null +++ b/Resources/Public/Icons/tx_t3monitoring_domain_model_task.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ext_tables.php b/ext_tables.php index b90636b..62c067f 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -15,6 +15,7 @@ function () { 'Extension' => 'list, show', 'Sla' => 'list, show', 'Tag' => 'list, show', + 'Task' => 'list' ], [ 'access' => 'user,group', @@ -28,5 +29,6 @@ function () { \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_t3monitoring_domain_model_extension'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_t3monitoring_domain_model_sla'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_t3monitoring_domain_model_tag'); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_t3monitoring_domain_model_task'); } ); diff --git a/ext_tables.sql b/ext_tables.sql index e41727b..42f7457 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -33,6 +33,8 @@ CREATE TABLE tx_t3monitoring_domain_model_client ( core int(11) unsigned DEFAULT '0', sla int(11) unsigned DEFAULT '0', tag tinytext, + task_alert_late tinyint(4) unsigned DEFAULT '0' NOT NULL, + task_alert_error tinyint(4) unsigned DEFAULT '0' NOT NULL, tstamp int(11) unsigned DEFAULT '0' NOT NULL, crdate int(11) unsigned DEFAULT '0' NOT NULL, @@ -178,3 +180,22 @@ CREATE TABLE tx_t3monitoring_client_extension_mm ( KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) ); + +# +# Table structure for table 'tx_t3monitoring_domain_model_task' +# +CREATE TABLE tx_t3monitoring_domain_model_task ( + description text NOT NULL, + client_task_uid int(11) NOT NULL, + nextexecution int(11) DEFAULT '0' NOT NULL, + lastexecution int(11) DEFAULT '0' NOT NULL, + lastexecution_failure text NOT NULL, + lastexecution_context varchar(10) DEFAULT '' NOT NULL, + class varchar(255) DEFAULT '' NOT NULL, + multiple tinyint(4) unsigned DEFAULT '0' NOT NULL, + type varchar(50) DEFAULT '' NOT NULL, + frequency varchar(50) DEFAULT '' NOT NULL, + command varchar(255) DEFAULT '' NOT NULL, + client int(11) DEFAULT '0' NOT NULL, + late tinyint(1) unsigned DEFAULT '0' NOT NULL +); \ No newline at end of file