-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1175 from proditis/target-datails
Target datails
- Loading branch information
Showing
7 changed files
with
289 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
backend/modules/infrastructure/views/target/full-view/_metadata-tab.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
use yii\widgets\DetailView; | ||
use yii\helpers\HtmlPurifier; | ||
use yii\helpers\Markdown; | ||
use yii\helpers\Html; | ||
|
||
?> | ||
<h5>Target Metadata</h5> | ||
<?= DetailView::widget([ | ||
'model' => $model->metadata, | ||
'attributes' => [ | ||
[ | ||
'attribute' => 'scenario', | ||
'format' => 'html', | ||
'contentOptions' => ['style' => 'max-width:100%'], | ||
'value' => function ($model) { | ||
return HtmlPurifier::process(Markdown::process($model->scenario, 'gfm-comment'), ['Attr.AllowedFrameTargets' => ['_blank']]); | ||
} | ||
], | ||
[ | ||
'attribute' => 'instructions', | ||
'format' => 'html', | ||
'contentOptions' => ['style' => 'max-width:100%'], | ||
'value' => function ($model) { | ||
return HtmlPurifier::process(Markdown::process($model->instructions, 'gfm-comment'), ['Attr.AllowedFrameTargets' => ['_blank']]); | ||
} | ||
], | ||
[ | ||
'attribute' => 'solution', | ||
'format' => 'html', | ||
'contentOptions' => ['style' => 'max-width:100%'], | ||
'value' => function ($model) { | ||
return HtmlPurifier::process(Markdown::process($model->solution, 'gfm-comment'), ['Attr.AllowedFrameTargets' => ['_blank']]); | ||
} | ||
], | ||
[ | ||
'attribute' => 'pre_exploitation', | ||
'format' => 'html', | ||
'contentOptions' => ['style' => 'max-width:100%'], | ||
'value' => function ($model) { | ||
return HtmlPurifier::process(Markdown::process($model->pre_exploitation, 'gfm-comment'), ['Attr.AllowedFrameTargets' => ['_blank']]); | ||
} | ||
], | ||
[ | ||
'attribute' => 'pre_credits', | ||
'format' => 'html', | ||
'contentOptions' => ['style' => 'max-width:100%'], | ||
'value' => function ($model) { | ||
return HtmlPurifier::process(Markdown::process($model->pre_credits, 'gfm-comment'), ['Attr.AllowedFrameTargets' => ['_blank']]); | ||
} | ||
], | ||
[ | ||
'attribute' => 'post_credits', | ||
'format' => 'html', | ||
'contentOptions' => ['style' => 'max-width:100%'], | ||
'value' => function ($model) { | ||
return HtmlPurifier::process(Markdown::process($model->post_credits, 'gfm-comment'), ['Attr.AllowedFrameTargets' => ['_blank']]); | ||
} | ||
], | ||
[ | ||
'attribute' => 'pre_exploitation', | ||
'format' => 'html', | ||
'contentOptions' => ['style' => 'max-width:100%'], | ||
'value' => function ($model) { | ||
return HtmlPurifier::process(Markdown::process($model->pre_exploitation, 'gfm-comment'), ['Attr.AllowedFrameTargets' => ['_blank']]); | ||
} | ||
], | ||
[ | ||
'attribute' => 'post_exploitation', | ||
'format' => 'html', | ||
'contentOptions' => ['style' => 'max-width:100%'], | ||
'value' => function ($model) { | ||
return HtmlPurifier::process(Markdown::process($model->post_exploitation, 'gfm-comment'), ['Attr.AllowedFrameTargets' => ['_blank']]); | ||
} | ||
], | ||
], | ||
]) ?> |
32 changes: 32 additions & 0 deletions
32
backend/modules/infrastructure/views/target/full-view/_network-schedule-tab.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use yii\helpers\Html; | ||
use yii\grid\GridView; | ||
use yii\widgets\Pjax; | ||
/* @var $this yii\web\View */ | ||
/* @var $searchModel app\modules\infrastructure\models\NetworkTargetScheduleSearch */ | ||
/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
|
||
Pjax::begin(['id' => 'network-schedule-tabPJ', 'enablePushState' => false, 'enableReplaceState' => false,]); ?> | ||
|
||
<h1>Network Target Schedule</h1> | ||
|
||
<?= GridView::widget([ | ||
'dataProvider' => $dataProvider, | ||
'filterModel' => $searchModel, | ||
'id' => 'network-schedule-tab', | ||
'columns' => [ | ||
[ | ||
'attribute' => 'target_name', | ||
'value' => 'target.name', | ||
], | ||
[ | ||
'attribute' => 'network_name', | ||
'value' => 'network.name', | ||
], | ||
'migration_date', | ||
|
||
['class' => 'yii\grid\ActionColumn'], | ||
], | ||
]); | ||
Pjax::end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
backend/modules/infrastructure/views/target/full-view/_target_instances-tab.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
use yii\helpers\Html; | ||
use yii\helpers\ArrayHelper; | ||
use yii\grid\GridView; | ||
use yii\widgets\Pjax; | ||
use app\modules\infrastructure\models\Server; | ||
/* @var $this yii\web\View */ | ||
/* @var $searchModel app\modules\infrastructure\models\TargetInstanceSearch */ | ||
/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
|
||
Pjax::begin(['id' => 'instances-tabPJ', 'enablePushState' => false, 'enableReplaceState' => false,]); ?> | ||
?> | ||
<h3>Target Instances</h3> | ||
|
||
<?= GridView::widget([ | ||
'id' => 'instances-tab', | ||
'dataProvider' => $dataProvider, | ||
'columns' => [ | ||
[ | ||
'attribute' => 'player_id', | ||
'value' => function ($model) { | ||
return $model->player_id . ': ' . $model->player->username; | ||
} | ||
], | ||
[ | ||
'attribute' => 'server_id', | ||
'filter' => ArrayHelper::map(Server::find()->orderBy(['name' => SORT_ASC, 'ip' => SORT_ASC])->asArray()->all(), 'id', 'name'), | ||
'value' => function ($model) { | ||
if ($model->server) return $model->server_id . ': ' . $model->server->name; | ||
return null; | ||
} | ||
], | ||
'ipoctet', | ||
[ | ||
'attribute' => 'reboot', | ||
'value' => 'rebootVal', | ||
'filter' => [0 => 'Start / Do Nothing', 1 => 'Restart', 2 => 'Destroy'], | ||
'headerOptions' => ['style' => 'width:7em'], | ||
'contentOptions' => ['style' => 'white-space: nowrap;'], | ||
], | ||
'team_allowed:boolean', | ||
[ | ||
'class' => 'yii\grid\ActionColumn', | ||
'template' => '{restart} {destroy} {view} {update} {delete}', | ||
'contentOptions' => ['style' => 'white-space: nowrap;'], | ||
'buttons' => [ | ||
'restart' => function ($url) { | ||
return Html::a( | ||
'<i class="bi bi-arrow-clockwise"></i>', | ||
$url, | ||
[ | ||
'title' => 'Restart instance', | ||
'data-pjax' => '0', | ||
'data-confirm' => 'You are about to start/restart this instance. Are you sure?', | ||
'data-method' => 'POST', | ||
] | ||
); | ||
}, | ||
'destroy' => function ($url) { | ||
return Html::a( | ||
'<i class="bi bi-power"></i>', | ||
$url, | ||
[ | ||
'title' => 'Destroy container', | ||
'data-pjax' => '0', | ||
'data-confirm' => 'You are about to destroy this instance. Are you sure?', | ||
'data-method' => 'POST', | ||
] | ||
); | ||
}, | ||
], | ||
], | ||
], | ||
]); | ||
Pjax::end(); |