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-2016, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace hipanel\modules\hosting\grid; |
12
|
|
|
|
13
|
|
|
use hipanel\grid\ActionColumn; |
14
|
|
|
use hipanel\grid\BoxedGridView; |
15
|
|
|
use hipanel\grid\MainColumn; |
16
|
|
|
use hipanel\grid\RefColumn; |
17
|
|
|
use hipanel\grid\XEditableColumn; |
18
|
|
|
use hipanel\modules\hosting\widgets\backup\BackupGridRow; |
19
|
|
|
use hipanel\modules\hosting\widgets\db\State; |
20
|
|
|
use hipanel\modules\server\grid\ServerColumn; |
21
|
|
|
use Yii; |
22
|
|
|
|
23
|
|
|
class DbGridView extends BoxedGridView |
24
|
|
|
{ |
25
|
|
|
public function columns() |
26
|
|
|
{ |
27
|
|
|
return array_merge(parent::columns(), [ |
28
|
|
|
'name' => [ |
29
|
|
|
'class' => MainColumn::class, |
30
|
|
|
'format' => 'html', |
31
|
|
|
'attribute' => 'name', |
32
|
|
|
'filterAttribute' => 'name_like', |
33
|
|
|
], |
34
|
|
|
'state' => [ |
35
|
|
|
'class' => RefColumn::class, |
36
|
|
|
'i18nDictionary' => 'hipanel:hosting', |
37
|
|
|
'format' => 'raw', |
38
|
|
|
'value' => function ($model) { |
39
|
|
|
return State::widget(compact('model')); |
40
|
|
|
}, |
41
|
|
|
'gtype' => 'state,db', |
42
|
|
|
], |
43
|
|
|
'account' => [ |
44
|
|
|
'class' => AccountColumn::class, |
45
|
|
|
], |
46
|
|
|
'server' => [ |
47
|
|
|
'class' => ServerColumn::class, |
48
|
|
|
], |
49
|
|
|
'service_ip' => [ |
50
|
|
|
'filter' => false, |
51
|
|
|
], |
52
|
|
|
'description' => [ |
53
|
|
|
'class' => XEditableColumn::class, |
54
|
|
|
'pluginOptions' => [ |
55
|
|
|
'url' => 'set-description', |
56
|
|
|
], |
57
|
|
|
'filter' => true, |
58
|
|
|
'popover' => Yii::t('hipanel', 'Make any notes for your convenience'), |
59
|
|
|
], |
60
|
|
|
'password' => [ |
61
|
|
|
'class' => XEditableColumn::class, |
62
|
|
|
'pluginOptions' => [ |
63
|
|
|
'url' => 'set-password', |
64
|
|
|
], |
65
|
|
|
'filter' => true, |
66
|
|
|
'popover' => Yii::t('hipanel', 'Change password'), |
67
|
|
|
'value' => function () { |
68
|
|
|
return Yii::t('hipanel', 'Change password'); |
69
|
|
|
}, |
70
|
|
|
], |
71
|
|
|
'backups_widget' => [ |
72
|
|
|
'label' => Yii::t('hipanel:hosting', 'Backups'), |
73
|
|
|
'format' => 'raw', |
74
|
|
|
'value' => function ($model) { |
75
|
|
|
return BackupGridRow::widget(['model' => $model]); |
76
|
|
|
}, |
77
|
|
|
], |
78
|
|
|
'actions' => [ |
79
|
|
|
'class' => ActionColumn::class, |
80
|
|
|
'template' => '{view} {delete}', |
81
|
|
|
], |
82
|
|
|
]); |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|