1212use CodeRhapsodie \EzDataflowBundle \Gateway \ScheduledDataflowGateway ;
1313use Doctrine \DBAL \Query \QueryBuilder ;
1414use eZ \Publish \Core \MVC \Symfony \Security \Authorization \Attribute ;
15- use EzSystems \EzPlatformAdminUi \Notification \NotificationHandlerInterface ;
1615use EzSystems \EzPlatformAdminUiBundle \Controller \Controller ;
1716use Pagerfanta \Adapter \DoctrineDbalAdapter ;
1817use Pagerfanta \Pagerfanta ;
@@ -27,15 +26,12 @@ class DashboardController extends Controller
2726{
2827 /** @var JobGateway */
2928 private $ jobGateway ;
30- /** @var NotificationHandlerInterface */
31- private $ notificationHandler ;
3229 /** @var ScheduledDataflowGateway */
3330 private $ scheduledDataflowGateway ;
3431
35- public function __construct (JobGateway $ jobGateway , NotificationHandlerInterface $ notificationHandler , ScheduledDataflowGateway $ scheduledDataflowGateway )
32+ public function __construct (JobGateway $ jobGateway , ScheduledDataflowGateway $ scheduledDataflowGateway )
3633 {
3734 $ this ->jobGateway = $ jobGateway ;
38- $ this ->notificationHandler = $ notificationHandler ;
3935 $ this ->scheduledDataflowGateway = $ scheduledDataflowGateway ;
4036 }
4137
@@ -108,9 +104,11 @@ public function getOneshotPage(Request $request): Response
108104 public function history (Request $ request ): Response
109105 {
110106 $ this ->denyAccessUnlessGranted (new Attribute ('ezdataflow ' , 'view ' ));
107+ $ filter = (int ) $ request ->query ->get ('filter ' , JobGateway::FILTER_NONE );
111108
112109 return $ this ->render ('@ezdesign/ezdataflow/Dashboard/history.html.twig ' , [
113- 'pager ' => $ this ->getPager ($ this ->jobGateway ->getListQueryForAdmin (), $ request ),
110+ 'pager ' => $ this ->getPager ($ this ->jobGateway ->getListQueryForAdmin ($ filter ), $ request ),
111+ 'filter ' => $ filter ,
114112 ]);
115113 }
116114
@@ -120,9 +118,11 @@ public function history(Request $request): Response
120118 public function getHistoryPage (Request $ request ): Response
121119 {
122120 $ this ->denyAccessUnlessGranted (new Attribute ('ezdataflow ' , 'view ' ));
121+ $ filter = (int ) $ request ->query ->get ('filter ' , JobGateway::FILTER_NONE );
123122
124123 return $ this ->render ('@ezdesign/ezdataflow/Dashboard/history.html.twig ' , [
125- 'pager ' => $ this ->getPager ($ this ->jobGateway ->getListQueryForAdmin (), $ request ),
124+ 'pager ' => $ this ->getPager ($ this ->jobGateway ->getListQueryForAdmin ($ filter ), $ request ),
125+ 'filter ' => $ filter ,
126126 ]);
127127 }
128128
@@ -143,6 +143,7 @@ private function getPager(QueryBuilder $query, Request $request): Pagerfanta
143143 {
144144 $ pager = new Pagerfanta (new DoctrineDbalAdapter ($ query , function ($ queryBuilder ) {
145145 return $ queryBuilder ->select ('COUNT(DISTINCT id) AS total_results ' )
146+ ->resetQueryPart ('orderBy ' )
146147 ->setMaxResults (1 );
147148 }));
148149 $ pager ->setMaxPerPage (20 );
0 commit comments