Add form actions for creating and canceling tickets#114
Add form actions for creating and canceling tickets#114dsFejerA wants to merge 1 commit intopelican-dev:mainfrom
Conversation
Quick fix for CreateTicket in server area.
📝 WalkthroughWalkthroughThe CreateTicket page now includes a custom form actions method that defines two buttons: a primary create action that submits the form, and a secondary cancel action that returns to the resource list. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 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. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php (1)
20-35: Optional: Use Filament's built-ingetCreateFormAction()instead of reimplementing it.The create action is a verbatim reimplementation of what
parent::getCreateFormAction()already returns. Delegating to it removes the coupling to internal translation key strings and keeps the action in sync with future Filament updates.♻️ Proposed refactor
protected function getFormActions(): array { return [ - Action::make('create') - ->label(__('filament-panels::resources/pages/create-record.form.actions.create.label')) - ->submit('create') - ->color('primary') - ->button(), - + parent::getCreateFormAction(), Action::make('cancel') ->label(__('filament-panels::resources/pages/edit-record.form.actions.cancel.label')) ->url($this->getResource()::getUrl()) ->color('gray') ->button(), ]; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php` around lines 20 - 35, Replace the manual creation of the "create" Action in getFormActions() with Filament's built-in one by calling parent::getCreateFormAction() (leave the existing "cancel" Action as-is); specifically, locate the getFormActions method and swap out the Action::make('create') block for parent::getCreateFormAction() so you rely on the framework-provided create action instead of reimplementing it.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php`:
- Line 28: Remove the trailing whitespace on the blank line in CreateTicket.php
that sits between the two Action chains; open the CreateTicket class file and
delete the extra spaces on the empty line separating the chained ->actions(...)
calls so the file has a truly empty line (no trailing spaces) and Pint CI will
pass.
---
Nitpick comments:
In `@tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php`:
- Around line 20-35: Replace the manual creation of the "create" Action in
getFormActions() with Filament's built-in one by calling
parent::getCreateFormAction() (leave the existing "cancel" Action as-is);
specifically, locate the getFormActions method and swap out the
Action::make('create') block for parent::getCreateFormAction() so you rely on
the framework-provided create action instead of reimplementing it.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php
📜 Review details
🧰 Additional context used
🧬 Code graph analysis (1)
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php (3)
tickets/src/Filament/Admin/Resources/Tickets/Pages/CreateTicket.php (1)
getFormActions(27-30)tickets/src/Filament/Admin/Resources/Tickets/Pages/EditTicket.php (1)
getFormActions(33-36)legal-pages/src/Enums/LegalPageType.php (1)
getUrl(27-30)
🪛 GitHub Actions: Lint
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php
[error] 1-1: Pint style check failed. 1 style issue detected in Laravel project (vendor/bin/pint --test).
🔇 Additional comments (2)
tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php (2)
7-7: LGTM — correct import for page-level form actions.
29-33: No action needed. The translation keyfilament-panels::resources/pages/create-record.form.actions.cancel.labelexists in Filament v3'screate-record.phptranslation file. The code at lines 29-33 is correct and uses the proper translation key for the cancel button.
| ->submit('create') | ||
| ->color('primary') | ||
| ->button(), | ||
|
|
There was a problem hiding this comment.
Fix trailing whitespace — this is causing the Pint CI failure.
Line 28 (the blank line between the two Action chains) has trailing whitespace, which is the one style issue flagged by Pint. Remove the whitespace to fix the pipeline.
🧹 Proposed fix
Action::make('create')
->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'))
->submit('create')
->color('primary')
->button(),
-
+
Action::make('cancel')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tickets/src/Filament/Server/Resources/Tickets/Pages/CreateTicket.php` at line
28, Remove the trailing whitespace on the blank line in CreateTicket.php that
sits between the two Action chains; open the CreateTicket class file and delete
the extra spaces on the empty line separating the chained ->actions(...) calls
so the file has a truly empty line (no trailing spaces) and Pint CI will pass.
|
See 47f93e0 |
Quick fix for CreateTicket in server area.
Summary by CodeRabbit