Completed
Push — master ( 82e6a4...a94b7d )
by Klochok
11:17
created

HubGridView   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 8
Bugs 0 Features 0
Metric Value
wmc 1
c 8
b 0
f 0
lcom 0
cbo 3
dl 0
loc 71
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A columns() 0 68 1
1
<?php
2
3
namespace hipanel\modules\server\grid;
4
5
use hipanel\grid\RefColumn;
6
use hipanel\modules\client\grid\ClientColumn;
7
use hipanel\modules\server\menus\HubActionsMenu;
8
use hiqdev\yii2\menus\grid\MenuColumn;
9
use Yii;
10
use yii\helpers\Html;
11
12
class HubGridView extends \hipanel\grid\BoxedGridView
13
{
14
    public function columns()
15
    {
16
        return array_merge(parent::columns(), [
0 ignored issues
show
Bug introduced by
The method columns() does not exist on hipanel\grid\BoxedGridView. Did you maybe mean column()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
17
            'inn' => [
18
                'enableSorting' => false,
19
            ],
20
            'model' => [
21
                'enableSorting' => false,
22
            ],
23
            'ip' => [
24
                'enableSorting' => false,
25
            ],
26
            'mac' => [
27
                'enableSorting' => false,
28
            ],
29
            'actions' => [
30
                'class' => MenuColumn::class,
31
                'menuClass' => HubActionsMenu::class,
32
            ],
33
            'traf_server_id' => [
34
                'format' => 'html',
35
                'enableSorting' => false,
36
                'value' => function ($model) {
37
                    return Html::a($model->traf_server_id_label, ['@server/view', 'id' => $model->traf_server_id]);
38
                }
39
            ],
40
            'vlan_server_id' => [
41
                'format' => 'html',
42
                'enableSorting' => false,
43
                'value' => function ($model) {
44
                    return Html::a($model->vlan_server_id_label, ['@server/view', 'id' => $model->vlan_server_id]);
45
                }
46
            ],
47
            'buyer' => [
48
                'label' => Yii::t('hipanel:server:hub', 'Buyer'),
49
                'class' => ClientColumn::class,
50
                'idAttribute' => 'buyer_id',
51
                'attribute' => 'buyer_id',
52
                'nameAttribute' => 'buyer',
53
                'enableSorting' => false,
54
55
            ],
56
            'switch' => [
57
                'format' => 'html',
58
                'enableSorting' => false,
59
                'label' => Yii::t('hipanel:server', 'Switch'),
60
                'value' => function ($model) {
61
                    $name = Html::tag('span', $model->name, ['class' => 'text-bold text-info']);
62
                    $note = Html::tag('small', $model->note, ['class' => 'text-muted']);
63
                    return sprintf('%s %s %s', $name, '', $note);
64
                }
65
            ],
66
            'type' => [
67
                'class' => RefColumn::class,
68
                'enableSorting' => false,
69
                'findOptions' => [
70
                    'select' => 'full',
71
                    'mapOptions' => ['from' => 'id', 'to' => 'label'],
72
                ],
73
                'attribute' => 'type_id',
74
                'i18nDictionary' => 'hipanel:server:hub',
75
                'gtype' => 'type,device,switch',
76
                'value' => function ($model) {
77
                    return Yii::t('hipanel:server:hub', $model->type_label);
78
                },
79
            ],
80
        ]);
81
    }
82
}
83