refactor: use Infolist for BaselineProfile view page
Replace disabled form fields with proper Infolist (TextEntry, Section) on the ViewBaselineProfile page. Adds three sections: Profile (name, status badge, version, description), Scope (policy types as badges), and Metadata (created by, last snapshot, timestamps).
This commit is contained in:
parent
a98323d2f4
commit
ee5840227f
@ -28,6 +28,8 @@
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Infolists\Components\Section;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
@ -165,6 +167,59 @@ public static function form(Schema $schema): Schema
|
||||
]);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->schema([
|
||||
Section::make('Profile')
|
||||
->schema([
|
||||
TextEntry::make('name'),
|
||||
TextEntry::make('status')
|
||||
->badge()
|
||||
->formatStateUsing(BadgeRenderer::label(BadgeDomain::BaselineProfileStatus))
|
||||
->color(BadgeRenderer::color(BadgeDomain::BaselineProfileStatus))
|
||||
->icon(BadgeRenderer::icon(BadgeDomain::BaselineProfileStatus)),
|
||||
TextEntry::make('version_label')
|
||||
->label('Version')
|
||||
->placeholder('—'),
|
||||
TextEntry::make('description')
|
||||
->placeholder('No description')
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columns(2)
|
||||
->columnSpanFull(),
|
||||
Section::make('Scope')
|
||||
->schema([
|
||||
TextEntry::make('scope_jsonb.policy_types')
|
||||
->label('Policy type scope')
|
||||
->badge()
|
||||
->formatStateUsing(function (string $state): string {
|
||||
$options = self::policyTypeOptions();
|
||||
|
||||
return $options[$state] ?? $state;
|
||||
})
|
||||
->placeholder('All policy types'),
|
||||
])
|
||||
->columnSpanFull(),
|
||||
Section::make('Metadata')
|
||||
->schema([
|
||||
TextEntry::make('createdByUser.name')
|
||||
->label('Created by')
|
||||
->placeholder('—'),
|
||||
TextEntry::make('activeSnapshot.captured_at')
|
||||
->label('Last snapshot')
|
||||
->dateTime()
|
||||
->placeholder('No snapshot yet'),
|
||||
TextEntry::make('created_at')
|
||||
->dateTime(),
|
||||
TextEntry::make('updated_at')
|
||||
->dateTime(),
|
||||
])
|
||||
->columns(2)
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
$workspace = self::resolveWorkspace();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user