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') { if ($model->build_type == 'template') {
$dockerContainerApi->setDockerCompose($model->docker_compose); $dockerContainerApi->setDockerCompose($model->docker_compose);
} }
$createContainer = $dockerContainerApi->run(); $createContainer = $dockerContainerApi->run();
if (!isset($createContainer['ID'])) { if (!isset($createContainer['ID'])) {
return false; return false;
} }

View file

@ -71,7 +71,7 @@ class DockerCatalog extends Page implements HasForms
$this->pullLogPulling = false; $this->pullLogPulling = false;
$this->dispatch('close-modal', id: 'pull-docker-image'); $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') Forms\Components\Select::make('build_type')
->label('Build container from') ->label('Build container from')
->live() ->live()
->default($buildType) ->default('image')
->options(['template'=>'Docker Template', 'image'=>'Docker Image']) ->options([
// 'template'=>'Docker Template',
'image'=>'Docker Image'
])
->columnSpanFull(), ->columnSpanFull(),
Forms\Components\Select::make('docker_template_id') Forms\Components\Select::make('docker_template_id')

View file

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

View file

@ -1,5 +1,5 @@
<div> <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 !!} {!! $this->containerLog !!}
</div> </div>
</div> </div>

View file

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