Fix variable assignment in Import.php and ApplicationDeploymentJob.php
This commit is contained in:
parent
484a3dbe5c
commit
e71032a8fc
@ -116,9 +116,13 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $local_persistent_volumes;
|
return $local_persistent_volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,9 +124,13 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $local_persistent_volumes;
|
return $local_persistent_volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,9 +121,13 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $local_persistent_volumes;
|
return $local_persistent_volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,9 +114,13 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $local_persistent_volumes;
|
return $local_persistent_volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,9 +130,13 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $local_persistent_volumes;
|
return $local_persistent_volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,9 +114,13 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $local_persistent_volumes;
|
return $local_persistent_volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,9 +136,13 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $local_persistent_volumes;
|
return $local_persistent_volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +125,13 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->database->persistentStorages as $persistentStorage) {
|
foreach ($this->database->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $local_persistent_volumes;
|
return $local_persistent_volumes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1340,7 +1340,11 @@ private function generate_local_persistent_volumes()
|
|||||||
{
|
{
|
||||||
$local_persistent_volumes = [];
|
$local_persistent_volumes = [];
|
||||||
foreach ($this->application->persistentStorages as $persistentStorage) {
|
foreach ($this->application->persistentStorages as $persistentStorage) {
|
||||||
$volume_name = $persistentStorage->host_path ?? $persistentStorage->name;
|
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
|
||||||
|
$volume_name = $persistentStorage->host_path;
|
||||||
|
} else {
|
||||||
|
$volume_name = $persistentStorage->name;
|
||||||
|
}
|
||||||
if ($this->pull_request_id !== 0) {
|
if ($this->pull_request_id !== 0) {
|
||||||
$volume_name = $volume_name . '-pr-' . $this->pull_request_id;
|
$volume_name = $volume_name . '-pr-' . $this->pull_request_id;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
class Import extends Component
|
class Import extends Component
|
||||||
{
|
{
|
||||||
|
public bool $unsupported = false;
|
||||||
public $resource;
|
public $resource;
|
||||||
public $parameters;
|
public $parameters;
|
||||||
public $containers;
|
public $containers;
|
||||||
@ -65,7 +65,7 @@ public function getContainers()
|
|||||||
$this->resource->getMorphClass() == 'App\Models\StandaloneClickhouse' ||
|
$this->resource->getMorphClass() == 'App\Models\StandaloneClickhouse' ||
|
||||||
$this->resource->getMorphClass() == 'App\Models\StandaloneMongodb'
|
$this->resource->getMorphClass() == 'App\Models\StandaloneMongodb'
|
||||||
) {
|
) {
|
||||||
$this->dispatch('error', 'Import is not supported for this resource.');
|
$this->unsupported = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,15 +37,19 @@
|
|||||||
</script>
|
</script>
|
||||||
@endscript
|
@endscript
|
||||||
<h2>Import Backup</h2>
|
<h2>Import Backup</h2>
|
||||||
|
@if ($unsupported)
|
||||||
|
<div>Database restore is not supported.</div>
|
||||||
|
@else
|
||||||
<div class="mt-2 mb-4 rounded alert-error">
|
<div class="mt-2 mb-4 rounded alert-error">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 stroke-current shrink-0" fill="none" viewBox="0 0 24 24">
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 stroke-current shrink-0" fill="none"
|
||||||
|
viewBox="0 0 24 24">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
||||||
</svg>
|
</svg>
|
||||||
<span>This is a destructive action, existing data will be replaced!</span>
|
<span>This is a destructive action, existing data will be replaced!</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (str(data_get($resource, 'status'))->startsWith('running'))
|
@if (str(data_get($resource, 'status'))->startsWith('running'))
|
||||||
|
|
||||||
@if ($resource->type() === 'standalone-postgresql')
|
@if ($resource->type() === 'standalone-postgresql')
|
||||||
<x-forms.input class="mb-2" label="Custom Import Command"
|
<x-forms.input class="mb-2" label="Custom Import Command"
|
||||||
wire:model='postgresqlRestoreCommand'></x-forms.input>
|
wire:model='postgresqlRestoreCommand'></x-forms.input>
|
||||||
@ -69,9 +73,10 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="container w-full mx-auto">
|
<div class="container w-full mx-auto">
|
||||||
<livewire:activity-monitor header="Database restore output" />
|
<livewire:activity-monitor header="Database Restore Output" />
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<div>Database must be running to restore a backup.</div>
|
<div>Database must be running to restore a backup.</div>
|
||||||
@endif
|
@endif
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user