66use Boy132 \GenericOIDCProviders \Filament \Admin \Resources \GenericOIDCProviders \Pages \EditGenericOIDCProvider ;
77use Boy132 \GenericOIDCProviders \Filament \Admin \Resources \GenericOIDCProviders \Pages \ListGenericOIDCProviders ;
88use Boy132 \GenericOIDCProviders \Models \GenericOIDCProvider ;
9- use Filament \Actions \CreateAction ;
109use Filament \Actions \DeleteAction ;
1110use Filament \Actions \DeleteBulkAction ;
1211use Filament \Actions \EditAction ;
1514use Filament \Forms \Components \TextInput ;
1615use Filament \Forms \Components \Toggle ;
1716use Filament \Resources \Resource ;
17+ use Filament \Schemas \Components \Group ;
1818use Filament \Schemas \Components \StateCasts \BooleanStateCast ;
1919use Filament \Schemas \Components \Utilities \Get ;
2020use Filament \Schemas \Components \Utilities \Set ;
@@ -33,6 +33,8 @@ class GenericOIDCProviderResource extends Resource
3333
3434 protected static string |\BackedEnum |null $ navigationIcon = 'tabler-brand-oauth ' ;
3535
36+ protected static ?string $ recordTitleAttribute = 'id ' ;
37+
3638 public static function getNavigationGroup (): ?string
3739 {
3840 return trans ('admin/dashboard.advanced ' );
@@ -61,7 +63,6 @@ public static function getNavigationBadge(): ?string
6163 public static function form (Schema $ schema ): Schema
6264 {
6365 return $ schema
64- ->columns (3 )
6566 ->components ([
6667 TextInput::make ('id ' )
6768 ->label ('ID ' )
@@ -88,15 +89,14 @@ public static function form(Schema $schema): Schema
8889 ->label (trans ('generic-oidc-providers::strings.base_url ' ))
8990 ->required ()
9091 ->url ()
91- ->autocomplete (false ),
92- Toggle::make ('create_missing_users ' )
93- ->label (trans ('admin/setting.oauth.create_missing_users ' ))
94- ->inline (false )
95- ->onIcon ('tabler-check ' )
96- ->offIcon ('tabler-x ' )
97- ->onColor ('success ' )
98- ->offColor ('danger ' )
99- ->stateCast (new BooleanStateCast (false )),
92+ ->autocomplete (false )
93+ ->columnSpan (fn ($ operation ) => $ operation === 'create ' ? 2 : 1 ),
94+ TextInput::make ('redirect_url ' )
95+ ->label (trans ('generic-oidc-providers::strings.redirect_url ' ))
96+ ->saved (false )
97+ ->formatStateUsing (fn (Get $ get ) => url ('/auth/oauth/callback/ ' . $ get ('id ' )))
98+ ->disabled ()
99+ ->hiddenOn ('create ' ),
100100 TextInput::make ('client_id ' )
101101 ->label (trans ('admin/setting.oauth.client_id ' ))
102102 ->required ()
@@ -109,27 +109,40 @@ public static function form(Schema $schema): Schema
109109 ->password ()
110110 ->revealable ()
111111 ->autocomplete (false ),
112- Toggle::make ('link_missing_users ' )
113- ->label (trans ('admin/setting.oauth.link_missing_users ' ))
114- ->inline (false )
115- ->onIcon ('tabler-check ' )
116- ->offIcon ('tabler-x ' )
117- ->onColor ('success ' )
118- ->offColor ('danger ' )
119- ->stateCast (new BooleanStateCast (false )),
120- Toggle::make ('verify_jwt ' )
121- ->label (trans ('generic-oidc-providers::strings.verify_jwt ' ))
122- ->inline (false )
123- ->onIcon ('tabler-check ' )
124- ->offIcon ('tabler-x ' )
125- ->onColor ('success ' )
126- ->offColor ('danger ' )
127- ->stateCast (new BooleanStateCast (false ))
128- ->live (),
112+ Group::make ()
113+ ->columns (3 )
114+ ->columnSpanFull ()
115+ ->schema ([
116+ Toggle::make ('create_missing_users ' )
117+ ->label (trans ('admin/setting.oauth.create_missing_users ' ))
118+ ->inline (false )
119+ ->onIcon ('tabler-check ' )
120+ ->offIcon ('tabler-x ' )
121+ ->onColor ('success ' )
122+ ->offColor ('danger ' )
123+ ->stateCast (new BooleanStateCast (false )),
124+ Toggle::make ('link_missing_users ' )
125+ ->label (trans ('admin/setting.oauth.link_missing_users ' ))
126+ ->inline (false )
127+ ->onIcon ('tabler-check ' )
128+ ->offIcon ('tabler-x ' )
129+ ->onColor ('success ' )
130+ ->offColor ('danger ' )
131+ ->stateCast (new BooleanStateCast (false )),
132+ Toggle::make ('verify_jwt ' )
133+ ->label (trans ('generic-oidc-providers::strings.verify_jwt ' ))
134+ ->inline (false )
135+ ->onIcon ('tabler-check ' )
136+ ->offIcon ('tabler-x ' )
137+ ->onColor ('success ' )
138+ ->offColor ('danger ' )
139+ ->stateCast (new BooleanStateCast (false ))
140+ ->live (),
141+ ]),
129142 Textarea::make ('jwt_public_key ' )
130143 ->label (trans ('generic-oidc-providers::strings.jwt_public_key ' ))
131144 ->visible (fn (Get $ get ) => $ get ('verify_jwt ' ))
132- ->columnSpan ( 2 )
145+ ->columnSpanFull ( )
133146 ->rows (3 )
134147 ->autosize ()
135148 ->placeholder ('-----BEGIN PUBLIC KEY-----
@@ -178,10 +191,7 @@ public static function table(Table $table): Table
178191 ])
179192 ->emptyStateIcon ('tabler-brand-oauth ' )
180193 ->emptyStateDescription ('' )
181- ->emptyStateHeading (trans ('generic-oidc-providers::strings.no_generic_oidc_providers ' ))
182- ->emptyStateActions ([
183- CreateAction::make (),
184- ]);
194+ ->emptyStateHeading (trans ('generic-oidc-providers::strings.no_generic_oidc_providers ' ));
185195 }
186196
187197 public static function getPages (): array
0 commit comments