Resource changes

This commit is contained in:
Lance Pioch 2024-04-25 17:35:27 -04:00
parent 85b250d016
commit ea146f4715
6 changed files with 16 additions and 26 deletions

View File

@ -47,7 +47,8 @@ class ListMounts extends ListRecords
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
Actions\CreateAction::make()
->label('Create Mount'),
];
}
}

View File

@ -83,7 +83,8 @@ class ListNodes extends ListRecords
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
Actions\CreateAction::make()
->label('Create Node'),
];
}
}

View File

@ -102,7 +102,8 @@ class ListServers extends ListRecords
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
Actions\CreateAction::make()
->label('Create Server'),
];
}
}

View File

@ -14,6 +14,8 @@ class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;
protected static bool $canCreateAnother = false;
public function form(Form $form): Form
{
return $form
@ -22,15 +24,6 @@ class CreateUser extends CreateRecord
Forms\Components\TextInput::make('username')->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')
->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
->dehydrated(fn (?string $state): bool => filled($state))

View File

@ -22,15 +22,6 @@ class EditUser extends EditRecord
Forms\Components\TextInput::make('username')->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')
->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
->dehydrated(fn (?string $state): bool => filled($state))
@ -62,12 +53,14 @@ class EditUser extends EditRecord
->default(false),
Forms\Components\Hidden::make('skipValidation')->default(true),
Forms\Components\Select::make('language')
->required()
->hidden()
->default('en')
->options(fn (User $user) => $user->getAvailableLanguages()),
])->columns(2),
])->columns(),
]);
}
protected function getHeaderActions(): array

View File

@ -52,10 +52,10 @@ class ListUsers extends ListRecords
->label('Servers'),
Tables\Columns\TextColumn::make('subusers_count')
->visibleFrom('sm')
->label('Subusers')
->counts('subusers')
->icon('tabler-users')
->icon('tabler-users'),
// ->formatStateUsing(fn (string $state, $record): string => (string) ($record->servers_count + $record->subusers_count))
->label('Subuser Accounts'),
])
->filters([
//
@ -72,7 +72,8 @@ class ListUsers extends ListRecords
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
Actions\CreateAction::make()
->label('Create User'),
];
}
}