feat: add customHelper to stack-form
This commit is contained in:
@@ -34,6 +34,7 @@ class StackForm extends Component
|
|||||||
$value = data_get($field, 'value');
|
$value = data_get($field, 'value');
|
||||||
$rules = data_get($field, 'rules', 'nullable');
|
$rules = data_get($field, 'rules', 'nullable');
|
||||||
$isPassword = data_get($field, 'isPassword', false);
|
$isPassword = data_get($field, 'isPassword', false);
|
||||||
|
$customHelper = data_get($field, 'customHelper', false);
|
||||||
$this->fields->put($key, [
|
$this->fields->put($key, [
|
||||||
'serviceName' => $serviceName,
|
'serviceName' => $serviceName,
|
||||||
'key' => $key,
|
'key' => $key,
|
||||||
@@ -41,6 +42,7 @@ class StackForm extends Component
|
|||||||
'value' => $value,
|
'value' => $value,
|
||||||
'isPassword' => $isPassword,
|
'isPassword' => $isPassword,
|
||||||
'rules' => $rules,
|
'rules' => $rules,
|
||||||
|
'customHelper' => $customHelper,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->rules["fields.$key.value"] = $rules;
|
$this->rules["fields.$key.value"] = $rules;
|
||||||
|
@@ -288,6 +288,21 @@ class Service extends BaseModel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch ($image) {
|
switch ($image) {
|
||||||
|
case $image->contains('castopod'):
|
||||||
|
$data = collect([]);
|
||||||
|
$disable_https = $this->environment_variables()->where('key', 'CP_DISABLE_HTTPS')->first();
|
||||||
|
if ($disable_https) {
|
||||||
|
$data = $data->merge([
|
||||||
|
'Disable HTTPS' => [
|
||||||
|
'key' => 'CP_DISABLE_HTTPS',
|
||||||
|
'value' => data_get($disable_https, 'value'),
|
||||||
|
'rules' => 'required',
|
||||||
|
'customHelper' => "If you want to use https, set this to 0. Variable name: CP_DISABLE_HTTPS",
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$fields->put('Castopod', $data->toArray());
|
||||||
|
break;
|
||||||
case $image->contains('label-studio'):
|
case $image->contains('label-studio'):
|
||||||
$data = collect([]);
|
$data = collect([]);
|
||||||
$username = $this->environment_variables()->where('key', 'LABEL_STUDIO_USERNAME')->first();
|
$username = $this->environment_variables()->where('key', 'LABEL_STUDIO_USERNAME')->first();
|
||||||
@@ -1093,6 +1108,7 @@ class Service extends BaseModel
|
|||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$key = data_get($field, 'key');
|
$key = data_get($field, 'key');
|
||||||
$value = data_get($field, 'value');
|
$value = data_get($field, 'value');
|
||||||
|
ray($key, $value);
|
||||||
$found = $this->environment_variables()->where('key', $key)->first();
|
$found = $this->environment_variables()->where('key', $key)->first();
|
||||||
if ($found) {
|
if ($found) {
|
||||||
$found->value = $value;
|
$found->value = $value;
|
||||||
|
@@ -24,8 +24,13 @@
|
|||||||
<div class="grid grid-cols-2 gap-2">
|
<div class="grid grid-cols-2 gap-2">
|
||||||
@foreach ($fields as $serviceName => $field)
|
@foreach ($fields as $serviceName => $field)
|
||||||
<div class="flex items-center gap-2"><span
|
<div class="flex items-center gap-2"><span
|
||||||
class="font-bold">{{ data_get($field, 'serviceName') }}</span>{{ data_get($field, 'name') }}<x-helper
|
class="font-bold">{{ data_get($field, 'serviceName') }}</span>{{ data_get($field, 'name') }}
|
||||||
helper="Variable name: {{ $serviceName }}" /></div>
|
@if (data_get($field, 'customHelper'))
|
||||||
|
<x-helper helper="{{ data_get($field, 'customHelper') }}" />
|
||||||
|
@else
|
||||||
|
<x-helper helper="Variable name: {{ $serviceName }}" />
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
<x-forms.input type="{{ data_get($field, 'isPassword') ? 'password' : 'text' }}"
|
<x-forms.input type="{{ data_get($field, 'isPassword') ? 'password' : 'text' }}"
|
||||||
required="{{ str(data_get($field, 'rules'))?->contains('required') }}"
|
required="{{ str(data_get($field, 'rules'))?->contains('required') }}"
|
||||||
id="fields.{{ $serviceName }}.value"></x-forms.input>
|
id="fields.{{ $serviceName }}.value"></x-forms.input>
|
||||||
|
Reference in New Issue
Block a user