Skip to content

Commit 2c239ce

Browse files
committed
fix(one-click-service): Use JSON Object key slugs instead of service/database name
1 parent e7dff30 commit 2c239ce

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

app/Livewire/Project/New/Select.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public function loadServices()
115115
$local_logo_path = public_path($logo);
116116

117117
return [
118+
'id' => (string) $key,
118119
'name' => str($key)->headline(),
119120
'logo' => asset($logo),
120121
'logo_github_url' => file_exists($local_logo_path)
@@ -325,7 +326,10 @@ private function formatLastModified(string $path): ?string
325326

326327
public function setType(string $type)
327328
{
328-
$type = str($type)->lower()->slug()->value();
329+
$type = str($type)->trim()->value();
330+
if (! str($type)->startsWith('one-click-service-')) {
331+
$type = str($type)->lower()->slug()->value();
332+
}
329333
if ($this->loading) {
330334
return;
331335
}

app/Livewire/Project/Resource/Create.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public function mount()
9797
$service->save();
9898
if ($oneClickDotEnvs?->count() > 0) {
9999
$oneClickDotEnvs->each(function ($value) use ($service) {
100-
$key = str()->before($value, '=');
101-
$value = str(str()->after($value, '='));
100+
$key = str($value)->before('=');
101+
$value = str(str($value)->after('='));
102102
if ($value) {
103103
EnvironmentVariable::create([
104104
'key' => $key,

bootstrap/helpers/constants.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
'timescaledb', // Matches timescale/timescaledb
7474
'timescaledb-ha', // Matches timescale/timescaledb-ha
7575
'pgvector/pgvector',
76+
'denokv', // Matches ghcr.io/denoland/denokv
7677
];
7778
const SPECIFIC_SERVICES = [
7879
'quay.io/minio/minio',

resources/views/livewire/project/new/select.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class="text-xs text-neutral-500 dark:text-neutral-400">
154154

155155
<div class="grid justify-start grid-cols-1 gap-4 text-left xl:grid-cols-3">
156156
<template x-for="service in filteredServices" :key="service.name">
157-
<div class="relative" x-on:click="setType('one-click-service-' + service.name)"
157+
<div class="relative" x-on:click="setType('one-click-service-' + service.id)"
158158
:class="{ 'cursor-pointer': !selecting, 'cursor-not-allowed opacity-50': selecting }">
159159
<x-resource-view>
160160
<x-slot:title>

0 commit comments

Comments
 (0)