33namespace Boy132 \UserCreatableServers \Filament \Admin \Resources \Users \RelationManagers ;
44
55use Boy132 \UserCreatableServers \Filament \Admin \Resources \UserResourceLimits \UserResourceLimitsResource ;
6- use Filament \Actions \ActionGroup ;
76use Filament \Actions \DeleteAction ;
87use Filament \Actions \EditAction ;
98use Filament \Actions \ViewAction ;
@@ -29,29 +28,29 @@ public static function canViewForRecord(Model $ownerRecord, string $pageClass):
2928
3029 public function table (Table $ table ): Table
3130 {
31+ $ suffix = config ('panel.use_binary_prefix ' ) ? ' MiB ' : ' MB ' ;
32+
3233 return $ table
3334 ->heading (trans_choice ('user-creatable-servers::strings.user_resource_limits ' , 2 ))
3435 ->columns ([
3536 TextColumn::make ('cpu ' )
3637 ->label (trans ('user-creatable-servers::strings.cpu ' ))
3738 ->badge ()
38- ->suffix ( '% ' ),
39+ ->formatStateUsing ( fn ( $ state ) => $ state > 0 ? $ state . '% ' : trans ( ' user-creatable-servers::strings.unlimited ' ) ),
3940 TextColumn::make ('memory ' )
4041 ->label (trans ('user-creatable-servers::strings.memory ' ))
4142 ->badge ()
42- ->suffix ( config ( ' panel.use_binary_prefix ' ) ? ' MiB ' : ' MB ' ),
43+ ->formatStateUsing ( fn ( $ state ) => $ state > 0 ? $ state . $ suffix : trans ( ' user-creatable-servers::strings.unlimited ' ) ),
4344 TextColumn::make ('disk ' )
4445 ->label (trans ('user-creatable-servers::strings.disk ' ))
4546 ->badge ()
46- ->suffix ( config ( ' panel.use_binary_prefix ' ) ? ' MiB ' : ' MB ' ),
47+ ->formatStateUsing ( fn ( $ state ) => $ state > 0 ? $ state . $ suffix : trans ( ' user-creatable-servers::strings.unlimited ' ) ),
4748 ])
4849 ->recordActions ([
49- ActionGroup::make ([
50- ViewAction::make ()
51- ->hidden (fn ($ record ) => static ::canEdit ($ record )),
52- EditAction::make (),
53- DeleteAction::make (),
54- ]),
50+ ViewAction::make ()
51+ ->hidden (fn ($ record ) => static ::canEdit ($ record )),
52+ EditAction::make (),
53+ DeleteAction::make (),
5554 ])
5655 ->emptyStateIcon ('tabler-cube-plus ' )
5756 ->emptyStateDescription ('' );
0 commit comments