Skip to content

Commit

Permalink
server/view - fixed loading of huge data
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Jan 25, 2016
1 parent 4167fd2 commit 033ba81
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/controllers/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use hipanel\base\CrudController;
use hipanel\models\Ref;
use hipanel\modules\finance\controllers\TariffController;
use hipanel\modules\finance\models\Tariff;
use hipanel\modules\server\models\Osimage;
use hipanel\modules\server\models\Server;
use Yii;
Expand Down Expand Up @@ -59,13 +60,19 @@ public function actions()
$model->vnc = $controller->getVNCInfo($model);

$panels = $controller->getPanelTypes();
$tariff = TariffController::findModel([
$tariff = Tariff::find()->where([
'id' => $model->tariff_id,
'show_final' => true,
'show_deleted' => true,
'with_resources' => true,
]);
$ispSupported = !empty($tariff['resources']['isp']['quantity']);
])->joinWith('resources')->one();

$ispSupported = false;
foreach ($tariff->getResources() as $resource) {
if ($resource->type === 'isp' && $resource->quantity > 0) {
$ispSupported = true;
}
}

$osimages = $controller->getOsimages($model);
$grouped_osimages = $controller->getGroupedOsimages($osimages, $ispSupported);
Expand Down

0 comments on commit 033ba81

Please sign in to comment.