Skip to content

Commit 8ae76c3

Browse files
authored
feat: add egg features editor in Admin UI (pterodactyl#5130)
1 parent 953575f commit 8ae76c3

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

app/Http/Requests/Admin/Egg/EggFormRequest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public function rules(): array
1414
'docker_images' => ['required', 'string', 'regex:/^[\w#\.\/\- ]*\|?~?[\w\.\/\-:@ ]*$/im'],
1515
'force_outgoing_ip' => 'sometimes|boolean',
1616
'file_denylist' => 'array',
17+
'features' => 'sometimes|array',
1718
'startup' => 'required|string',
1819
'config_from' => 'sometimes|bail|nullable|numeric',
1920
'config_stop' => 'required_without:config_from|nullable|string|max:191',
@@ -42,6 +43,7 @@ public function validated($key = null, $default = null): array
4243

4344
return array_merge($data, [
4445
'force_outgoing_ip' => array_get($data, 'force_outgoing_ip', false),
46+
'features' => array_get($data, 'features', []),
4547
]);
4648
}
4749
}

resources/views/admin/eggs/new.blade.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@
7272
<textarea id="pStartup" name="startup" class="form-control" rows="10">{{ old('startup') }}</textarea>
7373
<p class="text-muted small">The default startup command that should be used for new servers created with this Egg. You can change this per-server as needed.</p>
7474
</div>
75+
<div class="form-group">
76+
<label for="pConfigFeatures" class="control-label">Features</label>
77+
<div>
78+
<select class="form-control" name="features[]" id="pConfigFeatures" multiple>
79+
</select>
80+
<p class="text-muted small">Additional features belonging to the egg. Useful for configuring additional panel modifications.</p>
81+
</div>
82+
</div>
7583
</div>
7684
</div>
7785
</div>
@@ -161,5 +169,10 @@
161169
$(this).val(prepend + ' ' + append);
162170
}
163171
});
172+
$('#pConfigFeatures').select2({
173+
tags: true,
174+
selectOnClose: false,
175+
tokenSeparators: [',', ' '],
176+
});
164177
</script>
165178
@endsection

resources/views/admin/eggs/view.blade.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@
114114
<textarea id="pStartup" name="startup" class="form-control" rows="8">{{ $egg->startup }}</textarea>
115115
<p class="text-muted small">The default startup command that should be used for new servers using this Egg.</p>
116116
</div>
117+
<div class="form-group">
118+
<label for="pConfigFeatures" class="control-label">Features</label>
119+
<div>
120+
<select class="form-control" name="features[]" id="pConfigFeatures" multiple>
121+
@foreach($egg->features as $feature)
122+
<option value="{{ $feature }}" selected>{{ $feature }}</option>
123+
@endforeach
124+
</select>
125+
<p class="text-muted small">Additional features belonging to the egg. Useful for configuring additional panel modifications.</p>
126+
</div>
127+
</div>
117128
</div>
118129
</div>
119130
</div>
@@ -202,5 +213,10 @@
202213
$(this).val(prepend + ' ' + append);
203214
}
204215
});
216+
$('#pConfigFeatures').select2({
217+
tags: true,
218+
selectOnClose: false,
219+
tokenSeparators: [',', ' '],
220+
});
205221
</script>
206222
@endsection

0 commit comments

Comments
 (0)