66use App \Models \HelmRelease ;
77use App \Models \Server ;
88use App \Services \HelmChartService ;
9+ use Filament \Actions \Action ;
10+ use Filament \Actions \BulkActionGroup ;
11+ use Filament \Actions \DeleteAction ;
12+ use Filament \Actions \DeleteBulkAction ;
13+ use Filament \Actions \EditAction ;
914use Filament \Forms ;
15+ use Filament \Schemas \Components \Section ;
1016use Filament \Schemas \Schema ;
1117use Filament \Resources \Resource ;
1218use Filament \Tables ;
@@ -18,11 +24,11 @@ class HelmReleaseResource extends Resource
1824{
1925 protected static ?string $ model = HelmRelease::class;
2026
21- protected static string | \BackedEnum | null $ navigationIcon = 'heroicon-o-cube ' ;
27+ protected static string | \BackedEnum | null $ navigationIcon = 'heroicon-o-cube ' ;
2228
2329 protected static ?string $ navigationLabel = 'Helm Charts ' ;
2430
25- protected static string | \UnitEnum | null $ navigationGroup = 'Kubernetes ' ;
31+ protected static string | \UnitEnum | null $ navigationGroup = 'Kubernetes ' ;
2632
2733 protected static ?int $ navigationSort = 2 ;
2834
@@ -33,7 +39,7 @@ public static function form(Schema $schema): Schema
3339
3440 return $ schema
3541 ->components ([
36- Forms \ Components \ Section::make ('Release Information ' )
42+ Section::make ('Release Information ' )
3743 ->schema ([
3844 Forms \Components \Select::make ('server_id ' )
3945 ->label ('Server ' )
@@ -71,7 +77,7 @@ public static function form(Schema $schema): Schema
7177 ])
7278 ->columns (2 ),
7379
74- Forms \ Components \ Section::make ('Configuration ' )
80+ Section::make ('Configuration ' )
7581 ->schema ([
7682 Forms \Components \KeyValue::make ('values ' )
7783 ->label ('Helm Values ' )
@@ -115,7 +121,7 @@ public static function table(Table $table): Table
115121 Tables \Columns \TextColumn::make ('status ' )
116122 ->label ('Status ' )
117123 ->badge ()
118- ->color (fn (string $ state ): string => match ($ state ) {
124+ ->color (fn (string $ state ): string => match ($ state ) {
119125 'deployed ' => 'success ' ,
120126 'failed ' => 'danger ' ,
121127 'pending ' => 'warning ' ,
@@ -153,18 +159,18 @@ public static function table(Table $table): Table
153159 'uninstalled ' => 'Uninstalled ' ,
154160 ]),
155161
156- Tables \Filters \SelectFilter::make ('chart_name ' )
157- ->label ('Chart Type ' )
158- ->options (function () {
159- $ helmService = app (HelmChartService::class);
160- $ charts = $ helmService ->getAvailableCharts ();
161- return collect ($ charts )->mapWithKeys (function ($ chart , $ key ) {
162- return [$ key => $ chart ['name ' ]];
163- })->toArray ();
164- }),
162+ // Tables\Filters\SelectFilter::make('chart_name')
163+ // ->label('Chart Type')
164+ // ->options(function () {
165+ // $helmService = app(HelmChartService::class);
166+ // $charts = $helmService->getAvailableCharts();
167+ // return collect($charts)->mapWithKeys(function ($chart, $key) {
168+ // return [$key => $chart['name']];
169+ // })->toArray();
170+ // }),
165171 ])
166- ->actions ([
167- Tables \ Actions \ Action::make ('sync ' )
172+ ->recordActions ([
173+ Action::make ('sync ' )
168174 ->label ('Sync Status ' )
169175 ->icon ('heroicon-o-arrow-path ' )
170176 ->action (function (HelmRelease $ record ) {
@@ -177,15 +183,15 @@ public static function table(Table $table): Table
177183
178184 if ($ status && isset ($ status ['info ' ])) {
179185 $ updateData = [];
180-
186+
181187 if (isset ($ status ['info ' ]['status ' ])) {
182188 $ updateData ['status ' ] = $ status ['info ' ]['status ' ];
183189 }
184-
190+
185191 if (isset ($ status ['chart ' ]['metadata ' ]['version ' ])) {
186192 $ updateData ['chart_version ' ] = $ status ['chart ' ]['metadata ' ]['version ' ];
187193 }
188-
194+
189195 if (!empty ($ updateData )) {
190196 $ record ->update ($ updateData );
191197
@@ -208,9 +214,9 @@ public static function table(Table $table): Table
208214 }
209215 }),
210216
211- Tables \ Actions \ EditAction::make (),
217+ EditAction::make (),
212218
213- Tables \ Actions \ Action::make ('upgrade ' )
219+ Action::make ('upgrade ' )
214220 ->label ('Upgrade ' )
215221 ->icon ('heroicon-o-arrow-up-circle ' )
216222 ->color ('warning ' )
@@ -244,7 +250,7 @@ public static function table(Table $table): Table
244250 }
245251 }),
246252
247- Tables \ Actions \ DeleteAction::make ()
253+ DeleteAction::make ()
248254 ->label ('Uninstall ' )
249255 ->requiresConfirmation ()
250256 ->action (function (HelmRelease $ record ) {
@@ -272,8 +278,8 @@ public static function table(Table $table): Table
272278 }),
273279 ])
274280 ->bulkActions ([
275- Tables \ Actions \ BulkActionGroup::make ([
276- Tables \ Actions \ DeleteBulkAction::make (),
281+ BulkActionGroup::make ([
282+ DeleteBulkAction::make (),
277283 ]),
278284 ])
279285 ->defaultSort ('created_at ' , 'desc ' );
0 commit comments