| @@ 73-86 (lines=14) @@ | ||
| 70 | 'index' => [ |
|
| 71 | 'class' => IndexAction::class, |
|
| 72 | 'findOptions' => ['with_requests' => true, 'with_discounts' => true], |
|
| 73 | 'on beforePerform' => function (Event $event) { |
|
| 74 | /** @var \hipanel\actions\SearchAction $action */ |
|
| 75 | $action = $event->sender; |
|
| 76 | $dataProvider = $action->getDataProvider(); |
|
| 77 | $dataProvider->query->joinWith('ips'); |
|
| 78 | ||
| 79 | $dataProvider->query |
|
| 80 | ->andWhere(['with_ips' => 1]) |
|
| 81 | ->andWhere(['with_tariffs' => 1]) |
|
| 82 | ->andWhere(['with_switches' => 1]) |
|
| 83 | ->andWhere(['with_requests' => 1]) |
|
| 84 | ->andWhere(['with_discounts' => 1]) |
|
| 85 | ->select(['*']); |
|
| 86 | }, |
|
| 87 | 'filterStorageMap' => [ |
|
| 88 | 'name_like' => 'server.server.name', |
|
| 89 | 'ips' => 'hosting.ip.ip_in', |
|
| @@ 100-115 (lines=16) @@ | ||
| 97 | ], |
|
| 98 | 'view' => [ |
|
| 99 | 'class' => ViewAction::class, |
|
| 100 | 'on beforePerform' => function (Event $event) { |
|
| 101 | /** @var \hipanel\actions\SearchAction $action */ |
|
| 102 | $action = $event->sender; |
|
| 103 | $dataProvider = $action->getDataProvider(); |
|
| 104 | $dataProvider->query->joinWith('uses'); |
|
| 105 | $dataProvider->query->joinWith('ips'); |
|
| 106 | ||
| 107 | // TODO: ipModule is not wise yet. Redo |
|
| 108 | $dataProvider->query |
|
| 109 | ->andWhere(['with_requests' => 1]) |
|
| 110 | ->andWhere(['show_deleted' => 1]) |
|
| 111 | ->andWhere(['with_discounts' => 1]) |
|
| 112 | ->andWhere(['with_uses' => 1]) |
|
| 113 | ->andWhere(['with_ips' => 1]) |
|
| 114 | ->select(['*']); |
|
| 115 | }, |
|
| 116 | 'data' => function ($action) { |
|
| 117 | /** |
|
| 118 | * @var Action $action |
|