-
-
Notifications
You must be signed in to change notification settings - Fork 257
Add github eggs to egg importer #2116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
notAreYouScared
commented
Jan 17, 2026
📝 WalkthroughWalkthroughAdds a GitHub-based egg import tab to the import modal that builds category tabs with CheckboxList items, dispatches InstallEgg jobs per selected egg URL, sends a background-install-started notification, and expands the modal width. Also updates translation Changes
Sequence Diagram(s)sequenceDiagram
autonumber
rect rgba(240,240,255,0.5)
participant User
participant FilamentUI as "Filament UI (ImportEggAction)"
participant Queue as "Queue Dispatcher"
participant Worker as "Background Worker"
participant Installer as "InstallEgg Job"
participant Notifier as "Notification Service"
end
User->>FilamentUI: Open import modal, select GitHub eggs and confirm
FilamentUI->>Queue: Dispatch InstallEgg job for each selected egg URL
FilamentUI->>Notifier: Send background-install-started notification (count)
Queue->>Worker: Jobs enqueued
Worker->>Installer: Execute InstallEgg job (fetch & install egg)
Installer->>Notifier: Send completion/status notifications
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this 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
🤖 Fix all issues with AI agents
In `@app/Filament/Components/Actions/ImportEggAction.php`:
- Around line 116-120: The GitHub selections under the eggs.* state are not
being merged into the import list, so update the import construction in
ImportEggAction (the method that currently merges urls and files) to also
include the eggs selections by retrieving $this->getState('eggs', []) (or the
eggs state key used) and merging it into the array that is processed for
imports; ensure any eggs entries are mapped/normalized the same way as
urls/files so GitHub imports are actually queued/run (check
importEggsFromGitHub() usage and the method that builds the $imports array).
- Around line 198-205: The Tab currently created with Tab::make('') uses an
empty key which can break Livewire DOM diffing; update that Tab creation to use
a non-empty unique key (e.g., Tab::make('github')) while keeping the existing
->label(trans('admin/egg.import.github')), ->icon('tabler-brand-github'),
->columnSpanFull(), and ->schema([...]) in the same return block so it matches
the other tabs and avoids key collisions (look for the Tab::make('') occurrence
inside the return Tab block and the surrounding
Tabs::make('egg_tabs')->tabs($tabs) structure).
In `@lang/en/admin/egg.php`:
- Line 27: Update the user-facing label for the 'github' entry in
lang/en/admin/egg.php to use correct brand capitalization; locate the array key
'github' => 'Github' and change the value to 'GitHub' so the displayed label
matches official branding.
🧹 Nitpick comments (1)
app/Filament/Components/Actions/ImportEggAction.php (1)
171-182: Consider modernizing to Laravel 12's native helper methods.While
str_slugandarray_sortwork with the installedlaravel/helperspackage, prefer the native Laravel 12 methods:str()->slug()andArr::sort()for consistency with modern Laravel conventions.♻️ Proposed replacement
- $id = str_slug($label, '_'); + $id = str($label)->slug('_')->toString(); ... - ->options(fn () => array_sort($eggs[$label])) + ->options(fn () => Arr::sort($eggs[$label]))
There was a problem hiding this 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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/Filament/Components/Actions/ImportEggAction.php (1)
51-76: Rename foreach variable to prevent shadowing$eggsused for URL/file imports.
foreach ($gitHubEggs as $category => $eggs)at line 55 overwrites the$eggsarray built fromurls/filesat line 52, so URL/file imports are skipped after GitHub eggs are processed. When both sources are submitted, only GitHub eggs are imported. Rename the loop variable to$categoryEggs.Also use
Arr::get()instead ofarray_get()for consistency with the codebase (Arr is already imported and used elsewhere).Proposed fix
- $gitHubEggs = array_get($this->data, 'eggs', []); + $gitHubEggs = Arr::get($this->data, 'eggs', []); $eggs = array_merge(collect($data['urls'])->flatten()->whereNotNull()->unique()->all(), Arr::wrap($data['files'])); if ($gitHubEggs) { - foreach ($gitHubEggs as $category => $eggs) { - foreach ($eggs as $downloadUrl) { + foreach ($gitHubEggs as $category => $categoryEggs) { + foreach ($categoryEggs as $downloadUrl) { InstallEgg::dispatch($downloadUrl); } }
🧹 Nitpick comments (1)
app/Filament/Components/Actions/ImportEggAction.php (1)
191-204: Use Str::slug / Arr::sort instead of legacy helpers.
str_slug()andarray_sort()are not standard in recent Laravel releases; preferStr::slug()andArr::sort()unless a helper package is explicitly enabled.♻️ Proposed refactor
+use Illuminate\Support\Str; ... - $id = str_slug($label, '_'); + $id = Str::slug($label, '_'); ... - ->options(fn () => array_sort($eggs[$label])) + ->options(fn () => Arr::sort($eggs[$label]))
There was a problem hiding this 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
🤖 Fix all issues with AI agents
In `@app/Filament/Components/Actions/ImportEggAction.php`:
- Line 55: The foreach in ImportEggAction.php is declaring an unused key
variable $category; change the loop to iterate without the key by replacing
"foreach ($gitHubEggs as $category => $sortedEggs)" with "foreach ($gitHubEggs
as $sortedEggs)" in the ImportEggAction class where $gitHubEggs is processed so
only $sortedEggs is used.