Completed
Push — master ( 9fa729...e15551 )
by Dmitry
13:25
created

ServerRepresentations::fillRepresentations()   B

Complexity

Conditions 5
Paths 1

Size

Total Lines 50
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 50
rs 8.6315
c 1
b 0
f 0
cc 5
eloc 41
nc 1
nop 0
1
<?php
2
/**
3
 * Server module for HiPanel.
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\grid;
12
13
14
use hiqdev\higrid\representations\RepresentationCollection;
15
use Yii;
16
17
class ServerRepresentations extends RepresentationCollection
18
{
19
    protected function fillRepresentations()
20
    {
21
        $this->representations = array_filter([
22
            'common' => [
23
                'label'   => Yii::t('hipanel', 'common'),
24
                'columns' => [
25
                    'checkbox',
26
                    'actions',
27
                    'server', 'client_like', 'seller_id',
28
                    'ips', 'state', 'expires',
29
                    'tariff_and_discount',
30
                ],
31
            ],
32
            'short' => Yii::$app->user->can('support') ? [
33
                'label'   => Yii::t('hipanel:server', 'short'),
34
                'columns' => [
35
                    'checkbox',
36
                    'actions',
37
                    'ips', 'client', 'dc', 'server', 'order_no',
38
                ],
39
            ] : null,
40
            'hardware' => Yii::$app->user->can('support') ? [
41
                'label'   => Yii::t('hipanel:server', 'hardware'),
42
                'columns' => [
43
                    'checkbox',
44
                    'actions',
45
                    'rack', 'client', 'dc', 'server', 'hwsummary',
46
                ],
47
            ] : null,
48
            'manager' => Yii::$app->user->can('support') ? [
49
                'label'   => Yii::t('hipanel:server', 'manager'),
50
                'columns' => [
51
                    'checkbox',
52
                    'actions',
53
                    'client_like',
54
                    'rack', 'server', 'tariff',
55
                    'hwsummary', 'nums'
56
                ],
57
            ] : null,
58
            'admin' => Yii::$app->user->can('support') ? [
59
                'label'   => Yii::t('hipanel:server', 'admin'),
60
                'columns' => [
61
                    'checkbox',
62
                    'actions',
63
                    'dc', 'server', 'type',
64
                    'net', 'kvm', 'ipmi', 'pdu', 'ip', 'mac',
65
                ],
66
            ] : null,
67
        ]);
68
    }
69
}
70