@@ 18-51 (lines=34) @@ | ||
15 | use hipanel\filters\EasyAccessControl; |
|
16 | use yii\base\Event; |
|
17 | ||
18 | class RrdController extends CrudController |
|
19 | { |
|
20 | public function behaviors() |
|
21 | { |
|
22 | return array_merge(parent::behaviors(), [ |
|
23 | [ |
|
24 | 'class' => EasyAccessControl::class, |
|
25 | 'actions' => [ |
|
26 | '*' => 'server.read', |
|
27 | ], |
|
28 | ], |
|
29 | ]); |
|
30 | } |
|
31 | ||
32 | public function actions() |
|
33 | { |
|
34 | return [ |
|
35 | 'view' => [ |
|
36 | 'class' => IndexAction::class, |
|
37 | 'on beforePerform' => function (Event $event) { |
|
38 | /** @var \hipanel\actions\SearchAction $action */ |
|
39 | $action = $event->sender; |
|
40 | $dataProvider = $action->getDataProvider(); |
|
41 | $dataProvider->query->joinWith('images'); |
|
42 | $dataProvider->query->joinWith('server'); |
|
43 | $dataProvider->pagination = false; |
|
44 | }, |
|
45 | 'collection' => [ |
|
46 | 'formName' => '', |
|
47 | ], |
|
48 | ], |
|
49 | ]; |
|
50 | } |
|
51 | } |
|
52 |
@@ 18-51 (lines=34) @@ | ||
15 | use hipanel\filters\EasyAccessControl; |
|
16 | use yii\base\Event; |
|
17 | ||
18 | class SwitchGraphController extends CrudController |
|
19 | { |
|
20 | public function behaviors() |
|
21 | { |
|
22 | return array_merge(parent::behaviors(), [ |
|
23 | [ |
|
24 | 'class' => EasyAccessControl::class, |
|
25 | 'actions' => [ |
|
26 | '*' => 'server.read', |
|
27 | ], |
|
28 | ], |
|
29 | ]); |
|
30 | } |
|
31 | ||
32 | public function actions() |
|
33 | { |
|
34 | return [ |
|
35 | 'view' => [ |
|
36 | 'class' => IndexAction::class, |
|
37 | 'on beforePerform' => function (Event $event) { |
|
38 | /** @var \hipanel\actions\SearchAction $action */ |
|
39 | $action = $event->sender; |
|
40 | $dataProvider = $action->getDataProvider(); |
|
41 | $dataProvider->query->joinWith('images'); |
|
42 | $dataProvider->query->joinWith('server'); |
|
43 | $dataProvider->pagination = false; |
|
44 | }, |
|
45 | 'collection' => [ |
|
46 | 'formName' => '', |
|
47 | ], |
|
48 | ], |
|
49 | ]; |
|
50 | } |
|
51 | } |
|
52 |