replace placeholder with textentry

deprecated
This commit is contained in:
Charles 2025-04-25 09:02:47 -04:00
parent 6f5ce87985
commit 28b752a983
15 changed files with 88 additions and 81 deletions

View File

@ -4,7 +4,7 @@ namespace App\Extensions\Captcha\Providers;
use App\Filament\Components\Forms\Fields\TurnstileCaptcha;
use Exception;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\Toggle;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Http;
@ -47,10 +47,10 @@ class TurnstileProvider extends CaptchaProvider
->onColor('success')
->offColor('danger')
->default(env('CAPTCHA_TURNSTILE_VERIFY_DOMAIN', true)),
Placeholder::make('info')
TextEntry::make('info')
->label(trans('admin/setting.captcha.info_label'))
->columnSpan(2)
->content(new HtmlString(trans('admin/setting.captcha.info'))),
->state(new HtmlString(trans('admin/setting.captcha.info'))),
]);
}

View File

@ -2,7 +2,7 @@
namespace App\Extensions\OAuth\Providers;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\TextInput;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
@ -32,10 +32,10 @@ final class DiscordProvider extends OAuthProvider
return array_merge([
\Filament\Schemas\Components\Wizard\Step::make('Register new Discord OAuth App')
->schema([
Placeholder::make('INeedAName')
->content(new HtmlString(Blade::render('<p>Visit the <x-filament::link href="https://discord.com/developers/applications" target="_blank">Discord Developer Portal</x-filament::link> and click on <b>New Application</b>. Enter a <b>Name</b> (e.g. your panel name) and click on <b>Create</b>.</p><p>Copy the <b>Client ID</b> and the <b>Client Secret</b> from the OAuth2 tab, you will need them in the final step.</p>'))),
Placeholder::make('INeedAName2')
->content(new HtmlString('<p>Under <b>Redirects</b> add the below URL.</p>')),
TextEntry::make('INeedAName')
->state(new HtmlString(Blade::render('<p>Visit the <x-filament::link href="https://discord.com/developers/applications" target="_blank">Discord Developer Portal</x-filament::link> and click on <b>New Application</b>. Enter a <b>Name</b> (e.g. your panel name) and click on <b>Create</b>.</p><p>Copy the <b>Client ID</b> and the <b>Client Secret</b> from the OAuth2 tab, you will need them in the final step.</p>'))),
TextEntry::make('INeedAName2')
->state(new HtmlString('<p>Under <b>Redirects</b> add the below URL.</p>')),
TextInput::make('_noenv_callback')
->label('Redirect URL')
->dehydrated()

View File

@ -2,7 +2,7 @@
namespace App\Extensions\OAuth\Providers;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\TextInput;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
@ -26,21 +26,21 @@ final class GithubProvider extends OAuthProvider
return array_merge([
\Filament\Schemas\Components\Wizard\Step::make('Register new Github OAuth App')
->schema([
Placeholder::make('INeedAName2')
->content(new HtmlString(Blade::render('<p>Visit the <x-filament::link href="https://github.com/settings/developers" target="_blank">Github Developer Dashboard</x-filament::link>, go to <b>OAuth Apps</b> and click on <b>New OAuth App</b>.</p><p>Enter an <b>Application name</b> (e.g. your panel name), set <b>Homepage URL</b> to your panel url and enter the below url as <b>Authorization callback URL</b>.</p>'))),
TextEntry::make('INeedAName2')
->state(new HtmlString(Blade::render('<p>Visit the <x-filament::link href="https://github.com/settings/developers" target="_blank">Github Developer Dashboard</x-filament::link>, go to <b>OAuth Apps</b> and click on <b>New OAuth App</b>.</p><p>Enter an <b>Application name</b> (e.g. your panel name), set <b>Homepage URL</b> to your panel url and enter the below url as <b>Authorization callback URL</b>.</p>'))),
TextInput::make('_noenv_callback')
->label('Authorization callback URL')
->dehydrated()
->disabled()
//TODO ->hintAction(fn (string $state) => request()->isSecure() ? CopyAction::make()->copyable($state) : null)
->default(fn () => url('/auth/oauth/callback/github')),
Placeholder::make('INeedAName')
->content(new HtmlString('<p>When you filled all fields click on <b>Register application</b>.</p>')),
TextEntry::make('INeedAName')
->state(new HtmlString('<p>When you filled all fields click on <b>Register application</b>.</p>')),
]),
\Filament\Schemas\Components\Wizard\Step::make('Create Client Secret')
->schema([
Placeholder::make('INeedAName3')
->content(new HtmlString('<p>Once you registered your app, generate a new <b>Client Secret</b>.</p><p>You will also need the <b>Client ID</b>.</p>')),
TextEntry::make('INeedAName3')
->state(new HtmlString('<p>Once you registered your app, generate a new <b>Client Secret</b>.</p><p>You will also need the <b>Client ID</b>.</p>')),
]),
], parent::getSetupSteps());
}

View File

@ -2,7 +2,7 @@
namespace App\Extensions\OAuth\Providers;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\TextInput;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
@ -46,8 +46,8 @@ final class GitlabProvider extends OAuthProvider
return array_merge([
\Filament\Schemas\Components\Wizard\Step::make('Register new Gitlab OAuth App')
->schema([
Placeholder::make('INeedAName')
->content(new HtmlString(Blade::render('Check out the <x-filament::link href="https://docs.gitlab.com/integration/oauth_provider/" target="_blank">Gitlab docs</x-filament::link> on how to create the oauth app.'))),
TextEntry::make('INeedAName')
->state(new HtmlString(Blade::render('Check out the <x-filament::link href="https://docs.gitlab.com/integration/oauth_provider/" target="_blank">Gitlab docs</x-filament::link> on how to create the oauth app.'))),
TextInput::make('_noenv_callback')
->label('Redirect URI')
->dehydrated()

View File

@ -2,7 +2,7 @@
namespace App\Extensions\OAuth\Providers;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\TextInput;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
@ -57,8 +57,8 @@ final class SteamProvider extends OAuthProvider
return array_merge([
\Filament\Schemas\Components\Wizard\Step::make('Create API Key')
->schema([
Placeholder::make('INeedAName')
->content(new HtmlString(Blade::render('Visit <x-filament::link href="https://steamcommunity.com/dev/apikey" target="_blank">https://steamcommunity.com/dev/apikey</x-filament::link> to generate an API key.'))),
TextEntry::make('INeedAName')
->state(new HtmlString(Blade::render('Visit <x-filament::link href="https://steamcommunity.com/dev/apikey" target="_blank">https://steamcommunity.com/dev/apikey</x-filament::link> to generate an API key.'))),
]),
], parent::getSetupSteps());
}

View File

@ -7,7 +7,7 @@ use App\Services\Databases\Hosts\HostCreationService;
use Exception;
use Filament\Schemas\Components\Fieldset;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
@ -48,8 +48,8 @@ class CreateDatabaseHost extends CreateRecord
Step::make(trans('admin/databasehost.setup.preparations'))
->columns()
->schema([
Placeholder::make('INeedAName')
->content(trans('admin/databasehost.setup.note')),
TextEntry::make('INeedAName')
->state(trans('admin/databasehost.setup.note')),
Toggle::make('different_server')
->label(new HtmlString(trans('admin/databasehost.setup.different_server')))
->dehydrated(false)
@ -82,8 +82,8 @@ class CreateDatabaseHost extends CreateRecord
->schema([
Fieldset::make(trans('admin/databasehost.setup.database_user'))
->schema([
Placeholder::make('INeedAName')
->content(new HtmlString(trans('admin/databasehost.setup.cli_login')))
TextEntry::make('INeedAName')
->state(new HtmlString(trans('admin/databasehost.setup.cli_login')))
->columnSpanFull(),
TextInput::make('create_user')
->label(trans('admin/databasehost.setup.command_create_user'))
@ -99,14 +99,14 @@ class CreateDatabaseHost extends CreateRecord
->dehydrated(false)
// TODO ->suffixAction(fn (string $state) => request()->isSecure() ? CopyAction::make()->copyable($state) : null)
->columnSpanFull(),
Placeholder::make('INeedAName')
->content(new HtmlString(trans('admin/databasehost.setup.cli_exit')))
TextEntry::make('INeedAName')
->state(new HtmlString(trans('admin/databasehost.setup.cli_exit')))
->columnSpanFull(),
]),
Fieldset::make(trans('admin/databasehost.setup.external_access'))
->schema([
Placeholder::make('INeedAName2')
->content(new HtmlString(trans('admin/databasehost.setup.allow_external_access')))
TextEntry::make('INeedAName2')
->state(new HtmlString(trans('admin/databasehost.setup.allow_external_access')))
->columnSpanFull(),
]),
]),

View File

@ -13,7 +13,7 @@ use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Schemas\Components\Actions;
use Filament\Schemas\Components\Fieldset;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\TagsInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
@ -73,18 +73,18 @@ class EditNode extends EditRecord
->label(trans('admin/node.node_info'))
->columns(4)
->schema([
Placeholder::make('INeedAName')
TextEntry::make('INeedAName')
->label(trans('admin/node.wings_version'))
->content(fn (Node $node, SoftwareVersionService $versionService) => ($node->systemInformation()['version'] ?? trans('admin/node.unknown')) . ' (' . trans('admin/node.latest') . ': ' . $versionService->latestWingsVersion() . ')'),
Placeholder::make('INeedAName2')
->state(fn (Node $node, SoftwareVersionService $versionService) => ($node->systemInformation()['version'] ?? trans('admin/node.unknown')) . ' (' . trans('admin/node.latest') . ': ' . $versionService->latestWingsVersion() . ')'),
TextEntry::make('INeedAName2')
->label(trans('admin/node.cpu_threads'))
->content(fn (Node $node) => $node->systemInformation()['cpu_count'] ?? 0),
Placeholder::make('INeedAName3')
->state(fn (Node $node) => $node->systemInformation()['cpu_count'] ?? 0),
TextEntry::make('INeedAName3')
->label(trans('admin/node.architecture'))
->content(fn (Node $node) => $node->systemInformation()['architecture'] ?? trans('admin/node.unknown')),
Placeholder::make('INeedAName4')
->state(fn (Node $node) => $node->systemInformation()['architecture'] ?? trans('admin/node.unknown')),
TextEntry::make('INeedAName4')
->label(trans('admin/node.kernel'))
->content(fn (Node $node) => $node->systemInformation()['kernel_version'] ?? trans('admin/node.unknown')),
->state(fn (Node $node) => $node->systemInformation()['kernel_version'] ?? trans('admin/node.unknown')),
]),
View::make('filament.components.node-cpu-chart')
->columnSpan([
@ -501,10 +501,10 @@ class EditNode extends EditRecord
->label(trans('admin/node.tabs.config_file'))
->icon('tabler-code')
->schema([
Placeholder::make('instructions')
TextEntry::make('instructions')
->label(trans('admin/node.instructions'))
->columnSpanFull()
->content(new HtmlString(trans('admin/node.instructions_help'))),
->state(new HtmlString(trans('admin/node.instructions_help'))),
Textarea::make('config')
->label('/etc/pelican/config.yml')
->disabled()

View File

@ -4,13 +4,16 @@ namespace App\Filament\Admin\Resources;
use App\Filament\Admin\Resources\RoleResource\Pages;
use App\Models\Role;
use Exception;
use Filament\Actions\Action;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\Placeholder;
use Filament\Schemas\Schema;
use Filament\Forms\Components\TextInput;
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Resource;
use Filament\Schemas\Components\Component;
use Filament\Schemas\Components\Fieldset;
@ -90,7 +93,10 @@ class RoleResource extends Resource
]);
}
public static function form(Form|\Filament\Schemas\Schema $schema): \Filament\Schemas\Schema
/**
* @throws Exception
*/
public static function form(Form|Schema $schema): Schema
{
$permissionSections = [];
@ -120,15 +126,16 @@ class RoleResource extends Resource
->columns(3)
->schema($permissionSections)
->hidden(fn (Get $get) => $get('name') === Role::ROOT_ADMIN),
Placeholder::make('permissions')
TextEntry::make('permissions')
->label(trans('admin/role.permissions'))
->content(trans('admin/role.root_admin', ['role' => Role::ROOT_ADMIN]))
->state(trans('admin/role.root_admin', ['role' => Role::ROOT_ADMIN]))
->visible(fn (Get $get) => $get('name') === Role::ROOT_ADMIN),
]);
}
/**
* @param string[]|int[]|Permission[]|\BackedEnum[] $options
* @throws Exception
*/
private static function makeSection(string $model, array $options): Section
{

View File

@ -19,7 +19,7 @@ use Filament\Schemas\Components\Component;
use Filament\Schemas\Components\Fieldset;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TagsInput;
@ -416,10 +416,10 @@ class CreateServer extends CreateRecord
->collapsible()
->columnSpanFull()
->schema([
Placeholder::make(trans('admin/server.select_egg'))
TextEntry::make(trans('admin/server.select_egg'))
->hidden(fn (Get $get) => $get('egg_id')),
Placeholder::make(trans('admin/server.no_variables'))
TextEntry::make(trans('admin/server.no_variables'))
->hidden(fn (Get $get) => !$get('egg_id') ||
Egg::query()->find($get('egg_id'))?->variables()?->count()
),

View File

@ -21,7 +21,7 @@ use Filament\Actions;
use Filament\Actions\Action;
use Filament\Forms\Components\FileUpload;
use Filament\Schemas\Components\Grid;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\Repeater;
use Filament\Schemas\Components\Section;
use Filament\Forms\Components\Select;
@ -187,7 +187,7 @@ class EditProfile extends \Filament\Auth\Pages\EditProfile
->schema(function (TwoFactorSetupService $setupService) {
if ($this->getUser()->use_totp) {
return [
Placeholder::make('2fa-already-enabled')
TextEntry::make('2fa-already-enabled')
->label(trans('profile.2fa_enabled')),
Textarea::make('backup-tokens')
->hidden(fn () => !cache()->get("users.{$this->getUser()->id}.2fa.tokens"))
@ -241,9 +241,9 @@ class EditProfile extends \Filament\Auth\Pages\EditProfile
$image = (new QRCode($options))->render($url);
return [
Placeholder::make('qr')
TextEntry::make('qr')
->label(trans('profile.scan_qr'))
->content(fn () => new HtmlString("
->state(fn () => new HtmlString("
<div style='width: 300px; background-color: rgb(24, 24, 27);'>$image</div>
"))
->helperText(trans('profile.setup_key') .': '. $secret),
@ -320,7 +320,7 @@ class EditProfile extends \Filament\Auth\Pages\EditProfile
});
})
->schema(fn () => [
Placeholder::make('adf')->label(fn (ApiKey $key) => $key->memo),
TextEntry::make('adf')->label(fn (ApiKey $key) => $key->memo),
]),
]),
]),
@ -341,7 +341,7 @@ class EditProfile extends \Filament\Auth\Pages\EditProfile
$query->orderBy('timestamp', 'desc');
})
->schema([
Placeholder::make('activity!')->label('')->content(fn (ActivityLog $log) => new HtmlString($log->htmlable())),
TextEntry::make('activity!')->label('')->state(fn (ActivityLog $log) => new HtmlString($log->htmlable())),
]),
]),

View File

@ -10,7 +10,7 @@ use Exception;
use Filament\Actions\Action;
use Filament\Facades\Filament;
use Filament\Schemas\Components\Fieldset;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Section;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
@ -185,9 +185,9 @@ class Settings extends ServerFormPage
//TODO ->suffixAction(fn () => request()->isSecure() ? CopyAction::make() : null)
->disabled()
->formatStateUsing(fn (Server $server) => auth()->user()->username . '.' . $server->uuid_short),
Placeholder::make('password')
TextEntry::make('password')
->columnSpan(1)
->content('Your SFTP password is the same as the password you use to access this panel.'),
->state('Your SFTP password is the same as the password you use to access this panel.'),
]),
]),
Section::make('Reinstall Server')
@ -232,9 +232,9 @@ class Settings extends ServerFormPage
])
->footerActionsAlignment(Alignment::Right)
->schema([
Placeholder::make('INeedAName1')
TextEntry::make('INeedAName1')
->label('Reinstalling your server will stop it, and then re-run the installation script that initially set it up.'),
Placeholder::make('INeedAName')
TextEntry::make('INeedAName')
->label('Some files may be deleted or modified during this process, please back up your data before continuing.'),
]),
]);

View File

@ -12,7 +12,7 @@ use Filament\Facades\Filament;
use Filament\Actions\Action;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\ListRecords;
use Filament\Actions\ViewAction;
@ -68,8 +68,8 @@ class ListActivities extends ListRecords
ViewAction::make()
//->visible(fn (ActivityLog $activityLog) => $activityLog->hasAdditionalMetadata())
->schema([
Placeholder::make('event')
->content(fn (ActivityLog $activityLog) => new HtmlString($activityLog->getLabel())),
TextEntry::make('event')
->state(fn (ActivityLog $activityLog) => new HtmlString($activityLog->getLabel())),
TextInput::make('user')
->formatStateUsing(function (ActivityLog $activityLog) use ($server) {
if (!$activityLog->actor instanceof User) {

View File

@ -18,7 +18,7 @@ use App\Filament\Components\Tables\Columns\DateTimeColumn;
use Filament\Actions;
use Filament\Facades\Filament;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
@ -100,7 +100,7 @@ class ListBackups extends ListRecords
->icon('tabler-folder-up')
->authorize(fn () => auth()->user()->can(Permission::ACTION_BACKUP_RESTORE, $server))
->schema([
Placeholder::make('INeedAName')
TextEntry::make('INeedAName')
->helperText('Your server will be stopped. You will not be able to control the power state, access the file manager, or create additional backups until this process is completed.'),
Checkbox::make('truncate')
->label('Delete all files before restoring backup?'),

View File

@ -16,7 +16,7 @@ use Filament\Actions\Action as HeaderAction;
use Filament\Facades\Filament;
use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\Select;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
@ -209,8 +209,8 @@ class ListFiles extends ListRecords
->hint('Enter the location of this file or folder, relative to the current directory.')
->required()
->live(),
Placeholder::make('new_location')
->content(fn (Get $get, File $file) => resolve_path('./' . join_paths($this->path, $get('location') ?? '/', $file->name))),
TextEntry::make('new_location')
->state(fn (Get $get, File $file) => resolve_path('./' . join_paths($this->path, $get('location') ?? '/', $file->name))),
])
->action(function ($data, File $file) {
$location = rtrim($data['location'], '/');
@ -369,8 +369,8 @@ class ListFiles extends ListRecords
->hint('Enter the new directory, relative to the current directory.')
->required()
->live(),
Placeholder::make('new_location')
->content(fn (Get $get) => resolve_path('./' . join_paths($this->path, $get('location') ?? ''))),
TextEntry::make('new_location')
->state(fn (Get $get) => resolve_path('./' . join_paths($this->path, $get('location') ?? ''))),
])
->action(function (Collection $files, $data) {
$location = rtrim($data['location'], '/');

View File

@ -2,7 +2,7 @@
namespace App\Livewire\Installer\Steps;
use Filament\Forms\Components\Placeholder;
use Filament\Infolists\Components\TextEntry;
use Filament\Notifications\Notification;
use Filament\Schemas\Components\Section;
use Filament\Support\Exceptions\Halt;
@ -22,8 +22,8 @@ class RequirementsStep
->icon($correctPhpVersion ? 'tabler-check' : 'tabler-x')
->iconColor($correctPhpVersion ? 'success' : 'danger')
->schema([
Placeholder::make('INeedAName')
->content('Your PHP Version is ' . PHP_VERSION . '.'),
TextEntry::make('INeedAName')
->state('Your PHP Version is ' . PHP_VERSION . '.'),
]),
];
@ -45,11 +45,11 @@ class RequirementsStep
->icon($allExtensionsInstalled ? 'tabler-check' : 'tabler-x')
->iconColor($allExtensionsInstalled ? 'success' : 'danger')
->schema([
Placeholder::make('INeedAName')
->content('All needed PHP Extensions are installed.')
TextEntry::make('INeedAName')
->state('All needed PHP Extensions are installed.')
->visible($allExtensionsInstalled),
Placeholder::make('INeedAName')
->content('The following PHP Extensions are missing: ' . implode(', ', array_keys($phpExtensions, false)))
TextEntry::make('INeedAName')
->state('The following PHP Extensions are missing: ' . implode(', ', array_keys($phpExtensions, false)))
->visible(!$allExtensionsInstalled),
]);
@ -64,11 +64,11 @@ class RequirementsStep
->icon($correctFolderPermissions ? 'tabler-check' : 'tabler-x')
->iconColor($correctFolderPermissions ? 'success' : 'danger')
->schema([
Placeholder::make('INeedAName')
->content('All Folders have the correct permissions.')
TextEntry::make('INeedAName')
->state('All Folders have the correct permissions.')
->visible($correctFolderPermissions),
Placeholder::make('INeedAName2')
->content('The following Folders have wrong permissions: ' . implode(', ', array_keys($folderPermissions, false)))
TextEntry::make('INeedAName2')
->state('The following Folders have wrong permissions: ' . implode(', ', array_keys($folderPermissions, false)))
->visible(!$correctFolderPermissions),
]);