From c9a958f4c0777c2ed83a8ab6a91affacb6ff7cd8 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Fri, 25 Mar 2016 17:09:04 +0200 Subject: [PATCH] Server RRD view page re-designed --- src/Plugin.php | 1 + src/views/rrd/_search.php | 58 +++++++++++++++------------------- src/views/rrd/view.php | 65 ++++++++++++++++++++++----------------- src/views/server/view.php | 4 +-- 4 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index 1149f1d4..a521db73 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -8,6 +8,7 @@ class Plugin extends \hiqdev\pluginmanager\Plugin 'aliases' => [ "@server" => "/server/server", "@rrd" => "/server/rrd", + "@switch-graph" => "/server/switch-graph", ], 'menus' => [ 'hipanel\modules\server\SidebarMenu', diff --git a/src/views/rrd/_search.php b/src/views/rrd/_search.php index 9c67c107..d9624289 100644 --- a/src/views/rrd/_search.php +++ b/src/views/rrd/_search.php @@ -3,48 +3,40 @@ /** * @var \hipanel\widgets\AdvancedSearch $search */ -use yii\helpers\Html; ?> field('id')->hiddenInput()->label(false) ?> -
- field('graph')->widget(\yii\bootstrap\ToggleButtonGroup::class, [ - 'type' => 'radio', - 'items' => array_merge(['' => Yii::t('hipanel/server/rrd', 'Index')], array_combine((array) $model->graphs, (array) $model->graphs)), - 'labelOptions' => [ - 'class' => 'btn btn-default' - ], - 'options' => [ - 'style' => 'display: block' - ] - ]) ?> -
- -
- field('period')->widget(\yii\bootstrap\ToggleButtonGroup::class, [ - 'type' => 'radio', - 'items' => ['1' => '1 min/px', '5' => '5 min/px', '60' => '1 hour/px', '720' => '12 hours/px'], - 'labelOptions' => [ - 'class' => 'btn btn-default', - ], - 'options' => [ - 'style' => 'display: block' - ] - ]) ?> -
-
- field('width') ?> -
-
- field('shift') ?> -
+
+ field('graph')->dropDownList( + array_merge(['' => Yii::t('hipanel/server/rrd', 'Index')], + array_combine((array)$model->graphs, (array)$model->graphs)), + ['class' => 'form-control input-sm'] + ) ?> +
+
+ field('period')->dropDownList( + [ + '1' => Yii::t('hipanel/server', '1 min/px'), + '5' => Yii::t('hipanel/server', '5 min/px'), + '60' => Yii::t('hipanel/server', '60 min/px'), + '720' => Yii::t('hipanel/server', '720 min/px'), + ], + ['class' => 'form-control input-sm'] + ) ?> +
+
+ field('width')->textInput(['placeholder' => '1081', 'class' => 'form-control input-sm']) ?> +
+
+ field('shift')->textInput(['placeholder' => '0', 'class' => 'form-control input-sm']) ?> +
getDivId(); $this->registerJs(<<params['pjax'], ['enablePushState' => true])); -$box = ActionBox::begin(['model' => $searchModel, 'dataProvider' => $dataProvider, 'bulk' => false]); +$box = ActionBox::begin([ + 'model' => $searchModel, + 'dataProvider' => $dataProvider, + 'bulk' => false, +]); echo $box->renderSearchForm(['model' => $model], [ 'id' => 'rrd-form', 'options' => [ 'displayNone' => false, ], - 'action' => ['@rrd/view', 'id' => $model->id] + 'action' => ['@rrd/view', 'id' => $model->id], + 'submitButtonWrapperOptions' => [ + 'class' => 'col-md-2 md-pt-20' + ], ]); -$box->end(); + echo GridView::widget([ + 'showHeader' => false, + 'options' => [ + 'class' => 'table-responsive' + ], + 'tableOptions' => [ + 'class' => 'table', + ], + 'summary' => false, + 'dataProvider' => new \yii\data\ArrayDataProvider([ + 'allModels' => $model->images, + 'pagination' => false, + 'sort' => false, + ]), + 'columns' => [ + [ + 'format' => 'raw', + 'value' => function ($model, $key, $index, $widget) { + $html = Html::tag('img', '', ['src' => 'data:image/png;base64,' . $model->base64]); -echo GridView::widget([ - 'showHeader' => false, - 'options' => [ - 'class' => 'table-responsive' - ], - 'tableOptions' => [ - 'class' => 'table', - ], - 'summary' => false, - 'dataProvider' => new \yii\data\ArrayDataProvider([ - 'allModels' => $model->images, - 'pagination' => false, - 'sort' => false, - ]), - 'columns' => [ - [ - 'format' => 'raw', - 'value' => function ($model, $key, $index, $widget) { - $html = Html::tag('img', '', ['src' => 'data:image/png;base64,' . $model->base64]); + if ($model->graph) { + $html = Html::a($html, Url::current(['graph' => $model->graph])); + } - if ($model->graph) { - $html = Html::a($html, Url::current(['graph' => $model->graph])); + return Html::tag('div', $html, ['class' => 'text-center']); } - - return Html::tag('div', $html, ['class' => 'text-center']); - } + ] ] - ] -]); + ]); +$box->end(); + Pjax::end(); diff --git a/src/views/server/view.php b/src/views/server/view.php index d0802bfd..9fd5e4f0 100644 --- a/src/views/server/view.php +++ b/src/views/server/view.php @@ -1,6 +1,5 @@
  • - ' . Yii::t('hipanel/server', 'Resources usage charts'), ['@rrd/view', 'id' => $model->id]); ?> + ' . Yii::t('hipanel/server', 'Resources usage graphs'), ['@rrd/view', 'id' => $model->id]); ?> + ' . Yii::t('hipanel/server', 'Switch graphs'), ['@switch-graph/view', 'id' => $model->id]); ?>
  • user->can('support') && Yii::$app->user->id != $model->client_id) { ?>