Skip to content

Commit 59a1501

Browse files
committed
feature/server-mounts initial commit
1 parent 5dbcddc commit 59a1501

File tree

5 files changed

+176
-0
lines changed

5 files changed

+176
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Pterodactyl\Http\Controllers\Admin\Mounts;
4+
5+
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
6+
use Pterodactyl\Http\Controllers\Controller;
7+
8+
class MountController extends Controller
9+
{
10+
/**
11+
* @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface
12+
*/
13+
protected $repository;
14+
15+
/**
16+
* LocationController constructor.
17+
*
18+
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
19+
*/
20+
public function __construct(
21+
LocationRepositoryInterface $repository
22+
) {
23+
$this->repository = $repository;
24+
}
25+
26+
/**
27+
* Return the mount overview page.
28+
*
29+
* @return \Illuminate\View\View
30+
*/
31+
public function index()
32+
{
33+
return view('admin.mounts.index', [
34+
'locations' => $this->repository->getAllWithDetails(),
35+
]);
36+
}
37+
}

app/Models/Mount.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Pterodactyl\Models;
4+
5+
/**
6+
* @property int $id
7+
*/
8+
class Mount extends Model
9+
{
10+
/**
11+
* The resource name for this model when it is transformed into an
12+
* API representation using fractal.
13+
*/
14+
const RESOURCE_NAME = 'mount';
15+
16+
/**
17+
* The table associated with the model.
18+
*
19+
* @var string
20+
*/
21+
protected $table = 'mounts';
22+
23+
/**
24+
* Fields that are not mass assignable.
25+
*
26+
* @var array
27+
*/
28+
protected $guarded = ['id'];
29+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{{-- Pterodactyl - Panel --}}
2+
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
3+
4+
{{-- This software is licensed under the terms of the MIT license. --}}
5+
{{-- https://opensource.org/licenses/MIT --}}
6+
@extends('layouts.admin')
7+
8+
@section('title')
9+
Mounts
10+
@endsection
11+
12+
@section('content-header')
13+
<h1>Mounts<small>SoonTM</small></h1>
14+
<ol class="breadcrumb">
15+
<li><a href="{{ route('admin.index') }}">Admin</a></li>
16+
<li class="active">Mounts</li>
17+
</ol>
18+
@endsection
19+
20+
@section('content')
21+
<div class="row">
22+
<div class="col-xs-12">
23+
<div class="box box-primary">
24+
<div class="box-header with-border">
25+
<h3 class="box-title">Mount List</h3>
26+
27+
<div class="box-tools">
28+
<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#newLocationModal">Create New</button>
29+
</div>
30+
</div>
31+
32+
<div class="box-body table-responsive no-padding">
33+
<table class="table table-hover">
34+
<tbody>
35+
<tr>
36+
<th>ID</th>
37+
<th>Short Code</th>
38+
<th>Description</th>
39+
<th class="text-center">Nodes</th>
40+
<th class="text-center">Servers</th>
41+
</tr>
42+
43+
@foreach ($locations as $location)
44+
<tr>
45+
<td><code>{{ $location->id }}</code></td>
46+
<td><a href="{{ route('admin.locations.view', $location->id) }}">{{ $location->short }}</a></td>
47+
<td>{{ $location->long }}</td>
48+
<td class="text-center">{{ $location->nodes_count }}</td>
49+
<td class="text-center">{{ $location->servers_count }}</td>
50+
</tr>
51+
@endforeach
52+
</tbody>
53+
</table>
54+
</div>
55+
</div>
56+
</div>
57+
</div>
58+
59+
<div class="modal fade" id="newLocationModal" tabindex="-1" role="dialog">
60+
<div class="modal-dialog" role="document">
61+
<div class="modal-content">
62+
<form action="{{ route('admin.locations') }}" method="POST">
63+
<div class="modal-header">
64+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
65+
<h4 class="modal-title">Create Location</h4>
66+
</div>
67+
68+
<div class="modal-body">
69+
<div class="row">
70+
<div class="col-md-12">
71+
<label for="pShortModal" class="form-label">Short Code</label>
72+
<input type="text" name="short" id="pShortModal" class="form-control" />
73+
<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>
74+
</div>
75+
76+
<div class="col-md-12">
77+
<label for="pLongModal" class="form-label">Description</label>
78+
<textarea name="long" id="pLongModal" class="form-control" rows="4"></textarea>
79+
<p class="text-muted small">A longer description of this location. Must be less than 255 characters.</p>
80+
</div>
81+
</div>
82+
</div>
83+
84+
<div class="modal-footer">
85+
{!! csrf_field() !!}
86+
<button type="button" class="btn btn-default btn-sm pull-left" data-dismiss="modal">Cancel</button>
87+
<button type="submit" class="btn btn-success btn-sm">Create</button>
88+
</div>
89+
</form>
90+
</div>
91+
</div>
92+
</div>
93+
@endsection

resources/views/layouts/admin.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@
117117
</a>
118118
</li>
119119
<li class="header">SERVICE MANAGEMENT</li>
120+
<li class="{{ ! starts_with(Route::currentRouteName(), 'admin.mounts') ?: 'active' }}">
121+
<a href="{{ route('admin.mounts') }}">
122+
<i class="fa fa-magic"></i> <span>Mounts</span>
123+
</a>
124+
</li>
120125
<li class="{{ ! starts_with(Route::currentRouteName(), 'admin.nests') ?: 'active' }}">
121126
<a href="{{ route('admin.nests') }}">
122127
<i class="fa fa-th-large"></i> <span>Nests</span>

routes/admin.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,18 @@
165165
Route::delete('/view/{node}/allocations', 'NodesController@allocationRemoveMultiple')->name('admin.nodes.view.allocation.removeMultiple');
166166
});
167167

168+
/*
169+
|--------------------------------------------------------------------------
170+
| Mount Controller Routes
171+
|--------------------------------------------------------------------------
172+
|
173+
| Endpoint: /admin/mounts
174+
|
175+
*/
176+
Route::group(['prefix' => 'mounts'], function () {
177+
Route::get('/', 'Mounts\MountController@index')->name('admin.mounts');
178+
});
179+
168180
/*
169181
|--------------------------------------------------------------------------
170182
| Nest Controller Routes

0 commit comments

Comments
 (0)