1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-21 16:42:29 +01:00

feat: add egg features editor in Admin UI (#5130)

This commit is contained in:
Dawid Jaworski 2024-06-29 20:59:05 +02:00 committed by GitHub
parent 953575ff5c
commit 8ae76c3889
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 0 deletions

View File

@ -14,6 +14,7 @@ class EggFormRequest extends AdminFormRequest
'docker_images' => ['required', 'string', 'regex:/^[\w#\.\/\- ]*\|?~?[\w\.\/\-:@ ]*$/im'],
'force_outgoing_ip' => 'sometimes|boolean',
'file_denylist' => 'array',
'features' => 'sometimes|array',
'startup' => 'required|string',
'config_from' => 'sometimes|bail|nullable|numeric',
'config_stop' => 'required_without:config_from|nullable|string|max:191',
@ -42,6 +43,7 @@ class EggFormRequest extends AdminFormRequest
return array_merge($data, [
'force_outgoing_ip' => array_get($data, 'force_outgoing_ip', false),
'features' => array_get($data, 'features', []),
]);
}
}

View File

@ -72,6 +72,14 @@
<textarea id="pStartup" name="startup" class="form-control" rows="10">{{ old('startup') }}</textarea>
<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>
</div>
<div class="form-group">
<label for="pConfigFeatures" class="control-label">Features</label>
<div>
<select class="form-control" name="features[]" id="pConfigFeatures" multiple>
</select>
<p class="text-muted small">Additional features belonging to the egg. Useful for configuring additional panel modifications.</p>
</div>
</div>
</div>
</div>
</div>
@ -161,5 +169,10 @@
$(this).val(prepend + ' ' + append);
}
});
$('#pConfigFeatures').select2({
tags: true,
selectOnClose: false,
tokenSeparators: [',', ' '],
});
</script>
@endsection

View File

@ -114,6 +114,17 @@
<textarea id="pStartup" name="startup" class="form-control" rows="8">{{ $egg->startup }}</textarea>
<p class="text-muted small">The default startup command that should be used for new servers using this Egg.</p>
</div>
<div class="form-group">
<label for="pConfigFeatures" class="control-label">Features</label>
<div>
<select class="form-control" name="features[]" id="pConfigFeatures" multiple>
@foreach($egg->features as $feature)
<option value="{{ $feature }}" selected>{{ $feature }}</option>
@endforeach
</select>
<p class="text-muted small">Additional features belonging to the egg. Useful for configuring additional panel modifications.</p>
</div>
</div>
</div>
</div>
</div>
@ -202,5 +213,10 @@
$(this).val(prepend + ' ' + append);
}
});
$('#pConfigFeatures').select2({
tags: true,
selectOnClose: false,
tokenSeparators: [',', ' '],
});
</script>
@endsection