2026-03-27 07:02:40 +00:00
|
|
|
|
<script setup lang="ts">
|
2026-05-15 09:56:58 +00:00
|
|
|
|
import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
|
2026-06-15 09:18:01 +00:00
|
|
|
|
import { MessagePlugin } from 'tdesign-vue-next'
|
2026-03-27 07:02:40 +00:00
|
|
|
|
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'
|
2026-03-30 11:39:35 +00:00
|
|
|
|
import DataSourceTypeIcon from './DataSourceTypeIcon.vue'
|
2026-05-15 09:56:58 +00:00
|
|
|
|
import { useAuthStore } from '@/stores/auth'
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{ kbId: string }>()
|
2026-03-30 05:32:39 +00:00
|
|
|
|
const emit = defineEmits<{ (e: 'count', value: number): void }>()
|
2026-03-27 07:02:40 +00:00
|
|
|
|
const { t } = useI18n()
|
2026-05-15 09:56:58 +00:00
|
|
|
|
const authStore = useAuthStore()
|
|
|
|
|
|
|
|
|
|
|
|
// 后端 /datasource 的 list/logs 是 Viewer+,但所有写操作(POST/PUT/DELETE
|
|
|
|
|
|
// 以及 sync/pause/resume/validate)都是 Admin+。低权限用户保留只读视图,
|
|
|
|
|
|
// 增删改和触发同步全部隐藏,而不是按下去再撞 403。
|
|
|
|
|
|
const canManageDataSource = computed(() => authStore.hasRole('admin'))
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
|
|
|
|
|
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('')
|
2026-03-30 12:10:08 +00:00
|
|
|
|
const pollTimer = ref<number | null>(null)
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-03-30 12:10:08 +00:00
|
|
|
|
function stopPolling() {
|
|
|
|
|
|
if (pollTimer.value !== null) {
|
|
|
|
|
|
window.clearTimeout(pollTimer.value)
|
|
|
|
|
|
pollTimer.value = null
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function schedulePolling() {
|
|
|
|
|
|
stopPolling()
|
|
|
|
|
|
pollTimer.value = window.setTimeout(() => {
|
|
|
|
|
|
loadList(true)
|
|
|
|
|
|
}, 3000)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function loadList(silent = false) {
|
|
|
|
|
|
if (!silent) loading.value = true
|
2026-03-27 07:02:40 +00:00
|
|
|
|
try {
|
|
|
|
|
|
const res = await listDataSources(props.kbId)
|
|
|
|
|
|
dataSources.value = res?.data || res || []
|
2026-03-30 05:32:39 +00:00
|
|
|
|
emit('count', dataSources.value.length)
|
2026-03-30 12:10:08 +00:00
|
|
|
|
|
|
|
|
|
|
const hasRunningSync = dataSources.value.some(ds => ds.latest_sync_log?.status === 'running')
|
|
|
|
|
|
if (hasRunningSync) {
|
|
|
|
|
|
schedulePolling()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
stopPolling()
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
} catch (e: any) {
|
|
|
|
|
|
console.error(e)
|
|
|
|
|
|
} finally {
|
2026-03-30 12:10:08 +00:00
|
|
|
|
if (!silent) loading.value = false
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
async function removeDataSource(ds: DataSource) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await deleteDataSource(ds.id)
|
|
|
|
|
|
MessagePlugin.success(t('datasource.deleteSuccess'))
|
|
|
|
|
|
await loadList()
|
|
|
|
|
|
} catch (e: any) {
|
|
|
|
|
|
MessagePlugin.error(e?.message || e?.error || t('datasource.deleteFailed'))
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function handleSync(ds: DataSource) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await triggerSync(ds.id)
|
|
|
|
|
|
MessagePlugin.success(t('datasource.syncTriggered'))
|
2026-03-30 12:10:08 +00:00
|
|
|
|
await loadList(true)
|
2026-03-30 07:08:57 +00:00
|
|
|
|
} catch (e: any) {
|
|
|
|
|
|
MessagePlugin.error(e?.message || e?.error || t('datasource.syncFailed'))
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function handlePause(ds: DataSource) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await pauseDataSource(ds.id)
|
|
|
|
|
|
MessagePlugin.success(t('datasource.paused'))
|
|
|
|
|
|
loadList()
|
2026-03-30 07:08:57 +00:00
|
|
|
|
} catch (e: any) {
|
|
|
|
|
|
MessagePlugin.error(e?.message || e?.error || t('datasource.pauseFailed'))
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function handleResume(ds: DataSource) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await resumeDataSource(ds.id)
|
|
|
|
|
|
MessagePlugin.success(t('datasource.resumed'))
|
|
|
|
|
|
loadList()
|
2026-03-30 07:08:57 +00:00
|
|
|
|
} catch (e: any) {
|
|
|
|
|
|
MessagePlugin.error(e?.message || e?.error || t('datasource.resumeFailed'))
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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}`)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-30 12:10:08 +00:00
|
|
|
|
function isSyncRunning(ds: DataSource) {
|
|
|
|
|
|
return ds.latest_sync_log?.status === 'running'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-27 07:02:40 +00:00
|
|
|
|
function onEditorSaved() {
|
|
|
|
|
|
editorVisible.value = false
|
|
|
|
|
|
loadList()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(loadList)
|
2026-03-30 12:10:08 +00:00
|
|
|
|
onBeforeUnmount(stopPolling)
|
2026-03-27 07:02:40 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="ds-settings">
|
|
|
|
|
|
<div class="section-header">
|
2026-06-15 09:18:01 +00:00
|
|
|
|
<h2>{{ t('datasource.title') }}</h2>
|
|
|
|
|
|
<p class="section-description">{{ t('datasource.description') }}</p>
|
2026-03-27 07:02:40 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
<t-loading :loading="loading" size="small" class="ds-list-loading">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-if="!loading && dataSources.length === 0 && !canManageDataSource"
|
|
|
|
|
|
class="empty-state"
|
|
|
|
|
|
>
|
|
|
|
|
|
<t-empty :description="t('datasource.empty')" />
|
2026-03-30 05:32:39 +00:00
|
|
|
|
</div>
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
<div v-else-if="!loading" class="ds-grid">
|
|
|
|
|
|
<component
|
|
|
|
|
|
:is="canManageDataSource ? 'button' : 'div'"
|
|
|
|
|
|
v-for="ds in dataSources"
|
|
|
|
|
|
:key="ds.id"
|
|
|
|
|
|
:type="canManageDataSource ? 'button' : undefined"
|
2026-06-23 06:58:45 +00:00
|
|
|
|
:class="['ds-card', `ds-card--${ds.type}`, { 'ds-card--clickable': canManageDataSource }]"
|
2026-06-15 09:18:01 +00:00
|
|
|
|
@click="canManageDataSource ? openEdit(ds) : undefined"
|
2026-06-12 14:40:18 +00:00
|
|
|
|
>
|
2026-06-15 09:18:01 +00:00
|
|
|
|
<div class="ds-card__badge">
|
2026-06-23 06:58:45 +00:00
|
|
|
|
<DataSourceTypeIcon :type="ds.type" variant="badge" />
|
2026-06-15 09:18:01 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="ds-card__body">
|
|
|
|
|
|
<div class="ds-card__header">
|
|
|
|
|
|
<h3 class="ds-card__title" :title="ds.name">{{ ds.name }}</h3>
|
|
|
|
|
|
<div class="ds-card__actions" @click.stop>
|
|
|
|
|
|
<t-dropdown trigger="click" :min-column-width="140" attach="body">
|
|
|
|
|
|
<t-button
|
|
|
|
|
|
variant="text"
|
|
|
|
|
|
shape="square"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
class="ds-card__action-btn"
|
|
|
|
|
|
@click.stop
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #icon><t-icon name="ellipsis" /></template>
|
|
|
|
|
|
</t-button>
|
|
|
|
|
|
<template #dropdown>
|
|
|
|
|
|
<t-dropdown-menu>
|
|
|
|
|
|
<t-dropdown-item v-if="canManageDataSource" @click="openEdit(ds)">
|
|
|
|
|
|
<t-icon name="edit" /> {{ t('datasource.edit') }}
|
|
|
|
|
|
</t-dropdown-item>
|
|
|
|
|
|
<t-dropdown-item
|
|
|
|
|
|
v-if="canManageDataSource"
|
|
|
|
|
|
:disabled="isSyncRunning(ds)"
|
|
|
|
|
|
@click="handleSync(ds)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<t-icon name="refresh" :class="{ 'ds-icon-spin': isSyncRunning(ds) }" />
|
|
|
|
|
|
{{ isSyncRunning(ds) ? t('datasource.logStatus.running') : t('datasource.syncNow') }}
|
|
|
|
|
|
</t-dropdown-item>
|
|
|
|
|
|
<t-dropdown-item @click="openLogs(ds)">
|
|
|
|
|
|
<t-icon name="root-list" /> {{ t('datasource.logs') }}
|
|
|
|
|
|
</t-dropdown-item>
|
|
|
|
|
|
<t-dropdown-item
|
|
|
|
|
|
v-if="canManageDataSource && ds.status === 'active'"
|
|
|
|
|
|
@click="handlePause(ds)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<t-icon name="pause-circle" /> {{ t('datasource.pause') }}
|
|
|
|
|
|
</t-dropdown-item>
|
|
|
|
|
|
<t-dropdown-item
|
|
|
|
|
|
v-else-if="canManageDataSource && ds.status === 'paused'"
|
|
|
|
|
|
@click="handleResume(ds)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<t-icon name="play-circle" /> {{ t('datasource.resume') }}
|
|
|
|
|
|
</t-dropdown-item>
|
|
|
|
|
|
<t-dropdown-item
|
|
|
|
|
|
v-if="canManageDataSource"
|
|
|
|
|
|
theme="error"
|
|
|
|
|
|
class="ds-dropdown-delete-item"
|
|
|
|
|
|
>
|
|
|
|
|
|
<t-popconfirm
|
|
|
|
|
|
:content="t('datasource.deleteConfirm')"
|
|
|
|
|
|
:confirm-btn="{ content: t('datasource.delete'), theme: 'danger' }"
|
|
|
|
|
|
:cancel-btn="{ content: t('common.cancel') }"
|
|
|
|
|
|
placement="left"
|
|
|
|
|
|
attach="body"
|
|
|
|
|
|
@confirm="removeDataSource(ds)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="ds-dropdown-delete-trigger" @click.stop>
|
|
|
|
|
|
<t-icon name="delete" />
|
|
|
|
|
|
<span>{{ t('datasource.delete') }}</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</t-popconfirm>
|
|
|
|
|
|
</t-dropdown-item>
|
|
|
|
|
|
</t-dropdown-menu>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</t-dropdown>
|
2026-06-12 14:40:18 +00:00
|
|
|
|
</div>
|
2026-03-27 07:02:40 +00:00
|
|
|
|
</div>
|
2026-06-15 09:18:01 +00:00
|
|
|
|
<p class="ds-card__subtitle">
|
|
|
|
|
|
{{ connectorLabel(ds.type) }} · {{ syncModeLabel(ds.sync_mode) }}
|
|
|
|
|
|
<span class="ds-card__sep">·</span>
|
|
|
|
|
|
<span class="ds-card__status" :class="`ds-card__status--${ds.status}`">
|
|
|
|
|
|
<span class="ds-status-dot" aria-hidden="true" />
|
|
|
|
|
|
{{ statusLabel(ds.status) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p class="ds-card__detail">
|
|
|
|
|
|
{{ scheduleLabel(ds.sync_schedule) }}
|
|
|
|
|
|
<span class="ds-card__sep">·</span>
|
|
|
|
|
|
<t-tooltip :content="lastSyncFullTime(ds)" :disabled="!lastSyncFullTime(ds)">
|
|
|
|
|
|
<span>{{ lastSyncTime(ds) || '--' }}</span>
|
2026-06-12 14:40:18 +00:00
|
|
|
|
</t-tooltip>
|
2026-06-15 09:18:01 +00:00
|
|
|
|
<template v-if="ds.latest_sync_log">
|
|
|
|
|
|
<span class="ds-card__sep">·</span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
class="ds-card__sync-result"
|
|
|
|
|
|
:class="`ds-card__sync-result--${ds.latest_sync_log.status}`"
|
2026-06-12 14:40:18 +00:00
|
|
|
|
>
|
2026-06-15 09:18:01 +00:00
|
|
|
|
{{ lastSyncStatusLabel(ds) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-for="pill in syncResultPills(ds)"
|
|
|
|
|
|
:key="pill.cls"
|
|
|
|
|
|
class="ds-card__metric"
|
|
|
|
|
|
>{{ pill.text }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<div v-if="ds.error_message" class="ds-card__error">
|
|
|
|
|
|
<t-icon name="error-circle-filled" size="14px" />
|
|
|
|
|
|
<span>{{ ds.error_message }}</span>
|
2026-03-30 06:50:31 +00:00
|
|
|
|
</div>
|
2026-06-15 09:18:01 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</component>
|
|
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-if="canManageDataSource"
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="ds-card ds-card--add"
|
|
|
|
|
|
@click="openCreate"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="ds-card--add__icon" aria-hidden="true">
|
|
|
|
|
|
<t-icon name="add" />
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="ds-card--add__label">{{ t('datasource.add') }}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</t-loading>
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
|
|
|
|
|
<DataSourceEditorDialog
|
|
|
|
|
|
v-model:visible="editorVisible"
|
|
|
|
|
|
:kb-id="kbId"
|
|
|
|
|
|
:data-source="editingDs"
|
|
|
|
|
|
@saved="onEditorSaved"
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<DataSourceSyncLogs
|
|
|
|
|
|
v-model:visible="logsVisible"
|
|
|
|
|
|
:data-source-id="logsDsId"
|
|
|
|
|
|
:data-source-name="logsDsName"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
<style scoped lang="less">
|
2026-06-15 09:18:01 +00:00
|
|
|
|
@import './datasource-surface.less';
|
2026-03-27 07:02:40 +00:00
|
|
|
|
.ds-settings {
|
2026-06-12 14:40:18 +00:00
|
|
|
|
width: 100%;
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.section-header {
|
2026-06-15 09:18:01 +00:00
|
|
|
|
margin-bottom: 28px;
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
h2 {
|
2026-06-12 14:40:18 +00:00
|
|
|
|
font-size: 20px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: var(--td-text-color-primary);
|
2026-06-15 09:18:01 +00:00
|
|
|
|
margin: 0 0 8px 0;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
.section-description {
|
2026-06-12 14:40:18 +00:00
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: var(--td-text-color-secondary);
|
2026-06-15 09:18:01 +00:00
|
|
|
|
margin: 0;
|
|
|
|
|
|
line-height: 1.6;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
.ds-list-loading {
|
|
|
|
|
|
min-height: 120px;
|
2026-03-30 05:32:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
.empty-state {
|
2026-06-12 14:40:18 +00:00
|
|
|
|
padding: 32px 0;
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
.ds-grid {
|
2026-06-12 14:40:18 +00:00
|
|
|
|
display: grid;
|
2026-06-15 09:18:01 +00:00
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
2026-06-12 14:40:18 +00:00
|
|
|
|
gap: 12px;
|
2026-06-15 09:18:01 +00:00
|
|
|
|
|
|
|
|
|
|
.ds-card--add {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
.ds-card {
|
2026-03-30 05:32:39 +00:00
|
|
|
|
position: relative;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
padding: 14px 16px;
|
2026-06-15 09:18:01 +00:00
|
|
|
|
.ds-surface-card();
|
2026-06-12 14:40:18 +00:00
|
|
|
|
text-align: left;
|
|
|
|
|
|
font: inherit;
|
|
|
|
|
|
color: inherit;
|
2026-06-15 09:18:01 +00:00
|
|
|
|
min-width: 0;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
|
|
|
|
|
|
&--clickable {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
width: 100%;
|
2026-06-15 09:18:01 +00:00
|
|
|
|
.ds-surface-card--interactive();
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&--add {
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
min-height: 68px;
|
|
|
|
|
|
border-style: dashed;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
color: var(--td-text-color-placeholder);
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
|
&:focus-visible {
|
|
|
|
|
|
color: var(--td-brand-color);
|
|
|
|
|
|
border-color: var(--td-brand-color);
|
|
|
|
|
|
background: color-mix(in srgb, var(--td-brand-color) 6%, transparent);
|
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&:focus-visible {
|
|
|
|
|
|
outline: 2px solid var(--td-brand-color);
|
|
|
|
|
|
outline-offset: 2px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&__icon {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 32px;
|
|
|
|
|
|
height: 32px;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
background: color-mix(in srgb, var(--td-brand-color) 10%, transparent);
|
|
|
|
|
|
color: var(--td-brand-color);
|
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&__label {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-03-30 06:50:31 +00:00
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&__badge {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
width: 36px;
|
|
|
|
|
|
height: 36px;
|
|
|
|
|
|
border-radius: 9px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2026-06-23 06:58:45 +00:00
|
|
|
|
margin-top: 1px;
|
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
letter-spacing: 0.02em;
|
|
|
|
|
|
background: rgba(7, 192, 95, 0.12);
|
|
|
|
|
|
color: #07c05f;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-23 06:58:45 +00:00
|
|
|
|
&--feishu .ds-card__badge,
|
|
|
|
|
|
&--notion .ds-card__badge,
|
|
|
|
|
|
&--yuque .ds-card__badge,
|
|
|
|
|
|
&--rss .ds-card__badge {
|
|
|
|
|
|
background: var(--td-bg-color-container, #fff);
|
|
|
|
|
|
box-shadow: inset 0 0 0 1px var(--td-component-stroke);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&__body {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&__header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
}
|
2026-03-30 06:50:31 +00:00
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&__title {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
color: var(--td-text-color-primary);
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&__subtitle {
|
2026-06-15 09:18:01 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
gap: 4px;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
margin: 2px 0 0;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
color: var(--td-text-color-secondary);
|
2026-06-15 09:18:01 +00:00
|
|
|
|
min-width: 0;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&__status {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 4px;
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&--active {
|
|
|
|
|
|
color: var(--td-success-color);
|
|
|
|
|
|
}
|
2026-03-30 06:50:31 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&--paused {
|
|
|
|
|
|
color: var(--td-warning-color);
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
2026-03-30 06:50:31 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&--error {
|
|
|
|
|
|
color: var(--td-error-color);
|
|
|
|
|
|
}
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&__detail {
|
2026-06-12 14:40:18 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
gap: 4px;
|
2026-06-15 09:18:01 +00:00
|
|
|
|
margin: 4px 0 0;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
font-size: 12px;
|
2026-06-15 09:18:01 +00:00
|
|
|
|
line-height: 1.45;
|
|
|
|
|
|
color: var(--td-text-color-placeholder);
|
|
|
|
|
|
min-width: 0;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&__sync-result {
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
color: var(--td-text-color-secondary);
|
|
|
|
|
|
|
|
|
|
|
|
&--success {
|
|
|
|
|
|
color: var(--td-success-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&--failed {
|
|
|
|
|
|
color: var(--td-error-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&--running {
|
|
|
|
|
|
color: var(--td-brand-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&--partial {
|
|
|
|
|
|
color: var(--td-warning-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&__metric {
|
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
|
font-variant-numeric: tabular-nums;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
color: var(--td-text-color-disabled);
|
|
|
|
|
|
}
|
2026-03-30 05:32:39 +00:00
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&__sep {
|
|
|
|
|
|
color: var(--td-text-color-disabled);
|
|
|
|
|
|
user-select: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-12 14:40:18 +00:00
|
|
|
|
&__error {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
padding: 8px 10px;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
background: var(--td-error-color-1);
|
|
|
|
|
|
color: var(--td-error-color);
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
line-height: 1.45;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&__actions {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 2px;
|
2026-06-15 09:18:01 +00:00
|
|
|
|
margin-left: auto;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&__action-btn {
|
2026-06-12 14:40:18 +00:00
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
padding: 2px;
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
color: var(--td-text-color-placeholder);
|
2026-06-15 09:18:01 +00:00
|
|
|
|
transition: opacity 0.15s ease, color 0.15s ease;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
|
&:focus-visible {
|
|
|
|
|
|
background: var(--td-bg-color-secondarycontainer);
|
|
|
|
|
|
color: var(--td-text-color-primary);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
&:hover .ds-card__action-btn,
|
|
|
|
|
|
&:focus-within .ds-card__action-btn,
|
|
|
|
|
|
&__actions:focus-within .ds-card__action-btn {
|
2026-06-12 14:40:18 +00:00
|
|
|
|
opacity: 1;
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-15 09:18:01 +00:00
|
|
|
|
.ds-status-dot {
|
|
|
|
|
|
width: 6px;
|
|
|
|
|
|
height: 6px;
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
background: currentColor;
|
|
|
|
|
|
flex-shrink: 0;
|
2026-06-12 14:40:18 +00:00
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
|
2026-03-30 12:10:08 +00:00
|
|
|
|
.ds-icon-spin {
|
|
|
|
|
|
animation: ds-spin 1s linear infinite;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes ds-spin {
|
|
|
|
|
|
from { transform: rotate(0deg); }
|
|
|
|
|
|
to { transform: rotate(360deg); }
|
|
|
|
|
|
}
|
2026-06-15 09:18:01 +00:00
|
|
|
|
|
|
|
|
|
|
:deep(.t-dropdown__item.ds-dropdown-delete-item) {
|
|
|
|
|
|
border-top: 1px solid var(--td-component-stroke);
|
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
|
padding-top: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
.t-popup__reference {
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ds-dropdown-delete-trigger {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
line-height: 22px;
|
|
|
|
|
|
}
|
2026-03-27 07:02:40 +00:00
|
|
|
|
</style>
|