feat(storage): integrate AWS S3 support in storage settings
- Added support for AWS S3 as a storage engine, including configuration options for endpoint, region, access key, secret key, bucket name, and path prefix. - Updated the StorageEngineConfig interface to include S3 configuration. - Enhanced the UI components to allow users to configure S3 settings and test connections. - Updated localization files to include new S3-related labels and descriptions in multiple languages. These changes significantly enhance the storage capabilities of the application, providing users with more options for managing their data.
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
>
|
||||
<div class="engine-option">
|
||||
<div class="engine-option-top">
|
||||
<span class="engine-option-name">{{ opt.value }}</span>
|
||||
<span class="engine-option-name">{{ getEngineDisplayName(opt.value) }}</span>
|
||||
<t-tag
|
||||
v-if="opt.isDefault"
|
||||
theme="primary"
|
||||
@@ -65,7 +65,7 @@
|
||||
size="small"
|
||||
>{{ $t('kbSettings.parser.unavailable') }}</t-tag>
|
||||
</div>
|
||||
<div class="engine-option-desc">{{ opt.desc }}</div>
|
||||
<div class="engine-option-desc">{{ getEngineDisplayDesc(opt.value, opt.desc) }}</div>
|
||||
<div v-if="opt.disabled && opt.reason" class="engine-option-reason">
|
||||
{{ opt.reason }}
|
||||
<a class="go-settings" @click.stop.prevent="goToParserSettings">{{ $t('kbSettings.parser.goSettings') }}</a>
|
||||
@@ -92,6 +92,18 @@ import { storeToRefs } from 'pinia'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
function getEngineDisplayName(engineName: string): string {
|
||||
const key = `kbSettings.parser.engines.${engineName}.name`
|
||||
const translated = t(key)
|
||||
return translated !== key ? translated : engineName
|
||||
}
|
||||
|
||||
function getEngineDisplayDesc(engineName: string, fallback: string): string {
|
||||
const key = `kbSettings.parser.engines.${engineName}.desc`
|
||||
const translated = t(key)
|
||||
return translated !== key ? translated : fallback
|
||||
}
|
||||
|
||||
export interface ParserEngineRule {
|
||||
file_types: string[]
|
||||
engine: string
|
||||
@@ -176,7 +188,7 @@ function getEngineOptions(extensions: string[]): EngineOption[] {
|
||||
const defaultName = raw.find(e => e.available)?.name ?? ''
|
||||
return raw.map(e => ({
|
||||
value: e.name,
|
||||
selectLabel: `${e.name} — ${e.desc}`,
|
||||
selectLabel: `${getEngineDisplayName(e.name)} — ${getEngineDisplayDesc(e.name, e.desc)}`,
|
||||
desc: e.desc,
|
||||
fileTypes: e.fileTypes,
|
||||
disabled: !e.available,
|
||||
|
||||
@@ -108,6 +108,13 @@ const engineOptions = computed(() => {
|
||||
available: statusMap.tos,
|
||||
disabled: statusMap.tos === false,
|
||||
},
|
||||
{
|
||||
value: 's3',
|
||||
label: t('kbSettings.storage.engineS3'),
|
||||
desc: t('kbSettings.storage.engineS3Desc'),
|
||||
available: statusMap.s3,
|
||||
disabled: statusMap.s3 === false,
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
@@ -139,7 +146,7 @@ async function load() {
|
||||
engineStatus.value = engines
|
||||
defaultProvider.value = configRes?.data?.default_provider || 'local'
|
||||
const d = configRes?.data
|
||||
hasAnyConfig.value = !!(d?.local?.path_prefix || d?.minio?.bucket_name || d?.cos?.bucket_name || d?.tos?.bucket_name)
|
||||
hasAnyConfig.value = !!(d?.local?.path_prefix || d?.minio?.bucket_name || d?.cos?.bucket_name || d?.tos?.bucket_name || d?.s3?.bucket_name)
|
||||
if (!localProvider.value || localProvider.value === '') {
|
||||
localProvider.value = defaultProvider.value
|
||||
emit('update:storageProvider', localProvider.value)
|
||||
|
||||
Reference in New Issue
Block a user