mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
update
This commit is contained in:
parent
8dc9b2537b
commit
30a1ed80d5
6 changed files with 73 additions and 34 deletions
|
@ -30,15 +30,13 @@ class CustomerPanelProvider extends PanelProvider
|
|||
$defaultColor = Color::Yellow;
|
||||
$brandLogo = asset('images/phyre-logo.svg');
|
||||
|
||||
if (!app()->runningInConsole()) {
|
||||
$isAppInstalled = file_exists(storage_path('installed'));
|
||||
if ($isAppInstalled) {
|
||||
if (setting('general.brand_logo_url')) {
|
||||
$brandLogo = setting('general.brand_logo_url');
|
||||
}
|
||||
if (setting('general.brand_primary_color')) {
|
||||
$defaultColor = Color::hex(setting('general.brand_primary_color'));
|
||||
}
|
||||
$isAppInstalled = file_exists(storage_path('installed'));
|
||||
if ($isAppInstalled) {
|
||||
if (setting('general.brand_logo_url')) {
|
||||
$brandLogo = setting('general.brand_logo_url');
|
||||
}
|
||||
if (setting('general.brand_primary_color')) {
|
||||
$defaultColor = Color::hex(setting('general.brand_primary_color'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class DockerContainer extends Model
|
|||
$createContainer = $dockerContainerApi->run();
|
||||
|
||||
if (!isset($createContainer['ID'])) {
|
||||
return false;
|
||||
throw new \Exception('Failed to create container');
|
||||
}
|
||||
|
||||
$model->image = $createContainer['Image'];
|
||||
|
|
|
@ -90,7 +90,6 @@ class DockerContainerApi
|
|||
$output = shell_exec("cd $dockerContaienrPath && docker-compose up -d");
|
||||
|
||||
// Get docker container id from output
|
||||
$dockerContainerId = trim($output);
|
||||
$output = shell_exec('docker ps --format json --filter name='.$this->name);
|
||||
$output = json_decode($output, true);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ services:
|
|||
ports:
|
||||
- {{$externalPort}}:{{ $port }}
|
||||
|
||||
@if(isset($environmentVariables))
|
||||
@if(isset($environmentVariables) && !empty($environmentVariables))
|
||||
|
||||
environment:
|
||||
|
||||
|
|
|
@ -97,26 +97,25 @@ class AdminPanelProvider extends PanelProvider
|
|||
$defaultColor = Color::Yellow;
|
||||
$brandLogo = asset('images/phyre-logo.svg');
|
||||
|
||||
if (!app()->runningInConsole()) {
|
||||
$isAppInstalled = file_exists(storage_path('installed'));
|
||||
if ($isAppInstalled) {
|
||||
if (setting('general.brand_logo_url')) {
|
||||
$brandLogo = setting('general.brand_logo_url');
|
||||
}
|
||||
if (setting('general.brand_primary_color')) {
|
||||
$defaultColor = Color::hex(setting('general.brand_primary_color'));
|
||||
}
|
||||
$findModules = Module::where('installed', 1)->get();
|
||||
if ($findModules->count() > 0) {
|
||||
foreach ($findModules as $module) {
|
||||
$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');
|
||||
}
|
||||
|
||||
$isAppInstalled = file_exists(storage_path('installed'));
|
||||
if ($isAppInstalled) {
|
||||
if (setting('general.brand_logo_url')) {
|
||||
$brandLogo = setting('general.brand_logo_url');
|
||||
}
|
||||
if (setting('general.brand_primary_color')) {
|
||||
$defaultColor = Color::hex(setting('general.brand_primary_color'));
|
||||
}
|
||||
$findModules = Module::where('installed', 1)->get();
|
||||
if ($findModules->count() > 0) {
|
||||
foreach ($findModules as $module) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,19 @@
|
|||
namespace tests\Unit;
|
||||
|
||||
use App\Models\User;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Livewire\Livewire;
|
||||
use Modules\Docker\App\Models\DockerContainer;
|
||||
use Modules\Docker\Filament\Clusters\Docker\Pages\DockerCatalog;
|
||||
use Modules\Docker\Filament\Clusters\Docker\Resources\DockerContainerResource;
|
||||
use Modules\Docker\Filament\Clusters\Docker\Resources\DockerContainerResource\Pages\CreateDockerContainer;
|
||||
use Modules\Docker\Filament\Clusters\Docker\Resources\DockerContainerResource\Pages\EditDockerContainer;
|
||||
use Modules\Docker\Filament\Clusters\Docker\Resources\DockerContainerResource\Pages\ListDockerContainers;
|
||||
use Modules\Docker\PostInstall;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DockerTest extends TestCase
|
||||
{
|
||||
public function testDocker()
|
||||
public function testDockerImages()
|
||||
{
|
||||
$docker = new PostInstall();
|
||||
$docker->setLogFile('/tmp/phyrepanel-docker-install.log');
|
||||
|
@ -62,4 +66,43 @@ class DockerTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testDockerContainers()
|
||||
{
|
||||
$createDockerContainerTest = Livewire::test(CreateDockerContainer::class);
|
||||
$createDockerContainerTest->assertSee('Create Docker Container');
|
||||
|
||||
$dockerName = 'nginx-latest-phyre-'.rand(1111,9999);
|
||||
$create = $createDockerContainerTest->fillForm([
|
||||
'name' => $dockerName,
|
||||
'image' => 'nginx',
|
||||
'environmentVariables' => [
|
||||
'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
'NGINX_VERSION' => '1.25.5',
|
||||
'NJS_VERSION' => '0.8.4',
|
||||
'NJS_RELEASE' => '2~bookworm',
|
||||
'PKG_RELEASE' => '1~bookworm',
|
||||
],
|
||||
'volumeMapping' => [],
|
||||
'port' => '83',
|
||||
'externalPort' => '3000',
|
||||
])->call('create');
|
||||
|
||||
$this->assertDatabaseHas(DockerContainer::class, [
|
||||
'name' => $dockerName,
|
||||
]);
|
||||
|
||||
$listDockerContainersTest = Livewire::test(ListDockerContainers::class);
|
||||
$listDockerContainersTest->assertSee($dockerName);
|
||||
|
||||
$findDockerContainer = DockerContainer::where('name', $dockerName)->first();
|
||||
|
||||
$editDockerContainersTest = Livewire::test(EditDockerContainer::class, [
|
||||
'record'=> $findDockerContainer->id
|
||||
]);
|
||||
$editDockerContainersTest->assertSee('Edit Docker Container');
|
||||
$editDockerContainersTest->callAction(DeleteAction::class);
|
||||
|
||||
$this->assertModelMissing($findDockerContainer);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue