Update synchronize actions in main index pages, hide for busy servers/sites to prevent exceptions

This commit is contained in:
Ralph J. Smit
2022-08-08 17:31:18 +02:00
parent 06aecba93d
commit 96587db6a2
2 changed files with 6 additions and 3 deletions

View File

@@ -89,7 +89,8 @@ class ServerResource extends Resource
->label(__('Synchronize'))
->tooltip(__('This will synchronize the latest data from this provider to your Ploi Core installation'))
->icon('heroicon-o-refresh')
->action(fn (Server $record) => app(SynchronizeServerAction::class)->execute($record->ploi_id)),
->action(fn (Server $record) => app(SynchronizeServerAction::class)->execute($record->ploi_id))
->visible(fn (Server $record) => $record->status === Server::STATUS_ACTIVE),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),

View File

@@ -47,6 +47,7 @@ class SiteResource extends Resource
return "PHP $record->php_version";
})
->label(__('Name'))
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('server.name')
->label(__('Server')),
@@ -86,8 +87,9 @@ class SiteResource extends Resource
->tooltip(__('This will synchronize the latest data from this provider to your Ploi Core installation'))
->icon('heroicon-o-refresh')
->action(function (Site $record) {
app(SynchronizeSiteAction::class)->execute($record->ploi_id);
}),
app(SynchronizeSiteAction::class)->execute($record->server->ploi_id, $record->ploi_id);
})
->visible(fn (Site $record) => $record->status === Site::STATUS_ACTIVE),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),