Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Integrate checks #168

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Classes/Controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use T3Monitor\T3monitoring\Domain\Model\Dto\ClientFilterDemand;
use T3Monitor\T3monitoring\Domain\Model\Dto\EmMonitoringConfiguration;
use T3Monitor\T3monitoring\Domain\Repository\CheckResultRepository;
use T3Monitor\T3monitoring\Domain\Repository\ClientRepository;
use T3Monitor\T3monitoring\Domain\Repository\CoreRepository;
use T3Monitor\T3monitoring\Domain\Repository\StatisticRepository;
Expand Down Expand Up @@ -39,6 +40,9 @@ class BaseController extends ActionController
/** @var StatisticRepository */
protected $statisticRepository;

/** @var CheckResultRepository */
protected $checkResultRepository;

/** @var ClientRepository */
protected $clientRepository;

Expand Down Expand Up @@ -67,6 +71,7 @@ public function initializeAction()
{
$this->statisticRepository = $this->objectManager->get(StatisticRepository::class);
$this->filterDemand = $this->objectManager->get(ClientFilterDemand::class);
$this->checkResultRepository = $this->objectManager->get(CheckResultRepository::class);
$this->clientRepository = $this->objectManager->get(ClientRepository::class);
$this->coreRepository = $this->objectManager->get(CoreRepository::class);
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
Expand Down
3 changes: 3 additions & 0 deletions Classes/Controller/StatisticController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function indexAction(ClientFilterDemand $filter = null)
$outdatedExtensionDemand = $this->getClientFilterDemand()->setWithOutdatedExtensions(true);
$clientsWithWarningInfo = $this->getClientFilterDemand()->setWithExtraWarning(true);
$clientsWithDangerInfo = $this->getClientFilterDemand()->setWithExtraDanger(true);
$clientsWithMissingProviderData = $this->getClientFilterDemand()->setWithMissingProviderData(true);
$emptyClientDemand = $this->getClientFilterDemand();

$feedItems = null;
Expand All @@ -97,9 +98,11 @@ public function indexAction(ClientFilterDemand $filter = null)
'clientsWithOutdatedCore' => $this->clientRepository->countByDemand($outdatedCoreDemand),
'clientsWithWarningInfo' => $this->clientRepository->countByDemand($clientsWithWarningInfo),
'clientsWithDangerInfo' => $this->clientRepository->countByDemand($clientsWithDangerInfo),
'clientsWithMissingProviderData' => $this->clientRepository->countByDemand($clientsWithMissingProviderData),
'numberOfClients' => $this->clientRepository->countAll(),
'slaVersions' => $this->slaRepository->findAll(),
'tagVersions' => $this->tagRepository->findAll(),
'rules' => $this->checkResultRepository->findAllWithFailCount(),
'feedItems' => $feedItems,
'importTimes' => [
'client' => $this->registry->get('t3monitoring', 'importClient'),
Expand Down
110 changes: 110 additions & 0 deletions Classes/Domain/Model/Check.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php
namespace T3Monitor\T3monitoring\Domain\Model;

class Check extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var string
*/
protected $title;

/**
* @var string
*/
protected $type;

/**
* @var string
*/
protected $argument;

/**
* @var string
*/
protected $operator;

/**
* @var string
*/
protected $value;

/**
* @return string
*/
public function getTitle(): string
{
return $this->title;
}

/**
* @param string $title
*/
public function setTitle(string $title)
{
$this->title = $title;
}

/**
* @return string
*/
public function getType(): string
{
return $this->type;
}

/**
* @param string $type
*/
public function setType(string $type)
{
$this->type = $type;
}

/**
* @return string
*/
public function getArgument(): string
{
return $this->argument;
}

/**
* @param string $argument
*/
public function setArgument(string $argument)
{
$this->argument = $argument;
}

/**
* @return string
*/
public function getOperator(): string
{
return $this->operator;
}

/**
* @param string $operator
*/
public function setOperator(string $operator)
{
$this->operator = $operator;
}

/**
* @return string
*/
public function getValue(): string
{
return $this->value;
}

/**
* @param string $value
*/
public function setValue(string $value)
{
$this->value = $value;
}
}
85 changes: 85 additions & 0 deletions Classes/Domain/Model/CheckResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php
namespace T3Monitor\T3monitoring\Domain\Model;

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

class CheckResult extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var \T3Monitor\T3monitoring\Domain\Model\Client
*/
protected $client;

/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3Monitor\T3monitoring\Domain\Model\Rule>
*/
protected $failedRules;

/**
* @var bool
*/
protected $missingProviderData;

public function __construct()
{
$this->failedRules = GeneralUtility::makeInstance(ObjectStorage::class);
}

/**
* @return Client
*/
public function getClient()
{
return $this->client;
}

/**
* @param int $client
*/
public function setClient($client)
{
$this->client = $client;
}

/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3Monitor\T3monitoring\Domain\Model\Rule> failedRules
*/
public function getFailedRules()
{
return $this->failedRules;
}

/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3Monitor\T3monitoring\Domain\Model\Rule> $failedRules
* @return void
*/
public function setFailedRules(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $failedRules)
{
$this->failedRules = $failedRules;
}

/**
* @param \T3Monitor\T3monitoring\Domain\Model\Rule
*/
public function addFailedRule(Rule $failedRule)
{
$this->failedRules->attach($failedRule);
}

/**
* @return bool
*/
public function getMissingProviderData()
{
return $this->missingProviderData;
}

/**
* @param bool $missingProviderData
*/
public function setMissingProviderData(bool $missingProviderData)
{
$this->missingProviderData = $missingProviderData;
}
}
21 changes: 21 additions & 0 deletions Classes/Domain/Model/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ class Client extends AbstractEntity
*/
protected $lastSuccessfulImport = null;

/**
* @var \T3Monitor\T3monitoring\Domain\Model\CheckResult
*/
protected $checkResult;

/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3Monitor\T3monitoring\Domain\Model\Extension>
* @lazy
Expand Down Expand Up @@ -772,4 +777,20 @@ public function getExtraDangerAsArray()
}
return [];
}

/**
* @return \T3Monitor\T3monitoring\Domain\Model\CheckResult
*/
public function getCheckResult()
{
return $this->checkResult;
}

/**
* @param \T3Monitor\T3monitoring\Domain\Model\CheckResult $checkResult
*/
public function setCheckResult(CheckResult $checkResult)
{
$this->checkResult = $checkResult;
}
}
39 changes: 39 additions & 0 deletions Classes/Domain/Model/Dto/ClientFilterDemand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ class ClientFilterDemand extends AbstractEntity
/** @var bool */
protected $withEmailAddress;

/** @var int */
protected $withFailedRule;

/** @var bool */
protected $withMissingProviderData;

/**
* @return string
*/
Expand Down Expand Up @@ -288,4 +294,37 @@ public function setWithEmailAddress($withEmailAddress)
$this->withEmailAddress = $withEmailAddress;
return $this;
}

/**
* @return int
*/
public function isWithFailedRule()
{
return $this->withFailedRule;
}

/**
* @param int $withFailedRule
*/
public function setWithFailedRule($withFailedRule)
{
$this->withFailedRule = $withFailedRule;
}

/**
* @return bool
*/
public function isWithMissingProviderData()
{
return $this->withMissingProviderData;
}

/**
* @param bool $withMissingProviderData
*/
public function setWithMissingProviderData($withMissingProviderData)
{
$this->withMissingProviderData = $withMissingProviderData;
return $this;
}
}
Loading