From 5255311a2ed3f931bfb39fea053692e28853d9a4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 3 Oct 2023 12:14:58 +0200 Subject: [PATCH 1/3] hmm --- app/Models/Service.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Models/Service.php b/app/Models/Service.php index 49d8b9f33..fe7ecc281 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -8,6 +8,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; use Symfony\Component\Yaml\Yaml; use Illuminate\Support\Str; +use Spatie\Url\Url; class Service extends BaseModel { @@ -259,7 +260,7 @@ class Service extends BaseModel $networks = $serviceNetworks->toArray(); foreach ($definedNetwork as $key => $network) { $networks = array_merge($networks, [ - $network + $network => null ]); } data_set($service, 'networks', $networks); @@ -288,10 +289,7 @@ class Service extends BaseModel $isDirectory = (bool) data_get($volume, 'isDirectory', false); $foundConfig = $savedService->fileStorages()->whereMountPath($target)->first(); if ($foundConfig) { - $contentNotNull = data_get($foundConfig, 'content'); - if ($contentNotNull) { - $content = $contentNotNull; - } + $content = data_get($foundConfig, 'content'); $isDirectory = (bool) data_get($foundConfig, 'is_directory'); } } @@ -319,7 +317,11 @@ class Service extends BaseModel ); } else if ($type->value() === 'volume') { $slug = Str::slug($source, '-'); - $name = "{$savedService->service->uuid}_{$slug}"; + if ($isNew) { + $name = "{$savedService->service->uuid}-{$slug}"; + } else { + $name = "{$savedService->service->uuid}_{$slug}"; + } if (is_string($volume)) { $source = Str::of($volume)->before(':'); $target = Str::of($volume)->after(':')->beforeLast(':'); @@ -343,7 +345,7 @@ class Service extends BaseModel ] ); } - $savedService->getFilesFromServer(isInit: true); + $savedService->getFilesFromServer(); return $volume; }); data_set($service, 'volumes', $serviceVolumes->toArray()); From 8ff216e5fbc3222598c8e9548268285f746325d0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 3 Oct 2023 12:20:09 +0200 Subject: [PATCH 2/3] revert --- app/Models/Service.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Models/Service.php b/app/Models/Service.php index fe7ecc281..49d8b9f33 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -8,7 +8,6 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; use Symfony\Component\Yaml\Yaml; use Illuminate\Support\Str; -use Spatie\Url\Url; class Service extends BaseModel { @@ -260,7 +259,7 @@ class Service extends BaseModel $networks = $serviceNetworks->toArray(); foreach ($definedNetwork as $key => $network) { $networks = array_merge($networks, [ - $network => null + $network ]); } data_set($service, 'networks', $networks); @@ -289,7 +288,10 @@ class Service extends BaseModel $isDirectory = (bool) data_get($volume, 'isDirectory', false); $foundConfig = $savedService->fileStorages()->whereMountPath($target)->first(); if ($foundConfig) { - $content = data_get($foundConfig, 'content'); + $contentNotNull = data_get($foundConfig, 'content'); + if ($contentNotNull) { + $content = $contentNotNull; + } $isDirectory = (bool) data_get($foundConfig, 'is_directory'); } } @@ -317,11 +319,7 @@ class Service extends BaseModel ); } else if ($type->value() === 'volume') { $slug = Str::slug($source, '-'); - if ($isNew) { - $name = "{$savedService->service->uuid}-{$slug}"; - } else { - $name = "{$savedService->service->uuid}_{$slug}"; - } + $name = "{$savedService->service->uuid}_{$slug}"; if (is_string($volume)) { $source = Str::of($volume)->before(':'); $target = Str::of($volume)->after(':')->beforeLast(':'); @@ -345,7 +343,7 @@ class Service extends BaseModel ] ); } - $savedService->getFilesFromServer(); + $savedService->getFilesFromServer(isInit: true); return $volume; }); data_set($service, 'volumes', $serviceVolumes->toArray()); From bd856f7f67c2243fc0afe85908805185fe0cce73 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 3 Oct 2023 13:14:11 +0200 Subject: [PATCH 3/3] fix: volume names in services --- app/Models/Service.php | 6 +++--- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Models/Service.php b/app/Models/Service.php index 49d8b9f33..b4a959fa6 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -318,8 +318,8 @@ class Service extends BaseModel ] ); } else if ($type->value() === 'volume') { - $slug = Str::slug($source, '-'); - $name = "{$savedService->service->uuid}_{$slug}"; + $slugWithoutUuid = Str::slug($source, '-'); + $name = "{$savedService->service->uuid}_{$slugWithoutUuid}"; if (is_string($volume)) { $source = Str::of($volume)->before(':'); $target = Str::of($volume)->after(':')->beforeLast(':'); @@ -336,7 +336,7 @@ class Service extends BaseModel 'resource_type' => get_class($savedService) ], [ - 'name' => $name, + 'name' => $slugWithoutUuid, 'mount_path' => $target, 'resource_id' => $savedService->id, 'resource_type' => get_class($savedService) diff --git a/config/sentry.php b/config/sentry.php index fbddc758e..22e020eb9 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.60', + 'release' => '4.0.0-beta.61', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index b61b5c9de..8559368c3 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@