feat: add more persistent storage types

This commit is contained in:
Andras Bacsai
2024-05-27 14:14:44 +02:00
parent 2f621279c2
commit 035e145cd1
15 changed files with 188 additions and 38 deletions

View File

@@ -1,12 +1,14 @@
<div class="p-4 transition border rounded dark:border-coolgray-200">
<div class="flex flex-col justify-center pb-4 text-sm select-text">
<h2>{{ data_get($resource, 'name', 'unknown') }}</h2>
<div>{{ $workdir }}{{ $fs_path }} -> {{ $fileStorage->mount_path }}</div>
@if ($fileStorage->is_directory)
<div class="text-xs">Directory</div>
@else
<div class="text-xs">File</div>
@if (data_get($resource, 'build_pack') === 'dockercompose')
<h2>{{ data_get($resource, 'name', 'unknown') }}</h2>
@endif
@if ($fileStorage->is_directory)
<div class="dark:text-white">Directory Mount</div>
@else
<div class="dark:text-white">File Mount</div>
@endif
<div>{{ $workdir }}{{ $fs_path }} -> {{ $fileStorage->mount_path }}</div>
</div>
<form wire:submit='submit' class="flex flex-col gap-2">
<div class="flex gap-2">
@@ -16,7 +18,8 @@
</x-modal-confirmation>
@else
<x-modal-confirmation action="convertToDirectory" buttonTitle="Convert to directory">
This will convert this to a directory. If it was a file, it will be deleted. It is not reversible. <br>Please think again.
This will convert this to a directory. If it was a file, it will be deleted. It is not reversible.
<br>Please think again.
</x-modal-confirmation>
@endif
<x-modal-confirmation isErrorButton buttonTitle="Delete">

View File

@@ -15,8 +15,8 @@
volume
name, example: <span class='text-helper'>-pr-1</span>" />
@if ($resource?->build_pack !== 'dockercompose')
<x-modal-input buttonTitle="+ Add" title="New Persistent Storage">
<livewire:project.shared.storages.add :uuid="$resource->uuid" />
<x-modal-input :closeOutside="false" buttonTitle="+ Add" title="New Persistent Storage">
<livewire:project.shared.storages.add :resource="$resource"/>
</x-modal-input>
@endif
</div>

View File

@@ -1,18 +1,43 @@
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submit'>
@if ($isSwarm)
<h5>Swarm Mode detected: You need to set a shared volume (EFS/NFS/etc) on all the worker nodes if you would
like to use a persistent volumes.</h5>
@endif
<x-forms.input placeholder="pv-name" id="name" label="Name" required helper="Volume name." />
@if ($isSwarm)
<x-forms.input placeholder="/root" id="host_path" label="Source Path" required
<div class="flex flex-col w-full gap-2 rounded">
You can add Volumes, Files and Directories to your resources here.
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submitPersistentVolume'>
<h3>Volume Mount</h3>
@if ($isSwarm)
<h5>Swarm Mode detected: You need to set a shared volume (EFS/NFS/etc) on all the worker nodes if you would
like to use a persistent volumes.</h5>
@endif
<x-forms.input placeholder="pv-name" id="name" label="Name" required helper="Volume name." />
@if ($isSwarm)
<x-forms.input placeholder="/root" id="host_path" label="Source Path" required
helper="Directory on the host system." />
@else
<x-forms.input placeholder="/root" id="host_path" label="Source Path"
helper="Directory on the host system." />
@endif
<x-forms.input placeholder="/tmp/root" id="mount_path" label="Destination Path" required
helper="Directory inside the container." />
<x-forms.button type="submit" @click="modalOpen=false">
Save
</x-forms.button>
</form>
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submitFileStorage'>
<h3>File Mount</h3>
<x-forms.input placeholder="/etc/nginx/nginx.conf" id="file_storage_path" label="Destination Path" required
helper="File inside the container" />
<x-forms.textarea label="Content" id="file_storage_content"></x-forms.textarea>
<x-forms.button type="submit" @click="modalOpen=false">
Save
</x-forms.button>
</form>
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submitFileStorageDirectory'>
<h3>Directory Mount</h3>
<x-forms.input placeholder="{{ application_configuration_dir() }}/{{ $resource->uuid }}/etc/nginx"
id="file_storage_directory_source" label="Source Directory" required
helper="Directory on the host system." />
@else
<x-forms.input placeholder="/root" id="host_path" label="Source Path" helper="Directory on the host system." />
@endif
<x-forms.input placeholder="/tmp/root" id="mount_path" label="Destination Path" required
helper="Directory inside the container." />
<x-forms.button type="submit" @click="slideOverOpen=false">
Save
</x-forms.button>
</form>
<x-forms.input placeholder="/etc/nginx" id="file_storage_directory_destination" label="Destination Directory"
required helper="Directory inside the container." />
<x-forms.button type="submit" @click="modalOpen=false">
Save
</x-forms.button>
</form>
</div>

View File

@@ -4,27 +4,27 @@
@if ($isFirst)
<x-forms.input id="storage.name" label="Volume Name" required
helper="Warning: Changing the volume name after the initial start could cause problems. Only use it when you know what are you doing." />
<x-forms.input id="storage.host_path" label="Source Path (on host)"
<x-forms.input id="storage.host_path" helper="Directory on the host system." label="Source Path"
helper="Warning: Changing the source path after the initial start could cause problems. Only use it when you know what are you doing." />
<x-forms.input id="storage.mount_path" label="Destination Path (in container)" required readonly />
<x-forms.input id="storage.mount_path" label="Destination Path" helper="Directory inside the container." required readonly />
<x-forms.button type="submit">
Update
</x-forms.button>
@else
<x-forms.input id="storage.name" required readonly
helper="Warning: Changing the volume name after the initial start could cause problems. Only use it when you know what are you doing." />
<x-forms.input id="storage.host_path" readonly />
<x-forms.input id="storage.mount_path" required readonly />
<x-forms.input id="storage.host_path" helper="Directory on the host system." readonly />
<x-forms.input id="storage.mount_path" helper="Directory inside the container." required readonly />
@endif
@else
@if ($isFirst)
<x-forms.input id="storage.name" label="Volume Name" required />
<x-forms.input id="storage.host_path" label="Source Path (on host)" />
<x-forms.input id="storage.mount_path" label="Destination Path (in container)" required />
<x-forms.input id="storage.host_path" helper="Directory on the host system." label="Source Path" />
<x-forms.input id="storage.mount_path" label="Destination Path" helper="Directory inside the container." required />
@else
<x-forms.input id="storage.name" required />
<x-forms.input id="storage.host_path" />
<x-forms.input id="storage.mount_path" required />
<x-forms.input id="storage.host_path" helper="Directory on the host system." />
<x-forms.input id="storage.mount_path" helper="Directory inside the container." required />
@endif
<div class="flex gap-2">
<x-forms.button type="submit">