lets see now

This commit is contained in:
Andras Bacsai 2023-12-06 14:57:03 +01:00
parent 5c59a752e3
commit 2073b8949b
3 changed files with 13 additions and 9 deletions

View File

@ -2,18 +2,22 @@
namespace App\Http\Livewire\Project\Service; namespace App\Http\Livewire\Project\Service;
use App\Models\Service;
use Livewire\Component; use Livewire\Component;
class ComposeModal extends Component class ComposeModal extends Component
{ {
public ?string $raw = null; public Service $service;
public ?string $actual = null; protected $rules = [
'service.docker_compose_raw' => 'required',
'service.docker_compose' => 'required',
];
public function render() public function render()
{ {
return view('livewire.project.service.compose-modal'); return view('livewire.project.service.compose-modal');
} }
public function submit() { public function submit() {
$this->emit('warning', "Saving new docker compose..."); $this->emit('warning', "Saving new docker compose...");
$this->emit('saveCompose', $this->raw); $this->emit('saveCompose', $this->service->docker_compose_raw);
} }
} }

View File

@ -1,4 +1,4 @@
<dialog id="composeModal" class="modal" x-data="{ raw: true }"> <dialog id="composeModal" class="modal" x-data="{ raw: true }" wire:ignore.self>
<form method="dialog" class="flex flex-col gap-2 rounded max-w-7xl modal-box" wire:submit.prevent='submit'> <form method="dialog" class="flex flex-col gap-2 rounded max-w-7xl modal-box" wire:submit.prevent='submit'>
<div class="flex items-end gap-2"> <div class="flex items-end gap-2">
<h1>Docker Compose</h1> <h1>Docker Compose</h1>
@ -13,11 +13,11 @@
<div>Volume names are updated upon save. The service UUID will be added as a prefix to all volumes, to prevent name collision. <br>To see the actual volume names, check the Deployable Compose file, or go to Storage menu.</div> <div>Volume names are updated upon save. The service UUID will be added as a prefix to all volumes, to prevent name collision. <br>To see the actual volume names, check the Deployable Compose file, or go to Storage menu.</div>
<div x-cloak x-show="raw"> <div x-cloak x-show="raw">
<x-forms.textarea rows="20" id="raw"> <x-forms.textarea rows="20" id="service.docker_compose_raw">
</x-forms.textarea> </x-forms.textarea>
</div> </div>
<div x-cloak x-show="raw === false"> <div x-cloak x-show="raw === false">
<x-forms.textarea rows="20" readonly id="actual"> <x-forms.textarea rows="20" readonly id="service.docker_compose">
</x-forms.textarea> </x-forms.textarea>
</div> </div>
<x-forms.button onclick="composeModal.close()" type="submit"> <x-forms.button onclick="composeModal.close()" type="submit">

View File

@ -1,7 +1,7 @@
<div x-data="{ raw: true, activeTab: window.location.hash ? window.location.hash.substring(1) : 'service-stack' }" x-init="$wire.checkStatus" wire:poll.10000ms="checkStatus" wire:ignore.self> <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'service-stack' }" x-init="$wire.checkStatus">
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" /> <livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
<livewire:project.service.compose-modal :raw="$service->docker_compose_raw" :actual="$service->docker_compose" /> <livewire:project.service.compose-modal :service="$service" />
<div class="flex h-full pt-6"> <div class="flex h-full pt-6" wire:poll.10000ms="checkStatus">
<div class="flex flex-col items-start gap-4 min-w-fit"> <div class="flex flex-col items-start gap-4 min-w-fit">
<a target="_blank" href="{{ $service->documentation() }}">Documentation <x-external-link /></a> <a target="_blank" href="{{ $service->documentation() }}">Documentation <x-external-link /></a>
<a :class="activeTab === 'service-stack' && 'text-white'" <a :class="activeTab === 'service-stack' && 'text-white'"