diff --git a/web/Modules/Terminal/Filament/Pages/Terminal.php b/web/Modules/Terminal/Filament/Pages/Terminal.php index a2392f5..d1d7774 100644 --- a/web/Modules/Terminal/Filament/Pages/Terminal.php +++ b/web/Modules/Terminal/Filament/Pages/Terminal.php @@ -3,6 +3,7 @@ namespace Modules\Terminal\Filament\Pages; use Filament\Pages\Page; +use Illuminate\Support\Str; class Terminal extends Page { @@ -20,8 +21,17 @@ class Terminal extends Page { $sessionId = session()->getId(); - shell_exec('node /usr/local/phyre/web/nodejs/terminal/server.js >> /usr/local/phyre/web/storage/logs/terminal/server-terminal.log &'); - + $runNewTerminal = true; + $checkPort = shell_exec('netstat -tuln | grep 8449'); + if (!empty($checkPort)) { + if (Str::contains($checkPort, 'LISTEN')) { + $runNewTerminal = false; + } + } + if ($runNewTerminal) { + $exec = shell_exec('node /usr/local/phyre/web/Modules/Terminal/nodejs/terminal/server.js >> /usr/local/phyre/web/storage/logs/terminal/server-terminal.log &'); + } + return [ 'title' => 'Terminal', 'sessionId' => $sessionId, diff --git a/web/resources/views/filament/pages/terminal.blade.php b/web/Modules/Terminal/resources/views/filament/pages/terminal.blade.php similarity index 100% rename from web/resources/views/filament/pages/terminal.blade.php rename to web/Modules/Terminal/resources/views/filament/pages/terminal.blade.php diff --git a/web/Modules/Terminal/shell-scripts/install-nodejs.sh b/web/Modules/Terminal/shell-scripts/install-nodejs.sh index 9fd4811..86bb487 100644 --- a/web/Modules/Terminal/shell-scripts/install-nodejs.sh +++ b/web/Modules/Terminal/shell-scripts/install-nodejs.sh @@ -1,3 +1,5 @@ -apt-get install npm nodejs -y +sudo apt-get install npm nodejs -y cd /usr/local/phyre/web/Modules/Terminal/nodejs/terminal npm i + +echo "Done!" diff --git a/web/app/Providers/Filament/AdminPanelProvider.php b/web/app/Providers/Filament/AdminPanelProvider.php index f8ed1e5..ad1ed69 100644 --- a/web/app/Providers/Filament/AdminPanelProvider.php +++ b/web/app/Providers/Filament/AdminPanelProvider.php @@ -102,16 +102,16 @@ class AdminPanelProvider extends PanelProvider $findModules = Module::where('installed', 1)->get(); if ($findModules->count() > 0) { foreach ($findModules as $module) { - $modulePath = module_path($module->name, 'Filament/Clusters'); - if (is_dir($modulePath)) { - $panel->discoverClusters(in: $modulePath, for: 'Modules\\' . $module->name . '\\Filament\\Clusters'); + $modulePathClusters = module_path($module->name, 'Filament/Clusters'); + if (is_dir($modulePathClusters)) { + $panel->discoverClusters(in: $modulePathClusters, for: 'Modules\\' . $module->name . '\\Filament\\Clusters'); + } + $modulePathPages = module_path($module->name, 'Filament/Pages'); + if (is_dir($modulePathPages)) { + $panel->discoverPages(in: $modulePathPages, for: 'Modules\\' . $module->name . '\\Filament\\Pages'); } } } - // ->discoverClusters(in: module_path('Microweber', 'Filament/Clusters'), for: 'Modules\\Microweber\\Filament\\Clusters') -// ->discoverClusters(in: module_path('LetsEncrypt', 'Filament/Clusters'), for: 'Modules\\LetsEncrypt\\Filament\\Clusters') -// ->discoverClusters(in: module_path('Docker', 'Filament/Clusters'), for: 'Modules\\Docker\\Filament\\Clusters') - } } diff --git a/web/config/app.php b/web/config/app.php index ac96460..f9e06f5 100644 --- a/web/config/app.php +++ b/web/config/app.php @@ -170,7 +170,9 @@ return [ App\Providers\Filament\AdminPanelProvider::class, App\Providers\RouteServiceProvider::class, - \Modules\Customer\App\Providers\CustomerServiceProvider::class + \Modules\Customer\App\Providers\CustomerServiceProvider::class, + \Modules\Docker\App\Providers\DockerServiceProvider::class, + \Modules\Terminal\App\Providers\TerminalServiceProvider::class, ])->toArray(),