ChartOptions   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 9
dl 0
loc 19
c 0
b 0
f 0
ccs 0
cts 12
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A initDefaults() 0 14 1
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-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
/**
12
 * @see    http://hiqdev.com/hipanel-module-domain
13
 * @license http://hiqdev.com/hipanel-module-domain/license
14
 * @copyright Copyright (c) 2015 HiQDev
15
 */
16
17
namespace hipanel\modules\server\widgets;
18
19
use yii\helpers\ArrayHelper;
20
use yii\web\JsExpression;
21
22
/**
23
 * Class ChartOptions.
24
 */
25
class ChartOptions extends \hipanel\widgets\ChartOptions
26
{
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function initDefaults()
31
    {
32
        $id = $this->getId();
33
34
        parent::initDefaults();
35
36
        $this->ajaxOptions = ArrayHelper::merge([
37
            'beforeSend' => new JsExpression("function () {
38
                $('.{$id}').closest('.box').append($('<div>').addClass('overlay').html($('<i>').addClass('fa fa-refresh fa-spin')));
39
            }"),
40
            'complete' => new JsExpression("function () {
41
                $('.{$id}').closest('.box').find('.overlay').remove();
42
            }"),
43
        ], $this->ajaxOptions);
44
    }
45
}
46