Skip to content

Commit c19c423

Browse files
committed
More fixes
1 parent 17642bf commit c19c423

File tree

14 files changed

+67
-61
lines changed

14 files changed

+67
-61
lines changed

app/Http/Controllers/Admin/PackController.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function __construct(
114114
public function index(Request $request)
115115
{
116116
return view('admin.packs.index', [
117-
'packs' => $this->repository->search($request->input('query'))->paginateWithOptionAndServerCount(
117+
'packs' => $this->repository->search($request->input('query'))->paginateWithEggAndServerCount(
118118
$this->config->get('pterodactyl.paginate.admin.packs')
119119
),
120120
]);
@@ -124,23 +124,27 @@ public function index(Request $request)
124124
* Display new pack creation form.
125125
*
126126
* @return \Illuminate\View\View
127+
*
128+
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
127129
*/
128130
public function create()
129131
{
130132
return view('admin.packs.new', [
131-
'services' => $this->serviceRepository->getWithOptions(),
133+
'nests' => $this->serviceRepository->getWithEggs(),
132134
]);
133135
}
134136

135137
/**
136138
* Display new pack creation modal for use with template upload.
137139
*
138140
* @return \Illuminate\View\View
141+
*
142+
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
139143
*/
140144
public function newTemplate()
141145
{
142146
return view('admin.packs.modal', [
143-
'services' => $this->serviceRepository->getWithOptions(),
147+
'nests' => $this->serviceRepository->getWithEggs(),
144148
]);
145149
}
146150

@@ -160,7 +164,7 @@ public function newTemplate()
160164
public function store(PackFormRequest $request)
161165
{
162166
if ($request->has('from_template')) {
163-
$pack = $this->templateUploadService->handle($request->input('option_id'), $request->file('file_upload'));
167+
$pack = $this->templateUploadService->handle($request->input('egg_id'), $request->file('file_upload'));
164168
} else {
165169
$pack = $this->creationService->handle($request->normalize(), $request->file('file_upload'));
166170
}
@@ -175,12 +179,13 @@ public function store(PackFormRequest $request)
175179
*
176180
* @param int $pack
177181
* @return \Illuminate\View\View
182+
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
178183
*/
179184
public function view($pack)
180185
{
181186
return view('admin.packs.view', [
182187
'pack' => $this->repository->getWithServers($pack),
183-
'services' => $this->serviceRepository->getWithOptions(),
188+
'nests' => $this->serviceRepository->getWithEggs(),
184189
]);
185190
}
186191

app/Http/Requests/Admin/ServerFormRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function withValidator($validator)
6363
$validator->sometimes('pack_id', [
6464
Rule::exists('packs', 'id')->where(function ($query) {
6565
$query->where('selectable', 1);
66-
$query->where('option_id', $this->input('option_id'));
66+
$query->where('egg_id', $this->input('egg_id'));
6767
}),
6868
], function ($input) {
6969
return $input->pack_id !== 0 && $input->pack_id !== null;

app/Models/Pack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Pack extends Model implements CleansAttributes, ValidableContract
3434
* @var array
3535
*/
3636
protected $fillable = [
37-
'option_id', 'uuid', 'name', 'version', 'description', 'selectable', 'visible', 'locked',
37+
'egg_id', 'uuid', 'name', 'version', 'description', 'selectable', 'visible', 'locked',
3838
];
3939

4040
/**

app/Services/Packs/PackUpdateService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public function __construct(
5454
public function handle($pack, array $data)
5555
{
5656
if (! $pack instanceof Pack) {
57-
$pack = $this->repository->withColumns(['id', 'option_id'])->find($pack);
57+
$pack = $this->repository->withColumns(['id', 'egg_id'])->find($pack);
5858
}
5959

60-
if ((int) array_get($data, 'option_id', $pack->option_id) !== $pack->option_id) {
60+
if ((int) array_get($data, 'egg_id', $pack->egg_id) !== $pack->egg_id) {
6161
$count = $this->serverRepository->findCountWhere([['pack_id', '=', $pack->id]]);
6262

6363
if ($count !== 0) {

app/Services/Packs/TemplateUploadService.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct(
5252
/**
5353
* Process an uploaded file to create a new pack from a JSON or ZIP format.
5454
*
55-
* @param int $option
55+
* @param int $egg
5656
* @param \Illuminate\Http\UploadedFile $file
5757
* @return \Pterodactyl\Models\Pack
5858
*
@@ -63,7 +63,7 @@ public function __construct(
6363
* @throws \Pterodactyl\Exceptions\Service\Pack\UnreadableZipArchiveException
6464
* @throws \Pterodactyl\Exceptions\Service\Pack\InvalidPackArchiveFormatException
6565
*/
66-
public function handle($option, UploadedFile $file)
66+
public function handle($egg, UploadedFile $file)
6767
{
6868
if (! $file->isValid()) {
6969
throw new InvalidFileUploadException(trans('exceptions.packs.invalid_upload'));
@@ -76,10 +76,10 @@ public function handle($option, UploadedFile $file)
7676
}
7777

7878
if ($file->getMimeType() === 'application/zip') {
79-
return $this->handleArchive($option, $file);
79+
return $this->handleArchive($egg, $file);
8080
} else {
8181
$json = json_decode($file->openFile()->fread($file->getSize()), true);
82-
$json['option_id'] = $option;
82+
$json['egg_id'] = $egg;
8383

8484
return $this->creationService->handle($json);
8585
}
@@ -88,7 +88,7 @@ public function handle($option, UploadedFile $file)
8888
/**
8989
* Process a ZIP file to create a pack and stored archive.
9090
*
91-
* @param int $option
91+
* @param int $egg
9292
* @param \Illuminate\Http\UploadedFile $file
9393
* @return \Pterodactyl\Models\Pack
9494
*
@@ -99,7 +99,7 @@ public function handle($option, UploadedFile $file)
9999
* @throws \Pterodactyl\Exceptions\Service\Pack\UnreadableZipArchiveException
100100
* @throws \Pterodactyl\Exceptions\Service\Pack\InvalidPackArchiveFormatException
101101
*/
102-
protected function handleArchive($option, $file)
102+
protected function handleArchive($egg, $file)
103103
{
104104
if (! $this->archive->open($file->getRealPath())) {
105105
throw new UnreadableZipArchiveException(trans('exceptions.packs.unreadable'));
@@ -110,7 +110,7 @@ protected function handleArchive($option, $file)
110110
}
111111

112112
$json = json_decode($this->archive->getFromName('import.json'), true);
113-
$json['option_id'] = $option;
113+
$json['egg_id'] = $egg;
114114

115115
$pack = $this->creationService->handle($json);
116116
if (! $this->archive->extractTo(storage_path('app/packs/' . $pack->uuid), 'archive.tar.gz')) {

app/Services/Servers/ServerCreationService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function __construct(
124124
public function create(array $data)
125125
{
126126
// @todo auto-deployment
127-
$validator = $this->validatorService->isAdmin()->setFields($data['environment'])->validate($data['option_id']);
127+
$validator = $this->validatorService->isAdmin()->setFields($data['environment'])->validate($data['egg_id']);
128128
$uniqueShort = str_random(8);
129129

130130
$this->connection->beginTransaction();

database/factories/ModelFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
$factory->define(Pterodactyl\Models\Pack::class, function (Faker\Generator $faker) {
134134
return [
135135
'id' => $faker->unique()->randomNumber(),
136-
'option_id' => $faker->randomNumber(),
136+
'egg_id' => $faker->randomNumber(),
137137
'uuid' => $faker->uuid,
138138
'name' => $faker->word,
139139
'description' => null,

resources/themes/pterodactyl/admin/nodes/view/servers.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<td><code>{{ $server->uuidShort }}</code></td>
5757
<td><a href="{{ route('admin.servers.view', $server->id) }}">{{ $server->name }}</a></td>
5858
<td><a href="{{ route('admin.users.view', $server->owner_id) }}">{{ $server->user->username }}</a></td>
59-
<td>{{ $server->service->name }} ({{ $server->option->name }})</td>
59+
<td>{{ $server->nest->name }} ({{ $server->egg->name }})</td>
6060
<td class="text-center"><span data-action="memory">NaN</span> / {{ $server->memory === 0 ? '&infin;' : $server->memory }} MB</td>
6161
<td class="text-center">{{ $server->disk }} MB</td>
6262
<td class="text-center"><span data-action="cpu" data-cpumax="{{ $server->cpu }}">NaN</span> %</td>

resources/themes/pterodactyl/admin/packs/index.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<th>Pack Name</th>
4444
<th>Version</th>
4545
<th>Description</th>
46-
<th>Option</td>
46+
<th>Egg</th>
4747
<th class="text-center">Servers</th>
4848
</tr>
4949
@foreach ($packs as $pack)
@@ -52,7 +52,7 @@
5252
<td class="middle"><a href="{{ route('admin.packs.view', $pack->id) }}">{{ $pack->name }}</a></td>
5353
<td class="middle"><code>{{ $pack->version }}</code></td>
5454
<td class="col-md-6">{{ str_limit($pack->description, 150) }}</td>
55-
<td class="middle"><a href="{{ route('admin.services.option.view', $pack->option->id) }}">{{ $pack->option->name }}</a></td>
55+
<td class="middle"><a href="{{ route('admin.nests.egg.view', $pack->egg->id) }}">{{ $pack->egg->name }}</a></td>
5656
<td class="middle text-center">{{ $pack->servers_count }}</td>
5757
</tr>
5858
@endforeach

resources/themes/pterodactyl/admin/packs/modal.blade.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
<div class="well" style="margin-bottom:0">
1111
<div class="row">
1212
<div class="col-md-12">
13-
<label for="pOptionIdModal" class="form-label">Associated Service Option:</label>
14-
<select id="pOptionIdModal" name="option_id" class="form-control">
15-
@foreach($services as $service)
16-
<optgroup label="{{ $service->name }}">
17-
@foreach($service->options as $option)
18-
<option value="{{ $option->id }}">{{ $option->name }}</option>
13+
<label for="pEggIdModal" class="form-label">Associated Egg:</label>
14+
<select id="pEggIdModal" name="egg_id" class="form-control">
15+
@foreach($nests as $nest)
16+
<optgroup label="{{ $nest->name }}">
17+
@foreach($nest->eggs as $egg)
18+
<option value="{{ $egg->id }}">{{ $egg->name }}</option>
1919
@endforeach
2020
</optgroup>
2121
@endforeach
2222
</select>
23-
<p class="text-muted small">The option that this pack is assocaited with. Only servers that are assigned this option will be able to access this pack.</p>
23+
<p class="text-muted small">The Egg that this pack is assocaited with. Only servers that are assigned this Egg will be able to access this pack.</p>
2424
</div>
2525
</div>
2626
<div class="row" style="margin-top:15px;">

0 commit comments

Comments
 (0)