Thats enough re-theming for the day...

This commit is contained in:
Dane Everitt 2017-02-18 19:31:44 -05:00
parent 911434d033
commit b926d432e8
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
15 changed files with 733 additions and 38 deletions

View file

@ -46,8 +46,16 @@ class ServersController extends Controller
public function getIndex(Request $request) public function getIndex(Request $request)
{ {
$servers = Models\Server::withTrashed()->with(
'node', 'user', 'allocation'
);
if (! is_null($request->input('query'))) {
$servers->search($request->input('query'));
}
return view('admin.servers.index', [ return view('admin.servers.index', [
'servers' => Models\Server::withTrashed()->with('node', 'user')->paginate(25), 'servers' => $servers->paginate(25),
]); ]);
} }
@ -109,13 +117,25 @@ class ServersController extends Controller
*/ */
public function postNewServerGetNodes(Request $request) public function postNewServerGetNodes(Request $request)
{ {
if (! $request->input('location')) { $nodes = Models\Node::with('allocations')->where('location_id', $request->input('location'))->get();
return response()->json([ return $nodes->map(function ($item) {
'error' => 'Missing location in request.', $filtered = $item->allocations->map(function($map) {
], 500); return collect($map)->only(['ip', 'port']);
} });
return response()->json(Models\Node::select('id', 'name', 'public')->where('location_id', $request->input('location'))->get()); $item->ports = $filtered->unique('ip')->map(function ($map) use ($item) {
return [
'ip' => $map['ip'],
'ports' => $item->allocations->where('ip', $map['ip'])->pluck('port')->all(),
];
})->values();
return [
'id' => $item->id,
'text' => $item->name,
'allocations' => $item->ports,
];
})->values();
} }
/** /**
@ -126,24 +146,7 @@ class ServersController extends Controller
*/ */
public function postNewServerGetIps(Request $request) public function postNewServerGetIps(Request $request)
{ {
if (! $request->input('node')) { return Models\Allocation::select('id', 'ip')->where('node_id', $request->input('node'))->whereNull('server_id')->get()->unique('ip')->values()->all();
return response()->json([
'error' => 'Missing node in request.',
], 500);
}
$ips = Models\Allocation::where('node_id', $request->input('node'))->whereNull('server_id')->get();
$listing = [];
foreach ($ips as &$ip) {
if (array_key_exists($ip->ip, $listing)) {
$listing[$ip->ip] = array_merge($listing[$ip->ip], [$ip->port]);
} else {
$listing[$ip->ip] = [$ip->port];
}
}
return response()->json($listing);
} }
/** /**

View file

@ -124,6 +124,12 @@ class UserController extends Controller
public function getJson(Request $request) public function getJson(Request $request)
{ {
return User::select('email')->get()->pluck('email'); return User::select('id', 'email', 'username', 'name_first', 'name_last')
->search($request->input('q'))
->get()->transform(function ($item) {
$item->md5 = md5(strtolower($item->email));
return $item;
});
} }
} }

View file

@ -69,9 +69,6 @@ class AdminAuthenticate
return abort(403); return abort(403);
} }
// @TODO: eventually update admin themes
Theme::set('default');
return $next($request); return $next($request);
} }
} }

View file

@ -136,18 +136,22 @@ class AdminRoutes
// Assorted Page Helpers // Assorted Page Helpers
$router->post('/new/get-nodes', [ $router->post('/new/get-nodes', [
'as' => 'admin.servers.new.get-nodes',
'uses' => 'Admin\ServersController@postNewServerGetNodes', 'uses' => 'Admin\ServersController@postNewServerGetNodes',
]); ]);
$router->post('/new/get-ips', [ $router->post('/new/get-ips', [
'as' => 'admin.servers.new.get-ips',
'uses' => 'Admin\ServersController@postNewServerGetIps', 'uses' => 'Admin\ServersController@postNewServerGetIps',
]); ]);
$router->post('/new/service-options', [ $router->post('/new/service-options', [
'as' => 'admin.servers.new.service-options',
'uses' => 'Admin\ServersController@postNewServerServiceOption', 'uses' => 'Admin\ServersController@postNewServerServiceOption',
]); ]);
$router->post('/new/option-details', [ $router->post('/new/option-details', [
'as' => 'admin.servers.new.option-details',
'uses' => 'Admin\ServersController@postNewServerOptionDetails', 'uses' => 'Admin\ServersController@postNewServerOptionDetails',
]); ]);
// End Assorted Page Helpers // End Assorted Page Helpers

View file

@ -29,11 +29,12 @@ use Cache;
use Javascript; use Javascript;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Nicolaslopezj\Searchable\SearchableTrait;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
class Server extends Model class Server extends Model
{ {
use Notifiable, SoftDeletes; use Notifiable, SearchableTrait, SoftDeletes;
/** /**
* The table associated with the model. * The table associated with the model.
@ -85,6 +86,22 @@ class Server extends Model
'installed' => 'integer', 'installed' => 'integer',
]; ];
protected $searchable = [
'columns' => [
'servers.name' => 10,
'servers.username' => 10,
'servers.uuidShort' => 9,
'servers.uuid' => 8,
'users.email' => 6,
'users.username' => 6,
'nodes.name' => 2,
],
'joins' => [
'users' => ['users.id', 'servers.owner_id'],
'nodes' => ['nodes.id', 'servers.node_id'],
],
];
/** /**
* Returns a single server specified by UUID. * Returns a single server specified by UUID.
* DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS. * DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS.

View file

@ -30,6 +30,7 @@ use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Nicolaslopezj\Searchable\SearchableTrait;
use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable; use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
@ -39,7 +40,7 @@ use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification;
class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
{ {
use Authenticatable, Authorizable, CanResetPassword, Notifiable; use Authenticatable, Authorizable, CanResetPassword, Notifiable, SearchableTrait;
/** /**
* The rules for user passwords. * The rules for user passwords.
@ -87,6 +88,16 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
*/ */
protected $hidden = ['password', 'remember_token', 'totp_secret']; protected $hidden = ['password', 'remember_token', 'totp_secret'];
protected $searchable = [
'columns' => [
'email' => 10,
'username' => 9,
'name_first' => 6,
'name_last' => 6,
'uuid' => 1,
],
];
/** /**
* Enables or disables TOTP on an account if the token is valid. * Enables or disables TOTP on an account if the token is valid.
* *

View file

@ -29,7 +29,8 @@
"predis/predis": "1.1.1", "predis/predis": "1.1.1",
"fideloper/proxy": "3.2.0", "fideloper/proxy": "3.2.0",
"laracasts/utilities": "2.1.0", "laracasts/utilities": "2.1.0",
"lord/laroute": "2.3.0" "lord/laroute": "2.3.0",
"nicolaslopezj/searchable": "1.9.5"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "~1.4", "fzaninotto/faker": "~1.4",

50
composer.lock generated
View file

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "49714983a18ad2bba4759ccde45314c5", "hash": "6a9656aff0fb3809d27a2a093a810197",
"content-hash": "af8cd5b69f96dd17c1e02afc1ba8e467", "content-hash": "8affaad10f155172b5079a72015b8bc5",
"packages": [ "packages": [
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
@ -2011,6 +2011,52 @@
], ],
"time": "2015-11-04 20:07:17" "time": "2015-11-04 20:07:17"
}, },
{
"name": "nicolaslopezj/searchable",
"version": "1.9.5",
"source": {
"type": "git",
"url": "https://github.com/nicolaslopezj/searchable.git",
"reference": "1351b1b21ae9be9e0f49f375f56488df839723d4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nicolaslopezj/searchable/zipball/1351b1b21ae9be9e0f49f375f56488df839723d4",
"reference": "1351b1b21ae9be9e0f49f375f56488df839723d4",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"illuminate/database": "4.2.x|~5.0",
"php": ">=5.4.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Nicolaslopezj\\Searchable\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Lopez",
"email": "nicolaslopezj@me.com"
}
],
"description": "Eloquent model search trait.",
"keywords": [
"database",
"eloquent",
"laravel",
"model",
"search",
"searchable"
],
"time": "2016-12-16 21:23:34"
},
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v2.1.1", "version": "v2.1.1",

File diff suppressed because one or more lines are too long

View file

@ -132,3 +132,20 @@ td.has-progress {
.no-margin { .no-margin {
margin: 0 !important; margin: 0 !important;
} }
li.select2-results__option--highlighted[aria-selected="false"] > .user-block > .username > a {
color: #fff;
}
li.select2-results__option--highlighted[aria-selected="false"] > .user-block > .description {
color: #eee;
}
.img-bordered-xs {
border: 1px solid #d2d6de;
padding: 1px;
}
span[aria-labelledby="select2-pOwner-container"] {
padding-left: 2px !important;
}

View file

@ -0,0 +1,71 @@
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
{{-- of this software and associated documentation files (the "Software"), to deal --}}
{{-- in the Software without restriction, including without limitation the rights --}}
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
{{-- copies of the Software, and to permit persons to whom the Software is --}}
{{-- furnished to do so, subject to the following conditions: --}}
{{-- The above copyright notice and this permission notice shall be included in all --}}
{{-- copies or substantial portions of the Software. --}}
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
{{-- SOFTWARE. --}}
@extends('layouts.admin')
@section('title')
Administration
@endsection
@section('content-header')
<h1>Administrative Overview<small>A quick glance at your system.</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li class="active">Index</li>
</ol>
@endsection
@section('content')
<div class="row">
<div class="col-xs-12">
<div class="box
@if(Version::isLatestPanel())
box-success
@else
box-danger
@endif
">
<div class="box-header with-border">
<h3 class="box-title">System Information</h3>
</div>
<div class="box-body">
@if (Version::isLatestPanel())
You are running Pterodactyl Panel version <code>{{ Version::getCurrentPanel() }}</code>. Your panel is up-to-date!
@else
Your panel is <strong>not up-to-date!</strong> The latest version is <a href="https://github.com/Pterodactyl/Panel/releases/v{{ Version::getPanel() }}" target="_blank"><code>{{ Version::getPanel() }}</code></a> and you are currently running version <code>{{ Version::getCurrentPanel() }}</code>.
@endif
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-sm-3 text-center">
<a href="{{ Version::getDiscord() }}"><button class="btn btn-warning" style="width:100%;"><i class="fa fa-fw fa-support"></i> Get Help <small>(via Discord)</small></button></a>
</div>
<div class="col-xs-6 col-sm-3 text-center">
<a href="https://docs.pterodactyl.io"><button class="btn btn-primary" style="width:100%;"><i class="fa fa-fw fa-link"></i> Documentation</button></a>
</div>
<div class="col-xs-6 col-sm-3 text-center">
<a href="https://github.com/Pterodactyl/Panel"><button class="btn btn-primary" style="width:100%;"><i class="fa fa-fw fa-support"></i> Github</button></a>
</div>
<div class="col-xs-6 col-sm-3 text-center">
<a href="https://patreon.com/pterry"><button class="btn btn-success" style="width:100%;"><i class="fa fa-fw fa-money"></i> Support the Project</button></a>
</div>
</div>
@endsection

View file

@ -0,0 +1,94 @@
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
{{-- of this software and associated documentation files (the "Software"), to deal --}}
{{-- in the Software without restriction, including without limitation the rights --}}
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
{{-- copies of the Software, and to permit persons to whom the Software is --}}
{{-- furnished to do so, subject to the following conditions: --}}
{{-- The above copyright notice and this permission notice shall be included in all --}}
{{-- copies or substantial portions of the Software. --}}
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
{{-- SOFTWARE. --}}
@extends('layouts.admin')
@section('title')
List Servers
@endsection
@section('content-header')
<h1>Servers<small>All servers available on the system.</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li class="active">Servers</li>
</ol>
@endsection
@section('content')
<div class="row">
<div class="col-xs-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Server List</h3>
<div class="box-tools">
<form action="{{ route('admin.servers') }}" method="GET">
<div class="input-group input-group-sm" style="width: 300px;">
<input type="text" name="query" class="form-control pull-right" value="{{ request()->input('query') }}" placeholder="Search">
<div class="input-group-btn">
<button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
<a href="{{ route('admin.servers.new') }}"><button type="button" class="btn btn-sm btn-primary" style="border-radius: 0 3px 3px 0;margin-left:-1px;">Create New</button></a>
</div>
</div>
</form>
</div>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tbody>
<tr>
<th>ID</th>
<th>Server Name</th>
<th>Owner</th>
<th>Node</th>
<th>Connection</th>
<th></th>
</tr>
@foreach ($servers as $server)
<tr data-server="{{ $server->uuidShort }}">
<td><code>{{ $server->uuidShort }}</code></td>
<td><a href="/admin/servers/view/{{ $server->id }}">{{ $server->name }}</a></td>
<td><a href="/admin/users/view/{{ $server->user->id }}">{{ $server->user->email }}</a></td>
<td><a href="/admin/nodes/view/{{ $server->node->id }}">{{ $server->node->name }}</a></td>
<td>
<code>{{ $server->allocation->alias }}:{{ $server->allocation->port }}</code>
</td>
<td class="text-center">
@if($server->suspended && ! $server->trashed())
<span class="label bg-maroon">Suspended</span>
@elseif($server->trashed())
<span class="label label-danger">Pending Deletion</span>
@elseif(! $server->installed)
<span class="label label-warning">Installing</span>
@else
<span class="label label-success">Active</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="box-footer with-border">
<div class="col-md-12 text-center">{!! $servers->render() !!}</div>
</div>
</div>
</div>
</div>
@endsection

View file

@ -0,0 +1,230 @@
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
{{-- of this software and associated documentation files (the "Software"), to deal --}}
{{-- in the Software without restriction, including without limitation the rights --}}
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
{{-- copies of the Software, and to permit persons to whom the Software is --}}
{{-- furnished to do so, subject to the following conditions: --}}
{{-- The above copyright notice and this permission notice shall be included in all --}}
{{-- copies or substantial portions of the Software. --}}
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
{{-- SOFTWARE. --}}
@extends('layouts.admin')
@section('title')
New Server
@endsection
@section('content-header')
<h1>Create Server<small>Add a new server to the panel.</small></h1>
<ol class="breadcrumb">
<li><a href="{{ route('admin.index') }}">Admin</a></li>
<li><a href="{{ route('admin.servers') }}">Servers</a></li>
<li class="active">Create Server</li>
</ol>
@endsection
@section('content')
<form action="{{ route('admin.servers.new') }}" method="POST">
<div class="row">
<div class="col-xs-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Core Details</h3>
</div>
<div class="box-body row">
<div class="form-group col-sm-6">
<label for="pName">Server Name</label>
<input type="text" class="form-control" id="pName" name="name" placeholder="Server Name">
<p class="small text-muted no-margin">Character limits: <code>a-z A-Z 0-9 _ - .</code> and <code>[Space]</code> (max 200 characters).</p>
</div>
<div class="form-group col-sm-6">
<label for="pUserId">Server Owner</label>
<select class="form-control" style="padding-left:0;" name="user_id" id="pUserId"></select>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="overlay" id="allocationLoader" style="display:none;"><i class="fa fa-refresh fa-spin"></i></div>
<div class="box-header with-border">
<h3 class="box-title">Allocation Management</h3>
</div>
<div class="box-body row">
<div class="form-group col-sm-6">
<label for="pLocationId">Location</label>
<select name="location_id" id="pLocationId" class="form-control">
<option disabled selected>Select a Location</option>
@foreach($locations as $location)
<option value="{{ $location->id }}">{{ $location->long }} ({{ $location->short }})</option>
@endforeach
</select>
<p class="small text-muted no-margin">The location in which this server will be deployed.</p>
</div>
<div class="form-group col-sm-6">
<label for="pNodeId">Node</label>
<select name="node_id" id="pNodeId" class="form-control">
<option disabled selected>Select a Node</option>
</select>
<p class="small text-muted no-margin">The node which this server will be deployed to.</p>
</div>
<div class="form-group col-sm-6">
<label for="pIp">IP Address</label>
<select name="ip" id="pIp" class="form-control">
<option disabled selected>Select an IP</option>
</select>
<p class="small text-muted no-margin">The IP address that this server will be allocated to.</p>
</div>
<div class="form-group col-sm-6">
<label for="pPort">Port</label>
<select name="port" id="pPort" class="form-control">
<option disabled selected>Select a Port</option>
</select>
<p class="small text-muted no-margin">The port that this server will be allocated to.</p>
</div>
</div>
<div class="box-footer">
<p class="text-muted small no-margin">
<input type="checkbox" name="auto_deploy" id="pAutoDeploy" />
<label for="pAutoDeploy">Check this box if you want the panel to automatically select a node and allocation for this server in the given location.</label>
</p>
</div>
</div>
</div>
</div>
</form>
@endsection
@section('footer-scripts')
@parent
<script>
$(document).ready(function() {
$('#pLocationId').select2();
$('#pNodeId').select2();
$('#pIp').select2();
$('#pPort').select2();
$('#pUserId').select2({
ajax: {
url: Router.route('admin.users.json'),
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term, // search term
page: params.page,
};
},
processResults: function (data, params) {
return { results: data };
},
cache: true,
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 2,
templateResult: function (data) {
if (data.loading) return data.text;
return '<div class="user-block"> \
<img class="img-circle img-bordered-xs" src="https://www.gravatar.com/avatar/' + data.md5 + '?s=120" alt="User Image"> \
<span class="username"> \
<a href="#">' + data.name_first + ' ' + data.name_last +'</a> \
</span> \
<span class="description"><strong>' + data.email + '</strong> - ' + data.username + '</span> \
</div>';
},
templateSelection: function (data) {
return '<div> \
<span> \
<img class="img-rounded img-bordered-xs" src="https://www.gravatar.com/avatar/' + data.md5 + '?s=120" style="height:28px;margin-top:-4px;" alt="User Image"> \
</span> \
<span style="padding-left:5px;"> \
' + data.name_first + ' ' + data.name_last + ' (<strong>' + data.email + '</strong>) \
</span> \
</div>';
}
});
});
function hideLoader() {
$('#allocationLoader').hide();
}
function showLoader() {
$('#allocationLoader').show();
}
var currentLocation = null;
var curentNode = null;
var currentIP = null;
var NodeDataIdentifier = null;
var NodeData = [];
var AllocationsForNode = null;
$('#pLocationId').on('change', function (event) {
showLoader()
currentLocation = $(this).val();
currentNode = null;
$.ajax({
method: 'POST',
url: Router.route('admin.servers.new.get-nodes'),
headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') },
data: { location: currentLocation },
}).done(function (data) {
NodeData = data;
console.log(data);
$('#pNodeId').select2({data: data});
}).fail(function (jqXHR) {
cosole.error(jqXHR);
currentLocation = null;
}).always(hideLoader);
});
$('#pNodeId').on('change', function (event) {
currentNode = $(this).val();
$.each(NodeData, function (i, v) {
if (v.id == currentNode) {
NodeDataIdentifier = i;
$('#pIp').select2({
data: $.map(v.allocations, function (item) {
return {
id: item.ip,
text: item.ip,
}
}),
})
}
});
});
$('#pIp').on('change', function (event) {
currentIP = $(this).val();
$.each(NodeData[NodeDataIdentifier].allocations, function (i, v) {
if (v.ip == currentIP) {
$('#pPort').val(null);
$('#pPort').select2({
data: $.map(v.ports, function (item) {
return {
id: item,
text: item,
}
}),
})
}
});
});
</script>
@endsection

View file

@ -0,0 +1,198 @@
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
{{-- of this software and associated documentation files (the "Software"), to deal --}}
{{-- in the Software without restriction, including without limitation the rights --}}
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
{{-- copies of the Software, and to permit persons to whom the Software is --}}
{{-- furnished to do so, subject to the following conditions: --}}
{{-- The above copyright notice and this permission notice shall be included in all --}}
{{-- copies or substantial portions of the Software. --}}
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
{{-- SOFTWARE. --}}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ Settings::get('company', 'Pterodactyl') }} - @yield('title')</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<meta name="_token" content="{{ csrf_token() }}">
@section('scripts')
{!! Theme::css('vendor/select2/select2.min.css') !!}
{!! Theme::css('vendor/bootstrap/bootstrap.min.css') !!}
{!! Theme::css('vendor/adminlte/admin.min.css') !!}
{!! Theme::css('vendor/adminlte/colors/skin-blue.min.css') !!}
{!! Theme::css('vendor/sweetalert/sweetalert.min.css') !!}
{!! Theme::css('vendor/animate/animate.min.css') !!}
{!! Theme::css('css/pterodactyl.css') !!}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
@show
</head>
<body class="hold-transition skin-blue fixed sidebar-mini">
<div class="wrapper">
<header class="main-header">
<a href="{{ route('index') }}" class="logo">
<span>{{ Settings::get('company', 'Pterodactyl') }}</span>
</a>
<nav class="navbar navbar-static-top">
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li class="dropdown user-menu">
<a href="{{ route('account') }}" class="dropdown-toggle" data-toggle="dropdown">
<img src="https://www.gravatar.com/avatar/{{ md5(strtolower(Auth::user()->email)) }}?s=160" class="user-image" alt="User Image">
<span class="hidden-xs">{{ Auth::user()->name_first }} {{ Auth::user()->name_last }}</span>
</a>
</li>
<li>
<a href="#" data-action="control-sidebar" data-toggle="tooltip" data-placement="bottom" title="Quick Access"><i class="fa fa-fighter-jet" style="margin-top:4px;padding-bottom:2px;"></i></a>
</li>
<li>
<li><a href="{{ route('admin.index') }}" data-toggle="tooltip" data-placement="bottom" title="Exit Admin Control"><i class="fa fa-server" style="margin-top:4px;padding-bottom:2px;"></i></a></li>
</li>
<li>
<li><a href="{{ route('auth.logout') }}" data-toggle="tooltip" data-placement="bottom" title="Logout"><i class="fa fa-power-off" style="margin-top:4px;padding-bottom:2px;"></i></a></li>
</li>
</ul>
</div>
</nav>
</header>
<aside class="main-sidebar">
<section class="sidebar">
<ul class="sidebar-menu">
<li class="header">BASIC ADMINISTRATION</li>
<li class="{{ Route::currentRouteName() !== 'admin.index' ?: 'active' }}">
<a href="{{ route('admin.index') }}">
<i class="fa fa-home"></i> <span>Overview</span>
</a>
</li>
<li class="{{ Route::currentRouteName() !== 'admin.settings' ?: 'active' }}">
<a href="{{ route('admin.settings')}}">
<i class="fa fa-wrench"></i> <span>Settings</span>
</a>
</li>
<li class="header">SERVER MANAGEMENT</li>
<li class="{{ Route::currentRouteName() !== 'admin.servers' ?: 'active' }}">
<a href="{{ route('admin.servers') }}">
<i class="fa fa-server"></i> <span>List Servers</span>
</a>
</li>
<li class="{{ Route::currentRouteName() !== 'admin.servers.new' ?: 'active' }}">
<a href="{{ route('admin.servers.new') }}">
<i class="fa fa-plus"></i> <span>Create Server</span>
</a>
</li>
</ul>
</section>
</aside>
<div class="content-wrapper">
<section class="content-header">
@yield('content-header')
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
@if (count($errors) > 0)
<div class="callout callout-danger">
@lang('base.validation_error')<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@foreach (Alert::getMessages() as $type => $messages)
@foreach ($messages as $message)
<div class="callout callout-{{ $type }} alert-dismissable" role="alert">
{!! $message !!}
</div>
@endforeach
@endforeach
</div>
</div>
@yield('content')
</section>
</div>
<footer class="main-footer">
<div class="pull-right hidden-xs small text-gray">
<strong>v</strong> {{ config('app.version') }}
</div>
Copyright &copy; 2015 - {{ date('Y') }} <a href="https://pterodactyl.io/">Pterodactyl Software</a>.
</footer>
<aside class="control-sidebar control-sidebar-dark">
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li class="active"><a href="#control-sidebar-servers-tab" data-toggle="tab"><i class="fa fa-server"></i></a></li>
<li><a href="#control-sidebar-nodes-tab" data-toggle="tab"><i class="fa fa-sitemap"></i></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="control-sidebar-servers-tab">
<ul class="control-sidebar-menu">
@foreach (Pterodactyl\Models\Server::all() as $s)
<li>
<a href="{{ route('admin.servers.view', $s->id) }}">
@if($s->owner_id === Auth::user()->id)
<i class="menu-icon fa fa-user bg-blue"></i>
@else
<i class="menu-icon fa fa-user-o bg-gray"></i>
@endif
<div class="menu-info">
<h4 class="control-sidebar-subheading">{{ $s->name }}</h4>
<p>{{ $s->username }}</p>
</div>
</a>
</li>
@endforeach
</ul>
</div>
<div class="tab-pane" id="control-sidebar-nodes-tab">
<ul class="control-sidebar-menu">
@foreach (Pterodactyl\Models\Node::with('location')->get() as $n)
<li>
<a href="{{ route('admin.nodes.view', $n->id) }}">
<i class="menu-icon fa fa-codepen bg-gray"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">{{ $n->name }}</h4>
<p>{{ $n->location->short }}</p>
</div>
</a>
</li>
@endforeach
</ul>
</div>
</div>
</aside>
<div class="control-sidebar-bg"></div>
</div>
@section('footer-scripts')
{!! Theme::js('js/laroute.js') !!}
{!! Theme::js('js/vendor/jquery/jquery.min.js') !!}
{!! Theme::js('vendor/sweetalert/sweetalert.min.js') !!}
{!! Theme::js('vendor/bootstrap/bootstrap.min.js') !!}
{!! Theme::js('vendor/slimscroll/jquery.slimscroll.min.js') !!}
{!! Theme::js('vendor/adminlte/app.min.js') !!}
{!! Theme::js('js/vendor/socketio/socket.io.min.js') !!}
{!! Theme::js('vendor/bootstrap-notify/bootstrap-notify.min.js') !!}
{!! Theme::js('vendor/select2/select2.full.min.js') !!}
@show
</body>
</html>

View file

@ -62,14 +62,14 @@
<span class="hidden-xs">{{ Auth::user()->name_first }} {{ Auth::user()->name_last }}</span> <span class="hidden-xs">{{ Auth::user()->name_first }} {{ Auth::user()->name_last }}</span>
</a> </a>
</li> </li>
<li>
<a href="#" data-action="control-sidebar" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.servers') }}"><i class="fa fa-server" style="margin-top:4px;padding-bottom:2px;"></i></a>
</li>
@if(Auth::user()->isRootAdmin()) @if(Auth::user()->isRootAdmin())
<li> <li>
<li><a href="{{ route('admin.index') }}" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.admin_cp') }}"><i class="fa fa-gears" style="margin-top:4px;padding-bottom:2px;"></i></a></li> <li><a href="{{ route('admin.index') }}" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.admin_cp') }}"><i class="fa fa-gears" style="margin-top:4px;padding-bottom:2px;"></i></a></li>
</li> </li>
@endif @endif
<li>
<a href="#" data-action="control-sidebar" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.servers') }}"><i class="fa fa-server" style="margin-top:4px;padding-bottom:2px;"></i></a>
</li>
<li> <li>
<li><a href="{{ route('auth.logout') }}" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.logout') }}"><i class="fa fa-power-off" style="margin-top:4px;padding-bottom:2px;"></i></a></li> <li><a href="{{ route('auth.logout') }}" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.logout') }}"><i class="fa fa-power-off" style="margin-top:4px;padding-bottom:2px;"></i></a></li>
</li> </li>