Merge branch 'develop' into dane/fix-performance-snafu
This commit is contained in:
commit
6bc51adad7
5 changed files with 24 additions and 100 deletions
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Models;
|
namespace Pterodactyl\Models;
|
||||||
|
|
||||||
use MountNode;
|
|
||||||
use MountServer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $uuid
|
* @property string $uuid
|
||||||
|
@ -48,6 +45,11 @@ class Mount extends Model
|
||||||
*/
|
*/
|
||||||
protected $attributes = [
|
protected $attributes = [
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
|
'uuid' => 'string',
|
||||||
|
'name' => 'string',
|
||||||
|
'description' => 'string',
|
||||||
|
'source' => 'string',
|
||||||
|
'target' => 'string',
|
||||||
'read_only' => 'bool',
|
'read_only' => 'bool',
|
||||||
'user_mountable' => 'bool',
|
'user_mountable' => 'bool',
|
||||||
];
|
];
|
||||||
|
@ -87,18 +89,20 @@ class Mount extends Model
|
||||||
/**
|
/**
|
||||||
* Returns all nodes that have this mount assigned.
|
* Returns all nodes that have this mount assigned.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
*/
|
*/
|
||||||
public function nodes()
|
public function nodes()
|
||||||
{
|
{
|
||||||
return $this->hasManyThrough(Server::class, MountNode::class);
|
return $this->belongsToMany(Node::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
* Returns all servers that have this mount assigned.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
*/
|
*/
|
||||||
public function servers()
|
public function servers()
|
||||||
{
|
{
|
||||||
return $this->hasManyThrough(Server::class, MountServer::class);
|
return $this->belongsToMany(Server::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Pterodactyl\Models\Node;
|
|
||||||
use Pterodactyl\Models\Mount;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class MountNode extends Model
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $timestamps = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $incrementing = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $table = 'mount_node';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
||||||
*/
|
|
||||||
public function node()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Node::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
||||||
*/
|
|
||||||
public function mount()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Mount::class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Pterodactyl\Models\Mount;
|
|
||||||
use Pterodactyl\Models\Server;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class MountServer extends Model
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $timestamps = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $incrementing = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $table = 'mount_server';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
||||||
*/
|
|
||||||
public function server()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Server::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
||||||
*/
|
|
||||||
public function mount()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Mount::class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Services\Servers;
|
namespace Pterodactyl\Services\Servers;
|
||||||
|
|
||||||
use Pterodactyl\Models\Mount;
|
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||||
|
|
||||||
|
@ -72,6 +71,17 @@ class ServerConfigurationStructureService
|
||||||
*/
|
*/
|
||||||
protected function returnCurrentFormat(Server $server)
|
protected function returnCurrentFormat(Server $server)
|
||||||
{
|
{
|
||||||
|
$mounts = $server->mounts;
|
||||||
|
foreach ($mounts as $mount) {
|
||||||
|
unset($mount->id);
|
||||||
|
unset($mount->uuid);
|
||||||
|
unset($mount->name);
|
||||||
|
unset($mount->description);
|
||||||
|
$mount->read_only = $mount->read_only == 1;
|
||||||
|
unset($mount->user_mountable);
|
||||||
|
unset($mount->pivot);
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'uuid' => $server->uuid,
|
'uuid' => $server->uuid,
|
||||||
'suspended' => (bool) $server->suspended,
|
'suspended' => (bool) $server->suspended,
|
||||||
|
@ -102,9 +112,7 @@ class ServerConfigurationStructureService
|
||||||
],
|
],
|
||||||
'mappings' => $server->getAllocationMappings(),
|
'mappings' => $server->getAllocationMappings(),
|
||||||
],
|
],
|
||||||
'mounts' => $server->mounts->map(function (Mount $mount) {
|
'mounts' => $mounts,
|
||||||
return $mount->only('uuid', 'source', 'description', 'read_only');
|
|
||||||
})->toArray(),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,21 +35,11 @@
|
||||||
@import url('//fonts.googleapis.com/css?family=IBM+Plex+Mono|IBM+Plex+Sans:500&display=swap');
|
@import url('//fonts.googleapis.com/css?family=IBM+Plex+Mono|IBM+Plex+Sans:500&display=swap');
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@section('assets')
|
@yield('assets')
|
||||||
{{-- {!! $asset->css('main.css') !!}--}}
|
|
||||||
@show
|
|
||||||
|
|
||||||
@include('layouts.scripts')
|
@include('layouts.scripts')
|
||||||
</head>
|
</head>
|
||||||
<body class="{{ $css['body'] ?? 'bg-neutral-50' }}">
|
<body class="{{ $css['body'] ?? 'bg-neutral-50' }}">
|
||||||
@if(\Illuminate\Support\Str::contains(config('app.version'), ['-alpha', '-beta']))
|
|
||||||
<div class="bg-red-500">
|
|
||||||
<p class="text-center text-white text-sm p-3">
|
|
||||||
You are running a pre-release version of Pterodactyl. Please report any issues
|
|
||||||
<a href="https://github.com/pterodactyl/panel/issues" class="text-red-100">via GitHub</a>.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@yield('above-container')
|
@yield('above-container')
|
||||||
@yield('container')
|
@yield('container')
|
||||||
|
|
Loading…
Reference in a new issue