66use League \Uri \Modifier ;
77use Symfony \Component \HttpFoundation \Request ;
88use Symfony \Component \PropertyAccess \PropertyAccessorInterface ;
9+ use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
910use Symfony \Component \Yaml \Yaml ;
1011
1112class ProcessOverviewHelper
1213{
1314 public function __construct (
1415 private readonly PropertyAccessorInterface $ propertyAccessor ,
1516 private readonly DataSourceHelper $ dataSourceHelper ,
17+ private readonly UrlGeneratorInterface $ urlGenerator ,
1618 ) {
1719 }
1820
@@ -33,7 +35,7 @@ public function getData(Request $request, ProcessOverview $overview): array
3335 $ query = [];
3436 }
3537 $ query += $ request ->query ->all ();
36- $ data = $ this ->dataSourceHelper ->getProcessRun ($ datasource , $ processId , $ query );
38+ $ data = $ this ->dataSourceHelper ->getProcessRuns ($ datasource , $ processId , $ query );
3739
3840 $ metadataColumns = [];
3941 $ metadataColumnsOptions = $ this ->getArrayValue ($ options , 'metadata_columns ' ) ?? [];
@@ -61,10 +63,27 @@ public function getData(Request $request, ProcessOverview $overview): array
6163 }
6264 $ rows [] = array_merge (
6365 array_map (
64- fn (array $ col ) => [
65- 'type ' => 'text ' ,
66- 'value ' => $ this ->getArrayValue ($ item , $ col ['data ' ]),
67- ],
66+ function (array $ col ) use ($ overview , $ item ) {
67+ $ value = $ this ->getArrayValue ($ item , $ col ['data ' ]);
68+ $ result = [
69+ 'type ' => 'text ' ,
70+ ];
71+
72+ if (isset ($ col ['mask ' ]['search ' ], $ col ['mask ' ]['replace ' ])) {
73+ $ value = @preg_replace ($ col ['mask ' ]['search ' ], $ col ['mask ' ]['replace ' ], $ value );
74+
75+ $ result ['raw_value_url ' ] = $ this ->urlGenerator ->generate ('process_overview_raw_data_field ' ,
76+ [
77+ 'group ' => $ overview ->getGroup ()->getId (),
78+ 'overview ' => $ overview ->getId (),
79+ 'run ' => $ item ['id ' ],
80+ 'field ' => $ col ['data ' ],
81+ ], UrlGeneratorInterface::ABSOLUTE_URL );
82+ }
83+ $ result ['value ' ] = $ value ;
84+
85+ return $ result ;
86+ },
6887 $ metadataColumns
6988 ),
7089 array_map (static fn (array $ step ) => $ step + ['type ' => 'step ' ], $ steps ),
@@ -101,6 +120,22 @@ public function getData(Request $request, ProcessOverview $overview): array
101120 }
102121 }
103122
123+ public function getRawRunFieldValue (Request $ request , ProcessOverview $ overview , string $ run , string $ field )
124+ {
125+ $ datasource = $ overview ->getDataSource ();
126+ $ processId = $ overview ->getProcessId ();
127+ if (empty ($ datasource ) || empty ($ processId )) {
128+ return [];
129+ }
130+
131+ $ data = $ this ->dataSourceHelper ->getProcessRun ($ datasource , $ processId , $ run );
132+
133+ return [
134+ 'field ' => $ field ,
135+ 'value ' => $ this ->getArrayValue ($ data , $ field ),
136+ ];
137+ }
138+
104139 private function getArrayValue (array $ array , string $ key ): mixed
105140 {
106141 $ propertyPath = '[ ' .str_replace ('. ' , '][ ' , $ key ).'] ' ;
0 commit comments