예제 #1
0
use yii\widgets\Pjax;
use meican\base\grid\Grid;
use meican\base\grid\IcheckboxColumn;
use meican\base\grid\GridButtons;
\meican\topology\assets\network\Index::register($this);
$this->params['header'] = [Yii::t('topology', 'Networks'), [Yii::t('home', 'Home'), Yii::t('topology', 'Topology'), 'Networks']];
?>

<div class="box box-default">
    <div class="box-header with-border">
         <?php 
echo GridButtons::widget();
?>
    </div>
    <div class="box-body">

    <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['delete'], 'id' => 'network-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
Pjax::begin();
echo Grid::widget(['dataProvider' => $networks, 'filterModel' => $searchModel, 'id' => 'gridNetowrks', 'columns' => array(['class' => IcheckboxColumn::className(), 'name' => 'delete', 'multiple' => false, 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['label' => Yii::t("topology", 'Name'), 'value' => 'name', 'headerOptions' => ['style' => 'width: 25%;']], ['label' => Yii::t("topology", 'Urn'), 'value' => 'urn', 'headerOptions' => ['style' => 'width: 30%;']], ['label' => Yii::t("topology", 'Latitude'), 'value' => 'latitude', 'headerOptions' => ['style' => 'width: 8%;']], ['label' => Yii::t("topology", 'Longitude'), 'value' => 'longitude', 'headerOptions' => ['style' => 'width: 8%;']], ['label' => Yii::t("topology", 'Domain'), 'value' => function ($net) {
    return $net->getDomain()->one()->name;
}, 'filter' => Html::activeDropDownList($searchModel, 'domain_name', ArrayHelper::map($allowedDomains, 'name', 'name'), ['class' => 'form-control', 'prompt' => Yii::t("topology", 'any')]), 'headerOptions' => ['style' => 'width: 25%;']])]);
Pjax::end();
ActiveForm::end();
?>
    
    </div>
</div>
예제 #2
0
use meican\circuits\models\ConnectionAuth;
use meican\aaa\models\User;
$this->params['header'] = [Yii::t('circuits', 'Pending Authorization'), ['Home', Yii::t('circuits', 'Circuits')]];
?>

<div class="box box-default">
    <div class="box-body">      
	<?php 
echo Grid::widget(['options' => ['class' => 'list'], 'dataProvider' => $data, 'id' => 'gridInfo', 'filterModel' => $searchModel, 'layout' => "{items}{summary}{pager}", 'columns' => array(['label' => Yii::t('circuits', 'Reply request as '), 'value' => 'domain', 'filter' => Html::activeDropDownList($searchModel, 'domain', ArrayHelper::map(ConnectionAuth::find()->select(["domain"])->distinct(true)->orderBy(['domain' => SORT_ASC])->asArray()->all(), 'domain', 'domain'), ['class' => 'form-control', 'prompt' => Yii::t("circuits", 'any')]), 'contentOptions' => ['style' => 'font-weight: bold;'], 'headerOptions' => ['style' => 'width: 23%;']], ['label' => Yii::t('circuits', 'Source Domain'), 'value' => function ($aut) {
    if ($aut->source) {
        return $aut->source;
    } else {
        return Yii::t('circuits', 'deleted');
    }
}, 'filter' => Html::activeDropDownList($searchModel, 'src_domain', ArrayHelper::map(ConnectionPath::find()->select(["domain"])->distinct(true)->orderBy(['domain' => SORT_ASC])->asArray()->all(), 'domain', 'domain'), ['class' => 'form-control', 'prompt' => Yii::t("circuits", 'any')]), 'headerOptions' => ['style' => 'width: 21%;']], ['label' => Yii::t('circuits', 'Destination Domain'), 'value' => function ($aut) {
    if ($aut->destination) {
        return $aut->destination;
    } else {
        return Yii::t('circuits', 'deleted');
    }
}, 'filter' => Html::activeDropDownList($searchModel, 'dst_domain', ArrayHelper::map(ConnectionPath::find()->select(["domain"])->distinct(true)->orderBy(['domain' => SORT_ASC])->asArray()->all(), 'domain', 'domain'), ['class' => 'form-control', 'prompt' => Yii::t("circuits", 'any')]), 'headerOptions' => ['style' => 'width: 21%;']], ['label' => Yii::t('circuits', 'Requester'), 'value' => function ($aut) {
    $user_id = $aut->request_user_id;
    return User::findOne(['id' => $user_id])->name;
}, 'headerOptions' => ['style' => 'width: 12%;']], ['label' => Yii::t('circuits', 'Bandwidth'), 'value' => function ($aut) {
    return $aut->bandwidth . " Mbps";
}, 'headerOptions' => ['style' => 'width: 12%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{answer}', 'buttons' => ['answer' => function ($url, $model) {
    return Html::a(Html::button(Yii::t('circuits', 'Answer'), ['class' => 'btn btn-sm btn-primary']), ['answer', 'id' => $model->id, 'domain' => $model->domain]);
}], 'headerOptions' => ['style' => 'width: 11%;']])]);
?>
	</div>
</div>
예제 #3
0
use meican\base\components\LinkColumn;
use meican\bpm\models\BpmWorkflow;
use meican\base\grid\Grid;
\meican\bpm\assets\Index::register($this);
$this->params['header'] = ["Workflows", ['Home', 'Workflows']];
?>

<div class="box box-default">
    <div class="box-body">               
	<?php 
echo Grid::widget(['options' => ['class' => 'list'], 'dataProvider' => $data, 'filterModel' => $searchModel, 'id' => 'gridDevices', 'layout' => "{items}{summary}{pager}", 'columns' => array(['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}', 'contentOptions' => function ($model) {
    return ['class' => 'btn-delete', 'id' => $model->id];
}, 'buttons' => ['delete' => function ($url, $model) {
    return Html::a('<span class="fa fa-trash"></span>', '#');
}], 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{copy}', 'buttons' => ['copy' => function ($url, $model) {
    return Html::a('<span class="fa fa-copy"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['label' => Yii::t("bpm", 'Name'), 'value' => 'name', 'headerOptions' => ['style' => 'width: 35%;']], ['label' => Yii::t("bpm", 'Domain'), 'value' => 'domain', 'filter' => Html::activeDropDownList($searchModel, 'domain', ArrayHelper::map(BpmWorkflow::find()->select(["domain"])->distinct(true)->orderBy(['domain' => SORT_ASC])->asArray()->all(), 'domain', 'domain'), ['class' => 'form-control', 'prompt' => Yii::t("bpm", 'any')]), 'headerOptions' => ['style' => 'width: 35%;']], ['format' => 'raw', 'label' => 'Status', 'value' => function ($model) {
    return Html::input('checkbox', '', $model->id, ['id' => 'toggle-' . $model->id, 'class' => 'toggle-event-class', 'checked' => !$model->isDisabled(), 'data-toggle' => "toggle", 'data-size' => "mini", "data-on" => Yii::t("bpm", "Enabled"), "data-off" => Yii::t("bpm", "Disabled"), "data-width" => "100", "data-onstyle" => "success", "data-offstyle" => "warning"]);
}, 'filter' => Html::activeDropDownList($searchModel, 'status', ["enabled" => Yii::t("bpm", "Enabled"), "disabled" => Yii::t("bpm", "Disabled")], ['class' => 'form-control', 'prompt' => Yii::t("circuits", 'any')]), 'headerOptions' => ['style' => 'width: 18%;']])]);
?>
	</div>
</div>

<?php 
Modal::begin(['id' => 'delete-workflow-modal', 'headerOptions' => ['hidden' => 'hidden'], 'footer' => '<button id="delete-btn" class="btn btn-danger">' . Yii::t("bpm", "Delete") . '</button><button id="cancel-btn" class="btn btn-default">' . Yii::t("bpm", "Cancel") . '</button>']);
echo '<p style="text-align: left; height: 100%; width:100%;">' . Yii::t("bpm", "Delete this workflows?") . '</p>';
Modal::end();
Modal::begin(['id' => 'disable-workflow-modal', 'headerOptions' => ['hidden' => 'hidden'], 'footer' => '<button id="confirm-btn" class="btn btn-danger">' . Yii::t("bpm", "Yes") . '</button><button id="cancel-btn" class="btn btn-default">' . Yii::t("bpm", "Cancel") . '</button>']);
echo '<p style="text-align: left; height: 100%; width:100%;" id="disable-message"></p>';
예제 #4
0
파일: view.php 프로젝트: ufrgs-hyman/meican
                <li class="active"><a href="#path-map" data-toggle="tab">Map</a></li>
                <li class="pull-left header"> Path</li>
            </ul>
            <div class="tab-content no-padding">
              <div class="tab-pane active" id="path-map">
              </div>
              <div class="tab-pane" id="path-graph">
                Comming soon.
              </div>
              <div class="tab-pane with-padding" id="path-info">
                <?php 
$provider = new \yii\data\ArrayDataProvider(['allModels' => [['order' => 0, 'urn' => 'fdasfd', 'vlan' => 123]]]);
echo Grid::widget(['id' => 'path-grid', 'summary' => false, 'dataProvider' => $provider, 'columns' => array(['header' => 'Order', 'value' => function ($model) {
    return "";
}], ['header' => 'URN', 'value' => function ($model) {
    return "";
}], ['header' => 'VLAN', 'value' => function ($model) {
    return "";
}])]);
?>
              </div>
            </div>
        </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="box box-default">
            <div class="box-header with-border">
                <h3 class="box-title"><?php 
echo Yii::t("topology", "Details");
?>
예제 #5
0
    </div>
    <div class="col-md-6">
        <div class="box box-default">
            <div class="box-header with-border">
                <h3 class="box-title"><?php 
echo Yii::t("aaa", "Roles");
?>
</h3>
            </div>
            <div class="box-body">
                <?php 
echo Grid::widget(['dataProvider' => $rolesProvider, 'columns' => array(['attribute' => 'domain', 'format' => 'raw', 'value' => function ($model) {
    $type = $model->getGroup()->type;
    if ($type == Group::TYPE_DOMAIN) {
        $dom = $model->getDomain();
        if ($dom) {
            return $dom->name;
        }
        return Yii::t("aaa", "Any");
    } else {
        return Yii::t("aaa", "Any");
    }
}], ['attribute' => '_groupRoleName', 'format' => 'raw', 'value' => function ($model) {
    return $model->getGroup()->name;
}])]);
?>
            </div>
        </div>
    </div>
</div>
예제 #6
0
파일: view.php 프로젝트: ufrgs-hyman/meican
    </div>
    <div class="col-md-6">
        <div class="box box-default">
            <div class="box-header with-border">
                <h3 class="box-title"><?php 
echo Yii::t("topology", "Services");
?>
</h3>
                <div class="box-tools">
                    <?php 
echo GridButtons::widget(['size' => 'small', 'addRoute' => ['/topology/service/create', 'id' => $model->id]]);
?>
                </div>
            </div>
            <div class="box-body">
                <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['/topology/service/delete'], 'id' => 'service-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
echo Grid::widget(['dataProvider' => $services, 'columns' => array(array('class' => IcheckboxColumn::className(), 'name' => 'delete', 'multiple' => false, 'headerOptions' => ['style' => 'width: 2%;']), ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', Url::to(['/topology/service/update', 'id' => $model->id]));
}], 'headerOptions' => ['style' => 'width: 2%;']], ['attribute' => 'type', 'value' => function ($model) {
    return $model->getType();
}], 'url')]);
ActiveForm::end();
?>
            </div>
        </div>
    </div>
</div>

        
예제 #7
0
파일: task.php 프로젝트: ufrgs-hyman/meican
            <button class="btn btn-sm btn-default" id="apply-all">Apply all changes</button>
        </div>
    </div>
    <div class="box-body">
        <?php 
Pjax::begin(['id' => 'change-pjax']);
echo Grid::widget(['id' => 'change-grid', 'filterModel' => $searchChange, 'dataProvider' => $changeProvider, 'columns' => array(['class' => 'yii\\grid\\ActionColumn', 'template' => '{apply}', 'buttons' => ['apply' => function ($url, $model) {
    return $model->status == Change::STATUS_APPLIED ? "" : Html::a('<span class="fa fa-check apply-btn"></span>', '#');
}], 'headerOptions' => ['style' => 'width: 2%;']], ['attribute' => 'domain', 'filter' => Html::activeDropDownList($searchChange, 'domain', ArrayHelper::map(Change::find()->where(['status' => Change::STATUS_PENDING])->asArray()->select("domain")->distinct(true)->orderBy("domain ASC")->all(), 'domain', 'domain'), ['class' => 'form-control', 'prompt' => 'any']), 'headerOptions' => ['style' => 'width: 16%;']], ['header' => Yii::t('topology', 'Type'), 'value' => function ($model) {
    return $model->getType();
}, 'filter' => Html::activeDropDownList($searchChange, 'type', ArrayHelper::map(Change::getTypes(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'any']), 'headerOptions' => ['style' => 'width: 7%;']], ['attribute' => 'item_type', 'filter' => Html::activeDropDownList($searchChange, 'item_type', ArrayHelper::map(Change::getItemTypes(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'any']), 'value' => function ($model) {
    return $model->getItemType();
}, 'headerOptions' => ['style' => 'width: 12%;']], ['attribute' => 'data', 'filter' => false, 'format' => 'raw', 'value' => function ($model) {
    return $model->getDetails();
}, 'headerOptions' => ['style' => 'width: 30%;']], ['header' => 'Status', 'filter' => false, 'format' => 'raw', 'value' => function ($model) {
    switch ($model->status) {
        case Change::STATUS_FAILED:
            return '<a href="#" title="' . $model->error . '"><span class="label label-danger">Failed</span></a>';
        case Change::STATUS_APPLIED:
            return '<span class="label label-success">Applied</span>';
        case Change::STATUS_PENDING:
            return '<span class="label label-primary">Pending</span>';
        default:
            return "";
    }
}, 'headerOptions' => ['style' => 'width: 5%;']])]);
Pjax::end();
?>
    </div>
    <div id="refresh-overlay" class="overlay">
        <i class="fa fa-refresh fa-spin"></i>
    </div>
예제 #8
0
echo Yii::t("aaa", "Add");
?>
</a>
            <a id="delete-system-role" class="btn btn-sm btn-default delete-btn"><?php 
echo Yii::t("aaa", "Delete");
?>
</a>
        </div>
    </div>
    <div class="box-body">
        <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['/aaa/role/delete'], 'id' => 'system-role-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
echo Grid::widget(['id' => 'role-system-grid', 'dataProvider' => $rolesProvider, 'columns' => array(array('class' => IcheckboxColumn::className(), 'checkboxOptions' => ['class' => 'deleteSystem'], 'name' => 'delete', 'multiple' => false, 'headerOptions' => ['style' => 'width: 2%;']), ['class' => 'yii\\grid\\ActionColumn', 'template' => '{edit}', 'contentOptions' => function ($model) {
    return ['class' => 'btn-edit', 'id' => $model->id];
}, 'buttons' => ['edit' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', null);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['attribute' => '_groupRoleName', 'format' => 'raw', 'value' => function ($model) {
    return $model->getGroup()->name;
}])]);
ActiveForm::end();
?>
    </div>
</div>

<?php 
Modal::begin(['id' => 'delete-role-system-modal', 'headerOptions' => ['hidden' => 'hidden'], 'footer' => '<button id="delete-role-btn" class="grid-btn btn btn-danger">' . Yii::t("aaa", "Delete") . '</button><button id="close-btn" class="btn btn-default">' . Yii::t("aaa", "Cancel") . '</button>']);
echo Yii::t("aaa", "Do you want delete the selected items?");
Modal::end();
Modal::begin(['id' => 'error-modal-system', 'headerOptions' => ['hidden' => 'hidden'], 'footer' => '<button id="close-btn" class="btn btn-default">' . Yii::t("aaa", "Close") . '</button>']);
Modal::end();
Modal::begin(['id' => 'add-role-system-modal', 'header' => Yii::t("aaa", "Add Role"), 'footer' => '<button id="save-role-btn" class="btn btn-primary">' . Yii::t("aaa", "Save") . '</button><button id="close-btn" class="btn btn-default">' . Yii::t("aaa", "Cancel") . '</button>']);
예제 #9
0
<?php

/**
 * @copyright Copyright (c) 2016 RNP
 * @license http://github.com/ufrgs-hyman/meican#license
 */
use meican\base\grid\Grid;
echo Grid::widget(['id' => 'history-grid', 'dataProvider' => $history, 'columns' => array(['attribute' => 'type', 'value' => function ($model) {
    return $model->getTypeLabel();
}], ['header' => Yii::t("circuits", 'Info'), 'format' => 'raw', 'value' => function ($model) {
    if ($model->message) {
        return '<a class="event-message" href="#"><span class="fa fa-file-text"></span></a>';
    } elseif ($model->data) {
        $tmp = json_decode($model->data);
        return (isset($tmp->bandwidth) ? '<span class="fa fa-tachometer"></span> ' . $tmp->bandwidth . ' Mbps<br>' : '') . (isset($tmp->start) ? '<span class="fa fa-clock-o"></span> Start at ' . Yii::$app->formatter->asDatetime($tmp->start) . '<br>' : '') . (isset($tmp->end) ? '<span class="fa fa-clock-o"></span> End at ' . Yii::$app->formatter->asDatetime($tmp->end) . '<br>' : '');
    }
    return '';
}], ['attribute' => 'author_id', 'format' => 'raw', 'value' => function ($model) {
    return $model->getAuthor();
}])]);
예제 #10
0
use meican\base\grid\IcheckboxColumn;
use meican\base\grid\GridButtons;
\meican\topology\assets\provider\Index::register($this);
$this->params['header'] = ["Providers", ['Home', 'Topology', 'Providers']];
?>

<div class="box box-default">
    <div class="box-header with-border">
        <?php 
echo GridButtons::widget();
?>
    </div>
    <div class="box-body">

    <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['delete'], 'id' => 'provider-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
Pjax::begin();
echo Grid::widget(['dataProvider' => $providers, 'columns' => array(array('class' => IcheckboxColumn::className(), 'name' => 'delete', 'multiple' => false, 'headerOptions' => ['style' => 'width: 2%;']), ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {view}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', $url);
}, 'view' => function ($url, $model) {
    return Html::a('<span class="fa fa-eye"></span>', $url, ['title' => Yii::t("topology", 'Show details and services of this provider')]);
}], 'headerOptions' => ['style' => 'width: 4%;']], 'name', ['attribute' => 'type', 'value' => function ($model) {
    return $model->getType();
}], 'nsa', 'latitude', 'longitude')]);
Pjax::end();
ActiveForm::end();
?>

    </div>
</div>
예제 #11
0
    </div>
    <div class="box-body">

    <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['delete'], 'id' => 'delete-test-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
Pjax::begin(['id' => 'test-pjax']);
echo Grid::widget(['id' => 'test-grid', 'dataProvider' => $data, 'columns' => array(array('class' => IcheckboxColumn::className(), 'name' => 'delete', 'headerOptions' => ['style' => 'width: 2%;'], 'multiple' => false), ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', '#');
}], 'headerOptions' => ['style' => 'width: 2%;']], ['header' => Yii::t("tester", "Source"), 'value' => function ($model) {
    return $model->getFirstPath()->one()->port_urn;
}, 'headerOptions' => ['style' => 'width: 20%;']], ['header' => Yii::t("tester", "VLAN"), 'value' => function ($model) {
    return $model->getFirstPath()->one()->vlan;
}, 'headerOptions' => ['style' => 'width: 5%;']], ['header' => Yii::t("tester", "Destination"), 'value' => function ($model) {
    return $model->getLastPath()->one()->port_urn;
}, 'headerOptions' => ['style' => 'width: 20%;']], ['header' => Yii::t("tester", "VLAN"), 'value' => function ($model) {
    return $model->getLastPath()->one()->vlan;
}, 'headerOptions' => ['style' => 'width: 5%;']], ['header' => '', 'value' => function ($model) {
    return "";
}, 'contentOptions' => function ($model, $key, $index, $column) {
    return ['class' => 'cron-value', 'data' => $model->getScheduledTask()->freq];
}, 'headerOptions' => ['style' => 'width: 1%;']], ['attribute' => 'last_run_at', 'value' => function ($model) {
    $cron = $model->getScheduledTask();
    return $cron->last_run_at ? Yii::$app->formatter->asDatetime($cron->last_run_at) : Yii::t("tester", "Never");
}, 'headerOptions' => ['style' => 'width: 10%;']], ['label' => Yii::t("tester", "Last result"), 'value' => function ($model) {
    return $model->getConnectionStatus();
}, 'headerOptions' => ['style' => 'width: 10%;']])]);
Pjax::end();
ActiveForm::end();
?>

    </div>
</div>
예제 #12
0
파일: view.php 프로젝트: ufrgs-hyman/meican
$this->params['header'] = [Yii::t('circuits', "Reservation Details"), ['Home', 'Circuits']];
?>

<div class="row">
    <div class="col-md-8">
        <div class="box box-default">
            <div class="box-header with-border">
                <h3 class="box-title"><?php 
echo Yii::t("circuits", "Circuits");
?>
</h3>
            </div>
            <div class="box-body">
                <?php 
echo Grid::widget(['dataProvider' => $connDataProvider, 'columns' => [['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<span class="fa fa-eye"></span>', ['connection/view', 'id' => $model->id]);
}], 'headerOptions' => ['style' => 'width: 2%;']], 'external_id', 'start:datetime', 'finish:datetime', 'status', 'dataplane_status', 'auth_status']]);
?>
            </div>
        </div> 
    </div>
    <div class="col-md-4">
        <div class="box box-default">
            <div class="box-header with-border">
                <h3 class="box-title"><?php 
echo Yii::t("circuits", "Reservation Info");
?>
</h3>
            </div>
            <div class="box-body">
                <?php 
예제 #13
0
echo Grid::widget(['options' => ['class' => 'list'], 'dataProvider' => new ArrayDataProvider(['allModels' => $requests, 'sort' => false, 'pagination' => ['pageSize' => 4]]), 'id' => 'gridRequest', 'layout' => "{items}{summary}{pager}", 'rowOptions' => function ($model, $key, $index, $grid) {
    return ['id' => $model['id'], 'onclick' => 'toDate(id)'];
}, 'columns' => array(['class' => 'yii\\grid\\ActionColumn', 'template' => '{accept}{reject}', 'contentOptions' => function ($model) {
    return ['style' => 'white-space: nowrap;'];
}, 'buttons' => ['accept' => function ($url, $model) {
    return Html::a('<span class="fa fa-thumbs-o-up"></span>', null, ['disabled' => $model->isAnswered(), 'class' => 'btn btn-accept', 'id' => $model->id]);
}, 'reject' => function ($url, $model) {
    return Html::a('<span class="fa fa-thumbs-o-down"></span>', null, ['disabled' => $model->isAnswered(), 'class' => 'btn btn-reject', 'id' => $model->id]);
}]], ['label' => Yii::t('circuits', 'Initial Date/Time'), 'value' => function ($req) {
    return Yii::$app->formatter->asDatetime(Connection::findOne(['id' => $req->connection_id])->start);
}, 'contentOptions' => ['style' => 'min-width: 70px;']], ['label' => Yii::t('circuits', 'Final Date/Time'), 'value' => function ($req) {
    return Yii::$app->formatter->asDatetime(Connection::findOne(['id' => $req->connection_id])->finish);
}, 'contentOptions' => ['style' => 'min-width: 70px;']], ['label' => Yii::t('circuits', 'Duration'), 'value' => function ($req) {
    $start = strtotime(Connection::findOne(['id' => $req->connection_id])->start);
    $finish = strtotime(Connection::findOne(['id' => $req->connection_id])->finish);
    $mins = ($finish - $start) / 60;
    $hours = 0;
    while ($mins > 59) {
        $hours++;
        $mins -= 60;
    }
    return $hours . "h" . $mins . "m";
}, 'contentOptions' => ['style' => 'min-width: 70px;']], ['format' => 'raw', 'label' => Yii::t('circuits', 'Status'), 'value' => function ($req) {
    if ($req->status == Connection::AUTH_STATUS_APPROVED) {
        return '<span class="label label-success">' . $req->getStatus() . '</span>';
    }
    if ($req->status == Connection::AUTH_STATUS_REJECTED || $req->status == Connection::AUTH_STATUS_EXPIRED) {
        return '<span class="label label-danger">' . $req->getStatus() . '</span>';
    }
    return '<span class="label label-warning">' . $req->getStatus() . '</span>';
}, 'contentOptions' => ['style' => 'min-width: 70px;']])]);
예제 #14
0
 * @copyright Copyright (c) 2016 RNP
 * @license http://github.com/ufrgs-hyman/meican#license
 */
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use yii\helpers\Html;
use meican\base\grid\Grid;
use meican\base\grid\IcheckboxColumn;
use meican\base\grid\GridButtons;
\meican\aaa\assets\group\Index::register($this);
$this->params['header'] = ["Groups", ['Home', 'Groups']];
?>

<div class="box box-default">
    <div class="box-header with-border">
        <?php 
echo GridButtons::widget();
?>
    </div>
    <div class="box-body">
        <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['delete'], 'id' => 'group-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
echo Grid::widget(['dataProvider' => $groups, 'columns' => array(array('class' => IcheckboxColumn::className(), 'name' => 'delete', 'multiple' => false, 'contentOptions' => ['style' => 'width: 15px;']), ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], 'name', ['label' => 'Tipo', 'value' => function ($group) {
    return $group->getType();
}])]);
ActiveForm::end();
?>
    </div>
</div>
예제 #15
0
?>
</a>
        </div>
    </div>
    <div class="box-body">
        <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['/aaa/role/delete'], 'id' => 'domain-role-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
echo Grid::widget(['id' => 'role-domain-grid', 'dataProvider' => $rolesProvider, 'columns' => array(['class' => IcheckboxColumn::className(), 'checkboxOptions' => ['class' => 'deleteDomain'], 'name' => 'delete', 'multiple' => false, 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{edit}', 'contentOptions' => function ($model) {
    return ['class' => 'btn-edit', 'id' => $model->id];
}, 'buttons' => ['edit' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', null);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['attribute' => '_groupRoleName', 'format' => 'raw', 'value' => function ($model) {
    return $model->getGroup()->name;
}], ['attribute' => 'domain', 'format' => 'raw', 'value' => function ($model) {
    $type = $model->getGroup()->type;
    if ($type == Group::TYPE_DOMAIN) {
        $dom = $model->getDomain();
        if ($dom) {
            return $dom->name;
        }
        return Yii::t("aaa", "Any");
    } else {
        return Yii::t("aaa", "Any");
    }
}])]);
ActiveForm::end();
?>
    </div>
</div>

<?php 
Modal::begin(['id' => 'delete-role-domain-modal', 'headerOptions' => ['hidden' => 'hidden'], 'footer' => '<button id="delete-role-btn" class="grid-btn btn btn-danger">' . Yii::t("aaa", "Delete") . '</button><button id="close-btn" class="btn btn-default">' . Yii::t("aaa", "Cancel") . '</button>']);
예제 #16
0
echo Grid::widget(['id' => $gridId, 'dataProvider' => $data, 'filterModel' => $searchModel, 'layout' => "{items}{summary}{pager}", 'columns' => array(['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<span class="fa fa-eye"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['label' => Yii::t('circuits', 'Name'), 'value' => 'name', 'headerOptions' => ['style' => 'width: 11%;']], ['attribute' => 'date', 'format' => 'datetime', 'headerOptions' => ['style' => 'width: 10%;']], ['label' => Yii::t('circuits', 'Source Domain'), 'value' => function ($model) {
    return $model->getSourceDomain();
}, 'filter' => Html::activeDropDownList($searchModel, 'src_domain', ArrayHelper::map($allowedDomains, 'name', 'name'), ['class' => 'form-control', 'prompt' => Yii::t("circuits", 'any')]), 'headerOptions' => ['style' => 'width: 14%;']], ['label' => Yii::t('circuits', 'Destination Domain'), 'value' => function ($model) {
    return $model->getDestinationDomain();
}, 'filter' => Html::activeDropDownList($searchModel, 'dst_domain', ArrayHelper::map($allowedDomains, 'name', 'name'), ['class' => 'form-control', 'prompt' => Yii::t("circuits", 'any')]), 'headerOptions' => ['style' => 'width: 14%;']], ['label' => Yii::t('circuits', 'Bandwidth'), 'value' => function ($res) {
    return $res->bandwidth . " Mbps";
}, 'headerOptions' => ['style' => 'width: 9%;']], ['label' => Yii::t('circuits', 'Requester'), 'value' => function ($res) {
    $user_id = $res->request_user_id;
    $user = User::findOne(['id' => $user_id]);
    if ($user) {
        return $user->name;
    }
    return null;
}, 'headerOptions' => ['style' => 'width: 12%;']], ['label' => Yii::t('circuits', "Status"), 'format' => 'html', 'value' => function ($model) {
    $conns = $model->getConnections()->select(['status', 'auth_status', 'dataplane_status'])->all();
    if (!$conns) {
        return 'Error';
    }
    //Se for somente uma conexão, mostra os status
    if (count($conns) < 2) {
        return $conns[0]->getStatus() . ", " . $conns[0]->getAuthStatus() . ", " . $conns[0]->getDataStatus();
    }
    //Se forem varias, mostra um resumo
    $provisioned = 0;
    $reject = 0;
    $pending = 0;
    foreach ($conns as $conn) {
        if ($conn->status == Connection::STATUS_PROVISIONED) {
            $provisioned++;
        } else {
            if ($conn->status == Connection::STATUS_FAILED_CREATE || $conn->status == Connection::STATUS_FAILED_CONFIRM || $conn->status == Connection::STATUS_FAILED_SUBMIT || $conn->status == Connection::STATUS_FAILED_PROVISION || $conn->auth_status == Connection::AUTH_STATUS_REJECTED || $conn->auth_status == Connection::AUTH_STATUS_EXPIRED) {
                $reject++;
            } else {
                $pending++;
            }
        }
    }
    $msg = Yii::t("circuits", 'Provisioned:') . " " . $provisioned . ", ";
    $msg .= Yii::t("circuits", 'Rejected:') . " " . $reject . ", ";
    $msg .= Yii::t("circuits", 'Pending:') . " " . $pending;
    return $msg;
}, 'headerOptions' => ['style' => 'width: 28%;']])]);
예제 #17
0
use meican\base\grid\Grid;
use meican\base\grid\IcheckboxColumn;
use meican\base\grid\GridButtons;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\Pjax;
\meican\topology\assets\domain\Index::register($this);
$this->params['header'] = [Yii::t('topology', 'Domains'), [Yii::t('home', 'Home'), Yii::t('topology', 'Topology'), 'Domains']];
?>

<div class="box box-default">
    <div class="box-header with-border">
        <?php 
echo GridButtons::widget();
?>
    </div>
    <div class="box-body">
        <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['delete'], 'id' => 'domain-form', 'enableClientScript' => false, 'enableClientValidation' => false]);
Pjax::begin();
echo Grid::widget(['dataProvider' => $domains, 'id' => 'grid', 'columns' => array(['class' => IcheckboxColumn::className(), 'name' => 'delete', 'multiple' => false, 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['label' => Yii::t('topology', 'Name'), 'value' => 'name', 'headerOptions' => ['style' => 'width: 50%;']], ['label' => Yii::t('topology', 'Default Policy'), 'value' => function ($dom) {
    return $dom->getPolicy();
}, 'headerOptions' => ['style' => 'width: 46%;']])]);
Pjax::end();
ActiveForm::end();
?>
    </div>
</div>
예제 #18
0
use yii\widgets\Pjax;
use yii\helpers\Url;
use yii\bootstrap\Html;
use yii\helpers\ArrayHelper;
use meican\base\grid\Grid;
use meican\base\grid\IcheckboxColumn;
use meican\base\grid\GridButtons;
use meican\aaa\models\UserDomainRole;
\meican\aaa\assets\user\Index::register($this);
$this->params['header'] = ["Users", ['Home', 'Users']];
?>

<div class="box box-default">
    <div class="box-header with-border">
        <?php 
echo GridButtons::widget();
?>
    </div>
    <div class="box-body">
        <?php 
$form = ActiveForm::begin(['method' => 'post', 'action' => ['delete'], 'enableClientScript' => false, 'enableClientValidation' => false]);
echo Grid::widget(['dataProvider' => $users, 'filterModel' => $searchModel, 'columns' => array(['class' => IcheckboxColumn::className(), 'name' => 'delete', 'multiple' => false, 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<span class="fa fa-eye"></span>', $url);
}], 'headerOptions' => ['style' => 'width: 2%;']], ['label' => Yii::t('aaa', 'User'), 'value' => 'login', 'headerOptions' => ['style' => 'width: 47%;']], ['label' => Yii::t('aaa', 'Name'), 'value' => 'name', 'headerOptions' => ['style' => 'width: 47%;']])]);
?>

        <?php 
ActiveForm::end();
?>
    </div>
</div>
예제 #19
0
            <div class="box-body">
                <?php 
Pjax::begin(['id' => 'task-pjax']);
echo Grid::widget(['id' => 'search-grid', 'dataProvider' => $taskProvider, 'columns' => array('started_at:datetime', ['header' => Yii::t("topology", "Rule"), 'value' => function ($model) {
    return $model->getRule()->one()->name;
}], 'status', ['header' => Yii::t("topology", "Discovered changes"), 'format' => 'raw', 'value' => function ($model) {
    return Html::a('<span class="fa fa-eye"></span> ', ['task', 'id' => $model->id]) . $model->getChanges()->count();
}])]);
Pjax::end();
?>
            </div>
        </div>  
    </div>
    <div class="col-md-4">
        <div class="box box-default">
            <div class="box-header with-border">
                <h3 class="box-title"><?php 
echo Yii::t("topology", "Change history");
?>
</h3>
            </div>
            <div class="box-body">
                <?php 
Pjax::begin(['id' => 'change-pjax']);
echo Grid::widget(['id' => 'change-grid', 'dataProvider' => $changeProvider, 'columns' => array('applied_at', 'domain')]);
Pjax::end();
?>
            </div>
        </div>  
    </div>
</div>  
예제 #20
0
    ?>
</a>
        	</div><br>

			<?php 
    $form = ActiveForm::begin(['method' => 'post', 'action' => ['/topology/port/delete'], 'id' => 'port-grid-form-' . $dom->id]);
    ?>
	
			<?php 
    echo Grid::widget(['id' => 'grid' . $dom->id, 'emptyText' => Yii::t('topology', 'No Ports added to this domain'), 'dataProvider' => new ArrayDataProvider(['models' => $dom->getBiPorts(), 'key' => 'id', 'pagination' => false]), 'layout' => '{items}', 'columns' => array(['class' => ICheckboxColumn::className(), 'checkboxOptions' => ['class' => 'deleteUrn' . $dom->id], 'multiple' => false, 'name' => 'delete', 'headerOptions' => ['style' => 'width: 2%;']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{edit}', 'contentOptions' => function ($port) {
        return ['class' => 'btn-edit', 'id' => $port->id];
    }, 'buttons' => ['edit' => function ($url, $model) {
        return Html::a('<span class="fa fa-pencil"></span>', null);
    }]], ['format' => 'raw', 'label' => Yii::t('topology', 'Network'), 'value' => function ($port) {
        return $port->getNetwork()->one()->name;
    }, 'headerOptions' => ['style' => 'width: 9%;']], ['format' => 'raw', 'label' => Yii::t('topology', 'Device'), 'value' => function ($port) {
        return $port->getDevice()->one()->name;
    }, 'headerOptions' => ['style' => 'width: 9%;']], ['label' => Yii::t('topology', 'Name'), 'value' => 'name', 'headerOptions' => ['style' => 'width: 10%;']], ['label' => Yii::t('topology', 'Urn'), 'value' => 'urn', 'headerOptions' => ['style' => 'width: 30%;']], ['format' => 'raw', 'label' => Yii::t('topology', 'VLANs'), 'value' => function ($port) {
        if ($port->vlan_range) {
            return $port->vlan_range;
        }
        return $port->getInboundPortVlanRange();
    }, 'headerOptions' => ['style' => 'width: 8%;']], ['label' => Yii::t('topology', 'Max Capacity (Mbps)'), 'value' => 'max_capacity', 'headerOptions' => ['style' => 'width: 10%;']], ['label' => Yii::t('topology', 'Min Capacity (Mbps)'), 'value' => 'min_capacity', 'headerOptions' => ['style' => 'width: 10%;']], ['label' => Yii::t('topology', 'Granularity (Mbps)'), 'value' => 'granularity', 'headerOptions' => ['style' => 'width: 10%;']])]);
    ?>
			
			<?php 
    ActiveForm::end();
    ?>
        </div>
    </div>
<?php 
}