This commit is contained in:
Bozhidar 2024-04-30 00:43:30 +03:00
parent 8dc9b2537b
commit 30a1ed80d5
6 changed files with 73 additions and 34 deletions

View file

@ -30,7 +30,6 @@ 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')) {
@ -40,7 +39,6 @@ class CustomerPanelProvider extends PanelProvider
$defaultColor = Color::hex(setting('general.brand_primary_color'));
}
}
}
return $panel
->id('customer::admin')

View file

@ -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'];

View file

@ -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);

View file

@ -10,7 +10,7 @@ services:
ports:
- {{$externalPort}}:{{ $port }}
@if(isset($environmentVariables))
@if(isset($environmentVariables) && !empty($environmentVariables))
environment:

View file

@ -97,7 +97,7 @@ 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')) {
@ -120,7 +120,6 @@ class AdminPanelProvider extends PanelProvider
}
}
}
}
$panel->brandLogo($brandLogo)
->brandLogoHeight('2.2rem')

View file

@ -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);
}
}