mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 11:16:51 +01:00 
			
		
		
		
	Resource changes
This commit is contained in:
		
							parent
							
								
									85b250d016
								
							
						
					
					
						commit
						ea146f4715
					
				@ -47,7 +47,8 @@ class ListMounts extends ListRecords
 | 
				
			|||||||
    protected function getHeaderActions(): array
 | 
					    protected function getHeaderActions(): array
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return [
 | 
					        return [
 | 
				
			||||||
            Actions\CreateAction::make(),
 | 
					            Actions\CreateAction::make()
 | 
				
			||||||
 | 
					                ->label('Create Mount'),
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -83,7 +83,8 @@ class ListNodes extends ListRecords
 | 
				
			|||||||
    protected function getHeaderActions(): array
 | 
					    protected function getHeaderActions(): array
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return [
 | 
					        return [
 | 
				
			||||||
            Actions\CreateAction::make(),
 | 
					            Actions\CreateAction::make()
 | 
				
			||||||
 | 
					                ->label('Create Node'),
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -102,7 +102,8 @@ class ListServers extends ListRecords
 | 
				
			|||||||
    protected function getHeaderActions(): array
 | 
					    protected function getHeaderActions(): array
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return [
 | 
					        return [
 | 
				
			||||||
            Actions\CreateAction::make(),
 | 
					            Actions\CreateAction::make()
 | 
				
			||||||
 | 
					                ->label('Create Server'),
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,8 @@ class CreateUser extends CreateRecord
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    protected static string $resource = UserResource::class;
 | 
					    protected static string $resource = UserResource::class;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected static bool $canCreateAnother = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function form(Form $form): Form
 | 
					    public function form(Form $form): Form
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $form
 | 
					        return $form
 | 
				
			||||||
@ -22,15 +24,6 @@ class CreateUser extends CreateRecord
 | 
				
			|||||||
                    Forms\Components\TextInput::make('username')->required()->maxLength(191),
 | 
					                    Forms\Components\TextInput::make('username')->required()->maxLength(191),
 | 
				
			||||||
                    Forms\Components\TextInput::make('email')->email()->required()->maxLength(191),
 | 
					                    Forms\Components\TextInput::make('email')->email()->required()->maxLength(191),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    Forms\Components\TextInput::make('name_first')
 | 
					 | 
				
			||||||
                        ->maxLength(191)
 | 
					 | 
				
			||||||
                        ->hidden(fn (string $operation): bool => $operation === 'create')
 | 
					 | 
				
			||||||
                        ->label('First Name'),
 | 
					 | 
				
			||||||
                    Forms\Components\TextInput::make('name_last')
 | 
					 | 
				
			||||||
                        ->maxLength(191)
 | 
					 | 
				
			||||||
                        ->hidden(fn (string $operation): bool => $operation === 'create')
 | 
					 | 
				
			||||||
                        ->label('Last Name'),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    Forms\Components\TextInput::make('password')
 | 
					                    Forms\Components\TextInput::make('password')
 | 
				
			||||||
                        ->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
 | 
					                        ->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
 | 
				
			||||||
                        ->dehydrated(fn (?string $state): bool => filled($state))
 | 
					                        ->dehydrated(fn (?string $state): bool => filled($state))
 | 
				
			||||||
 | 
				
			|||||||
@ -22,15 +22,6 @@ class EditUser extends EditRecord
 | 
				
			|||||||
                    Forms\Components\TextInput::make('username')->required()->maxLength(191),
 | 
					                    Forms\Components\TextInput::make('username')->required()->maxLength(191),
 | 
				
			||||||
                    Forms\Components\TextInput::make('email')->email()->required()->maxLength(191),
 | 
					                    Forms\Components\TextInput::make('email')->email()->required()->maxLength(191),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    Forms\Components\TextInput::make('name_first')
 | 
					 | 
				
			||||||
                        ->maxLength(191)
 | 
					 | 
				
			||||||
                        ->hidden(fn (string $operation): bool => $operation === 'create')
 | 
					 | 
				
			||||||
                        ->label('First Name'),
 | 
					 | 
				
			||||||
                    Forms\Components\TextInput::make('name_last')
 | 
					 | 
				
			||||||
                        ->maxLength(191)
 | 
					 | 
				
			||||||
                        ->hidden(fn (string $operation): bool => $operation === 'create')
 | 
					 | 
				
			||||||
                        ->label('Last Name'),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    Forms\Components\TextInput::make('password')
 | 
					                    Forms\Components\TextInput::make('password')
 | 
				
			||||||
                        ->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
 | 
					                        ->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
 | 
				
			||||||
                        ->dehydrated(fn (?string $state): bool => filled($state))
 | 
					                        ->dehydrated(fn (?string $state): bool => filled($state))
 | 
				
			||||||
@ -62,12 +53,14 @@ class EditUser extends EditRecord
 | 
				
			|||||||
                        ->default(false),
 | 
					                        ->default(false),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    Forms\Components\Hidden::make('skipValidation')->default(true),
 | 
					                    Forms\Components\Hidden::make('skipValidation')->default(true),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    Forms\Components\Select::make('language')
 | 
					                    Forms\Components\Select::make('language')
 | 
				
			||||||
                        ->required()
 | 
					                        ->required()
 | 
				
			||||||
                        ->hidden()
 | 
					                        ->hidden()
 | 
				
			||||||
                        ->default('en')
 | 
					                        ->default('en')
 | 
				
			||||||
                        ->options(fn (User $user) => $user->getAvailableLanguages()),
 | 
					                        ->options(fn (User $user) => $user->getAvailableLanguages()),
 | 
				
			||||||
                ])->columns(2),
 | 
					
 | 
				
			||||||
 | 
					                ])->columns(),
 | 
				
			||||||
            ]);
 | 
					            ]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    protected function getHeaderActions(): array
 | 
					    protected function getHeaderActions(): array
 | 
				
			||||||
 | 
				
			|||||||
@ -52,10 +52,10 @@ class ListUsers extends ListRecords
 | 
				
			|||||||
                    ->label('Servers'),
 | 
					                    ->label('Servers'),
 | 
				
			||||||
                Tables\Columns\TextColumn::make('subusers_count')
 | 
					                Tables\Columns\TextColumn::make('subusers_count')
 | 
				
			||||||
                    ->visibleFrom('sm')
 | 
					                    ->visibleFrom('sm')
 | 
				
			||||||
 | 
					                    ->label('Subusers')
 | 
				
			||||||
                    ->counts('subusers')
 | 
					                    ->counts('subusers')
 | 
				
			||||||
                    ->icon('tabler-users')
 | 
					                    ->icon('tabler-users'),
 | 
				
			||||||
                    // ->formatStateUsing(fn (string $state, $record): string => (string) ($record->servers_count + $record->subusers_count))
 | 
					                // ->formatStateUsing(fn (string $state, $record): string => (string) ($record->servers_count + $record->subusers_count))
 | 
				
			||||||
                    ->label('Subuser Accounts'),
 | 
					 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
            ->filters([
 | 
					            ->filters([
 | 
				
			||||||
                //
 | 
					                //
 | 
				
			||||||
@ -72,7 +72,8 @@ class ListUsers extends ListRecords
 | 
				
			|||||||
    protected function getHeaderActions(): array
 | 
					    protected function getHeaderActions(): array
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return [
 | 
					        return [
 | 
				
			||||||
            Actions\CreateAction::make(),
 | 
					            Actions\CreateAction::make()
 | 
				
			||||||
 | 
					                ->label('Create User'),
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user