This commit is contained in:
Bozhidar 2024-04-27 14:24:41 +03:00
parent 5a3a3611d0
commit 3be82bde08
6 changed files with 106 additions and 4 deletions

View file

@ -12,7 +12,11 @@ class DockerTemplate extends Model
/**
* The attributes that are mass assignable.
*/
protected $fillable = [];
protected $fillable = [
'name',
'description',
'docker_compose',
];
}

View file

@ -13,6 +13,7 @@ use Modules\Docker\App\Models\DockerTemplate;
use Modules\Docker\Filament\Clusters\Docker\Resources\DockerTemplateResource\Pages\CreateDockerTemplate;
use Modules\Docker\Filament\Clusters\Docker\Resources\DockerTemplateResource\Pages\EditDockerTemplate;
use Modules\Docker\Filament\Clusters\Docker\Resources\DockerTemplateResource\Pages\ListDockerTemplates;
use Riodwanto\FilamentAceEditor\AceEditor;
class DockerTemplateResource extends Resource
{
@ -34,7 +35,28 @@ class DockerTemplateResource extends Resource
{
return $form
->schema([
//
Forms\Components\TextInput::make('name')
->label('Name')
->required()
->placeholder('Enter the name of the template'),
Forms\Components\TextInput::make('description')
->label('Description')
->placeholder('Enter the description of the template'),
// Forms\Components\Textarea::make('docker_compose')
// ->label('Docker compose')
// ->required()
// ->columnSpanFull()
// ->placeholder('Enter the Dockerfile content'),
AceEditor::make('docker_compose')
->mode('php')
->theme('github')
->darkTheme('dracula'),
]);
}
@ -42,7 +64,8 @@ class DockerTemplateResource extends Resource
{
return $table
->columns([
//
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('description'),
])
->filters([
//

View file

@ -25,6 +25,7 @@
"outerweb/filament-settings": "^1.2",
"phpseclib/phpseclib": "^3.0",
"postare/blade-mdi": "^1.1",
"riodwanto/filament-ace-editor": "^1.0",
"spatie/ssh": "^1.10",
"stechstudio/filament-impersonate": "^3.8",
"symfony/process": "^6.3",

74
web/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": "24c114639ffad26d47dac674a59e408e",
"content-hash": "6e65fe2d2aeaae5d8f903e679ebff837",
"packages": [
{
"name": "acmephp/core",
@ -6339,6 +6339,78 @@
],
"time": "2023-11-08T05:53:05+00:00"
},
{
"name": "riodwanto/filament-ace-editor",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/riodwanto/filament-ace-editor.git",
"reference": "06894ad2ff03e6bd6f7768febdb7e9c2dd86a930"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/riodwanto/filament-ace-editor/zipball/06894ad2ff03e6bd6f7768febdb7e9c2dd86a930",
"reference": "06894ad2ff03e6bd6f7768febdb7e9c2dd86a930",
"shasum": ""
},
"require": {
"illuminate/contracts": "^10.0",
"php": "^8.1",
"spatie/laravel-package-tools": "^1.15.0"
},
"require-dev": {
"filament/filament": "^3.0",
"nunomaduro/collision": "^7.9",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-arch": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Riodwanto\\FilamentAceEditor\\FilamentAceEditorServiceProvider"
],
"aliases": {
"FilamentAceEditor": "Riodwanto\\FilamentAceEditor\\Facades\\FilamentAceEditor"
}
}
},
"autoload": {
"psr-4": {
"Riodwanto\\FilamentAceEditor\\": "src/",
"Riodwanto\\FilamentAceEditor\\Database\\Factories\\": "database/factories/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rio Dewanto P",
"email": "rdp.tech@gmail.com",
"role": "Developer"
}
],
"description": "Ace Editor implementation for Filament 3 Form",
"homepage": "https://github.com/riodwanto/filament-ace-editor",
"keywords": [
"code-editor",
"filament",
"filament-ace-editor",
"filament-field",
"filament-form-field",
"laravel",
"riodwanto"
],
"support": {
"issues": "https://github.com/riodwanto/filament-ace-editor/issues",
"source": "https://github.com/riodwanto/filament-ace-editor"
},
"time": "2024-03-03T11:54:56+00:00"
},
{
"name": "ryangjchandler/blade-capture-directive",
"version": "v1.0.0",

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
function m({state:r,statePath:o,placeholder:s,aceUrl:a,extensions:n,config:h={},options:c={},darkTheme:l,disableDarkTheme:d}){return{state:r,statePath:o,placeholder:s,options:c,darkTheme:l,disableDarkTheme:d,editor:null,observer:null,async init(){if(!await this.importAceEditor(a)){console.error("Failed to load the ACE editor core.");return}await this.importExtensions(n)||console.error("Failed to load ACE editor extensions."),this.configureAce(h),this.initializeEditor(),this.applyInitialTheme(),this.observeDarkModeChanges()},async importAceEditor(t){try{return await import(t),!0}catch(e){return console.error("Error importing the ACE editor core:",e),!1}},async importExtensions(t){try{let e=Object.values(t).map(i=>import(i));return await Promise.all(e),!0}catch(e){return console.error("Error importing ACE editor extensions:",e),!1}},configureAce(t){Object.entries(t).forEach(([e,i])=>ace.config.set(e,i))},initializeEditor(){this.editor=ace.edit(this.$refs.aceCodeEditor),this.editor.setOptions(this.options),this.editor.setValue(this.state?this.state:this.placeholder),this.editor.session.on("change",()=>{this.state=this.editor.getValue()})},applyInitialTheme(){this.disableDarkTheme?this.editor.setTheme(this.options.theme):this.setTheme()},observeDarkModeChanges(){if(this.disableDarkTheme)return;let t=document.querySelector("html");this.observer=new MutationObserver(()=>this.setTheme()),this.observer.observe(t,{attributes:!0,attributeFilter:["class"]})},setTheme(){let e=document.querySelector("html").classList.contains("dark")?this.darkTheme:this.options.theme;this.editor&&this.editor.setTheme(e)}}}export{m as default};