Skip to content

Commit

Permalink
Server reinstall - hides IPS manager for customers without ISP in tariff
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Oct 9, 2015
1 parent e7a34ff commit b15ff81
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 36 deletions.
19 changes: 11 additions & 8 deletions src/controllers/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,22 @@ public function actions()
'class' => 'hipanel\actions\ViewAction',
'findOptions' => ['with_requests' => true, 'show_deleted' => true, 'with_discounts' => true],
'data' => function ($action) {
/**
* @var $controller $this
* @var $model Server
*/
$controller = $action->controller;

$model = $action->getModel();
$model->vnc = $controller->getVNCInfo($model);

$panels = $controller->getPanelTypes();
// $tariff = TariffController::findModel([
// 'id' => $model->tariff_id,
// 'show_final' => true,
// 'show_deleted' => true
// ]);
// $ispSupported = $tariff['resources']['isp']['quantity'];
$ispSupported = 1; /// TODO: temporary enabled for all tariff. Redo after stock DBs renaming
$tariff = TariffController::findModel([
'id' => $model->tariff_id,
'show_final' => true,
'show_deleted' => true,
'with_resources' => true,
]);
$ispSupported = !empty($tariff['resources']['isp']['quantity']);

$osimages = $controller->getOsimages($model);
$grouped_osimages = $controller->getGroupedOsimages($osimages, $ispSupported);
Expand Down
58 changes: 30 additions & 28 deletions src/views/server/_reinstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

$model->scenario = 'reinstall';
ModalButton::begin([
'model' => $model,
'button' => ['label' => '<i class="ion-ios-cog-outline"></i>' . Yii::t('app', 'Reinstall OS')],
'modal' => [
'size' => Modal::SIZE_LARGE,
'header' => Html::tag('h4', Yii::t('app', 'Please, select the operating system you want to install')),
'model' => $model,
'button' => ['label' => '<i class="ion-ios-cog-outline"></i>' . Yii::t('app', 'Reinstall OS')],
'modal' => [
'size' => Modal::SIZE_LARGE,
'header' => Html::tag('h4', Yii::t('app', 'Please, select the operating system you want to install')),
'headerOptions' => ['class' => 'label-info'],
'footer' => [
'footer' => [
'data-loading-text' => Yii::t('app', 'Resinstalling started...'),
'class' => 'btn btn-warning',
'label' => Yii::t('app', 'Reinstall'),
'class' => 'btn btn-warning',
'label' => Yii::t('app', 'Reinstall'),
]
]
]);
Expand Down Expand Up @@ -56,32 +56,34 @@
<div class="panel-heading"><?= \Yii::t('app', 'Panel and soft') ?></div>
<div class="list-group">
<?php
foreach ($panels as $panel => $panel_name) { ?>
foreach ($panels as $panel => $panel_name) {
if (empty($grouped_osimages['softpacks'][$panel])) {
continue;
} ?>
<div class="list-group-item soft-list"
data-panel="<?= $panel ?>">
<h4 class="list-group-item-heading"><?= Yii::t('app', $panel_name) ?></h4>

<div class="list-group-item-text">
<?php if (is_array($grouped_osimages['softpacks'][$panel])) {
foreach ($grouped_osimages['softpacks'][$panel] as $softpack) { ?>
<div class="radio">
<label>
<?= Html::radio('panel_soft', false, [
'data' => [
'panel-soft' => 'soft',
'panel' => $panel
],
'value' => $softpack['name']
]) ?>
<strong><?= $softpack['name'] ?></strong>
<small style="font-weight: normal"><?= Yii::t('app', $softpack['description']) ?></small>
<a class="softinfo-bttn glyphicon glyphicon-info-sign" href="#"></a>
<?php foreach ($grouped_osimages['softpacks'][$panel] as $softpack) { ?>
<div class="radio">
<label>
<?= Html::radio('panel_soft', false, [
'data' => [
'panel-soft' => 'soft',
'panel' => $panel
],
'value' => $softpack['name']
]) ?>
<strong><?= $softpack['name'] ?></strong>
<small style="font-weight: normal"><?= Yii::t('app',
$softpack['description']) ?></small>
<a class="softinfo-bttn glyphicon glyphicon-info-sign" href="#"></a>

<div class="soft-desc" style="display: none;"></div>
</label>
</div>
<?php }
} ?>
<div class="soft-desc" style="display: none;"></div>
</label>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
Expand Down

0 comments on commit b15ff81

Please sign in to comment.