Fix default value for dns check on EditNode (#635)

This commit is contained in:
Boy132 2024-10-18 08:24:49 +02:00 committed by GitHub
parent ff0215afed
commit 207d875df8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -83,7 +83,7 @@ class EditNode extends EditRecord
if (request()->isSecure()) {
return '
Your panel is currently secured via an SSL certificate and that means your nodes require one too.
You must use a domain name, because you cannot get SSL certificates for IP Addresses
You must use a domain name, because you cannot get SSL certificates for IP Addresses.
';
}
@ -98,7 +98,7 @@ class EditNode extends EditRecord
->hintColor('danger')
->hint(function ($state) {
if (is_ip($state) && request()->isSecure()) {
return 'You cannot connect to an IP Address over SSL';
return 'You cannot connect to an IP Address over SSL!';
}
return '';
@ -130,11 +130,9 @@ class EditNode extends EditRecord
$set('dns', false);
})
->maxLength(255),
TextInput::make('ip')
->disabled()
->hidden(),
ToggleButtons::make('dns')
->label('DNS Record Check')
->helperText('This lets you know if your DNS record correctly points to an IP Address.')
@ -157,7 +155,6 @@ class EditNode extends EditRecord
'md' => 1,
'lg' => 1,
]),
TextInput::make('daemon_listen')
->columnSpan([
'default' => 1,
@ -172,7 +169,6 @@ class EditNode extends EditRecord
->default(8080)
->required()
->integer(),
TextInput::make('name')
->label('Display Name')
->columnSpan([
@ -184,7 +180,6 @@ class EditNode extends EditRecord
->required()
->helperText('This name is for display only and can be changed later.')
->maxLength(100),
ToggleButtons::make('scheme')
->label('Communicate over SSL')
->columnSpan([
@ -441,6 +436,16 @@ class EditNode extends EditRecord
$data['config'] = $node->getYamlConfiguration();
if (!is_ip($node->fqdn)) {
$validRecords = gethostbynamel($node->fqdn);
if ($validRecords) {
$data['dns'] = true;
$data['ip'] = collect($validRecords)->first();
} else {
$data['dns'] = false;
}
}
return $data;
}
@ -448,6 +453,7 @@ class EditNode extends EditRecord
{
return [];
}
protected function getHeaderActions(): array
{
return [
@ -467,6 +473,7 @@ class EditNode extends EditRecord
{
return null;
}
protected function getColumnStart()
{
return null;