Change node config to use Code Entry (#1781)

This commit is contained in:
Charles 2025-10-07 22:25:16 -04:00 committed by GitHub
parent cd965678b7
commit e4f807b297
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 79 additions and 6 deletions

View File

@ -18,6 +18,7 @@ use Filament\Forms\Components\TagsInput;
use Filament\Forms\Components\Textarea; use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\ToggleButtons; use Filament\Forms\Components\ToggleButtons;
use Filament\Infolists\Components\CodeEntry;
use Filament\Infolists\Components\TextEntry; use Filament\Infolists\Components\TextEntry;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
@ -34,6 +35,7 @@ use Filament\Schemas\Schema;
use Filament\Support\Enums\Alignment; use Filament\Support\Enums\Alignment;
use Illuminate\Http\Client\ConnectionException; use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
use Phiki\Grammar\Grammar;
use Throwable; use Throwable;
class EditNode extends EditRecord class EditNode extends EditRecord
@ -547,11 +549,12 @@ class EditNode extends EditRecord
->label(trans('admin/node.instructions')) ->label(trans('admin/node.instructions'))
->columnSpanFull() ->columnSpanFull()
->state(new HtmlString(trans('admin/node.instructions_help'))), ->state(new HtmlString(trans('admin/node.instructions_help'))),
Textarea::make('config') CodeEntry::make('config')
->label('/etc/pelican/config.yml') ->label('/etc/pelican/config.yml')
->grammar(Grammar::Yaml)
->state(fn (Node $node) => $node->getYamlConfiguration())
->copyable()
->disabled() ->disabled()
->rows(19)
->hintCopy()
->columnSpanFull(), ->columnSpanFull(),
Grid::make() Grid::make()
->columns() ->columns()
@ -629,8 +632,6 @@ class EditNode extends EditRecord
{ {
$node = Node::findOrFail($data['id']); $node = Node::findOrFail($data['id']);
$data['config'] = $node->getYamlConfiguration();
if (!is_ip($node->fqdn)) { if (!is_ip($node->fqdn)) {
$ip = get_ip_from_hostname($node->fqdn); $ip = get_ip_from_hostname($node->fqdn);
if ($ip) { if ($ip) {

View File

@ -23,6 +23,7 @@
"lcobucci/jwt": "^5.5", "lcobucci/jwt": "^5.5",
"league/flysystem-aws-s3-v3": "^3.29", "league/flysystem-aws-s3-v3": "^3.29",
"league/flysystem-memory": "^3.29", "league/flysystem-memory": "^3.29",
"phiki/phiki": "^2.0",
"phpseclib/phpseclib": "~3.0.18", "phpseclib/phpseclib": "~3.0.18",
"predis/predis": "^2.3", "predis/predis": "^2.3",
"s1lentium/iptools": "~1.2.0", "s1lentium/iptools": "~1.2.0",

73
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "fe426a19ad44b345d4cefbd0bd779be6", "content-hash": "77cf4449e7671237bbb750d1f2b793fb",
"packages": [ "packages": [
{ {
"name": "anourvalar/eloquent-serialize", "name": "anourvalar/eloquent-serialize",
@ -5196,6 +5196,77 @@
}, },
"time": "2020-10-15T08:29:30+00:00" "time": "2020-10-15T08:29:30+00:00"
}, },
{
"name": "phiki/phiki",
"version": "v2.0.4",
"source": {
"type": "git",
"url": "https://github.com/phikiphp/phiki.git",
"reference": "160785c50c01077780ab217e5808f00ab8f05a13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phikiphp/phiki/zipball/160785c50c01077780ab217e5808f00ab8f05a13",
"reference": "160785c50c01077780ab217e5808f00ab8f05a13",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"league/commonmark": "^2.5.3",
"php": "^8.2",
"psr/simple-cache": "^3.0"
},
"require-dev": {
"illuminate/support": "^11.45",
"laravel/pint": "^1.18.1",
"orchestra/testbench": "^9.15",
"pestphp/pest": "^3.5.1",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^2.0",
"symfony/var-dumper": "^7.1.6"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Phiki\\Adapters\\Laravel\\PhikiServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Phiki\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ryan Chandler",
"email": "support@ryangjchandler.co.uk",
"homepage": "https://ryangjchandler.co.uk",
"role": "Developer"
}
],
"description": "Syntax highlighting using TextMate grammars in PHP.",
"support": {
"issues": "https://github.com/phikiphp/phiki/issues",
"source": "https://github.com/phikiphp/phiki/tree/v2.0.4"
},
"funding": [
{
"url": "https://github.com/sponsors/ryangjchandler",
"type": "github"
},
{
"url": "https://buymeacoffee.com/ryangjchandler",
"type": "other"
}
],
"time": "2025-09-20T17:21:02+00:00"
},
{ {
"name": "phpdocumentor/reflection", "name": "phpdocumentor/reflection",
"version": "6.3.0", "version": "6.3.0",