minor fixes for random stuff
This commit is contained in:
		
							parent
							
								
									00502f6d4d
								
							
						
					
					
						commit
						cba00d822c
					
				| @ -54,7 +54,7 @@ class DatabaseSettingsCommand extends Command | |||||||
|         $this->output->note('Using the "root" account for MySQL connections is not only highly frowned upon, it is also not allowed by this application. You\'ll need to have created a MySQL user for this software.'); |         $this->output->note('Using the "root" account for MySQL connections is not only highly frowned upon, it is also not allowed by this application. You\'ll need to have created a MySQL user for this software.'); | ||||||
|         $this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask( |         $this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask( | ||||||
|             'Database Username', |             'Database Username', | ||||||
|             config('database.connections.mysql.username', 'panel') |             config('database.connections.mysql.username', 'pelican') | ||||||
|         ); |         ); | ||||||
| 
 | 
 | ||||||
|         $askForMySQLPassword = true; |         $askForMySQLPassword = true; | ||||||
|  | |||||||
| @ -34,13 +34,14 @@ class EmailSettingsCommand extends Command | |||||||
|         $this->variables['MAIL_DRIVER'] = $this->option('driver') ?? $this->choice( |         $this->variables['MAIL_DRIVER'] = $this->option('driver') ?? $this->choice( | ||||||
|             trans('command/messages.environment.mail.ask_driver'), |             trans('command/messages.environment.mail.ask_driver'), | ||||||
|             [ |             [ | ||||||
|  |                 'log' => 'Log', | ||||||
|                 'smtp' => 'SMTP Server', |                 'smtp' => 'SMTP Server', | ||||||
|                 'sendmail' => 'sendmail Binary', |                 'sendmail' => 'sendmail Binary', | ||||||
|                 'mailgun' => 'Mailgun Transactional Email', |                 'mailgun' => 'Mailgun', | ||||||
|                 'mandrill' => 'Mandrill Transactional Email', |                 'mandrill' => 'Mandrill', | ||||||
|                 'postmark' => 'Postmark Transactional Email', |                 'postmark' => 'Postmark', | ||||||
|             ], |             ], | ||||||
|             config('mail.default', 'smtp') |             'smtp', | ||||||
|         ); |         ); | ||||||
| 
 | 
 | ||||||
|         $method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables'; |         $method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables'; | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ class MakeUserCommand extends Command | |||||||
| { | { | ||||||
|     protected $description = 'Creates a user on the system via the CLI.'; |     protected $description = 'Creates a user on the system via the CLI.'; | ||||||
| 
 | 
 | ||||||
|     protected $signature = 'p:user:make {--email=} {--username=} {--name-first=} {--name-last=} {--password=} {--admin=} {--no-password}'; |     protected $signature = 'p:user:make {--email=} {--username=} {--password=} {--admin=} {--no-password}'; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * MakeUserCommand constructor. |      * MakeUserCommand constructor. | ||||||
| @ -40,8 +40,6 @@ class MakeUserCommand extends Command | |||||||
|         $root_admin = $this->option('admin') ?? $this->confirm(trans('command/messages.user.ask_admin')); |         $root_admin = $this->option('admin') ?? $this->confirm(trans('command/messages.user.ask_admin')); | ||||||
|         $email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_email')); |         $email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_email')); | ||||||
|         $username = $this->option('username') ?? $this->ask(trans('command/messages.user.ask_username')); |         $username = $this->option('username') ?? $this->ask(trans('command/messages.user.ask_username')); | ||||||
|         $name_first = $this->option('name-first') ?? $this->ask(trans('command/messages.user.ask_name_first')); |  | ||||||
|         $name_last = $this->option('name-last') ?? $this->ask(trans('command/messages.user.ask_name_last')); |  | ||||||
| 
 | 
 | ||||||
|         if (is_null($password = $this->option('password')) && !$this->option('no-password')) { |         if (is_null($password = $this->option('password')) && !$this->option('no-password')) { | ||||||
|             $this->warn(trans('command/messages.user.ask_password_help')); |             $this->warn(trans('command/messages.user.ask_password_help')); | ||||||
| @ -49,12 +47,11 @@ class MakeUserCommand extends Command | |||||||
|             $password = $this->secret(trans('command/messages.user.ask_password')); |             $password = $this->secret(trans('command/messages.user.ask_password')); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $user = $this->creationService->handle(compact('email', 'username', 'name_first', 'name_last', 'password', 'root_admin')); |         $user = $this->creationService->handle(compact('email', 'username', 'password', 'root_admin')); | ||||||
|         $this->table(['Field', 'Value'], [ |         $this->table(['Field', 'Value'], [ | ||||||
|             ['UUID', $user->uuid], |             ['UUID', $user->uuid], | ||||||
|             ['Email', $user->email], |             ['Email', $user->email], | ||||||
|             ['Username', $user->username], |             ['Username', $user->username], | ||||||
|             ['Name', $user->name], |  | ||||||
|             ['Admin', $user->root_admin ? 'Yes' : 'No'], |             ['Admin', $user->root_admin ? 'Yes' : 'No'], | ||||||
|         ]); |         ]); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -14,6 +14,8 @@ class CreateDatabaseHost extends CreateRecord | |||||||
| 
 | 
 | ||||||
|     protected ?string $heading = 'Database Hosts'; |     protected ?string $heading = 'Database Hosts'; | ||||||
| 
 | 
 | ||||||
|  |     protected static bool $canCreateAnother = false; | ||||||
|  | 
 | ||||||
|     protected ?string $subheading = '(database servers that can have individual databases)'; |     protected ?string $subheading = '(database servers that can have individual databases)'; | ||||||
| 
 | 
 | ||||||
|     public function form(Form $form): Form |     public function form(Form $form): Form | ||||||
|  | |||||||
| @ -11,6 +11,8 @@ use Filament\Forms\Form; | |||||||
| class CreateEgg extends CreateRecord | class CreateEgg extends CreateRecord | ||||||
| { | { | ||||||
|     protected static string $resource = EggResource::class; |     protected static string $resource = EggResource::class; | ||||||
|  | 
 | ||||||
|  |     protected static bool $canCreateAnother = false; | ||||||
|     public function form(Form $form): Form |     public function form(Form $form): Form | ||||||
|     { |     { | ||||||
|         return $form |         return $form | ||||||
| @ -44,6 +46,7 @@ class CreateEgg extends CreateRecord | |||||||
|                                 ->required() |                                 ->required() | ||||||
|                                 ->helperText('The default startup command that should be used for new servers using this Egg.'), |                                 ->helperText('The default startup command that should be used for new servers using this Egg.'), | ||||||
|                             Forms\Components\TagsInput::make('file_denylist') |                             Forms\Components\TagsInput::make('file_denylist') | ||||||
|  |                                 ->hidden() // latest wings broke it
 | ||||||
|                                 ->placeholder('denied-file.txt') |                                 ->placeholder('denied-file.txt') | ||||||
|                                 ->helperText('A list of files that the end user is not allowed to edit.') |                                 ->helperText('A list of files that the end user is not allowed to edit.') | ||||||
|                                 ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]), |                                 ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]), | ||||||
|  | |||||||
| @ -46,6 +46,7 @@ class EditEgg extends EditRecord | |||||||
|                                 ->required() |                                 ->required() | ||||||
|                                 ->helperText('The default startup command that should be used for new servers using this Egg.'), |                                 ->helperText('The default startup command that should be used for new servers using this Egg.'), | ||||||
|                             Forms\Components\TagsInput::make('file_denylist') |                             Forms\Components\TagsInput::make('file_denylist') | ||||||
|  |                                 ->hidden() // latest wings breaks it.
 | ||||||
|                                 ->placeholder('denied-file.txt') |                                 ->placeholder('denied-file.txt') | ||||||
|                                 ->helperText('A list of files that the end user is not allowed to edit.') |                                 ->helperText('A list of files that the end user is not allowed to edit.') | ||||||
|                                 ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]), |                                 ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]), | ||||||
| @ -161,6 +162,7 @@ class EditEgg extends EditRecord | |||||||
|                                 ->default('ash'), |                                 ->default('ash'), | ||||||
| 
 | 
 | ||||||
|                             MonacoEditor::make('script_install') |                             MonacoEditor::make('script_install') | ||||||
|  |                                 ->label('Install Script') | ||||||
|                                 ->columnSpanFull() |                                 ->columnSpanFull() | ||||||
|                                 ->fontSize('16px') |                                 ->fontSize('16px') | ||||||
|                                 ->language('shell') |                                 ->language('shell') | ||||||
|  | |||||||
| @ -56,6 +56,11 @@ class ListEggs extends ListRecords | |||||||
|             ]) |             ]) | ||||||
|             ->actions([ |             ->actions([ | ||||||
|                 Tables\Actions\EditAction::make(), |                 Tables\Actions\EditAction::make(), | ||||||
|  |                 Tables\Actions\ExportAction::make() | ||||||
|  |                     ->icon('tabler-download') | ||||||
|  |                     ->label('Export') | ||||||
|  |                     // uses old admin panel export service
 | ||||||
|  |                     ->url(fn (Egg $egg): string => route('admin.eggs.export', ['egg' => $egg])), | ||||||
|             ]) |             ]) | ||||||
|             ->headerActions([ |             ->headerActions([ | ||||||
|                 //
 |                 //
 | ||||||
| @ -69,7 +74,7 @@ class ListEggs extends ListRecords | |||||||
|     protected function getHeaderActions(): array |     protected function getHeaderActions(): array | ||||||
|     { |     { | ||||||
|         return [ |         return [ | ||||||
|             Actions\CreateAction::make(), |             Actions\CreateAction::make('create')->label('Create Egg'), | ||||||
| 
 | 
 | ||||||
|             Actions\Action::make('import') |             Actions\Action::make('import') | ||||||
|                 ->label('Import') |                 ->label('Import') | ||||||
|  | |||||||
| @ -13,6 +13,8 @@ use Filament\Forms; | |||||||
| class CreateMount extends CreateRecord | class CreateMount extends CreateRecord | ||||||
| { | { | ||||||
|     protected static string $resource = MountResource::class; |     protected static string $resource = MountResource::class; | ||||||
|  | 
 | ||||||
|  |     protected static bool $canCreateAnother = false; | ||||||
|     public function form(Form $form): Form |     public function form(Form $form): Form | ||||||
|     { |     { | ||||||
|         return $form |         return $form | ||||||
|  | |||||||
| @ -72,7 +72,7 @@ class EditUser extends EditRecord | |||||||
| 
 | 
 | ||||||
|             Actions\Action::make('toggleSuspend') |             Actions\Action::make('toggleSuspend') | ||||||
|                 ->hidden(fn (User $user) => $user->servers()->whereNot('status', ServerState::Suspended)->count() === 0) |                 ->hidden(fn (User $user) => $user->servers()->whereNot('status', ServerState::Suspended)->count() === 0) | ||||||
|                 ->label('Suspend All Servers') |                 ->label('Suspend Servers') | ||||||
|                 ->color('warning') |                 ->color('warning') | ||||||
|                 ->action(function (User $user) { |                 ->action(function (User $user) { | ||||||
|                     foreach ($user->servers()->whereNot('status', ServerState::Suspended)->get() as $server) { |                     foreach ($user->servers()->whereNot('status', ServerState::Suspended)->get() as $server) { | ||||||
| @ -82,7 +82,7 @@ class EditUser extends EditRecord | |||||||
| 
 | 
 | ||||||
|             Actions\Action::make('toggleUnsuspend') |             Actions\Action::make('toggleUnsuspend') | ||||||
|                 ->hidden(fn (User $user) => $user->servers()->where('status', ServerState::Suspended)->count() === 0) |                 ->hidden(fn (User $user) => $user->servers()->where('status', ServerState::Suspended)->count() === 0) | ||||||
|                 ->label('Unsuspend All Servers') |                 ->label('Unsuspend Servers') | ||||||
|                 ->color('success') |                 ->color('success') | ||||||
|                 ->action(function (User $user) { |                 ->action(function (User $user) { | ||||||
|                     foreach ($user->servers()->where('status', ServerState::Suspended)->get() as $server) { |                     foreach ($user->servers()->where('status', ServerState::Suspended)->get() as $server) { | ||||||
|  | |||||||
| @ -63,6 +63,7 @@ class ListUsers extends ListRecords | |||||||
|             ->actions([ |             ->actions([ | ||||||
|                 Tables\Actions\EditAction::make(), |                 Tables\Actions\EditAction::make(), | ||||||
|             ]) |             ]) | ||||||
|  |             ->checkIfRecordIsSelectableUsing(fn (User $user) => !$user->servers_count) | ||||||
|             ->bulkActions([ |             ->bulkActions([ | ||||||
|                 Tables\Actions\BulkActionGroup::make([ |                 Tables\Actions\BulkActionGroup::make([ | ||||||
|                     Tables\Actions\DeleteBulkAction::make(), |                     Tables\Actions\DeleteBulkAction::make(), | ||||||
|  | |||||||
| @ -22,6 +22,7 @@ class ServersRelationManager extends RelationManager | |||||||
|                     ->searchable(), |                     ->searchable(), | ||||||
|                 Tables\Columns\TextColumn::make('name') |                 Tables\Columns\TextColumn::make('name') | ||||||
|                     ->icon('tabler-brand-docker') |                     ->icon('tabler-brand-docker') | ||||||
|  |                     ->url(fn (Server $server): string => route('filament.admin.resources.servers.edit', ['record' => $server])) | ||||||
|                     ->searchable() |                     ->searchable() | ||||||
|                     ->sortable(), |                     ->sortable(), | ||||||
|                 Tables\Columns\TextColumn::make('node.name') |                 Tables\Columns\TextColumn::make('node.name') | ||||||
|  | |||||||
| @ -8,6 +8,6 @@ class EggPolicy | |||||||
| { | { | ||||||
|     public function create(User $user): bool |     public function create(User $user): bool | ||||||
|     { |     { | ||||||
|         return false; |         return true; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 notCharles
						notCharles