<commit_before><?php

use hipanel\modules\dns\grid\RecordGridView;
use hipanel\modules\dns\models\Record;
use hipanel\modules\dns\models\Zone;
use hipanel\widgets\Pjax;
use yii\data\ArrayDataProvider;
use yii\helpers\Html;
use yii\web\View;

/*
 * @var $this View
 * @var $model Zone
 * @var $recordsDataProvider ArrayDataProvider
 */

$this->title                    = $model->domain;
$this->subtitle                 = Yii::t('hipanel/dns', 'DNS zone for domain {domain}', ['domain' => $model->domain]) . ' #' . $model->id;
$this->params['breadcrumbs'][]  = ['label' => Yii::t('hipanel/dns', 'DNS'), 'url' => ['@dns/zone/index']];
$this->params['breadcrumbs'][]  = $this->title;

Pjax::begin([
    'id' => 'dns_zone_view',
    'enablePushState' => false,
]);

$records = $recordsDataProvider->getModels();

$ns_servers = [];
foreach ($records as $record) {
    if ($record->type === 'ns' && $record->service_id) {
        $ns_servers[] = $record['value'];
    }
}
\hipanel\helpers\ArrayHelper::multisort($ns_servers, 0);
?>

    <?php if ($model->is_served === false && count($ns_servers)) : ?>
        <div class="alert alert-warning alert-dismissible fade in" role="alert">
            <h4><i class="fa fa-warning-circle"></i>&nbsp;&nbsp;<?= Yii::t('hipanel/dns', 'Set NS servers for domain {domain}', ['domain' => $model->domain]) ?></h4>

            <p>
                <?= Yii::t('hipanel/dns', 'This DNS zone belongs to domain {domain_link}, but it is not configured properly. To make these DNS records work, please change NS servers of domain to {ns_servers}.', [
                    'domain_link' => Html::a($model->domain, ['@domain/view', 'id' => $model->id]),
                    'ns_servers' => Html::tag('code', implode(', ', $ns_servers)),
                ]) ?>
            </p>
        </div>
    <?php endif ?>
    <div class="row">
        <div class="col-md-12">
            <?php
            $exampleModel = new Record([
                'domain' => $model->domain,
                'hdomain_id' => $model->id,
                'ttl' => 7200,
                'scenario' => 'create',
            ]);

            echo $this->render('/record/_form', [
                'model' => $exampleModel,
            ]);
            ?>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <?php echo RecordGridView::widget([
                'dataProvider' => $recordsDataProvider,
                'options' => [
                    'class' => '',
                ],
                'columns' => [
                    'fqdn',
                    [
                        'attribute' => 'type',
                        'options' => [
                            'style' => 'width: 3%;',
                        ],
                        'value' => function ($model) {
                            return strtoupper($model->type);
                        },
                    ],
                    'value',
                    [
                        'attribute' => 'ttl',
                        'options' => [
                            'style' => 'width: 5%;',
                        ],
                    ],
                    'actions',
                ],
            ]); ?>
        </div>
    </div>

<?php
Pjax::end();<commit_msg>RecordGridView boxed false<commit_after><?php

use hipanel\modules\dns\grid\RecordGridView;
use hipanel\modules\dns\models\Record;
use hipanel\modules\dns\models\Zone;
use hipanel\widgets\Pjax;
use yii\data\ArrayDataProvider;
use yii\helpers\Html;
use yii\web\View;

/*
 * @var $this View
 * @var $model Zone
 * @var $recordsDataProvider ArrayDataProvider
 */

$this->title                    = $model->domain;
$this->subtitle                 = Yii::t('hipanel/dns', 'DNS zone for domain {domain}', ['domain' => $model->domain]) . ' #' . $model->id;
$this->params['breadcrumbs'][]  = ['label' => Yii::t('hipanel/dns', 'DNS'), 'url' => ['@dns/zone/index']];
$this->params['breadcrumbs'][]  = $this->title;

Pjax::begin([
    'id' => 'dns_zone_view',
    'enablePushState' => false,
]);

$records = $recordsDataProvider->getModels();

$ns_servers = [];
foreach ($records as $record) {
    if ($record->type === 'ns' && $record->service_id) {
        $ns_servers[] = $record['value'];
    }
}
\hipanel\helpers\ArrayHelper::multisort($ns_servers, 0);
?>

    <?php if ($model->is_served === false && count($ns_servers)) : ?>
        <div class="alert alert-warning alert-dismissible fade in" role="alert">
            <h4><i class="fa fa-warning-circle"></i>&nbsp;&nbsp;<?= Yii::t('hipanel/dns', 'Set NS servers for domain {domain}', ['domain' => $model->domain]) ?></h4>

            <p>
                <?= Yii::t('hipanel/dns', 'This DNS zone belongs to domain {domain_link}, but it is not configured properly. To make these DNS records work, please change NS servers of domain to {ns_servers}.', [
                    'domain_link' => Html::a($model->domain, ['@domain/view', 'id' => $model->id]),
                    'ns_servers' => Html::tag('code', implode(', ', $ns_servers)),
                ]) ?>
            </p>
        </div>
    <?php endif ?>
    <div class="row">
        <div class="col-md-12">
            <?php
            $exampleModel = new Record([
                'domain' => $model->domain,
                'hdomain_id' => $model->id,
                'ttl' => 7200,
                'scenario' => 'create',
            ]);

            echo $this->render('/record/_form', [
                'model' => $exampleModel,
            ]);
            ?>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <?php echo RecordGridView::widget([
                'boxed' => false,
                'dataProvider' => $recordsDataProvider,
                'options' => [
                    'class' => '',
                ],
                'columns' => [
                    'fqdn',
                    [
                        'attribute' => 'type',
                        'options' => [
                            'style' => 'width: 3%;',
                        ],
                        'value' => function ($model) {
                            return strtoupper($model->type);
                        },
                    ],
                    'value',
                    [
                        'attribute' => 'ttl',
                        'options' => [
                            'style' => 'width: 5%;',
                        ],
                    ],
                    'actions',
                ],
            ]); ?>
        </div>
    </div>

<?php
Pjax::end();
{'fraction_non_alphanumeric': 0.18007547169811322, 'fraction_numerical': 0.0039245283018867925, 'mean_word_length': 1.544546850998464, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 138, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5360704', 'n_tokens_mistral': 1996, 'n_tokens_neox': 1945, 'n_words': 381}