Introduced a two-tier media pipeline with dynamic disks, asset tracking, admin controls, and alerting around
upload/archival workflows.
- Added storage metadata + asset tables and models so every photo/variant knows where it lives
(database/migrations/2025_10_20_090000_create_media_storage_targets_table.php, database/ migrations/2025_10_20_090200_create_event_media_assets_table.php, app/Models/MediaStorageTarget.php:1, app/
Models/EventMediaAsset.php:1, app/Models/EventStorageAssignment.php:1, app/Models/Event.php:27).
- Rewired guest and tenant uploads to pick the event’s hot disk, persist EventMediaAsset records, compute
checksums, and clean up on delete (app/Http/Controllers/Api/EventPublicController.php:243, app/Http/
Controllers/Api/Tenant/PhotoController.php:25, app/Models/Photo.php:25).
- Implemented storage services, archival job scaffolding, monitoring config, and queue-failure notifications for upload issues (app/Services/Storage/EventStorageManager.php:16, app/Services/Storage/
StorageHealthService.php:9, app/Jobs/ArchiveEventMediaAssets.php:16, app/Providers/AppServiceProvider.php:39, app/Notifications/UploadPipelineFailed.php:8, config/storage-monitor.php:1).
- Seeded default hot/cold targets and exposed super-admin tooling via a Filament resource and capacity widget (database/seeders/MediaStorageTargetSeeder.php:13, database/seeders/DatabaseSeeder.php:17, app/Filament/Resources/MediaStorageTargetResource.php:1, app/Filament/Widgets/StorageCapacityWidget.php:12, app/Providers/Filament/SuperAdminPanelProvider.php:47).
- Dropped cron skeletons and artisan placeholders to schedule storage monitoring, archival dispatch, and upload queue health checks (cron/storage_monitor.sh, cron/archive_dispatcher.sh, cron/upload_queue_health.sh, routes/console.php:9).
131 lines
4.3 KiB
PHP
131 lines
4.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
use App\Filament\Resources\MediaStorageTargetResource\Pages;
|
|
use App\Models\MediaStorageTarget;
|
|
use Filament\Actions;
|
|
use Filament\Forms\Components\KeyValue;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Components\Toggle;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use UnitEnum;
|
|
use BackedEnum;
|
|
|
|
class MediaStorageTargetResource extends Resource
|
|
{
|
|
protected static ?string $model = MediaStorageTarget::class;
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-server';
|
|
|
|
protected static string|UnitEnum|null $navigationGroup = null;
|
|
|
|
public static function getNavigationGroup(): UnitEnum|string|null
|
|
{
|
|
return __('admin.nav.platform_management');
|
|
}
|
|
|
|
protected static ?int $navigationSort = 60;
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return $schema->schema([
|
|
TextInput::make('key')
|
|
->label('Schlüssel')
|
|
->required()
|
|
->unique(ignoreRecord: true)
|
|
->maxLength(64),
|
|
TextInput::make('name')
|
|
->label('Bezeichnung')
|
|
->required()
|
|
->maxLength(255),
|
|
Select::make('driver')
|
|
->label('Treiber')
|
|
->required()
|
|
->options([
|
|
'local' => 'Local',
|
|
'sftp' => 'SFTP',
|
|
's3' => 'S3 Compatible',
|
|
]),
|
|
TextInput::make('priority')
|
|
->label('Priorität')
|
|
->numeric()
|
|
->default(0),
|
|
Toggle::make('is_hot')
|
|
->label('Hot Storage')
|
|
->helperText('Markiert Speicher als primär für aktive Uploads.')
|
|
->default(false),
|
|
Toggle::make('is_default')
|
|
->label('Standard')
|
|
->helperText('Wird automatisch für neue Events verwendet.')
|
|
->default(false),
|
|
Toggle::make('is_active')
|
|
->label('Aktiv')
|
|
->default(true),
|
|
KeyValue::make('config')
|
|
->label('Konfiguration')
|
|
->keyLabel('Option')
|
|
->valueLabel('Wert')
|
|
->columnSpanFull()
|
|
->helperText('Treiber-spezifische Einstellungen wie Pfade, Hosts oder Zugangsdaten.'),
|
|
])->columns(2);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('key')
|
|
->label('Key')
|
|
->searchable()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('name')
|
|
->label('Name')
|
|
->searchable(),
|
|
Tables\Columns\BadgeColumn::make('driver')
|
|
->label('Driver')
|
|
->colors([
|
|
'gray' => 'local',
|
|
'info' => 'sftp',
|
|
'success' => 's3',
|
|
]),
|
|
Tables\Columns\IconColumn::make('is_hot')
|
|
->label('Hot')
|
|
->boolean(),
|
|
Tables\Columns\IconColumn::make('is_default')
|
|
->label('Default')
|
|
->boolean(),
|
|
Tables\Columns\IconColumn::make('is_active')
|
|
->label('Active')
|
|
->boolean(),
|
|
Tables\Columns\TextColumn::make('priority')
|
|
->label('Priority')
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('updated_at')
|
|
->label('Aktualisiert')
|
|
->since()
|
|
->sortable(),
|
|
])
|
|
->filters([])
|
|
->actions([
|
|
Actions\EditAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Actions\DeleteBulkAction::make(),
|
|
]);
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListMediaStorageTargets::route('/'),
|
|
'create' => Pages\CreateMediaStorageTarget::route('/create'),
|
|
'edit' => Pages\EditMediaStorageTarget::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|