Completed
Push — master ( 92156c...43c17e )
by Andrii
25:32 queued 10:20
created

AggregateGridView::columns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 45

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 45
rs 9.2
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\hosting\grid;
12
13
use hipanel\grid\BoxedGridView;
14
use hipanel\grid\DataColumn;
15
use hipanel\grid\MainColumn;
16
use hipanel\grid\RefColumn;
17
use hipanel\grid\XEditableColumn;
18
use hipanel\modules\hosting\menus\AggregateActionsMenu;
19
use hiqdev\yii2\menus\grid\MenuColumn;
20
use Yii;
21
22
class AggregateGridView extends BoxedGridView
23
{
24
    public function columns()
25
    {
26
        return array_merge(parent::columns(), [
27
            'ip' => [
28
                'class' => MainColumn::class,
29
                'format' => 'html',
30
                'attribute' => 'ip',
31
                'filterAttribute' => 'ip_like',
32
            ],
33
            'state' => [
34
                'class' => RefColumn::class,
35
                'i18nDictionary' => 'hipanel.hosting.ipam',
36
                'format' => 'raw',
37
                'gtype' => 'state,ip',
38
            ],
39
            'type' => [
40
                'class' => RefColumn::class,
41
                'i18nDictionary' => 'hipanel.hosting.ipam',
42
                'format' => 'raw',
43
                'gtype' => 'type,ip',
44
            ],
45
            'rir' => [
46
                'class' => RefColumn::class,
47
                'i18nDictionary' => 'hipanel.hosting.ipam',
48
                'format' => 'raw',
49
                'gtype' => 'type,ip_rir',
50
            ],
51
            'note' => [
52
                'class' => XEditableColumn::class,
53
                'pluginOptions' => [
54
                    'url' => 'set-note',
55
                ],
56
                'filter' => true,
57
                'popover' => Yii::t('hipanel', 'Make any notes for your convenience'),
58
            ],
59
            'utilization' => [
60
                'class' => UtilizationColumn::class,
61
            ],
62
            'actions' => [
63
                'class' => MenuColumn::class,
64
                'contentOptions' => ['style' => 'width: 1%; white-space:nowrap;'],
65
                'menuClass' => AggregateActionsMenu::class,
66
            ],
67
        ]);
68
    }
69
}
70