You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

59 lines
1.4 KiB

<template>
<div class="flex items-center">
<FormLabel :for="id">
{{ label }}
</FormLabel>
<BaseTooltip v-if="description" :text="description">
<IconsInfo class="size-4" />
</BaseTooltip>
<BaseTooltip
v-if="overridden"
text="This field is overridden by an environment variable"
>
<IconsWarning class="size-4 text-amber-500" />
</BaseTooltip>
</div>
<div class="flex gap-1">
<BaseInput
:id="id"
v-model.trim="data"
:name="id"
type="text"
class="w-full"
:placeholder="placeholder"
/>
<ClientOnly>
<AdminSuggestDialog :url="url" @change="data = $event">
<BasePrimaryButton as="span">
<div class="flex items-center gap-3">
<IconsSparkles class="w-4" />
<span class="whitespace-nowrap">
{{ $t('admin.config.suggest') }}
</span>
</div>
</BasePrimaryButton>
</AdminSuggestDialog>
</ClientOnly>
</div>
</template>
<script lang="ts" setup>
defineProps<{
id: string;
label: string;
description?: string;
placeholder?: string;
url: '/api/admin/ip-info' | '/api/setup/4';
overridden?: boolean;
}>();
const data = defineModel<string | null>({
set(value) {
const temp = value?.trim() ?? null;
if (temp === '') {
return null;
}
return temp;
},
});
</script>