From 8021647929026743af21b9044256ab5a06bab4e7 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Mon, 30 Mar 2026 14:50:31 +0800 Subject: [PATCH] feat(datasource): enhance DataSourceSettings and DataSourceSyncLogs UI - Improved DataSourceSettings component with better loading handling and UI updates for data source cards. - Refactored layout and styling for data source cards, including enhanced title and status display. - Updated DataSourceSyncLogs component with improved summary statistics and log display styles. - Enhanced responsiveness and visual consistency across components with updated padding, margins, and font sizes. --- .../knowledge/settings/DataSourceSettings.vue | 214 +++++++++++------- .../knowledge/settings/DataSourceSyncLogs.vue | 82 ++++--- 2 files changed, 178 insertions(+), 118 deletions(-) diff --git a/frontend/src/views/knowledge/settings/DataSourceSettings.vue b/frontend/src/views/knowledge/settings/DataSourceSettings.vue index 84845ec3..c3aa2174 100644 --- a/frontend/src/views/knowledge/settings/DataSourceSettings.vue +++ b/frontend/src/views/knowledge/settings/DataSourceSettings.vue @@ -26,7 +26,6 @@ const logsVisible = ref(false) const logsDsId = ref('') const logsDsName = ref('') - async function loadList() { loading.value = true try { @@ -66,11 +65,11 @@ function handleDelete(ds: DataSource) { try { await deleteDataSource(ds.id) MessagePlugin.success(t('datasource.deleteSuccess')) - loadList() + await loadList() + confirmDialog.hide() } catch { MessagePlugin.error(t('datasource.deleteFailed')) } - confirmDialog.destroy() }, }) } @@ -202,15 +201,18 @@ onMounted(loadList)
-
-
- {{ ds.name }} - - {{ statusLabel(ds.status) }} - +
+
+
+ {{ ds.name }} + + {{ statusLabel(ds.status) }} + +
+ {{ connectorLabel(ds.type) }}
- {{ connectorLabel(ds.type) }}
+
@@ -254,41 +256,43 @@ onMounted(loadList)
-
-
- {{ t('datasource.syncModeLabel') }} - {{ syncModeLabel(ds.sync_mode) }} +
+
+ {{ t('datasource.syncModeLabel') }} + {{ syncModeLabel(ds.sync_mode) }}
-
- {{ t('datasource.schedule') }} - {{ scheduleLabel(ds.sync_schedule) }} +
+ {{ t('datasource.schedule') }} + {{ scheduleLabel(ds.sync_schedule) }}
-
- {{ t('datasource.lastSync') }} +
+ {{ t('datasource.lastSync') }} - {{ lastSyncTime(ds) }} + {{ lastSyncTime(ds) }}
-
- {{ t('datasource.lastStatus') }} - +
+ {{ t('datasource.lastStatus') }} +
- -- - + -- +
-
- +
+ {{ ds.error_message }}
- +
+ +
{{ t('datasource.addCard') }}
@@ -320,7 +324,7 @@ onMounted(loadList) .section-title { margin: 0 0 6px 0; - font-size: 18px; + font-size: 20px; font-weight: 600; color: var(--td-text-color-primary); letter-spacing: -0.01em; @@ -386,34 +390,42 @@ onMounted(loadList) /* --- Card --- */ .ds-card { position: relative; - border: 1px solid var(--td-border-level-2-color); - border-radius: 10px; - padding: 16px 18px; background: var(--td-bg-color-container); - transition: border-color 0.2s, box-shadow 0.2s; + border: 1px solid var(--td-border-level-2-color); + border-radius: 12px; + padding: 20px; + transition: all 0.2s ease; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02); } .ds-card:hover { - border-color: var(--td-brand-color-hover); - box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); + border-color: var(--td-brand-color); + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06); } /* --- Card header --- */ .ds-card-header { display: flex; - align-items: flex-start; justify-content: space-between; - gap: 12px; + align-items: flex-start; + margin-bottom: 20px; } -.ds-card-identity { +.ds-card-title-wrap { display: flex; - flex-direction: column; - gap: 2px; + align-items: center; + gap: 16px; min-width: 0; flex: 1; } +.ds-title-text { + display: flex; + flex-direction: column; + gap: 4px; + min-width: 0; +} + .ds-name-row { display: flex; align-items: center; @@ -422,64 +434,79 @@ onMounted(loadList) } .ds-name { - font-size: 14px; + font-size: 16px; font-weight: 600; color: var(--td-text-color-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - line-height: 22px; + line-height: 24px; } -.ds-type-label { - font-size: 12px; - color: var(--td-text-color-placeholder); +.ds-status-tag { + border-radius: 4px; +} + +.ds-type-desc { + font-size: 13px; + color: var(--td-text-color-secondary); line-height: 18px; } .ds-card-actions { display: flex; align-items: center; - gap: 2px; + gap: 4px; flex-shrink: 0; - margin-top: 2px; + opacity: 0.6; + transition: opacity 0.2s ease; } -/* --- Info grid --- */ -.ds-card-body { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 10px 24px; - margin-top: 14px; - padding: 12px 14px; - background: var(--td-bg-color-secondarycontainer); - border-radius: 8px; +.ds-card:hover .ds-card-actions { + opacity: 1; } -.ds-info-cell { +.ds-card-actions :deep(.t-button) { + border-radius: 6px; +} + +/* --- Info stats --- */ +.ds-card-stats { + display: flex; + gap: 24px; + padding-top: 16px; + border-top: 1px solid var(--td-border-level-1-color); +} + +.ds-stat-item { display: flex; flex-direction: column; - gap: 2px; + gap: 6px; + flex: 1; } -.ds-info-label { - font-size: 12px; +.ds-stat-label { + font-size: 11px; + font-weight: 500; color: var(--td-text-color-placeholder); - line-height: 18px; + text-transform: uppercase; + letter-spacing: 0.5px; + line-height: 16px; + white-space: nowrap; } -.ds-info-value { - font-size: 13px; - color: var(--td-text-color-primary); +.ds-stat-value { display: flex; align-items: center; - gap: 4px; + gap: 6px; flex-wrap: wrap; + font-size: 13px; + color: var(--td-text-color-primary); line-height: 20px; } -.ds-info-placeholder { - color: var(--td-text-color-placeholder); +.ds-stat-placeholder { + color: var(--td-text-color-disabled); } /* --- Sync result pills --- */ @@ -499,16 +526,16 @@ onMounted(loadList) .ds-pill.failed { background: var(--td-error-color-1); color: var(--td-error-color); } /* --- Error alert --- */ -.ds-error { +.ds-card-error { + margin-top: 16px; + padding: 10px 14px; + border-radius: 8px; + background: var(--td-error-color-1); + color: var(--td-error-color); + font-size: 13px; display: flex; align-items: flex-start; - gap: 6px; - color: var(--td-error-color); - font-size: 12px; - background: var(--td-error-color-1); - padding: 8px 12px; - border-radius: 6px; - margin-top: 10px; + gap: 8px; line-height: 20px; } @@ -517,19 +544,40 @@ onMounted(loadList) display: flex; align-items: center; justify-content: center; - gap: 6px; - padding: 14px; - border: 1px dashed var(--td-border-level-2-color); - border-radius: 10px; - color: var(--td-text-color-placeholder); - font-size: 13px; + gap: 12px; + padding: 15px; + background: var(--td-bg-color-secondarycontainer); + border: 1px solid transparent; + border-radius: 12px; + color: var(--td-text-color-secondary); + font-size: 14px; + font-weight: 500; cursor: pointer; - transition: all 0.2s; + transition: all 0.2s ease; + margin-top: 4px; +} + +.ds-card-add-icon { + display: flex; + align-items: center; + justify-content: center; + width: 32px; + height: 32px; + border-radius: 8px; + background: var(--td-bg-color-component); + color: var(--td-text-color-placeholder); + transition: all 0.2s ease; } .ds-card-add:hover { + background: var(--td-bg-color-container); border-color: var(--td-brand-color); color: var(--td-brand-color); - background: rgba(0, 82, 217, 0.04); + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04); +} + +.ds-card-add:hover .ds-card-add-icon { + background: var(--td-brand-color-light); + color: var(--td-brand-color); } diff --git a/frontend/src/views/knowledge/settings/DataSourceSyncLogs.vue b/frontend/src/views/knowledge/settings/DataSourceSyncLogs.vue index 1dae0111..54e72142 100644 --- a/frontend/src/views/knowledge/settings/DataSourceSyncLogs.vue +++ b/frontend/src/views/knowledge/settings/DataSourceSyncLogs.vue @@ -251,32 +251,36 @@ const groupedLogs = computed(() => { padding: 80px 0; color: var(--td-text-color-placeholder); font-size: 13px; - gap: 8px; + gap: 12px; } /* --- Summary --- */ .logs-summary { display: flex; - gap: 4px; - padding-bottom: 16px; - margin-bottom: 8px; - border-bottom: 1px solid var(--td-border-level-2-color); + gap: 8px; + padding-bottom: 24px; + margin-bottom: 12px; + border-bottom: 1px solid var(--td-border-level-1-color); } .summary-stat { flex: 1; text-align: center; - padding: 8px 0; - border-radius: 6px; - background: var(--td-bg-color-secondarycontainer); + padding: 16px 8px; + border-radius: 12px; + background: var(--td-bg-color-container); + border: 1px solid var(--td-border-level-1-color); + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02); + display: flex; + flex-direction: column; + gap: 4px; } .stat-num { - display: block; - font-size: 18px; + font-size: 20px; font-weight: 700; color: var(--td-text-color-primary); - line-height: 1.3; + line-height: 1.2; font-variant-numeric: tabular-nums; } @@ -285,6 +289,9 @@ const groupedLogs = computed(() => { .stat-label { font-size: 11px; + font-weight: 500; + text-transform: uppercase; + letter-spacing: 0.5px; color: var(--td-text-color-placeholder); } @@ -295,14 +302,14 @@ const groupedLogs = computed(() => { } .timeline-group { - margin-bottom: 0; + margin-bottom: 8px; } .timeline-date { font-size: 11px; font-weight: 600; color: var(--td-text-color-placeholder); - padding: 10px 0 6px 24px; + padding: 12px 0 8px 24px; position: sticky; top: 0; background: var(--td-bg-color-container); @@ -315,6 +322,7 @@ const groupedLogs = computed(() => { display: flex; cursor: pointer; position: relative; + margin-bottom: 4px; } /* --- Dot column: continuous line --- */ @@ -335,7 +343,7 @@ const groupedLogs = computed(() => { bottom: 0; left: 50%; width: 1.5px; - background: var(--td-border-level-2-color); + background: var(--td-border-level-1-color); transform: translateX(-50%); } @@ -350,8 +358,8 @@ const groupedLogs = computed(() => { flex-shrink: 0; position: relative; z-index: 1; - margin-top: 15px; - box-shadow: 0 0 0 3px var(--td-bg-color-container); + margin-top: 18px; + box-shadow: 0 0 0 4px var(--td-bg-color-container); } .tl-dot .tl-spin { @@ -366,10 +374,9 @@ const groupedLogs = computed(() => { .tl-content { flex: 1; min-width: 0; - padding: 6px 10px; - margin: 2px 0; - border-radius: 6px; - transition: background 0.15s; + padding: 12px 14px; + border-radius: 10px; + transition: background 0.2s ease; } .timeline-item:hover .tl-content { @@ -378,8 +385,8 @@ const groupedLogs = computed(() => { .tl-header { display: flex; - align-items: baseline; - gap: 6px; + align-items: center; + gap: 8px; } .tl-status { @@ -396,8 +403,12 @@ const groupedLogs = computed(() => { .tl-duration { margin-left: auto; font-size: 11px; + font-weight: 500; color: var(--td-text-color-placeholder); font-variant-numeric: tabular-nums; + background: var(--td-bg-color-component); + padding: 2px 6px; + border-radius: 4px; } /* --- Pills --- */ @@ -405,13 +416,13 @@ const groupedLogs = computed(() => { display: flex; flex-wrap: wrap; gap: 4px; - margin-top: 6px; + margin-top: 8px; } .pill { font-size: 11px; - padding: 0 5px; - border-radius: 3px; + padding: 1px 6px; + border-radius: 4px; font-weight: 500; line-height: 18px; font-variant-numeric: tabular-nums; @@ -425,12 +436,12 @@ const groupedLogs = computed(() => { /* --- Expanded detail --- */ .tl-detail { - margin-top: 8px; - padding-top: 8px; + margin-top: 12px; + padding-top: 12px; border-top: 1px dashed var(--td-border-level-2-color); display: flex; flex-direction: column; - gap: 4px; + gap: 6px; } .detail-row { @@ -438,6 +449,7 @@ const groupedLogs = computed(() => { justify-content: space-between; font-size: 12px; color: var(--td-text-color-primary); + line-height: 20px; } .detail-label { @@ -445,9 +457,9 @@ const groupedLogs = computed(() => { } .tl-error { - margin-top: 6px; - padding: 6px 8px; - border-radius: 4px; + margin-top: 8px; + padding: 8px 12px; + border-radius: 6px; background: var(--td-error-color-1); color: var(--td-error-color); font-size: 12px; @@ -464,7 +476,7 @@ const groupedLogs = computed(() => { } .logs-drawer-title { - font-size: 15px; + font-size: 16px; font-weight: 600; color: var(--td-text-color-primary); overflow: hidden; @@ -474,11 +486,11 @@ const groupedLogs = computed(() => { /* --- Drawer overrides --- */ .ds-logs-drawer :deep(.t-drawer__header) { - padding: 16px 24px; - border-bottom: 1px solid var(--td-border-level-2-color); + padding: 20px 24px; + border-bottom: 1px solid var(--td-border-level-1-color); } .ds-logs-drawer :deep(.t-drawer__body) { - padding: 16px 20px; + padding: 20px 24px; }