Easy to copy and paste

This commit is contained in:
Lance Pioch 2024-03-31 01:39:24 -04:00
parent 400e4d783b
commit 766c6c08f4
3 changed files with 79 additions and 2 deletions

View File

@ -3,10 +3,13 @@
namespace App\Filament\Resources\NodeResource\Pages;
use App\Filament\Resources\NodeResource;
use App\Models\Node;
use Filament\Actions;
use Filament\Forms;
use Filament\Forms\Components\Wizard;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\HtmlString;
use Webbingbrasil\FilamentCopyActions\Forms\Actions\CopyAction;
class EditNode extends EditRecord
{
@ -23,7 +26,17 @@ class EditNode extends EditRecord
Forms\Components\Wizard\Step::make('Configuration')
->description('')
->schema([
Forms\Components\Placeholder::make('instructions')
->columnSpanFull()
->content(new HtmlString('
This file should be placed in your daemon\'s root directory (usually <code>/etc/pelican</code>) in a file called <code>config.yml</code>.
')),
Forms\Components\Textarea::make('config')
->label('Configuration File')
->disabled()
->rows(19)
->hintAction(CopyAction::make())
->columnSpanFull(),
]),
])
->columns(4)
@ -36,6 +49,15 @@ class EditNode extends EditRecord
]);
}
protected function mutateFormDataBeforeFill(array $data): array
{
$node = Node::findOrFail($data['id']);
$data['config'] = $node->getYamlConfiguration();
return $data;
}
protected function getSteps(): array
{
return [

View File

@ -35,6 +35,7 @@
"symfony/mailgun-mailer": "^7.0",
"symfony/postmark-mailer": "^7.0",
"symfony/yaml": "^7.0",
"webbingbrasil/filament-copyactions": "^3.0",
"webmozart/assert": "~1.11.0"
},
"require-dev": {

56
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "27aa42f361104f415f248548d4667e43",
"content-hash": "bf147fbbb2f57777d6c6b137bc61bcda",
"packages": [
{
"name": "anourvalar/eloquent-serialize",
@ -9471,6 +9471,60 @@
],
"time": "2022-03-08T17:03:00+00:00"
},
{
"name": "webbingbrasil/filament-copyactions",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/webbingbrasil/filament-copyactions.git",
"reference": "363215d222de4127d81ea295c8a2163cd5c5a3f8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webbingbrasil/filament-copyactions/zipball/363215d222de4127d81ea295c8a2163cd5c5a3f8",
"reference": "363215d222de4127d81ea295c8a2163cd5c5a3f8",
"shasum": ""
},
"require": {
"filament/filament": "^3.0",
"php": "^8.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Webbingbrasil\\FilamentCopyActions\\FilamentCopyActionsProvider"
]
}
},
"autoload": {
"psr-4": {
"Webbingbrasil\\FilamentCopyActions\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Danilo Andrade",
"email": "danilo@webbingbrasil.com.br",
"role": "Developer"
}
],
"description": "A easy-to-use copy actions for Filament Admin.",
"homepage": "https://github.com/webbingbrasil/filament-copyactions",
"keywords": [
"filament",
"laravel"
],
"support": {
"issues": "https://github.com/webbingbrasil/filament-copyactions/issues",
"source": "https://github.com/webbingbrasil/filament-copyactions/tree/3.0.0"
},
"time": "2024-01-17T18:17:00+00:00"
},
{
"name": "webmozart/assert",
"version": "1.11.0",