Skip to content

Commit de949e1

Browse files
shanerbaner82claude
andcommitted
Add logging to Filament re-sync action
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1a82308 commit de949e1

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

app/Filament/Resources/PluginResource/Pages/EditPlugin.php

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Filament\Forms;
1515
use Filament\Notifications\Notification;
1616
use Filament\Resources\Pages\EditRecord;
17+
use Illuminate\Support\Facades\Log;
1718
use Illuminate\Support\HtmlString;
1819

1920
class EditPlugin extends EditRecord
@@ -230,21 +231,46 @@ protected function getHeaderActions(): array
230231
->modalHeading('Re-sync Plugin')
231232
->modalDescription(fn () => "This will re-fetch the README, composer.json, nativephp.json, license, and latest version from GitHub for '{$this->record->name}'.")
232233
->action(function (): void {
233-
$syncService = app(PluginSyncService::class);
234-
$result = $syncService->sync($this->record);
234+
Log::info('[Filament:Resync] Action triggered', [
235+
'plugin_id' => $this->record->id,
236+
'name' => $this->record->name,
237+
'repository_url' => $this->record->repository_url,
238+
]);
235239

236-
$this->record->refresh();
240+
try {
241+
$syncService = app(PluginSyncService::class);
242+
$result = $syncService->sync($this->record);
243+
244+
Log::info('[Filament:Resync] Sync returned', [
245+
'plugin_id' => $this->record->id,
246+
'result' => $result,
247+
]);
248+
249+
$this->record->refresh();
250+
251+
if ($result) {
252+
Notification::make()
253+
->title('Plugin synced successfully')
254+
->body("README, versions, and metadata have been updated for '{$this->record->name}'.")
255+
->success()
256+
->send();
257+
} else {
258+
Notification::make()
259+
->title('Sync failed')
260+
->body('Could not fetch repository data. Check the repository URL and try again.')
261+
->danger()
262+
->send();
263+
}
264+
} catch (\Throwable $e) {
265+
Log::error('[Filament:Resync] Exception', [
266+
'plugin_id' => $this->record->id,
267+
'error' => $e->getMessage(),
268+
'trace' => $e->getTraceAsString(),
269+
]);
237270

238-
if ($result) {
239-
Notification::make()
240-
->title('Plugin synced successfully')
241-
->body("README, versions, and metadata have been updated for '{$this->record->name}'.")
242-
->success()
243-
->send();
244-
} else {
245271
Notification::make()
246-
->title('Sync failed')
247-
->body('Could not fetch repository data. Check the repository URL and try again.')
272+
->title('Sync error')
273+
->body($e->getMessage())
248274
->danger()
249275
->send();
250276
}

0 commit comments

Comments
 (0)