mirror of
https://github.com/pelican-dev/panel.git
synced 2025-09-24 18:18:04 +02:00
Fix refresh action for egg index select & add refresh action to allocation ip selects (#1736)
This commit is contained in:
parent
bb40a5273f
commit
4792542f20
@ -85,13 +85,22 @@ class AllocationsRelationManager extends RelationManager
|
|||||||
->label(trans('admin/node.create_allocation'))
|
->label(trans('admin/node.create_allocation'))
|
||||||
->schema(fn () => [
|
->schema(fn () => [
|
||||||
Select::make('allocation_ip')
|
Select::make('allocation_ip')
|
||||||
->options(collect($this->getOwnerRecord()->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
->options(fn () => collect($this->getOwnerRecord()->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
||||||
->label(trans('admin/node.ip_address'))
|
->label(trans('admin/node.ip_address'))
|
||||||
->inlineLabel()
|
->inlineLabel()
|
||||||
->ip()
|
->ip()
|
||||||
->helperText(trans('admin/node.ip_help'))
|
->helperText(trans('admin/node.ip_help'))
|
||||||
->afterStateUpdated(fn (Set $set) => $set('allocation_ports', []))
|
->afterStateUpdated(fn (Set $set) => $set('allocation_ports', []))
|
||||||
->live()
|
->live()
|
||||||
|
->hintAction(
|
||||||
|
Action::make('refresh')
|
||||||
|
->iconButton()
|
||||||
|
->icon('tabler-refresh')
|
||||||
|
->tooltip(trans('admin/node.refresh'))
|
||||||
|
->action(function () {
|
||||||
|
cache()->forget("nodes.{$this->getOwnerRecord()->id}.ips");
|
||||||
|
})
|
||||||
|
)
|
||||||
->required(),
|
->required(),
|
||||||
TextInput::make('allocation_alias')
|
TextInput::make('allocation_alias')
|
||||||
->label(trans('admin/node.table.alias'))
|
->label(trans('admin/node.table.alias'))
|
||||||
|
@ -218,12 +218,21 @@ class CreateServer extends CreateRecord
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
Select::make('allocation_ip')
|
Select::make('allocation_ip')
|
||||||
->options(collect(Node::find($get('node_id'))?->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
->options(fn () => collect(Node::find($get('node_id'))?->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
||||||
->label(trans('admin/server.ip_address'))->inlineLabel()
|
->label(trans('admin/server.ip_address'))->inlineLabel()
|
||||||
->helperText(trans('admin/server.ip_address_helper'))
|
->helperText(trans('admin/server.ip_address_helper'))
|
||||||
->afterStateUpdated(fn (Set $set) => $set('allocation_ports', []))
|
->afterStateUpdated(fn (Set $set) => $set('allocation_ports', []))
|
||||||
->ip()
|
->ip()
|
||||||
->live()
|
->live()
|
||||||
|
->hintAction(
|
||||||
|
Action::make('refresh')
|
||||||
|
->iconButton()
|
||||||
|
->icon('tabler-refresh')
|
||||||
|
->tooltip(trans('admin/node.refresh'))
|
||||||
|
->action(function () use ($get) {
|
||||||
|
cache()->forget("nodes.{$get('node_id')}.ips");
|
||||||
|
})
|
||||||
|
)
|
||||||
->required(),
|
->required(),
|
||||||
TextInput::make('allocation_alias')
|
TextInput::make('allocation_alias')
|
||||||
->label(trans('admin/server.alias'))->inlineLabel()
|
->label(trans('admin/server.alias'))->inlineLabel()
|
||||||
|
@ -77,11 +77,20 @@ class AllocationsRelationManager extends RelationManager
|
|||||||
->createAnother(false)
|
->createAnother(false)
|
||||||
->schema(fn () => [
|
->schema(fn () => [
|
||||||
Select::make('allocation_ip')
|
Select::make('allocation_ip')
|
||||||
->options(collect($this->getOwnerRecord()->node->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
->options(fn () => collect($this->getOwnerRecord()->node->ipAddresses())->mapWithKeys(fn (string $ip) => [$ip => $ip]))
|
||||||
->label(trans('admin/server.ip_address'))
|
->label(trans('admin/server.ip_address'))
|
||||||
->inlineLabel()
|
->inlineLabel()
|
||||||
->ip()
|
->ip()
|
||||||
->live()
|
->live()
|
||||||
|
->hintAction(
|
||||||
|
Action::make('refresh')
|
||||||
|
->iconButton()
|
||||||
|
->icon('tabler-refresh')
|
||||||
|
->tooltip(trans('admin/node.refresh'))
|
||||||
|
->action(function () {
|
||||||
|
cache()->forget("nodes.{$this->getOwnerRecord()->node->id}.ips");
|
||||||
|
})
|
||||||
|
)
|
||||||
->afterStateUpdated(fn (Set $set) => $set('allocation_ports', []))
|
->afterStateUpdated(fn (Set $set) => $set('allocation_ports', []))
|
||||||
->required(),
|
->required(),
|
||||||
TextInput::make('allocation_alias')
|
TextInput::make('allocation_alias')
|
||||||
|
@ -125,15 +125,20 @@ class ImportEggAction extends Action
|
|||||||
->schema([
|
->schema([
|
||||||
Select::make('github')
|
Select::make('github')
|
||||||
->label(trans('admin/egg.import.github'))
|
->label(trans('admin/egg.import.github'))
|
||||||
->options(cache('eggs.index'))
|
->options(fn () => cache('eggs.index'))
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->searchable()
|
->searchable()
|
||||||
->preload()
|
->preload()
|
||||||
->live()
|
->live()
|
||||||
->hintIcon('tabler-refresh', trans('admin/egg.import.refresh'))
|
->hintAction(
|
||||||
->hintAction(function () {
|
Action::make('refresh')
|
||||||
Artisan::call(UpdateEggIndexCommand::class);
|
->iconButton()
|
||||||
})
|
->icon('tabler-refresh')
|
||||||
|
->tooltip(trans('admin/egg.import.refresh'))
|
||||||
|
->action(function () {
|
||||||
|
Artisan::call(UpdateEggIndexCommand::class);
|
||||||
|
})
|
||||||
|
)
|
||||||
->afterStateUpdated(function ($state, Set $set, Get $get) use ($isMultiple) {
|
->afterStateUpdated(function ($state, Set $set, Get $get) use ($isMultiple) {
|
||||||
if ($state) {
|
if ($state) {
|
||||||
$urls = $isMultiple ? $get('urls') : [];
|
$urls = $isMultiple ? $get('urls') : [];
|
||||||
|
@ -37,6 +37,7 @@ return [
|
|||||||
'ip_address' => 'IP Address',
|
'ip_address' => 'IP Address',
|
||||||
'ip_help' => 'Usually your machine\'s public IP unless you are port forwarding.',
|
'ip_help' => 'Usually your machine\'s public IP unless you are port forwarding.',
|
||||||
'alias_help' => 'Optional display name to help you remember what these are.',
|
'alias_help' => 'Optional display name to help you remember what these are.',
|
||||||
|
'refresh' => 'Refresh',
|
||||||
'domain' => 'Domain Name',
|
'domain' => 'Domain Name',
|
||||||
'ssl_ip' => 'You cannot connect to an IP Address over SSL',
|
'ssl_ip' => 'You cannot connect to an IP Address over SSL',
|
||||||
'error' => 'This is the domain name that points to your node\'s IP Address. If you\'ve already set up this, you can verify it by checking the next field!',
|
'error' => 'This is the domain name that points to your node\'s IP Address. If you\'ve already set up this, you can verify it by checking the next field!',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user