Show server status in sidebar properly on subuser views
This commit is contained in:
parent
8e9069cced
commit
db7b741b28
4 changed files with 29 additions and 3 deletions
|
@ -28,6 +28,7 @@ use DB;
|
||||||
use Log;
|
use Log;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Alert;
|
use Alert;
|
||||||
|
use Javascript;
|
||||||
use Pterodactyl\Models;
|
use Pterodactyl\Models;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Pterodactyl\Exceptions\DisplayException;
|
use Pterodactyl\Exceptions\DisplayException;
|
||||||
|
@ -51,10 +52,16 @@ class SubuserController extends Controller
|
||||||
{
|
{
|
||||||
$server = Models\Server::getByUUID($uuid);
|
$server = Models\Server::getByUUID($uuid);
|
||||||
$this->authorize('list-subusers', $server);
|
$this->authorize('list-subusers', $server);
|
||||||
|
$node = Models\Node::find($server->node);
|
||||||
|
|
||||||
|
Javascript::put([
|
||||||
|
'server' => collect($server->makeVisible('daemonSecret'))->only(['uuid', 'uuidShort', 'daemonSecret', 'username']),
|
||||||
|
'node' => collect($node)->only('fqdn', 'scheme', 'daemonListen'),
|
||||||
|
]);
|
||||||
|
|
||||||
return view('server.users.index', [
|
return view('server.users.index', [
|
||||||
'server' => $server,
|
'server' => $server,
|
||||||
'node' => Models\Node::find($server->node),
|
'node' => $node,
|
||||||
'subusers' => Models\Subuser::select('subusers.*', 'users.email', 'users.username')
|
'subusers' => Models\Subuser::select('subusers.*', 'users.email', 'users.username')
|
||||||
->join('users', 'users.id', '=', 'subusers.user_id')
|
->join('users', 'users.id', '=', 'subusers.user_id')
|
||||||
->where('server_id', $server->id)
|
->where('server_id', $server->id)
|
||||||
|
@ -66,6 +73,12 @@ class SubuserController extends Controller
|
||||||
{
|
{
|
||||||
$server = Models\Server::getByUUID($uuid);
|
$server = Models\Server::getByUUID($uuid);
|
||||||
$this->authorize('view-subuser', $server);
|
$this->authorize('view-subuser', $server);
|
||||||
|
$node = Models\Node::find($server->node);
|
||||||
|
|
||||||
|
Javascript::put([
|
||||||
|
'server' => collect($server->makeVisible('daemonSecret'))->only(['uuid', 'uuidShort', 'daemonSecret', 'username']),
|
||||||
|
'node' => collect($node)->only('fqdn', 'scheme', 'daemonListen'),
|
||||||
|
]);
|
||||||
|
|
||||||
$subuser = Models\Subuser::select('subusers.*', 'users.email as a_userEmail')
|
$subuser = Models\Subuser::select('subusers.*', 'users.email as a_userEmail')
|
||||||
->join('users', 'users.id', '=', 'subusers.user_id')
|
->join('users', 'users.id', '=', 'subusers.user_id')
|
||||||
|
@ -87,7 +100,7 @@ class SubuserController extends Controller
|
||||||
|
|
||||||
return view('server.users.view', [
|
return view('server.users.view', [
|
||||||
'server' => $server,
|
'server' => $server,
|
||||||
'node' => Models\Node::find($server->node),
|
'node' => $node,
|
||||||
'subuser' => $subuser,
|
'subuser' => $subuser,
|
||||||
'permissions' => $permissions,
|
'permissions' => $permissions,
|
||||||
]);
|
]);
|
||||||
|
@ -137,10 +150,16 @@ class SubuserController extends Controller
|
||||||
{
|
{
|
||||||
$server = Models\Server::getByUUID($uuid);
|
$server = Models\Server::getByUUID($uuid);
|
||||||
$this->authorize('create-subuser', $server);
|
$this->authorize('create-subuser', $server);
|
||||||
|
$node = Models\Node::find($server->node);
|
||||||
|
|
||||||
|
Javascript::put([
|
||||||
|
'server' => collect($server->makeVisible('daemonSecret'))->only(['uuid', 'uuidShort', 'daemonSecret', 'username']),
|
||||||
|
'node' => collect($node)->only('fqdn', 'scheme', 'daemonListen'),
|
||||||
|
]);
|
||||||
|
|
||||||
return view('server.users.new', [
|
return view('server.users.new', [
|
||||||
'server' => $server,
|
'server' => $server,
|
||||||
'node' => Models\Node::find($server->node),
|
'node' => $node,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,3 +84,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@section('footer-scripts')
|
||||||
|
@parent
|
||||||
|
{!! Theme::js('js/frontend/server.socket.js') !!}
|
||||||
|
@endsection
|
||||||
|
|
|
@ -400,6 +400,7 @@
|
||||||
|
|
||||||
@section('footer-scripts')
|
@section('footer-scripts')
|
||||||
@parent
|
@parent
|
||||||
|
{!! Theme::js('js/frontend/server.socket.js') !!}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('#selectAllCheckboxes').on('click', function () {
|
$('#selectAllCheckboxes').on('click', function () {
|
||||||
|
|
|
@ -404,6 +404,7 @@
|
||||||
|
|
||||||
@section('footer-scripts')
|
@section('footer-scripts')
|
||||||
@parent
|
@parent
|
||||||
|
{!! Theme::js('js/frontend/server.socket.js') !!}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('#selectAllCheckboxes').on('click', function () {
|
$('#selectAllCheckboxes').on('click', function () {
|
||||||
|
|
Loading…
Reference in a new issue