File tree Expand file tree Collapse file tree
app/administration/src/snippet Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace Frosh \FlowBuilder ;
44
5+ use Frosh \FlowBuilder \FroshTools \Checker \FlowExecutionErrorChecker ;
6+ use Frosh \Tools \Components \Health \Checker \CheckerInterface ;
57use Shopware \Core \Framework \Plugin ;
6- use Shopware \Core \Framework \Plugin \Context \ActivateContext ;
7- use Shopware \Core \Framework \Plugin \Context \DeactivateContext ;
8- use Shopware \Core \Framework \Plugin \Context \InstallContext ;
9- use Shopware \Core \Framework \Plugin \Context \UninstallContext ;
10- use Shopware \Core \Framework \Plugin \Context \UpdateContext ;
8+ use Symfony \Component \DependencyInjection \ContainerBuilder ;
9+ use Symfony \Component \DependencyInjection \Definition ;
1110
1211class FroshFlowBuilder extends Plugin
1312{
13+ public function build (ContainerBuilder $ container ): void
14+ {
15+ parent ::build ($ container );
16+
17+ if (interface_exists (CheckerInterface::class)) {
18+ $ definition = new Definition (FlowExecutionErrorChecker::class);
19+ $ definition ->setAutowired (true );
20+ $ definition ->setAutoconfigured (true );
21+
22+ $ container ->setDefinition (FlowExecutionErrorChecker::class, $ definition );
23+ }
24+ }
1425}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Frosh \FlowBuilder \FroshTools \Checker ;
4+
5+ use Doctrine \DBAL \Connection ;
6+ use Frosh \FlowBuilder \Subscriber \FlowSubscriber ;
7+ use Frosh \Tools \Components \Health \Checker \CheckerInterface ;
8+ use Frosh \Tools \Components \Health \Checker \HealthChecker \HealthCheckerInterface ;
9+ use Frosh \Tools \Components \Health \HealthCollection ;
10+ use Frosh \Tools \Components \Health \SettingsResult ;
11+
12+ class FlowExecutionErrorChecker implements CheckerInterface, HealthCheckerInterface
13+ {
14+
15+ public function __construct (
16+ private readonly Connection $ connection ,
17+ )
18+ {
19+ }
20+
21+ public function collect (HealthCollection $ collection ): void
22+ {
23+ $ numberOfFailedFlows = $ this ->connection ->fetchOne ('SELECT COUNT(*) FROM frosh_flow_state WHERE state = :errorState LIMIT 1; ' , [
24+ 'errorState ' => FlowSubscriber::FLOW_STATE_ERROR
25+ ]);
26+
27+ if ($ numberOfFailedFlows > 0 ) {
28+ $ collection ->add (
29+ SettingsResult::warning (
30+ 'flow-execution-failed ' ,
31+ 'Some flow executions have failed ' ,
32+ $ numberOfFailedFlows ,
33+ 0
34+ )
35+ );
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change 11{
2- "frosh-flow-builder" : {
3- "history" : {
4- "tabTitle" : " Verlauf" ,
5- "cardTitle" : " Verlauf" ,
6- "columns" : {
7- "executedAt" : " Ausgeführt am" ,
8- "status" : " Status" ,
9- "triggeredBy" : " Ausgelöst von"
10- },
11- "state" : {
12- "success" : " Erfolgreich" ,
13- "error" : " Fehlgeschlagen"
14- }
15- }
2+ "frosh-flow-builder" : {
3+ "history" : {
4+ "tabTitle" : " Verlauf" ,
5+ "cardTitle" : " Verlauf" ,
6+ "columns" : {
7+ "executedAt" : " Ausgeführt am" ,
8+ "status" : " Status" ,
9+ "triggeredBy" : " Ausgelöst von"
10+ },
11+ "state" : {
12+ "success" : " Erfolgreich" ,
13+ "error" : " Fehlgeschlagen"
14+ }
1615 }
16+ }
1717}
Original file line number Diff line number Diff line change 99 <prototype
1010 namespace =" Frosh\FlowBuilder\"
1111 resource =" ../../"
12+ exclude =" ../../FroshTools/"
1213 />
1314 </services >
1415</container >
You can’t perform that action at this time.
0 commit comments