Skip to content

Commit

Permalink
feat: add egg features editor in Admin UI (#5130)
Browse files Browse the repository at this point in the history
  • Loading branch information
MinerPL authored Jun 29, 2024
1 parent 953575f commit 8ae76c3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/Http/Requests/Admin/Egg/EggFormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function rules(): array
'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',
Expand Down Expand Up @@ -42,6 +43,7 @@ public function validated($key = null, $default = null): array

return array_merge($data, [
'force_outgoing_ip' => array_get($data, 'force_outgoing_ip', false),
'features' => array_get($data, 'features', []),
]);
}
}
13 changes: 13 additions & 0 deletions resources/views/admin/eggs/new.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -161,5 +169,10 @@
$(this).val(prepend + ' ' + append);
}
});
$('#pConfigFeatures').select2({
tags: true,
selectOnClose: false,
tokenSeparators: [',', ' '],
});
</script>
@endsection
16 changes: 16 additions & 0 deletions resources/views/admin/eggs/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -202,5 +213,10 @@
$(this).val(prepend + ' ' + append);
}
});
$('#pConfigFeatures').select2({
tags: true,
selectOnClose: false,
tokenSeparators: [',', ' '],
});
</script>
@endsection

0 comments on commit 8ae76c3

Please sign in to comment.