Runware/ComfyUI fixes, dashboard links, import action, Leonardo plugin, widget, added status field and test connection button

This commit is contained in:
2025-12-03 14:48:45 +01:00
parent 3ec8e471bc
commit 090ec2c44b
16 changed files with 1019 additions and 142 deletions

View File

@@ -9,6 +9,7 @@ use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
@@ -38,6 +39,12 @@ class ApiProviderResource extends Resource
return $schema
->components([
Placeholder::make('provider_dashboard')
->label('Provider Dashboard')
->content(fn (?ApiProvider $record) => $record?->getDashboardUrl() ? '<a href="'.$record->getDashboardUrl().'" target="_blank" class="text-primary-600 underline">'.$record->getDashboardUrl().'</a>' : '—')
->disableLabel(false)
->columnSpanFull()
->visible(fn (?ApiProvider $record) => (bool) $record?->getDashboardUrl()),
TextInput::make('name')
->required()
->maxLength(255),

View File

@@ -3,7 +3,6 @@
namespace App\Filament\Resources\ApiProviders\Pages;
use App\Filament\Resources\ApiProviders\ApiProviderResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Livewire\Attributes\On;
@@ -19,8 +18,14 @@ class CreateApiProvider extends CreateRecord
$this->testResultState = $result;
}
protected function getHeaderActions(): array
{
// No record yet, so no dashboard link; keep header clean.
return [];
}
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('index');
}
}
}

View File

@@ -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');
}
}
}