mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 17:54:45 +02:00
Show valid ip address
This commit is contained in:
parent
195557373c
commit
8311669e6c
@ -16,6 +16,8 @@ class CreateNode extends CreateRecord
|
|||||||
|
|
||||||
protected static bool $canCreateAnother = false;
|
protected static bool $canCreateAnother = false;
|
||||||
|
|
||||||
|
protected ?string $subheading = '(a machine that runs Wings to connect back to this Panel)';
|
||||||
|
|
||||||
public function form(Forms\Form $form): Forms\Form
|
public function form(Forms\Form $form): Forms\Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
@ -56,6 +58,8 @@ class CreateNode extends CreateRecord
|
|||||||
})
|
})
|
||||||
->afterStateUpdated(function (Forms\Set $set, ?string $state) {
|
->afterStateUpdated(function (Forms\Set $set, ?string $state) {
|
||||||
$set('dns', null);
|
$set('dns', null);
|
||||||
|
$set('ip', null);
|
||||||
|
|
||||||
[$subdomain] = str($state)->explode('.', 2);
|
[$subdomain] = str($state)->explode('.', 2);
|
||||||
if (!is_numeric($subdomain)) {
|
if (!is_numeric($subdomain)) {
|
||||||
$set('name', $subdomain);
|
$set('name', $subdomain);
|
||||||
@ -67,10 +71,12 @@ class CreateNode extends CreateRecord
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$validRecord = checkdnsrr("$state.", 'A');
|
$validRecords = gethostbynamel($state);
|
||||||
if ($validRecord) {
|
if ($validRecords) {
|
||||||
$set('dns', true);
|
$set('dns', true);
|
||||||
|
|
||||||
|
$set('ip', collect($validRecords)->first());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,13 +84,18 @@ class CreateNode extends CreateRecord
|
|||||||
})
|
})
|
||||||
->maxLength(191),
|
->maxLength(191),
|
||||||
|
|
||||||
|
Forms\Components\TextInput::make('ip')
|
||||||
|
->disabled()
|
||||||
|
->hidden(),
|
||||||
|
|
||||||
Forms\Components\ToggleButtons::make('dns')
|
Forms\Components\ToggleButtons::make('dns')
|
||||||
->label('DNS Record Check')
|
->label('DNS Record Check')
|
||||||
->helperText('This lets you know if your DNS record correctly points to an IP Address.')
|
->helperText('This lets you know if your DNS record correctly points to an IP Address.')
|
||||||
->disabled()
|
->disabled()
|
||||||
->inline()
|
->inline()
|
||||||
->default(null)
|
->default(null)
|
||||||
// ->hidden()
|
->hint(fn (Forms\Get $get) => $get('ip'))
|
||||||
|
->hintColor('success')
|
||||||
->options([
|
->options([
|
||||||
true => 'Valid',
|
true => 'Valid',
|
||||||
false => 'Invalid'
|
false => 'Invalid'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user