Skip to content

Conversation

@notAreYouScared
Copy link
Member

@notAreYouScared notAreYouScared commented Oct 29, 2025

Closes #646

  • Should be an new optional root level parameter in egg configuration
  • Must be a base64 data URI scheme of an image (png)
    ~ Why only PNGs?
  • The image must be perfectly square, ideally 100px at least
    ~ Changed to circular to match avatars, on admin side, images are right justified in grid view. No changes in table view
    ~~ Set a 1024KB size limit.
  • ?? Use Icon on server list, grid and table views ??
  • Eggs in this repo must be updated with this change

* [ ] Use Icon for Server Tenant on end user side
I see no reason for this... Its only seen on the console page. Maybe we can remove the icon on the dropdown?

Edit Egg:
image
image
image
image

List Eggs: Will use the base64 string from image column, if blank, will use base64 string of the pelican logo.

image

Grid Views...
image
image

@coderabbitai
Copy link

coderabbitai bot commented Oct 29, 2025

📝 Walkthrough

Walkthrough

Adds an optional base64 image field to eggs (DB migration, model fillable/validation), integrates image preview/import/delete in admin list and edit UIs (URL and file import with client-side base64 handling), includes image in importer/exporter, updates seed YAMLs with images, and renders egg images as decorative overlays in server views.

Changes

Cohort / File(s) Summary
Database & Model
database/migrations/2025_10_29_105725_add_egg_image_column.php, app/Models/Egg.php
Adds nullable image longText column migration; updates Egg model docblock, fillable to include image, and validation rules to accept image as `string
Admin UI — Edit Form
app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
Adds modal-driven image management with URL import (validation, fetch, base64), file upload + editor (base64), inline preview, delete action and notifications; adds description textarea, egg_id text input (shown disabled), adjusts column spans and force_outgoing_ip toggle.
Admin UI — List View
app/Filament/Admin/Resources/Eggs/Pages/ListEggs.php
Adds ImageColumn for egg images (empty label, centered, circular, fallback data URI) and enhances name column with wrap/search/sort.
Import / Export Services
app/Services/Eggs/Sharing/EggExporterService.php, app/Services/Eggs/Sharing/EggImporterService.php
Exporter includes image in export payload; Importer populates image when creating records from parsed data.
Seed data
database/Seeders/eggs/**/*.yaml
e.g., database/Seeders/eggs/minecraft/egg-bungeecord.yaml, .../egg-forge-minecraft.yaml, .../egg-paper.yaml, .../egg-sponge.yaml, .../egg-vanilla-minecraft.yaml, .../egg-rust.yaml, database/Seeders/eggs/source-engine/*.yaml, database/Seeders/eggs/voice-servers/*.yaml
Adds image fields containing base64 data URIs to many egg seed YAMLs and updates exported_at timestamps.
Localization
lang/en/admin/egg.php
Adds import-related translation keys for image import, validation errors, and notifications (e.g., import.image_url, import.image_error, import.image_too_large, import.image_updated, import.image_deleted).
Livewire / View
app/Livewire/ServerEntry.php, resources/views/livewire/server-entry.blade.php
Renders egg image as a decorative semi-transparent background overlay when present; minor Blade formatting adjustments.
API / Transformer
app/Transformers/Api/Application/EggTransformer.php
Exposes image in API responses by adding it to the egg transformation output array.

Sequence Diagram(s)

sequenceDiagram
    participant Admin as Admin User
    participant UI as EditEgg Form (Filament)
    participant Fetch as Client Fetch
    participant Editor as Client Image Editor
    participant Model as Egg Model
    participant DB as Database

    rect rgba(60,130,255,0.08)
    Note over Admin,UI: URL import flow
    Admin->>UI: Open import modal & submit image URL
    UI->>Fetch: Validate URL & fetch bytes
    Fetch-->>UI: Image bytes or error
    UI->>UI: Convert bytes → base64 data URI
    UI->>Model: Save `image` = data URI
    Model->>DB: Persist image
    UI-->>Admin: Show success/error notification
    end

    rect rgba(60,200,100,0.08)
    Note over Admin,UI: File upload/edit flow
    Admin->>UI: Upload file & edit
    UI->>Editor: Edit → base64
    Editor-->>UI: base64 data URI
    UI->>Model: Save `image`
    Model->>DB: Persist
    UI-->>Admin: Show success notification
    end

    rect rgba(240,200,60,0.06)
    Note over Model,UI: Import/Export propagation
    UI->>Model: Export reads `image`
    Model->>DB: Include `image` in export payload
    UI->>Model: Importer sets `image` from payload when creating records
    end
Loading

Possibly related PRs

Pre-merge checks

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title 'Add Egg Images' is concise, clear, and accurately summarizes the main change in the changeset. It directly relates to the primary objective of adding image support to eggs across the codebase, which is evident from the extensive modifications to egg models, UI components, API transformers, and seeder files.
Description check ✅ Passed The pull request description provides meaningful detail about the implementation, referencing the linked issue #646 and outlining the requirements met (optional base64 PNG parameter, circular display, size limits, repository egg updates). It includes UI screenshots demonstrating the changes and explanations of behavior across different views, clearly connecting the description to the changeset.
Linked Issues check ✅ Passed The pull request successfully addresses all primary coding requirements from issue #646: (1) adds a new optional root-level 'image' parameter to egg configuration [visible in model, migration, exporter/importer, and seeders], (2) implements base64 data URI support for PNG images [confirmed in EditEgg.php modal implementation and validation rules], (3) supports square image requirement with circular UI display [implemented in ListEggs.php and ServerEntry.php], and (4) updates repository eggs with the new parameter [all seeder YAML files include the new image field with base64 data URIs].
Out of Scope Changes check ✅ Passed All code changes remain within scope of issue #646. The modifications include: model/database updates for the image field, UI components for image management and display, API transformer exposure, seeder updates with image data, and language translation keys for the UI. The addition of background image styling in ServerEntry.php and the force_outgoing_ip toggle in EditEgg.php appear to be complementary enhancements to the image feature rather than unrelated scope creep.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@notAreYouScared
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 29, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as outdated.

@notAreYouScared
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 29, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@pelican-dev pelican-dev deleted a comment from coderabbitai bot Oct 29, 2025
coderabbitai[bot]

This comment was marked as outdated.

@pelican-dev pelican-dev deleted a comment from coderabbitai bot Oct 31, 2025
@notAreYouScared notAreYouScared marked this pull request as ready for review October 31, 2025 12:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (3)
database/Seeders/eggs/minecraft/egg-paper.yaml (1)

10-10: Image format deviation from requirements (SVG instead of PNG).

Same issue as noted in egg-sponge.yaml - using SVG format instead of the required PNG format per PR objectives.

database/Seeders/eggs/source-engine/egg-garrys-mod.yaml (1)

12-12: Image format deviation from requirements (SVG instead of PNG).

Same issue as noted in egg-sponge.yaml - using SVG format instead of the required PNG format.

database/Seeders/eggs/source-engine/egg-team-fortress2.yaml (1)

12-12: Image format deviation from requirements (SVG instead of PNG).

Same issue as noted in egg-sponge.yaml - using SVG format instead of the required PNG format.

🧹 Nitpick comments (3)
resources/views/livewire/server-entry.blade.php (1)

23-27: Clarify the purpose of the empty z-index overlay.

Lines 23-27 define an empty <div> with only z-index: 1 styling. While this appears to create a layer for content to sit above the background image, the actual content below (lines 30+) is already within the parent container and should naturally layer above the background. Consider:

  • Is this div necessary, or does the browser's natural stacking order suffice?
  • If it's intentional for edge cases, add a brief inline comment explaining the z-index layer's purpose.
app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (2)

166-181: Consider enforcing image format and aspect ratio constraints.

The FileUpload component currently lacks validation to enforce:

  1. PNG-only requirement (per PR objectives: "The image must be a base64 data URI of a PNG")
  2. Square/1:1 aspect ratio (per objectives: "The image must be square")

While lines 105-112 (URL import path) allow multiple formats for flexibility, the file upload path at line 177 uses getMimeType() dynamically, creating inconsistency. Consider:

 FileUpload::make('image')
     ->hiddenLabel()
+    ->image()
+    ->acceptedFileTypes(['image/png'])
+    ->rules(['mimetypes:image/png', 'dimensions:ratio=1/1'])
     ->previewable()
     ...
     ->imageEditor()
+    ->imageEditorAspectRatios(['1:1'])
     ->saveUploadedFileUsing(function ($file, Set $set) {
-        $base64 = "data:{$file->getMimeType()};base64,". base64_encode(file_get_contents($file->getRealPath()));
+        // Force PNG per requirements
+        $base64 = 'data:image/png;base64,'. base64_encode(file_get_contents($file->getRealPath()));

Note: If the team decided to allow multiple formats intentionally (as evidenced by URL import supporting webp, jpeg, etc.), document this decision and align both import paths with the same format policy.


105-118: Document format flexibility vs. stated PNG-only requirement.

Lines 105-112 define $allowedExtensions supporting png, jpg, jpeg, gif, webp, and svg, but PR objectives state "The image must be a base64 data URI of a PNG." This inconsistency could confuse future maintainers.

If multi-format support is intentional, update the requirement documentation to reflect the actual policy. Otherwise, restrict to PNG-only.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c99ea0 and f0abd56.

📒 Files selected for processing (17)
  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (4 hunks)
  • app/Filament/Admin/Resources/Eggs/Pages/ListEggs.php (2 hunks)
  • app/Livewire/ServerEntry.php (1 hunks)
  • database/Seeders/eggs/minecraft/egg-bungeecord.yaml (2 hunks)
  • database/Seeders/eggs/minecraft/egg-forge-minecraft.yaml (1 hunks)
  • database/Seeders/eggs/minecraft/egg-paper.yaml (1 hunks)
  • database/Seeders/eggs/minecraft/egg-sponge.yaml (1 hunks)
  • database/Seeders/eggs/minecraft/egg-vanilla-minecraft.yaml (2 hunks)
  • database/Seeders/eggs/rust/egg-rust.yaml (2 hunks)
  • database/Seeders/eggs/source-engine/egg-custom-source-engine-game.yaml (1 hunks)
  • database/Seeders/eggs/source-engine/egg-garrys-mod.yaml (1 hunks)
  • database/Seeders/eggs/source-engine/egg-insurgency.yaml (1 hunks)
  • database/Seeders/eggs/source-engine/egg-team-fortress2.yaml (1 hunks)
  • database/Seeders/eggs/voice-servers/egg-mumble-server.yaml (1 hunks)
  • database/Seeders/eggs/voice-servers/egg-teamspeak3-server.yaml (1 hunks)
  • lang/en/admin/egg.php (1 hunks)
  • resources/views/livewire/server-entry.blade.php (3 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-10-07T14:44:18.583Z
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1779
File: app/Filament/Admin/Resources/Users/Pages/EditUser.php:51-51
Timestamp: 2025-10-07T14:44:18.583Z
Learning: In the Pelican Panel codebase, when using Filament's FileUpload component for the avatar field in UserResource, the 'avatar' key is intentionally unset from the data array in EditUser::handleRecordUpdate before passing to UserUpdateService. This is by design because the avatar is not stored in the database directly—Filament's FileUpload component handles file storage, retrieval, and deletion through its own lifecycle hooks (formatStateUsing, deleteUploadedFileUsing, etc.) independently of the database update service.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, Wizard Step components use the Filament\Schemas namespace (Filament\Schemas\Components\Wizard\Step), not Filament\Forms.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, the Forms component Placeholder was deprecated and removed. Use TextEntry from Filament\Infolists\Components\TextEntry in forms instead, binding values with ->state(). For HTML content, use ->html().

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-09-16T19:30:21.443Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1708
File: app/Filament/App/Resources/Servers/Pages/ListServers.php:115-116
Timestamp: 2025-09-16T19:30:21.443Z
Learning: The Filament `recordActions` method accepts both arrays and ActionGroup instances (signature: `array | ActionGroup $actions`), so ActionGroup can be passed directly without wrapping in an array.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/ListEggs.php
📚 Learning: 2025-09-16T19:32:01.343Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1708
File: app/Filament/App/Resources/Servers/Pages/ListServers.php:228-266
Timestamp: 2025-09-16T19:32:01.343Z
Learning: ActionGroup in Filament automatically hides itself when all child actions are not visible, so additional hidden() logic to prevent empty groups is unnecessary.

Applied to files:

  • resources/views/livewire/server-entry.blade.php
🔇 Additional comments (3)
database/Seeders/eggs/voice-servers/egg-mumble-server.yaml (1)

5-5: Image field integration looks good.

The auto-generated seed file correctly reflects the new image parameter addition. The base64 PNG data URI is properly placed at the root level per PR specifications, and the format matches the required pattern data:image/png;base64,.... Since this file is auto-generated (as noted in the header comment), any validation of the export logic should occur in the EggExporterService rather than here.

Also applies to: 12-12

database/Seeders/eggs/voice-servers/egg-teamspeak3-server.yaml (2)

5-5: Timestamp update is appropriate.

The exported_at timestamp has been updated to the current date, which aligns with the export workflow for seed files when egg configurations are modified.


12-12: Original review comment is incorrect; no naming inconsistency exists.

The verification confirms that the image field is used consistently throughout the codebase. Search results across PHP tests, YAML seed files, and the overall structure show:

  • Seed files: All egg definitions (teamspeak3, mumble, rust, minecraft variants, source-engine games, etc.) consistently use the image: field name with base64 data
  • Test files: References validate the image field (e.g., $response->image in ServerCreationServiceTest)
  • No preview field: Search found no evidence of a preview field anywhere in the codebase

The field naming is already consistent across the model, tests, and seed files. No changes or refactoring are needed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f918f84 and a9dbb28.

📒 Files selected for processing (1)
  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (4 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-sponge.yaml:10-10
Timestamp: 2025-10-31T13:18:53.023Z
Learning: The egg image field accepts multiple image formats including SVG (data:image/svg+xml;base64,...) and PNG (data:image/png;base64,...), not exclusively PNG as initially documented in PR #1849.
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-forge-minecraft.yaml:12-12
Timestamp: 2025-10-31T13:18:59.877Z
Learning: Egg image fields in the Pelican panel accept various data URI formats including PNG, JPEG, SVG, and WebP, not exclusively PNG. The format choice is flexible as long as the data URI is properly formatted with the correct MIME type prefix (e.g., data:image/jpeg;base64, data:image/png;base64, data:image/svg+xml;base64).
📚 Learning: 2025-10-31T13:18:53.023Z
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-sponge.yaml:10-10
Timestamp: 2025-10-31T13:18:53.023Z
Learning: The egg image field accepts multiple image formats including SVG (data:image/svg+xml;base64,...) and PNG (data:image/png;base64,...), not exclusively PNG as initially documented in PR #1849.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-07T14:44:18.583Z
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1779
File: app/Filament/Admin/Resources/Users/Pages/EditUser.php:51-51
Timestamp: 2025-10-07T14:44:18.583Z
Learning: In the Pelican Panel codebase, when using Filament's FileUpload component for the avatar field in UserResource, the 'avatar' key is intentionally unset from the data array in EditUser::handleRecordUpdate before passing to UserUpdateService. This is by design because the avatar is not stored in the database directly—Filament's FileUpload component handles file storage, retrieval, and deletion through its own lifecycle hooks (formatStateUsing, deleteUploadedFileUsing, etc.) independently of the database update service.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, Wizard Step components use the Filament\Schemas namespace (Filament\Schemas\Components\Wizard\Step), not Filament\Forms.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, the Forms component Placeholder was deprecated and removed. Use TextEntry from Filament\Infolists\Components\TextEntry in forms instead, binding values with ->state(). For HTML content, use ->html().

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
🧬 Code graph analysis (1)
app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (2)
app/Filament/Admin/Pages/Health.php (1)
  • refresh (72-82)
app/Filament/Server/Pages/Startup.php (1)
  • update (150-201)
🔇 Additional comments (5)
app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (5)

176-181: Good: Unused parameter removed.

The $record parameter flagged in previous reviews has been correctly removed. The closure now properly uses only $file and Set $set, eliminating the PHPMD warning.


185-209: Upload action logic is sound.

The action correctly handles both URL and file upload paths by checking base64Image state first (set by both tabs) and falling back to the direct image field. The refresh() call ensures the UI updates immediately, and appropriate notifications provide clear feedback.


210-229: Delete action implementation is correct.

The delete action properly checks visibility based on image existence, updates the record to null, provides user feedback, and refreshes the UI state. Clear and straightforward implementation.


232-292: Layout adjustments integrate cleanly with expanded grid.

The responsive column spans across all fields adapt well to the new 6-column grid layout (line 60). New fields (description, id, force_outgoing_ip) are positioned logically, and existing fields maintain their validation rules and helper text. The layout remains coherent across different screen sizes.


100-127: Excellent SSRF protection implementation.

The URL import validation includes comprehensive SSRF protection by blocking private and reserved IP ranges (line 124). This prevents attackers from exploiting the image fetch feature to scan internal networks or access internal services. The combination of URL validation, extension checking, and IP filtering provides defense in depth.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (2)

138-142: Consider removing error suppression operator.

The @ operator suppresses errors that might be useful for debugging. Since the try-catch block at lines 154-157 already handles exceptions, consider removing @ to allow proper error visibility during development.

Apply this diff:

-                                                                            $imageContent = @file_get_contents($state, false, $context, 0, 1048576); // 1024KB
+                                                                            $imageContent = file_get_contents($state, false, $context, 0, 1048576); // 1024KB

179-179: Consider adding aspect ratio constraint to image editor.

The PR objectives mention images should be "perfectly square." Adding an aspect ratio constraint to the image editor would guide users to crop images correctly during upload.

Apply this diff:

-                                                                    ->imageEditor()
+                                                                    ->imageEditor()
+                                                                    ->imageEditorAspectRatios(['1:1'])
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a9dbb28 and cc4bdd3.

📒 Files selected for processing (2)
  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (4 hunks)
  • lang/en/admin/egg.php (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-sponge.yaml:10-10
Timestamp: 2025-10-31T13:18:53.083Z
Learning: The egg image field accepts multiple image formats including SVG (data:image/svg+xml;base64,...) and PNG (data:image/png;base64,...), not exclusively PNG as initially documented in PR #1849.
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-forge-minecraft.yaml:12-12
Timestamp: 2025-10-31T13:18:59.898Z
Learning: Egg image fields in the Pelican panel accept various data URI formats including PNG, JPEG, SVG, and WebP, not exclusively PNG. The format choice is flexible as long as the data URI is properly formatted with the correct MIME type prefix (e.g., data:image/jpeg;base64, data:image/png;base64, data:image/svg+xml;base64).
📚 Learning: 2025-10-31T13:18:53.083Z
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-sponge.yaml:10-10
Timestamp: 2025-10-31T13:18:53.083Z
Learning: The egg image field accepts multiple image formats including SVG (data:image/svg+xml;base64,...) and PNG (data:image/png;base64,...), not exclusively PNG as initially documented in PR #1849.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-07T14:44:18.583Z
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1779
File: app/Filament/Admin/Resources/Users/Pages/EditUser.php:51-51
Timestamp: 2025-10-07T14:44:18.583Z
Learning: In the Pelican Panel codebase, when using Filament's FileUpload component for the avatar field in UserResource, the 'avatar' key is intentionally unset from the data array in EditUser::handleRecordUpdate before passing to UserUpdateService. This is by design because the avatar is not stored in the database directly—Filament's FileUpload component handles file storage, retrieval, and deletion through its own lifecycle hooks (formatStateUsing, deleteUploadedFileUsing, etc.) independently of the database update service.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-31T13:18:59.898Z
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-forge-minecraft.yaml:12-12
Timestamp: 2025-10-31T13:18:59.898Z
Learning: Egg image fields in the Pelican panel accept various data URI formats including PNG, JPEG, SVG, and WebP, not exclusively PNG. The format choice is flexible as long as the data URI is properly formatted with the correct MIME type prefix (e.g., data:image/jpeg;base64, data:image/png;base64, data:image/svg+xml;base64).

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, Wizard Step components use the Filament\Schemas namespace (Filament\Schemas\Components\Wizard\Step), not Filament\Forms.

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, the Forms component Placeholder was deprecated and removed. Use TextEntry from Filament\Infolists\Components\TextEntry in forms instead, binding values with ->state(). For HTML content, use ->html().

Applied to files:

  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
🧬 Code graph analysis (1)
app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (2)
app/Filament/Admin/Pages/Health.php (1)
  • refresh (72-82)
app/Filament/Server/Pages/Startup.php (1)
  • update (150-201)
🔇 Additional comments (2)
app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php (2)

189-233: LGTM!

The image upload and delete action handlers are well-implemented:

  • Properly handle both URL and file upload paths
  • Update the record and refresh to ensure UI consistency
  • Provide appropriate user feedback via notifications
  • No security concerns with base64 data storage

60-60: Layout changes look good.

The responsive column spans and new fields (egg_id, force_outgoing_ip, description) are appropriately configured and integrate well with the existing form structure.

Also applies to: 236-295

Copy link
Member

@Boy132 Boy132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New field needs to be added to EggTransformer too.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/Transformers/Api/Application/EggTransformer.php (1)

49-49: LGTM! Image field correctly exposed in API response.

The addition follows the existing transformer pattern and correctly exposes the new optional image field through the API.

Optional consideration: Base64 data URIs (up to 1024 KB) in list responses with many eggs could result in large payloads. If performance becomes a concern, consider making the image an optional include or a separate endpoint. However, this is an architectural choice and the current implementation aligns with the documented design approach.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b2518ec and 6cb3ea7.

📒 Files selected for processing (1)
  • app/Transformers/Api/Application/EggTransformer.php (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-sponge.yaml:10-10
Timestamp: 2025-10-31T13:18:53.083Z
Learning: The egg image field accepts multiple image formats including SVG (data:image/svg+xml;base64,...) and PNG (data:image/png;base64,...), not exclusively PNG as initially documented in PR #1849.
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-forge-minecraft.yaml:12-12
Timestamp: 2025-10-31T13:18:59.898Z
Learning: Egg image fields in the Pelican panel accept various data URI formats including PNG, JPEG, SVG, and WebP, not exclusively PNG. The format choice is flexible as long as the data URI is properly formatted with the correct MIME type prefix (e.g., data:image/jpeg;base64, data:image/png;base64, data:image/svg+xml;base64).
📚 Learning: 2025-10-31T13:18:53.083Z
Learnt from: notAreYouScared
Repo: pelican-dev/panel PR: 1849
File: database/Seeders/eggs/minecraft/egg-sponge.yaml:10-10
Timestamp: 2025-10-31T13:18:53.083Z
Learning: The egg image field accepts multiple image formats including SVG (data:image/svg+xml;base64,...) and PNG (data:image/png;base64,...), not exclusively PNG as initially documented in PR #1849.

Applied to files:

  • app/Transformers/Api/Application/EggTransformer.php

@notAreYouScared notAreYouScared merged commit 21f9f25 into main Nov 3, 2025
25 checks passed
@notAreYouScared notAreYouScared deleted the charles/egg-images branch November 3, 2025 17:32
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add optional preview pictures/icons to eggs

4 participants