feature/server-mounts initial commit
This commit is contained in:
parent
5dbcddc862
commit
59a150148a
5 changed files with 176 additions and 0 deletions
37
app/Http/Controllers/Admin/Mounts/MountController.php
Normal file
37
app/Http/Controllers/Admin/Mounts/MountController.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Admin\Mounts;
|
||||
|
||||
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
|
||||
class MountController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface
|
||||
*/
|
||||
protected $repository;
|
||||
|
||||
/**
|
||||
* LocationController constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(
|
||||
LocationRepositoryInterface $repository
|
||||
) {
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mount overview page.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('admin.mounts.index', [
|
||||
'locations' => $this->repository->getAllWithDetails(),
|
||||
]);
|
||||
}
|
||||
}
|
29
app/Models/Mount.php
Normal file
29
app/Models/Mount.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
*/
|
||||
class Mount extends Model
|
||||
{
|
||||
/**
|
||||
* The resource name for this model when it is transformed into an
|
||||
* API representation using fractal.
|
||||
*/
|
||||
const RESOURCE_NAME = 'mount';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'mounts';
|
||||
|
||||
/**
|
||||
* Fields that are not mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = ['id'];
|
||||
}
|
93
resources/views/admin/mounts/index.blade.php
Normal file
93
resources/views/admin/mounts/index.blade.php
Normal file
|
@ -0,0 +1,93 @@
|
|||
{{-- Pterodactyl - Panel --}}
|
||||
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
|
||||
|
||||
{{-- This software is licensed under the terms of the MIT license. --}}
|
||||
{{-- https://opensource.org/licenses/MIT --}}
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title')
|
||||
Mounts
|
||||
@endsection
|
||||
|
||||
@section('content-header')
|
||||
<h1>Mounts<small>SoonTM</small></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('admin.index') }}">Admin</a></li>
|
||||
<li class="active">Mounts</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">Mount List</h3>
|
||||
|
||||
<div class="box-tools">
|
||||
<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#newLocationModal">Create New</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<table class="table table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Short Code</th>
|
||||
<th>Description</th>
|
||||
<th class="text-center">Nodes</th>
|
||||
<th class="text-center">Servers</th>
|
||||
</tr>
|
||||
|
||||
@foreach ($locations as $location)
|
||||
<tr>
|
||||
<td><code>{{ $location->id }}</code></td>
|
||||
<td><a href="{{ route('admin.locations.view', $location->id) }}">{{ $location->short }}</a></td>
|
||||
<td>{{ $location->long }}</td>
|
||||
<td class="text-center">{{ $location->nodes_count }}</td>
|
||||
<td class="text-center">{{ $location->servers_count }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="newLocationModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<form action="{{ route('admin.locations') }}" method="POST">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Create Location</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<label for="pShortModal" class="form-label">Short Code</label>
|
||||
<input type="text" name="short" id="pShortModal" class="form-control" />
|
||||
<p class="text-muted small">A short identifier used to distinguish this location from others. Must be between 1 and 60 characters, for example, <code>us.nyc.lvl3</code>.</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<label for="pLongModal" class="form-label">Description</label>
|
||||
<textarea name="long" id="pLongModal" class="form-control" rows="4"></textarea>
|
||||
<p class="text-muted small">A longer description of this location. Must be less than 255 characters.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
{!! csrf_field() !!}
|
||||
<button type="button" class="btn btn-default btn-sm pull-left" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-success btn-sm">Create</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
|
@ -117,6 +117,11 @@
|
|||
</a>
|
||||
</li>
|
||||
<li class="header">SERVICE MANAGEMENT</li>
|
||||
<li class="{{ ! starts_with(Route::currentRouteName(), 'admin.mounts') ?: 'active' }}">
|
||||
<a href="{{ route('admin.mounts') }}">
|
||||
<i class="fa fa-magic"></i> <span>Mounts</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="{{ ! starts_with(Route::currentRouteName(), 'admin.nests') ?: 'active' }}">
|
||||
<a href="{{ route('admin.nests') }}">
|
||||
<i class="fa fa-th-large"></i> <span>Nests</span>
|
||||
|
|
|
@ -165,6 +165,18 @@ Route::group(['prefix' => 'nodes'], function () {
|
|||
Route::delete('/view/{node}/allocations', 'NodesController@allocationRemoveMultiple')->name('admin.nodes.view.allocation.removeMultiple');
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mount Controller Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Endpoint: /admin/mounts
|
||||
|
|
||||
*/
|
||||
Route::group(['prefix' => 'mounts'], function () {
|
||||
Route::get('/', 'Mounts\MountController@index')->name('admin.mounts');
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Nest Controller Routes
|
||||
|
|
Loading…
Reference in a new issue