minor fixes for random stuff

This commit is contained in:
notCharles 2024-04-25 18:57:21 -04:00
parent 00502f6d4d
commit cba00d822c
12 changed files with 28 additions and 14 deletions

View File

@ -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->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask(
'Database Username',
config('database.connections.mysql.username', 'panel')
config('database.connections.mysql.username', 'pelican')
);
$askForMySQLPassword = true;

View File

@ -34,13 +34,14 @@ class EmailSettingsCommand extends Command
$this->variables['MAIL_DRIVER'] = $this->option('driver') ?? $this->choice(
trans('command/messages.environment.mail.ask_driver'),
[
'log' => 'Log',
'smtp' => 'SMTP Server',
'sendmail' => 'sendmail Binary',
'mailgun' => 'Mailgun Transactional Email',
'mandrill' => 'Mandrill Transactional Email',
'postmark' => 'Postmark Transactional Email',
'mailgun' => 'Mailgun',
'mandrill' => 'Mandrill',
'postmark' => 'Postmark',
],
config('mail.default', 'smtp')
'smtp',
);
$method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables';

View File

@ -11,7 +11,7 @@ class MakeUserCommand extends Command
{
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.
@ -40,8 +40,6 @@ class MakeUserCommand extends Command
$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'));
$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')) {
$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'));
}
$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'], [
['UUID', $user->uuid],
['Email', $user->email],
['Username', $user->username],
['Name', $user->name],
['Admin', $user->root_admin ? 'Yes' : 'No'],
]);

View File

@ -14,6 +14,8 @@ class CreateDatabaseHost extends CreateRecord
protected ?string $heading = 'Database Hosts';
protected static bool $canCreateAnother = false;
protected ?string $subheading = '(database servers that can have individual databases)';
public function form(Form $form): Form

View File

@ -11,6 +11,8 @@ use Filament\Forms\Form;
class CreateEgg extends CreateRecord
{
protected static string $resource = EggResource::class;
protected static bool $canCreateAnother = false;
public function form(Form $form): Form
{
return $form
@ -44,6 +46,7 @@ class CreateEgg extends CreateRecord
->required()
->helperText('The default startup command that should be used for new servers using this Egg.'),
Forms\Components\TagsInput::make('file_denylist')
->hidden() // latest wings broke it
->placeholder('denied-file.txt')
->helperText('A list of files that the end user is not allowed to edit.')
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]),

View File

@ -46,6 +46,7 @@ class EditEgg extends EditRecord
->required()
->helperText('The default startup command that should be used for new servers using this Egg.'),
Forms\Components\TagsInput::make('file_denylist')
->hidden() // latest wings breaks it.
->placeholder('denied-file.txt')
->helperText('A list of files that the end user is not allowed to edit.')
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]),
@ -161,6 +162,7 @@ class EditEgg extends EditRecord
->default('ash'),
MonacoEditor::make('script_install')
->label('Install Script')
->columnSpanFull()
->fontSize('16px')
->language('shell')

View File

@ -56,6 +56,11 @@ class ListEggs extends ListRecords
])
->actions([
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([
//
@ -69,7 +74,7 @@ class ListEggs extends ListRecords
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
Actions\CreateAction::make('create')->label('Create Egg'),
Actions\Action::make('import')
->label('Import')

View File

@ -13,6 +13,8 @@ use Filament\Forms;
class CreateMount extends CreateRecord
{
protected static string $resource = MountResource::class;
protected static bool $canCreateAnother = false;
public function form(Form $form): Form
{
return $form

View File

@ -72,7 +72,7 @@ class EditUser extends EditRecord
Actions\Action::make('toggleSuspend')
->hidden(fn (User $user) => $user->servers()->whereNot('status', ServerState::Suspended)->count() === 0)
->label('Suspend All Servers')
->label('Suspend Servers')
->color('warning')
->action(function (User $user) {
foreach ($user->servers()->whereNot('status', ServerState::Suspended)->get() as $server) {
@ -82,7 +82,7 @@ class EditUser extends EditRecord
Actions\Action::make('toggleUnsuspend')
->hidden(fn (User $user) => $user->servers()->where('status', ServerState::Suspended)->count() === 0)
->label('Unsuspend All Servers')
->label('Unsuspend Servers')
->color('success')
->action(function (User $user) {
foreach ($user->servers()->where('status', ServerState::Suspended)->get() as $server) {

View File

@ -63,6 +63,7 @@ class ListUsers extends ListRecords
->actions([
Tables\Actions\EditAction::make(),
])
->checkIfRecordIsSelectableUsing(fn (User $user) => !$user->servers_count)
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),

View File

@ -22,6 +22,7 @@ class ServersRelationManager extends RelationManager
->searchable(),
Tables\Columns\TextColumn::make('name')
->icon('tabler-brand-docker')
->url(fn (Server $server): string => route('filament.admin.resources.servers.edit', ['record' => $server]))
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('node.name')

View File

@ -8,6 +8,6 @@ class EggPolicy
{
public function create(User $user): bool
{
return false;
return true;
}
}