This commit is contained in:
Bozhidar 2024-04-27 21:21:27 +03:00
parent 671399b606
commit d4c78480df
6 changed files with 39 additions and 35 deletions

View file

@ -87,8 +87,9 @@ class DockerContainer extends Model
if ($model->build_type == 'template') {
$dockerContainerApi->setDockerCompose($model->docker_compose);
}
$createContainer = $dockerContainerApi->run();
if (!isset($createContainer['ID'])) {
return false;
}

View file

@ -71,7 +71,7 @@ class DockerCatalog extends Page implements HasForms
$this->pullLogPulling = false;
$this->dispatch('close-modal', id: 'pull-docker-image');
return $this->redirect(route('filament.admin.docker.resources.docker-containers.create') . '?dockerImage=' . $this->pullImageName);
return $this->redirect('/admin/docker/containers/create?dockerImage=' . $this->pullImageName);
}
}

View file

@ -94,8 +94,11 @@ class DockerContainerResource extends Resource
Forms\Components\Select::make('build_type')
->label('Build container from')
->live()
->default($buildType)
->options(['template'=>'Docker Template', 'image'=>'Docker Image'])
->default('image')
->options([
// 'template'=>'Docker Template',
'image'=>'Docker Image'
])
->columnSpanFull(),
Forms\Components\Select::make('docker_template_id')

View file

@ -36,33 +36,33 @@ class ViewDockerContainer extends ViewRecord
return $infolist
->schema([
ViewEntry::make('status')
->columnSpanFull()
->view('docker::filament.infolists.docker-container.actions')
->registerActions([
Actions\Action::make('stop')
->label('Stop')
->color('primary'),
Actions\Action::make('start')
->label('Start')
->color('primary'),
Actions\Action::make('restart')
->label('Restart')
->color('success'),
Actions\Action::make('recreate')
->label('Recreate')
->action('recreate')
->color('info'),
Actions\Action::make('delete')
->label('Delete')
->color('danger'),
]),
// ViewEntry::make('status')
// ->columnSpanFull()
// ->view('docker::filament.infolists.docker-container.actions')
// ->registerActions([
// Actions\Action::make('stop')
// ->label('Stop')
// ->color('primary'),
//
// Actions\Action::make('start')
// ->label('Start')
// ->color('primary'),
//
// Actions\Action::make('restart')
// ->label('Restart')
// ->color('success'),
//
//
// Actions\Action::make('recreate')
// ->label('Recreate')
// ->action('recreate')
// ->color('info'),
//
//
// Actions\Action::make('delete')
// ->label('Delete')
// ->color('danger'),
// ]),
ViewEntry::make('containerLogs')
->columnSpanFull()

View file

@ -1,5 +1,5 @@
<div>
<div class="bg-black/5 p-4 rounded">
<div class="bg-black/5 dark:bg-white/5 dark:text-green-400 p-4 rounded">
{!! $this->containerLog !!}
</div>
</div>

View file

@ -67,7 +67,7 @@
<x-filament::button id="docker-container-details-{{ $dockerContainer['id'] }}"
tag="a"
href="{{route('filament.admin.docker.resources.docker-containers.view', $dockerContainer['id'])}}"
href="{{url('admin/docker/containers/'. $dockerContainer['id'])}}"
size="md" outlined>
<div class="flex gap-2 items-center">
@ -79,7 +79,7 @@
</x-filament::button>
<x-filament::button id="docker-container-logs-{{ $dockerContainer['id'] }}"
tag="a"
href="{{route('filament.admin.docker.resources.docker-containers.view', $dockerContainer['id'])}}"
href="{{url('admin/docker/containers/'. $dockerContainer['id'])}}"
size="md" outlined>
<div class="flex gap-2 items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6" viewBox="0 0 15 15">
@ -91,7 +91,7 @@
<x-filament::button id="docker-container-settings-{{ $dockerContainer['id'] }}"
tag="a"
href="{{route('filament.admin.docker.resources.docker-containers.edit', $dockerContainer['id'])}}"
href="{{url('admin/docker/containers/'. $dockerContainer['id'])}}"
size="md" outlined>
<div class="flex gap-2 items-center">