Runware/ComfyUI fixes, dashboard links, import action, Leonardo plugin, widget, added status field and test connection button
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace App\Filament\Resources\ApiProviders\Pages;
|
||||
|
||||
use App\Api\Plugins\PluginLoader;
|
||||
use App\Filament\Resources\ApiProviders\ApiProviderResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Livewire\Attributes\On;
|
||||
|
||||
@@ -22,6 +25,34 @@ class EditApiProvider extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('test_connection')
|
||||
->label('Verbindung testen')
|
||||
->icon('heroicon-o-bolt')
|
||||
->color('gray')
|
||||
->action(function (): void {
|
||||
try {
|
||||
$provider = $this->record;
|
||||
$plugin = PluginLoader::getPlugin($provider->plugin, $provider);
|
||||
$plugin->testConnection($provider->toArray());
|
||||
|
||||
Notification::make()
|
||||
->title('Verbindung erfolgreich')
|
||||
->success()
|
||||
->send();
|
||||
} catch (\Throwable $e) {
|
||||
Notification::make()
|
||||
->title('Verbindung fehlgeschlagen')
|
||||
->body($e->getMessage())
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
}),
|
||||
Action::make('dashboard')
|
||||
->label('Provider Dashboard')
|
||||
->icon('heroicon-o-arrow-top-right-on-square')
|
||||
->visible(fn () => $this->record?->getDashboardUrl())
|
||||
->url(fn () => $this->record?->getDashboardUrl())
|
||||
->openUrlInNewTab(),
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
@@ -30,4 +61,4 @@ class EditApiProvider extends EditRecord
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user