feat(datasource): implement data source management functionality
- Added a new API for managing data sources, including CRUD operations and connection validation. - Introduced UI components for data source settings, sync logs, and editor dialog, enhancing user experience in managing external data sources. - Updated localization files to support new data source features in multiple languages. - Implemented cron expression humanization for better scheduling visibility. - Enhanced knowledge base editor to include data source management options.
This commit is contained in:
@@ -0,0 +1,834 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import {
|
||||
createDataSource,
|
||||
updateDataSource,
|
||||
validateConnection,
|
||||
validateCredentials,
|
||||
listResources,
|
||||
deleteDataSource,
|
||||
type DataSource,
|
||||
type Resource,
|
||||
} from '@/api/datasource'
|
||||
|
||||
const props = defineProps<{
|
||||
kbId: string
|
||||
dataSource: DataSource | null
|
||||
}>()
|
||||
|
||||
const visible = defineModel<boolean>('visible', { default: false })
|
||||
const emit = defineEmits<{ saved: [] }>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const isEdit = computed(() => !!props.dataSource)
|
||||
const step = ref(0)
|
||||
const submitting = ref(false)
|
||||
|
||||
// Form data
|
||||
const form = ref({
|
||||
name: '',
|
||||
type: '',
|
||||
config: {
|
||||
credentials: {} as Record<string, any>,
|
||||
resource_ids: [] as string[],
|
||||
settings: {} as Record<string, any>,
|
||||
},
|
||||
sync_schedule: '0 0 */6 * * *',
|
||||
sync_mode: 'incremental' as 'incremental' | 'full',
|
||||
conflict_strategy: 'overwrite' as 'overwrite' | 'skip',
|
||||
sync_deletions: true,
|
||||
})
|
||||
|
||||
// Step 2: Resources
|
||||
const resources = ref<Resource[]>([])
|
||||
const loadingResources = ref(false)
|
||||
const selectedResourceIds = ref<string[]>([])
|
||||
|
||||
// Connection test
|
||||
const testing = ref(false)
|
||||
const testResult = ref<'success' | 'error' | ''>('')
|
||||
const testErrorMsg = ref('')
|
||||
|
||||
// Collapsible prereq in Step 1
|
||||
const prereqExpanded = ref(false)
|
||||
|
||||
// Temp data source for resource listing
|
||||
const tempDsId = ref('')
|
||||
|
||||
// Schedule presets
|
||||
const schedulePresets = computed(() => [
|
||||
{ label: t('datasource.schedule30min'), value: '0 */30 * * * *' },
|
||||
{ label: t('datasource.schedule1h'), value: '0 0 * * * *' },
|
||||
{ label: t('datasource.schedule6h'), value: '0 0 */6 * * *' },
|
||||
{ label: t('datasource.schedule12h'), value: '0 0 */12 * * *' },
|
||||
{ label: t('datasource.schedule24h'), value: '0 0 2 * * *' },
|
||||
])
|
||||
|
||||
// --- Connector definitions ---
|
||||
interface ConnectorDef {
|
||||
type: string
|
||||
available: boolean
|
||||
docUrl: string
|
||||
permissionDocUrl: string
|
||||
permissionPageUrl: string
|
||||
requiredPermissions: string[]
|
||||
fields: { key: string; labelKey: string; placeholder: string; secret?: boolean }[]
|
||||
}
|
||||
|
||||
const connectorDefs = computed<ConnectorDef[]>(() => [
|
||||
{
|
||||
type: 'feishu',
|
||||
available: true,
|
||||
docUrl: 'https://open.feishu.cn/app',
|
||||
permissionDocUrl: 'https://open.feishu.cn/document/server-docs/docs/wiki-v2/wiki-overview',
|
||||
permissionPageUrl: 'https://open.feishu.cn/app',
|
||||
requiredPermissions: [
|
||||
'wiki:wiki:readonly',
|
||||
'drive:drive:readonly',
|
||||
'drive:export:readonly',
|
||||
'docx:document:readonly',
|
||||
],
|
||||
fields: [
|
||||
{ key: 'app_id', labelKey: 'datasource.field.appId', placeholder: 'cli_xxxx' },
|
||||
{ key: 'app_secret', labelKey: 'datasource.field.appSecret', placeholder: '', secret: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'notion',
|
||||
available: false,
|
||||
docUrl: 'https://www.notion.so/my-integrations',
|
||||
permissionDocUrl: '',
|
||||
permissionPageUrl: '',
|
||||
requiredPermissions: [],
|
||||
fields: [
|
||||
{ key: 'api_key', labelKey: 'datasource.field.integrationToken', placeholder: 'ntn_xxxx', secret: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'yuque',
|
||||
available: false,
|
||||
docUrl: 'https://www.yuque.com/settings/tokens',
|
||||
permissionDocUrl: '',
|
||||
permissionPageUrl: '',
|
||||
requiredPermissions: [],
|
||||
fields: [
|
||||
{ key: 'api_token', labelKey: 'datasource.field.apiToken', placeholder: '', secret: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'wecom_doc',
|
||||
available: false,
|
||||
docUrl: 'https://developer.work.weixin.qq.com/',
|
||||
permissionDocUrl: '',
|
||||
permissionPageUrl: '',
|
||||
requiredPermissions: [],
|
||||
fields: [
|
||||
{ key: 'corp_id', labelKey: 'datasource.field.corpId', placeholder: '' },
|
||||
{ key: 'corp_secret', labelKey: 'datasource.field.corpSecret', placeholder: '', secret: true },
|
||||
],
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
const currentDef = computed(() => connectorDefs.value.find(d => d.type === form.value.type))
|
||||
|
||||
// --- Dialog lifecycle ---
|
||||
watch(visible, (v) => {
|
||||
if (!v) return
|
||||
step.value = isEdit.value ? 1 : 0
|
||||
testResult.value = ''
|
||||
testErrorMsg.value = ''
|
||||
tempDsId.value = ''
|
||||
prereqExpanded.value = false
|
||||
resources.value = []
|
||||
selectedResourceIds.value = []
|
||||
|
||||
if (isEdit.value && props.dataSource) {
|
||||
form.value = {
|
||||
name: props.dataSource.name,
|
||||
type: props.dataSource.type,
|
||||
config: props.dataSource.config || { credentials: {}, resource_ids: [], settings: {} },
|
||||
sync_schedule: props.dataSource.sync_schedule,
|
||||
sync_mode: props.dataSource.sync_mode,
|
||||
conflict_strategy: props.dataSource.conflict_strategy,
|
||||
sync_deletions: props.dataSource.sync_deletions,
|
||||
}
|
||||
selectedResourceIds.value = form.value.config?.resource_ids || []
|
||||
tempDsId.value = props.dataSource.id
|
||||
} else {
|
||||
form.value = {
|
||||
name: '',
|
||||
type: '',
|
||||
config: { credentials: {}, resource_ids: [], settings: {} },
|
||||
sync_schedule: '0 0 */6 * * *',
|
||||
sync_mode: 'incremental',
|
||||
conflict_strategy: 'overwrite',
|
||||
sync_deletions: true,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function selectType(def: ConnectorDef) {
|
||||
if (!def.available) return
|
||||
form.value.type = def.type
|
||||
form.value.name = t(`datasource.connector.${def.type}`)
|
||||
step.value = 1
|
||||
}
|
||||
|
||||
// --- Test connection (stateless, no DB write) ---
|
||||
async function testConnection() {
|
||||
const fields = currentDef.value?.fields || []
|
||||
for (const f of fields) {
|
||||
if (!form.value.config.credentials[f.key]) {
|
||||
MessagePlugin.warning(`${t(f.labelKey)} ${t('datasource.isRequired')}`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
testing.value = true
|
||||
testResult.value = ''
|
||||
testErrorMsg.value = ''
|
||||
try {
|
||||
if (isEdit.value && tempDsId.value) {
|
||||
await updateDataSource(tempDsId.value, {
|
||||
...form.value,
|
||||
knowledge_base_id: props.kbId,
|
||||
} as any)
|
||||
await validateConnection(tempDsId.value)
|
||||
} else {
|
||||
await validateCredentials(form.value.type, form.value.config.credentials)
|
||||
}
|
||||
testResult.value = 'success'
|
||||
MessagePlugin.success(t('datasource.testSuccess'))
|
||||
} catch (e: any) {
|
||||
testResult.value = 'error'
|
||||
testErrorMsg.value = e?.response?.data?.error || e?.message || ''
|
||||
MessagePlugin.error(t('datasource.testFailed'))
|
||||
}
|
||||
testing.value = false
|
||||
}
|
||||
|
||||
// --- Load resources ---
|
||||
async function loadResources() {
|
||||
loadingResources.value = true
|
||||
try {
|
||||
if (!tempDsId.value) {
|
||||
const res = await createDataSource({
|
||||
...form.value,
|
||||
knowledge_base_id: props.kbId,
|
||||
status: 'paused',
|
||||
} as any)
|
||||
const created = res?.data || res
|
||||
tempDsId.value = created.id
|
||||
} else if (!isEdit.value) {
|
||||
await updateDataSource(tempDsId.value, {
|
||||
...form.value,
|
||||
knowledge_base_id: props.kbId,
|
||||
} as any)
|
||||
}
|
||||
|
||||
const res = await listResources(tempDsId.value)
|
||||
resources.value = res?.data || res || []
|
||||
} catch {
|
||||
MessagePlugin.error(t('datasource.resourceLoadFailed'))
|
||||
}
|
||||
loadingResources.value = false
|
||||
}
|
||||
|
||||
function toggleResource(id: string) {
|
||||
const idx = selectedResourceIds.value.indexOf(id)
|
||||
if (idx >= 0) {
|
||||
selectedResourceIds.value.splice(idx, 1)
|
||||
} else {
|
||||
selectedResourceIds.value.push(id)
|
||||
}
|
||||
}
|
||||
|
||||
function validateStep1Fields(): boolean {
|
||||
const fields = currentDef.value?.fields || []
|
||||
for (const f of fields) {
|
||||
if (!form.value.config.credentials[f.key]) {
|
||||
MessagePlugin.warning(`${t(f.labelKey)} ${t('datasource.isRequired')}`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function nextStep() {
|
||||
if (step.value === 1) {
|
||||
if (!validateStep1Fields()) return
|
||||
if (testResult.value !== 'success') {
|
||||
MessagePlugin.warning(t('datasource.pleaseTestFirst'))
|
||||
return
|
||||
}
|
||||
}
|
||||
step.value++
|
||||
if (step.value === 2) {
|
||||
loadResources()
|
||||
}
|
||||
}
|
||||
|
||||
function prevStep() {
|
||||
step.value--
|
||||
}
|
||||
|
||||
// --- Final submit ---
|
||||
async function handleSubmit() {
|
||||
form.value.config.resource_ids = selectedResourceIds.value
|
||||
submitting.value = true
|
||||
try {
|
||||
if (tempDsId.value) {
|
||||
await updateDataSource(tempDsId.value, {
|
||||
...form.value,
|
||||
knowledge_base_id: props.kbId,
|
||||
status: 'active',
|
||||
} as any)
|
||||
} else {
|
||||
await createDataSource({
|
||||
...form.value,
|
||||
knowledge_base_id: props.kbId,
|
||||
status: 'active',
|
||||
} as any)
|
||||
}
|
||||
MessagePlugin.success(isEdit.value ? t('datasource.updateSuccess') : t('datasource.createSuccess'))
|
||||
emit('saved')
|
||||
visible.value = false
|
||||
} catch (e: any) {
|
||||
MessagePlugin.error(e?.message || t('datasource.saveFailed'))
|
||||
}
|
||||
submitting.value = false
|
||||
}
|
||||
|
||||
// --- Cleanup on dialog close ---
|
||||
async function handleClose() {
|
||||
if (!isEdit.value && tempDsId.value) {
|
||||
try {
|
||||
await deleteDataSource(tempDsId.value)
|
||||
} catch {
|
||||
// Ignore cleanup errors
|
||||
}
|
||||
tempDsId.value = ''
|
||||
}
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
const stepTitles = computed(() => [
|
||||
t('datasource.step.selectType'),
|
||||
t('datasource.step.credentials'),
|
||||
t('datasource.step.resources'),
|
||||
t('datasource.step.strategy'),
|
||||
])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<t-dialog
|
||||
v-model:visible="visible"
|
||||
:header="isEdit ? t('datasource.editTitle') : t('datasource.createTitle')"
|
||||
:footer="false"
|
||||
width="640px"
|
||||
destroy-on-close
|
||||
:on-close="handleClose"
|
||||
>
|
||||
<!-- Step indicator -->
|
||||
<div class="ds-steps">
|
||||
<div
|
||||
v-for="(title, i) in stepTitles"
|
||||
:key="i"
|
||||
:class="['ds-step', { active: step === i, done: step > i }]"
|
||||
>
|
||||
<span class="ds-step-num">{{ step > i ? '✓' : i + 1 }}</span>
|
||||
<span class="ds-step-title">{{ title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 0: Select connector type -->
|
||||
<div v-if="step === 0" class="ds-step-content">
|
||||
<div class="ds-type-grid">
|
||||
<div
|
||||
v-for="def in connectorDefs"
|
||||
:key="def.type"
|
||||
:class="['ds-type-card', { disabled: !def.available }]"
|
||||
@click="selectType(def)"
|
||||
>
|
||||
<div class="ds-type-header">
|
||||
<span class="ds-type-name">{{ t(`datasource.connector.${def.type}`) }}</span>
|
||||
<span v-if="!def.available" class="ds-type-soon">{{ t('datasource.comingSoon') }}</span>
|
||||
</div>
|
||||
<div class="ds-type-desc">{{ t(`datasource.connectorDesc.${def.type}`) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 1: Credentials -->
|
||||
<div v-if="step === 1" class="ds-step-content">
|
||||
<!-- Compact collapsible prereq hint -->
|
||||
<div v-if="currentDef && currentDef.requiredPermissions.length > 0" class="ds-prereq-bar" @click="prereqExpanded = !prereqExpanded">
|
||||
<t-icon name="help-circle" size="14px" />
|
||||
<span>{{ t('datasource.prereqBarText') }}</span>
|
||||
<t-icon :name="prereqExpanded ? 'chevron-up' : 'chevron-down'" size="14px" class="ds-prereq-arrow" />
|
||||
</div>
|
||||
<div v-if="prereqExpanded && currentDef" class="ds-prereq-detail">
|
||||
<div class="ds-prereq-item">
|
||||
<span class="ds-prereq-num">1</span>
|
||||
<div>
|
||||
<div class="ds-prereq-item-title">{{ t('datasource.prereqBotBrief') }}</div>
|
||||
<div class="ds-prereq-item-desc">{{ t('datasource.prereqBotDesc') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ds-prereq-item">
|
||||
<span class="ds-prereq-num">2</span>
|
||||
<div>
|
||||
<div class="ds-prereq-item-title">{{ t('datasource.prereqPermBrief') }}</div>
|
||||
<div class="ds-prereq-item-desc">
|
||||
<code v-for="perm in currentDef.requiredPermissions" :key="perm" class="ds-perm-tag">{{ perm }}</code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ds-prereq-item">
|
||||
<span class="ds-prereq-num">3</span>
|
||||
<div>
|
||||
<div class="ds-prereq-item-title">{{ t('datasource.prereqMemberBrief') }}</div>
|
||||
<div class="ds-prereq-item-desc">{{ t('datasource.prereqMemberDesc') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<a :href="currentDef.permissionPageUrl" target="_blank" rel="noopener" class="ds-prereq-link">
|
||||
{{ t('datasource.prereqOpenConsole') }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ t('datasource.nameLabel') }}</label>
|
||||
<t-input v-model="form.name" :placeholder="t('datasource.namePlaceholder')" />
|
||||
</div>
|
||||
|
||||
<div v-if="currentDef?.docUrl" class="ds-doc-link">
|
||||
<t-icon name="info-circle" size="14px" />
|
||||
<span>{{ t('datasource.docHint') }}</span>
|
||||
<a :href="currentDef.docUrl" target="_blank" rel="noopener">{{ currentDef.docUrl }}</a>
|
||||
</div>
|
||||
|
||||
<div v-for="field in currentDef?.fields || []" :key="field.key" class="form-item">
|
||||
<label class="form-label">{{ t(field.labelKey) }}</label>
|
||||
<t-input
|
||||
v-model="form.config.credentials[field.key]"
|
||||
:placeholder="field.placeholder"
|
||||
:type="field.secret ? 'password' : 'text'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<t-button variant="outline" :loading="testing" @click="testConnection">
|
||||
{{ t('datasource.testConnection') }}
|
||||
</t-button>
|
||||
<span v-if="testResult === 'success'" class="test-ok">{{ t('datasource.connected') }}</span>
|
||||
<span v-if="testResult === 'error'" class="test-fail">
|
||||
{{ t('datasource.connectionFailed') }}
|
||||
<span v-if="testErrorMsg" class="test-error-detail">- {{ testErrorMsg }}</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="ds-dialog-footer">
|
||||
<t-button variant="outline" @click="step = 0" v-if="!isEdit">{{ t('datasource.back') }}</t-button>
|
||||
<t-button theme="primary" @click="nextStep">{{ t('datasource.next') }}</t-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 2: Select resources -->
|
||||
<div v-if="step === 2" class="ds-step-content">
|
||||
<p class="form-tip">{{ t('datasource.resourceHint') }}</p>
|
||||
<div v-if="loadingResources" style="text-align:center;padding:20px"><t-loading /></div>
|
||||
<div v-else-if="resources.length > 0" class="ds-resource-list">
|
||||
<div
|
||||
v-for="r in resources"
|
||||
:key="r.external_id"
|
||||
:class="['ds-resource-row', { selected: selectedResourceIds.includes(r.external_id) }]"
|
||||
@click="toggleResource(r.external_id)"
|
||||
>
|
||||
<t-checkbox
|
||||
:checked="selectedResourceIds.includes(r.external_id)"
|
||||
@click.stop
|
||||
@change="toggleResource(r.external_id)"
|
||||
/>
|
||||
<div class="ds-resource-info">
|
||||
<div class="ds-resource-name">{{ r.name }}</div>
|
||||
<div class="ds-resource-meta">
|
||||
<span class="ds-resource-type">{{ r.type === 'wiki_space' ? t('datasource.wikiSpace') : r.type }}</span>
|
||||
<span v-if="r.description" class="ds-resource-desc">{{ r.description }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Empty state: concise guide -->
|
||||
<div v-else class="ds-resource-empty">
|
||||
<t-icon name="info-circle" size="32px" style="color: var(--td-warning-color); margin-bottom: 8px;" />
|
||||
<p class="ds-empty-title">{{ t('datasource.noResources') }}</p>
|
||||
<p class="ds-empty-desc">{{ t('datasource.noResourcesDesc') }}</p>
|
||||
<div class="ds-guide-steps">
|
||||
<div class="ds-guide-step">
|
||||
<span class="ds-guide-num">1</span>
|
||||
<span>{{ t('datasource.guideStep1') }}</span>
|
||||
</div>
|
||||
<div class="ds-guide-step">
|
||||
<span class="ds-guide-num">2</span>
|
||||
<span>{{ t('datasource.guideStep2') }}</span>
|
||||
</div>
|
||||
<div class="ds-guide-step">
|
||||
<span class="ds-guide-num">3</span>
|
||||
<span>{{ t('datasource.guideStep3') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ds-empty-actions">
|
||||
<t-button variant="outline" size="small" @click="loadResources">
|
||||
{{ t('datasource.retryLoadResources') }}
|
||||
</t-button>
|
||||
<a v-if="currentDef?.permissionDocUrl" :href="currentDef.permissionDocUrl" target="_blank" rel="noopener" class="ds-doc-link-inline">
|
||||
{{ t('datasource.permissionDocLink') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ds-dialog-footer">
|
||||
<t-button variant="outline" @click="prevStep">{{ t('datasource.back') }}</t-button>
|
||||
<t-button theme="primary" @click="nextStep">{{ t('datasource.next') }}</t-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 3: Sync strategy -->
|
||||
<div v-if="step === 3" class="ds-step-content">
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ t('datasource.syncScheduleLabel') }}</label>
|
||||
<t-select v-model="form.sync_schedule">
|
||||
<t-option v-for="p in schedulePresets" :key="p.value" :value="p.value" :label="p.label" />
|
||||
</t-select>
|
||||
</div>
|
||||
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ t('datasource.syncModeLabel') }}</label>
|
||||
<t-radio-group v-model="form.sync_mode">
|
||||
<t-radio value="incremental">{{ t('datasource.syncMode.incremental') }}</t-radio>
|
||||
<t-radio value="full">{{ t('datasource.syncMode.full') }}</t-radio>
|
||||
</t-radio-group>
|
||||
</div>
|
||||
|
||||
<div class="form-item">
|
||||
<label class="form-label">{{ t('datasource.conflictLabel') }}</label>
|
||||
<t-radio-group v-model="form.conflict_strategy">
|
||||
<t-radio value="overwrite">{{ t('datasource.conflict.overwrite') }}</t-radio>
|
||||
<t-radio value="skip">{{ t('datasource.conflict.skip') }}</t-radio>
|
||||
</t-radio-group>
|
||||
</div>
|
||||
|
||||
<div class="form-item">
|
||||
<t-checkbox v-model="form.sync_deletions">{{ t('datasource.syncDeletions') }}</t-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="ds-dialog-footer">
|
||||
<t-button variant="outline" @click="prevStep">{{ t('datasource.back') }}</t-button>
|
||||
<t-button theme="primary" :loading="submitting" @click="handleSubmit">
|
||||
{{ isEdit ? t('datasource.save') : t('datasource.createAndSync') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</t-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ds-steps {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
margin-bottom: 24px;
|
||||
border-bottom: 1px solid var(--td-border-level-2-color);
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.ds-step {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.ds-step.active { color: var(--td-brand-color); font-weight: 600; }
|
||||
.ds-step.done { color: var(--td-success-color); }
|
||||
|
||||
.ds-step-num {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
border: 1px solid currentColor;
|
||||
}
|
||||
|
||||
.ds-step.active .ds-step-num { background: var(--td-brand-color); color: #fff; border-color: var(--td-brand-color); }
|
||||
.ds-step.done .ds-step-num { background: var(--td-success-color); color: #fff; border-color: var(--td-success-color); }
|
||||
|
||||
.ds-step-content { min-height: 200px; }
|
||||
|
||||
/* --- Step 0: type cards --- */
|
||||
.ds-type-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.ds-type-card {
|
||||
border: 1px solid var(--td-border-level-2-color);
|
||||
border-radius: 8px;
|
||||
padding: 14px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.ds-type-card:hover:not(.disabled) { border-color: var(--td-brand-color); background: var(--td-brand-color-light); }
|
||||
.ds-type-card.disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
.ds-type-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
|
||||
.ds-type-name { font-size: 13px; font-weight: 600; }
|
||||
.ds-type-soon { font-size: 10px; color: var(--td-text-color-placeholder); background: var(--td-bg-color-component); padding: 1px 6px; border-radius: 3px; }
|
||||
.ds-type-desc { font-size: 11px; color: var(--td-text-color-secondary); }
|
||||
|
||||
/* --- Step 1: collapsible prereq --- */
|
||||
.ds-prereq-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 16px;
|
||||
border-radius: 6px;
|
||||
background: var(--td-warning-color-1);
|
||||
color: var(--td-warning-color);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.ds-prereq-bar:hover {
|
||||
background: var(--td-warning-color-2);
|
||||
}
|
||||
|
||||
.ds-prereq-arrow {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.ds-prereq-detail {
|
||||
border: 1px solid var(--td-border-level-2-color);
|
||||
border-radius: 8px;
|
||||
padding: 14px;
|
||||
margin-bottom: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.ds-prereq-item {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.ds-prereq-num {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background: var(--td-brand-color);
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.ds-prereq-item-title {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--td-text-color-primary);
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.ds-prereq-item-desc {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
margin-top: 2px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ds-perm-tag {
|
||||
font-size: 11px;
|
||||
padding: 1px 5px;
|
||||
border-radius: 3px;
|
||||
background: var(--td-bg-color-component);
|
||||
color: var(--td-text-color-secondary);
|
||||
font-family: monospace;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.ds-prereq-link {
|
||||
font-size: 12px;
|
||||
color: var(--td-brand-color);
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
/* --- Step 1: doc link & form --- */
|
||||
.ds-doc-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
background: var(--td-bg-color-component);
|
||||
padding: 8px 12px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.ds-doc-link a {
|
||||
color: var(--td-brand-color);
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.form-item { margin-bottom: 16px; }
|
||||
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--td-text-color-primary); }
|
||||
.form-tip { font-size: 12px; color: var(--td-text-color-placeholder); margin: 4px 0 12px; }
|
||||
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
|
||||
.test-ok { color: #00a870; font-size: 13px; }
|
||||
.test-fail { color: #e34d59; font-size: 13px; }
|
||||
.test-error-detail { font-size: 11px; color: var(--td-text-color-placeholder); }
|
||||
|
||||
.ds-dialog-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--td-border-level-2-color); }
|
||||
|
||||
/* --- Step 2: resource list --- */
|
||||
.ds-resource-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
|
||||
|
||||
.ds-resource-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.ds-resource-row:hover {
|
||||
background: var(--td-bg-color-container-hover);
|
||||
}
|
||||
|
||||
.ds-resource-row.selected {
|
||||
border-color: var(--td-brand-color);
|
||||
background: none;
|
||||
}
|
||||
|
||||
.ds-resource-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ds-resource-name {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--td-text-color-primary);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.ds-resource-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.ds-resource-type {
|
||||
font-size: 11px;
|
||||
padding: 0 5px;
|
||||
border-radius: 3px;
|
||||
background: var(--td-bg-color-component);
|
||||
color: var(--td-text-color-placeholder);
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.ds-resource-desc {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* --- Step 2: empty state --- */
|
||||
.ds-resource-empty {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
}
|
||||
|
||||
.ds-empty-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-primary);
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
.ds-empty-desc {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
|
||||
.ds-guide-steps {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
text-align: left;
|
||||
max-width: 440px;
|
||||
margin: 0 auto 16px;
|
||||
}
|
||||
|
||||
.ds-guide-step {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-primary);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ds-guide-num {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background: var(--td-brand-color-light);
|
||||
color: var(--td-brand-color);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.ds-empty-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.ds-doc-link-inline {
|
||||
color: var(--td-brand-color);
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,489 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import {
|
||||
listDataSources,
|
||||
deleteDataSource,
|
||||
triggerSync,
|
||||
pauseDataSource,
|
||||
resumeDataSource,
|
||||
type DataSource,
|
||||
} from '@/api/datasource'
|
||||
import { humanizeCron, relativeTime } from '@/utils/cronHumanize'
|
||||
import DataSourceEditorDialog from './DataSourceEditorDialog.vue'
|
||||
import DataSourceSyncLogs from './DataSourceSyncLogs.vue'
|
||||
|
||||
const props = defineProps<{ kbId: string }>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const dataSources = ref<DataSource[]>([])
|
||||
const loading = ref(false)
|
||||
const editorVisible = ref(false)
|
||||
const editingDs = ref<DataSource | null>(null)
|
||||
const logsVisible = ref(false)
|
||||
const logsDsId = ref('')
|
||||
const logsDsName = ref('')
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listDataSources(props.kbId)
|
||||
dataSources.value = res?.data || res || []
|
||||
} catch (e: any) {
|
||||
console.error(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function openCreate() {
|
||||
editingDs.value = null
|
||||
editorVisible.value = true
|
||||
}
|
||||
|
||||
function openEdit(ds: DataSource) {
|
||||
editingDs.value = ds
|
||||
editorVisible.value = true
|
||||
}
|
||||
|
||||
function openLogs(ds: DataSource) {
|
||||
logsDsId.value = ds.id
|
||||
logsDsName.value = ds.name
|
||||
logsVisible.value = true
|
||||
}
|
||||
|
||||
async function handleDelete(ds: DataSource) {
|
||||
try {
|
||||
await deleteDataSource(ds.id)
|
||||
MessagePlugin.success(t('datasource.deleteSuccess'))
|
||||
loadList()
|
||||
} catch {
|
||||
MessagePlugin.error(t('datasource.deleteFailed'))
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSync(ds: DataSource) {
|
||||
try {
|
||||
await triggerSync(ds.id)
|
||||
MessagePlugin.success(t('datasource.syncTriggered'))
|
||||
loadList()
|
||||
} catch {
|
||||
MessagePlugin.error(t('datasource.syncFailed'))
|
||||
}
|
||||
}
|
||||
|
||||
async function handlePause(ds: DataSource) {
|
||||
try {
|
||||
await pauseDataSource(ds.id)
|
||||
MessagePlugin.success(t('datasource.paused'))
|
||||
loadList()
|
||||
} catch {
|
||||
MessagePlugin.error(t('datasource.pauseFailed'))
|
||||
}
|
||||
}
|
||||
|
||||
async function handleResume(ds: DataSource) {
|
||||
try {
|
||||
await resumeDataSource(ds.id)
|
||||
MessagePlugin.success(t('datasource.resumed'))
|
||||
loadList()
|
||||
} catch {
|
||||
MessagePlugin.error(t('datasource.resumeFailed'))
|
||||
}
|
||||
}
|
||||
|
||||
function statusColor(status: string) {
|
||||
if (status === 'active') return 'var(--td-success-color)'
|
||||
if (status === 'error') return 'var(--td-error-color)'
|
||||
return 'var(--td-text-color-placeholder)'
|
||||
}
|
||||
|
||||
function statusLabel(status: string) {
|
||||
return t(`datasource.status.${status}`)
|
||||
}
|
||||
|
||||
function syncModeLabel(mode: string) {
|
||||
return t(`datasource.syncMode.${mode}`)
|
||||
}
|
||||
|
||||
function connectorLabel(type: string) {
|
||||
return t(`datasource.connector.${type}`) || type
|
||||
}
|
||||
|
||||
function scheduleLabel(cron: string) {
|
||||
return humanizeCron(cron, t)
|
||||
}
|
||||
|
||||
function lastSyncTime(ds: DataSource) {
|
||||
return relativeTime(ds.last_sync_at, t)
|
||||
}
|
||||
|
||||
function lastSyncFullTime(ds: DataSource) {
|
||||
if (!ds.last_sync_at) return ''
|
||||
return new Date(ds.last_sync_at).toLocaleString()
|
||||
}
|
||||
|
||||
// Build sync result pills from latest_sync_log
|
||||
function syncResultPills(ds: DataSource) {
|
||||
const log = ds.latest_sync_log
|
||||
if (!log) return []
|
||||
const pills: { text: string; cls: string }[] = []
|
||||
if (log.items_created > 0) pills.push({ text: `+${log.items_created}`, cls: 'created' })
|
||||
if (log.items_updated > 0) pills.push({ text: `~${log.items_updated}`, cls: 'updated' })
|
||||
if (log.items_deleted > 0) pills.push({ text: `-${log.items_deleted}`, cls: 'deleted' })
|
||||
if (log.items_failed > 0) pills.push({ text: `${log.items_failed} ${t('datasource.logMetric.failed')}`, cls: 'failed' })
|
||||
if (log.items_skipped > 0) pills.push({ text: `${log.items_skipped} ${t('datasource.logMetric.skipped')}`, cls: 'skipped' })
|
||||
return pills
|
||||
}
|
||||
|
||||
function lastSyncStatusLabel(ds: DataSource) {
|
||||
const log = ds.latest_sync_log
|
||||
if (!log) return '--'
|
||||
return t(`datasource.logStatus.${log.status}`)
|
||||
}
|
||||
|
||||
function lastSyncStatusColor(ds: DataSource) {
|
||||
const log = ds.latest_sync_log
|
||||
if (!log) return ''
|
||||
switch (log.status) {
|
||||
case 'success': return 'var(--td-success-color)'
|
||||
case 'failed': return 'var(--td-error-color)'
|
||||
case 'running': return 'var(--td-brand-color)'
|
||||
case 'partial': return 'var(--td-warning-color)'
|
||||
default: return ''
|
||||
}
|
||||
}
|
||||
|
||||
function onEditorSaved() {
|
||||
editorVisible.value = false
|
||||
loadList()
|
||||
}
|
||||
|
||||
onMounted(loadList)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="ds-settings">
|
||||
<!-- Section header: title only, no button here -->
|
||||
<div class="section-header">
|
||||
<h2 class="section-title">{{ t('datasource.title') }}</h2>
|
||||
<p class="section-desc">{{ t('datasource.description') }}</p>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="ds-loading">
|
||||
<t-loading />
|
||||
</div>
|
||||
|
||||
<div v-else-if="dataSources.length === 0" class="ds-empty">
|
||||
<t-icon name="cloud-download" size="48px" style="color: var(--td-text-color-placeholder)" />
|
||||
<p>{{ t('datasource.empty') }}</p>
|
||||
<t-button variant="outline" @click="openCreate">{{ t('datasource.addFirst') }}</t-button>
|
||||
</div>
|
||||
|
||||
<div v-else class="ds-list">
|
||||
<!-- Data source cards -->
|
||||
<div v-for="ds in dataSources" :key="ds.id" class="ds-card">
|
||||
<div class="ds-card-header">
|
||||
<div class="ds-card-title">
|
||||
<span class="ds-type-badge">{{ connectorLabel(ds.type) }}</span>
|
||||
<span class="ds-name">{{ ds.name }}</span>
|
||||
</div>
|
||||
<div class="ds-card-header-right">
|
||||
<div class="ds-status">
|
||||
<span class="ds-status-dot" :style="{ background: statusColor(ds.status) }"></span>
|
||||
{{ statusLabel(ds.status) }}
|
||||
</div>
|
||||
<t-dropdown trigger="click" :min-column-width="100">
|
||||
<t-button size="small" variant="text" shape="square">
|
||||
<template #icon><t-icon name="more" /></template>
|
||||
</t-button>
|
||||
<template #dropdown>
|
||||
<t-dropdown-menu>
|
||||
<t-dropdown-item @click="openEdit(ds)">
|
||||
<t-icon name="edit" /> {{ t('datasource.edit') }}
|
||||
</t-dropdown-item>
|
||||
<t-dropdown-item @click="openLogs(ds)">
|
||||
<t-icon name="history" /> {{ t('datasource.logs') }}
|
||||
</t-dropdown-item>
|
||||
<t-dropdown-item
|
||||
v-if="ds.status === 'active'"
|
||||
@click="handlePause(ds)"
|
||||
>
|
||||
<t-icon name="pause-circle" /> {{ t('datasource.pause') }}
|
||||
</t-dropdown-item>
|
||||
<t-dropdown-item
|
||||
v-else-if="ds.status === 'paused'"
|
||||
@click="handleResume(ds)"
|
||||
>
|
||||
<t-icon name="play-circle" /> {{ t('datasource.resume') }}
|
||||
</t-dropdown-item>
|
||||
<t-dropdown-item theme="error" @click="handleDelete(ds)">
|
||||
<t-icon name="delete" /> {{ t('datasource.delete') }}
|
||||
</t-dropdown-item>
|
||||
</t-dropdown-menu>
|
||||
</template>
|
||||
</t-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info grid -->
|
||||
<div class="ds-card-body">
|
||||
<div class="ds-info-cell">
|
||||
<span class="ds-info-label">{{ t('datasource.syncModeLabel') }}</span>
|
||||
<span class="ds-info-value">{{ syncModeLabel(ds.sync_mode) }}</span>
|
||||
</div>
|
||||
<div class="ds-info-cell">
|
||||
<span class="ds-info-label">{{ t('datasource.schedule') }}</span>
|
||||
<span class="ds-info-value">{{ scheduleLabel(ds.sync_schedule) }}</span>
|
||||
</div>
|
||||
<div class="ds-info-cell">
|
||||
<span class="ds-info-label">{{ t('datasource.lastSync') }}</span>
|
||||
<span class="ds-info-value" :title="lastSyncFullTime(ds)">{{ lastSyncTime(ds) }}</span>
|
||||
</div>
|
||||
<div class="ds-info-cell">
|
||||
<span class="ds-info-label">{{ t('datasource.lastStatus') }}</span>
|
||||
<span class="ds-info-value">
|
||||
<span v-if="ds.latest_sync_log" :style="{ color: lastSyncStatusColor(ds) }">{{ lastSyncStatusLabel(ds) }}</span>
|
||||
<span v-else>--</span>
|
||||
<span v-for="pill in syncResultPills(ds)" :key="pill.cls" :class="['ds-pill', pill.cls]">{{ pill.text }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="ds.error_message" class="ds-error">
|
||||
<t-icon name="error-circle" size="14px" />
|
||||
{{ ds.error_message }}
|
||||
</div>
|
||||
|
||||
<!-- Quick action -->
|
||||
<div class="ds-card-footer">
|
||||
<t-button size="small" variant="outline" theme="primary" @click="handleSync(ds)">
|
||||
<template #icon><t-icon name="refresh" /></template>
|
||||
{{ t('datasource.syncNow') }}
|
||||
</t-button>
|
||||
<t-button size="small" variant="text" @click="openLogs(ds)">
|
||||
{{ t('datasource.logs') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add card at the end -->
|
||||
<div class="ds-card-add" @click="openCreate">
|
||||
<t-icon name="add" size="20px" />
|
||||
<span>{{ t('datasource.addCard') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Editor dialog -->
|
||||
<DataSourceEditorDialog
|
||||
v-model:visible="editorVisible"
|
||||
:kb-id="kbId"
|
||||
:data-source="editingDs"
|
||||
@saved="onEditorSaved"
|
||||
/>
|
||||
|
||||
<!-- Sync logs drawer -->
|
||||
<DataSourceSyncLogs
|
||||
v-model:visible="logsVisible"
|
||||
:data-source-id="logsDsId"
|
||||
:data-source-name="logsDsName"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ds-settings {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* --- Section header: matches KBModelConfig / KBStorageSettings pattern --- */
|
||||
.section-header {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
|
||||
.section-desc {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
/* --- Loading / Empty --- */
|
||||
.ds-loading, .ds-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 60px 0;
|
||||
gap: 12px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
/* --- List --- */
|
||||
.ds-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
/* --- Card --- */
|
||||
.ds-card {
|
||||
border: 1px solid var(--td-border-level-2-color);
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.ds-card:hover {
|
||||
border-color: var(--td-brand-color-hover);
|
||||
}
|
||||
|
||||
.ds-card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.ds-card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ds-type-badge {
|
||||
font-size: 11px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
background: var(--td-brand-color-light);
|
||||
color: var(--td-brand-color);
|
||||
font-weight: 500;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ds-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-primary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ds-card-header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ds-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
|
||||
.ds-status-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* --- Info grid --- */
|
||||
.ds-card-body {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px 24px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.ds-info-cell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.ds-info-label {
|
||||
font-size: 11px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.ds-info-value {
|
||||
font-size: 13px;
|
||||
color: var(--td-text-color-primary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* --- Sync result pills --- */
|
||||
.ds-pill {
|
||||
font-size: 11px;
|
||||
padding: 0 5px;
|
||||
border-radius: 3px;
|
||||
font-weight: 500;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.ds-pill.created { background: var(--td-success-color-1); color: var(--td-success-color); }
|
||||
.ds-pill.updated { background: var(--td-brand-color-light); color: var(--td-brand-color); }
|
||||
.ds-pill.deleted { background: var(--td-warning-color-1); color: var(--td-warning-color); }
|
||||
.ds-pill.skipped { background: var(--td-bg-color-component); color: var(--td-text-color-placeholder); }
|
||||
.ds-pill.failed { background: var(--td-error-color-1); color: var(--td-error-color); }
|
||||
|
||||
/* --- Error --- */
|
||||
.ds-error {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
color: var(--td-error-color);
|
||||
font-size: 12px;
|
||||
background: var(--td-error-color-1);
|
||||
padding: 6px 10px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
/* --- Footer actions --- */
|
||||
.ds-card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border-top: 1px solid var(--td-border-level-2-color);
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
/* --- Add card --- */
|
||||
.ds-card-add {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 12px;
|
||||
border: 1px dashed var(--td-border-level-2-color);
|
||||
border-radius: 8px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.ds-card-add:hover {
|
||||
border-color: var(--td-brand-color);
|
||||
color: var(--td-brand-color);
|
||||
background: var(--td-brand-color-light);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,446 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getSyncLogs, type SyncLog } from '@/api/datasource'
|
||||
|
||||
const props = defineProps<{
|
||||
dataSourceId: string
|
||||
dataSourceName?: string
|
||||
}>()
|
||||
const visible = defineModel<boolean>('visible', { default: false })
|
||||
const { t } = useI18n()
|
||||
|
||||
const logs = ref<SyncLog[]>([])
|
||||
const loading = ref(false)
|
||||
const expandedId = ref('')
|
||||
|
||||
watch(visible, async (v) => {
|
||||
if (!v || !props.dataSourceId) return
|
||||
expandedId.value = ''
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getSyncLogs(props.dataSourceId, 50, 0)
|
||||
logs.value = res?.data || res || []
|
||||
} catch { /* ignore */ }
|
||||
loading.value = false
|
||||
})
|
||||
|
||||
function toggleExpand(id: string) {
|
||||
expandedId.value = expandedId.value === id ? '' : id
|
||||
}
|
||||
|
||||
// --- Stats ---
|
||||
const stats = computed(() => {
|
||||
const total = logs.value.length
|
||||
const success = logs.value.filter(l => l.status === 'success').length
|
||||
const failed = logs.value.filter(l => l.status === 'failed').length
|
||||
const totalItems = logs.value.reduce((acc, l) => acc + (l.items_created || 0) + (l.items_updated || 0), 0)
|
||||
return { total, success, failed, totalItems }
|
||||
})
|
||||
|
||||
// --- Helpers ---
|
||||
function statusIcon(status: string) {
|
||||
switch (status) {
|
||||
case 'success': return 'check-circle-filled'
|
||||
case 'running': return 'loading'
|
||||
case 'failed': return 'close-circle-filled'
|
||||
case 'partial': return 'error-circle-filled'
|
||||
case 'canceled': return 'minus-circle-filled'
|
||||
default: return 'info-circle-filled'
|
||||
}
|
||||
}
|
||||
|
||||
function statusColor(status: string) {
|
||||
switch (status) {
|
||||
case 'success': return 'var(--td-success-color)'
|
||||
case 'running': return 'var(--td-brand-color)'
|
||||
case 'failed': return 'var(--td-error-color)'
|
||||
case 'partial': return 'var(--td-warning-color)'
|
||||
default: return 'var(--td-text-color-placeholder)'
|
||||
}
|
||||
}
|
||||
|
||||
function formatTime(ts: string | null) {
|
||||
if (!ts) return '--'
|
||||
const d = new Date(ts)
|
||||
if (isNaN(d.getTime())) return '--'
|
||||
return d.toLocaleString(undefined, {
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
hour12: false,
|
||||
})
|
||||
}
|
||||
|
||||
function formatDate(ts: string | null) {
|
||||
if (!ts) return ''
|
||||
const d = new Date(ts)
|
||||
if (isNaN(d.getTime())) return ''
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
return `${pad(d.getMonth() + 1)}-${pad(d.getDate())}`
|
||||
}
|
||||
|
||||
function formatHourMin(ts: string | null) {
|
||||
if (!ts) return ''
|
||||
const d = new Date(ts)
|
||||
if (isNaN(d.getTime())) return ''
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
return `${pad(d.getHours())}:${pad(d.getMinutes())}`
|
||||
}
|
||||
|
||||
function duration(log: SyncLog) {
|
||||
if (!log.started_at || !log.finished_at) return '--'
|
||||
const ms = new Date(log.finished_at).getTime() - new Date(log.started_at).getTime()
|
||||
if (ms < 1000) return `<1s`
|
||||
const sec = Math.round(ms / 1000)
|
||||
if (sec < 60) return `${sec}s`
|
||||
return `${Math.floor(sec / 60)}m${sec % 60}s`
|
||||
}
|
||||
|
||||
function hasPills(log: SyncLog) {
|
||||
return log.items_created > 0 || log.items_updated > 0 || log.items_deleted > 0 || log.items_skipped > 0 || log.items_failed > 0
|
||||
}
|
||||
|
||||
// Group logs by date
|
||||
const groupedLogs = computed(() => {
|
||||
const groups: { date: string; logs: SyncLog[] }[] = []
|
||||
let currentDate = ''
|
||||
for (const log of logs.value) {
|
||||
const d = formatDate(log.started_at)
|
||||
if (d !== currentDate) {
|
||||
currentDate = d
|
||||
groups.push({ date: d, logs: [] })
|
||||
}
|
||||
groups[groups.length - 1].logs.push(log)
|
||||
}
|
||||
return groups
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<t-drawer
|
||||
v-model:visible="visible"
|
||||
:header="props.dataSourceName ? `${t('datasource.syncHistory')} · ${props.dataSourceName}` : t('datasource.syncHistory')"
|
||||
size="480px"
|
||||
destroy-on-close
|
||||
class="ds-logs-drawer"
|
||||
>
|
||||
<div v-if="loading" style="text-align:center;padding:60px"><t-loading /></div>
|
||||
|
||||
<div v-else-if="logs.length === 0" class="logs-empty">
|
||||
<t-icon name="history" size="40px" />
|
||||
<p>{{ t('datasource.noLogs') }}</p>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<!-- Summary -->
|
||||
<div class="logs-summary">
|
||||
<div class="summary-stat">
|
||||
<span class="stat-num">{{ stats.total }}</span>
|
||||
<span class="stat-label">{{ t('datasource.logSummary.total') }}</span>
|
||||
</div>
|
||||
<div class="summary-stat">
|
||||
<span class="stat-num success">{{ stats.success }}</span>
|
||||
<span class="stat-label">{{ t('datasource.logSummary.success') }}</span>
|
||||
</div>
|
||||
<div class="summary-stat">
|
||||
<span class="stat-num error">{{ stats.failed }}</span>
|
||||
<span class="stat-label">{{ t('datasource.logSummary.failed') }}</span>
|
||||
</div>
|
||||
<div class="summary-stat">
|
||||
<span class="stat-num">{{ stats.totalItems }}</span>
|
||||
<span class="stat-label">{{ t('datasource.logSummary.items') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Timeline grouped by date -->
|
||||
<div class="timeline">
|
||||
<div v-for="group in groupedLogs" :key="group.date" class="timeline-group">
|
||||
<div class="timeline-date">{{ group.date }}</div>
|
||||
|
||||
<div
|
||||
v-for="log in group.logs"
|
||||
:key="log.id"
|
||||
class="timeline-item"
|
||||
@click="toggleExpand(log.id)"
|
||||
>
|
||||
<!-- Dot -->
|
||||
<div class="tl-dot-col">
|
||||
<span class="tl-dot" :style="{ background: statusColor(log.status) }">
|
||||
<t-icon v-if="log.status === 'running'" name="loading" size="10px" class="tl-spin" />
|
||||
</span>
|
||||
<span class="tl-line"></span>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="tl-content">
|
||||
<div class="tl-header">
|
||||
<span class="tl-status" :style="{ color: statusColor(log.status) }">
|
||||
{{ t(`datasource.logStatus.${log.status}`) }}
|
||||
</span>
|
||||
<span class="tl-time">{{ formatHourMin(log.started_at) }}</span>
|
||||
<span v-if="log.finished_at" class="tl-duration">{{ duration(log) }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Pills -->
|
||||
<div v-if="hasPills(log)" class="tl-pills">
|
||||
<span v-if="log.items_created > 0" class="pill created">+{{ log.items_created }}</span>
|
||||
<span v-if="log.items_updated > 0" class="pill updated">~{{ log.items_updated }}</span>
|
||||
<span v-if="log.items_deleted > 0" class="pill deleted">-{{ log.items_deleted }}</span>
|
||||
<span v-if="log.items_skipped > 0" class="pill skipped">{{ log.items_skipped }} {{ t('datasource.logMetric.skipped') }}</span>
|
||||
<span v-if="log.items_failed > 0" class="pill failed">{{ log.items_failed }} {{ t('datasource.logMetric.failed') }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Expanded -->
|
||||
<div v-if="expandedId === log.id" class="tl-detail" @click.stop>
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">{{ t('datasource.logDetail.startTime') }}</span>
|
||||
<span>{{ formatTime(log.started_at) }}</span>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">{{ t('datasource.logDetail.endTime') }}</span>
|
||||
<span>{{ formatTime(log.finished_at) }}</span>
|
||||
</div>
|
||||
<div v-if="log.items_total > 0" class="detail-row">
|
||||
<span class="detail-label">{{ t('datasource.logMetric.total') }}</span>
|
||||
<span>{{ log.items_total }}</span>
|
||||
</div>
|
||||
<div v-if="log.error_message" class="tl-error">
|
||||
{{ log.error_message }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</t-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.logs-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 80px 0;
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-size: 13px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* --- Summary --- */
|
||||
.logs-summary {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding-bottom: 16px;
|
||||
margin-bottom: 8px;
|
||||
border-bottom: 1px solid var(--td-border-level-2-color);
|
||||
}
|
||||
|
||||
.summary-stat {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 8px 0;
|
||||
border-radius: 6px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
}
|
||||
|
||||
.stat-num {
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: var(--td-text-color-primary);
|
||||
line-height: 1.3;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.stat-num.success { color: var(--td-success-color); }
|
||||
.stat-num.error { color: var(--td-error-color); }
|
||||
|
||||
.stat-label {
|
||||
font-size: 11px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
/* --- Timeline --- */
|
||||
.timeline {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.timeline-group {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.timeline-date {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-placeholder);
|
||||
padding: 10px 0 6px 24px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: var(--td-bg-color-container);
|
||||
z-index: 1;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* --- Dot column: continuous line --- */
|
||||
.tl-dot-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 24px;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Continuous vertical line behind dots */
|
||||
.tl-dot-col::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
width: 1.5px;
|
||||
background: var(--td-border-level-2-color);
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.timeline-group:last-child .timeline-item:last-child .tl-dot-col::before {
|
||||
bottom: 50%;
|
||||
}
|
||||
|
||||
.tl-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-top: 15px;
|
||||
box-shadow: 0 0 0 3px var(--td-bg-color-container);
|
||||
}
|
||||
|
||||
.tl-dot .tl-spin {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tl-line {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* --- Content --- */
|
||||
.tl-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 6px 10px;
|
||||
margin: 2px 0;
|
||||
border-radius: 6px;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.timeline-item:hover .tl-content {
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
}
|
||||
|
||||
.tl-header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.tl-status {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tl-time {
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.tl-duration {
|
||||
margin-left: auto;
|
||||
font-size: 11px;
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
/* --- Pills --- */
|
||||
.tl-pills {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.pill {
|
||||
font-size: 11px;
|
||||
padding: 0 5px;
|
||||
border-radius: 3px;
|
||||
font-weight: 500;
|
||||
line-height: 18px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.pill.created { background: var(--td-success-color-1); color: var(--td-success-color); }
|
||||
.pill.updated { background: var(--td-brand-color-light); color: var(--td-brand-color); }
|
||||
.pill.deleted { background: var(--td-warning-color-1); color: var(--td-warning-color); }
|
||||
.pill.skipped { background: var(--td-bg-color-component); color: var(--td-text-color-placeholder); }
|
||||
.pill.failed { background: var(--td-error-color-1); color: var(--td-error-color); }
|
||||
|
||||
/* --- Expanded detail --- */
|
||||
.tl-detail {
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px dashed var(--td-border-level-2-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.detail-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.tl-error {
|
||||
margin-top: 6px;
|
||||
padding: 6px 8px;
|
||||
border-radius: 4px;
|
||||
background: var(--td-error-color-1);
|
||||
color: var(--td-error-color);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
/* --- Drawer overrides --- */
|
||||
.ds-logs-drawer :deep(.t-drawer__header) {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
padding: 16px 24px;
|
||||
border-bottom: 1px solid var(--td-border-level-2-color);
|
||||
}
|
||||
|
||||
.ds-logs-drawer :deep(.t-drawer__body) {
|
||||
padding: 16px 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -611,8 +611,8 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
max-width: 65%;
|
||||
flex: 0 0 40%;
|
||||
max-width: 40%;
|
||||
padding-right: 24px;
|
||||
|
||||
label {
|
||||
@@ -632,8 +632,8 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.setting-control {
|
||||
flex-shrink: 0;
|
||||
min-width: 280px;
|
||||
flex: 0 0 55%;
|
||||
max-width: 55%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
@@ -129,8 +129,8 @@ const handleQuestionGenerationChange = () => {
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
max-width: 65%;
|
||||
flex: 0 0 40%;
|
||||
max-width: 40%;
|
||||
padding-right: 24px;
|
||||
|
||||
label {
|
||||
@@ -157,8 +157,8 @@ const handleQuestionGenerationChange = () => {
|
||||
}
|
||||
|
||||
.setting-control {
|
||||
flex-shrink: 0;
|
||||
min-width: 280px;
|
||||
flex: 0 0 55%;
|
||||
max-width: 55%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
@@ -250,8 +250,8 @@ const emitUpdate = () => {
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
max-width: 65%;
|
||||
flex: 0 0 40%;
|
||||
max-width: 40%;
|
||||
padding-right: 24px;
|
||||
|
||||
label {
|
||||
@@ -271,8 +271,8 @@ const emitUpdate = () => {
|
||||
}
|
||||
|
||||
.setting-control {
|
||||
flex-shrink: 0;
|
||||
min-width: 280px;
|
||||
flex: 0 0 55%;
|
||||
max-width: 55%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
|
||||
@@ -153,8 +153,8 @@ const handleAddModel = (subSection: string) => {
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
max-width: 65%;
|
||||
flex: 0 0 40%;
|
||||
max-width: 40%;
|
||||
padding-right: 24px;
|
||||
|
||||
label {
|
||||
@@ -179,8 +179,8 @@ const handleAddModel = (subSection: string) => {
|
||||
}
|
||||
|
||||
.setting-control {
|
||||
flex-shrink: 0;
|
||||
min-width: 280px;
|
||||
flex: 0 0 55%;
|
||||
max-width: 55%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-start;
|
||||
|
||||
@@ -335,8 +335,8 @@ watch(() => props.parserEngineRules, (v) => {
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
max-width: 65%;
|
||||
flex: 0 0 40%;
|
||||
max-width: 40%;
|
||||
padding-right: 24px;
|
||||
|
||||
.group-label {
|
||||
@@ -386,8 +386,8 @@ watch(() => props.parserEngineRules, (v) => {
|
||||
}
|
||||
|
||||
.setting-control {
|
||||
flex-shrink: 0;
|
||||
min-width: 280px;
|
||||
flex: 0 0 55%;
|
||||
max-width: 55%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
|
||||
@@ -315,7 +315,7 @@ onMounted(async () => {
|
||||
.section-title {
|
||||
margin: 0 0 8px 0;
|
||||
font-family: "PingFang SC";
|
||||
font-size: 16px;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
@@ -340,7 +340,7 @@ onMounted(async () => {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-family: "PingFang SC";
|
||||
font-size: 14px;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
@@ -382,7 +382,7 @@ onMounted(async () => {
|
||||
|
||||
.shares-title {
|
||||
font-family: "PingFang SC";
|
||||
font-size: 14px;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: var(--td-text-color-primary);
|
||||
}
|
||||
|
||||
@@ -208,8 +208,8 @@ onMounted(load)
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
max-width: 65%;
|
||||
flex: 0 0 40%;
|
||||
max-width: 40%;
|
||||
padding-right: 24px;
|
||||
|
||||
label {
|
||||
@@ -229,8 +229,8 @@ onMounted(load)
|
||||
}
|
||||
|
||||
.setting-control {
|
||||
flex-shrink: 0;
|
||||
min-width: 280px;
|
||||
flex: 0 0 55%;
|
||||
max-width: 55%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
|
||||
Reference in New Issue
Block a user