enh: external tool server custom name/description support

This commit is contained in:
Timothy Jaeryang Baek
2025-05-27 00:10:33 +04:00
parent 20f54616e7
commit a38e44e870
3 changed files with 69 additions and 7 deletions

View File

@@ -22,7 +22,6 @@
export let edit = false;
export let direct = false;
export let connection = null;
let url = '';
@@ -33,6 +32,9 @@
let accessControl = {};
let name = '';
let description = '';
let enable = true;
let loading = false;
@@ -69,6 +71,10 @@
config: {
enable: enable,
access_control: accessControl
},
info: {
name,
description
}
}).catch((err) => {
toast.error($i18n.t('Connection failed'));
@@ -95,6 +101,10 @@
config: {
enable: enable,
access_control: accessControl
},
info: {
name: name,
description: description
}
};
@@ -108,6 +118,9 @@
key = '';
auth_type = 'bearer';
name = '';
description = '';
enable = true;
accessControl = null;
};
@@ -120,6 +133,9 @@
auth_type = connection?.auth_type ?? 'bearer';
key = connection?.key ?? '';
name = connection.info?.name ?? '';
description = connection.info?.description ?? '';
enable = connection.config?.enable ?? true;
accessControl = connection.config?.access_control ?? null;
}
@@ -276,6 +292,39 @@
{#if !direct}
<hr class=" border-gray-100 dark:border-gray-700/10 my-2.5 w-full" />
<div class="flex gap-2">
<div class="flex flex-col w-full">
<div class=" mb-0.5 text-xs text-gray-500">{$i18n.t('Name')}</div>
<div class="flex-1">
<input
class="w-full text-sm bg-transparent placeholder:text-gray-300 dark:placeholder:text-gray-700 outline-hidden"
type="text"
bind:value={name}
placeholder={$i18n.t('Enter name')}
autocomplete="off"
required
/>
</div>
</div>
</div>
<div class="flex flex-col w-full mt-2">
<div class=" mb-1 text-xs text-gray-500">{$i18n.t('Description')}</div>
<div class="flex-1">
<input
class="w-full text-sm bg-transparent placeholder:text-gray-300 dark:placeholder:text-gray-700 outline-hidden"
type="text"
bind:value={description}
placeholder={$i18n.t('Enter description')}
autocomplete="off"
/>
</div>
</div>
<hr class=" border-gray-100 dark:border-gray-700/10 my-2.5 w-full" />
<div class="my-2 -mx-2">
<div class="px-3 py-2 bg-gray-50 dark:bg-gray-950 rounded-lg">
<AccessControl bind:accessControl />