Skip to content

Commit 29bc5b9

Browse files
committed
refactor(TablePreview): implement sorting for upstream table status and enhance tooltip display; add localization for delay detail logic
1 parent f49fc73 commit 29bc5b9

4 files changed

Lines changed: 85 additions & 21 deletions

File tree

packages/ldp/src/TablePreview.vue

Lines changed: 79 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import VTable from '@tap/component/src/base/v-table'
2525
import VCodeEditor from '@tap/component/src/base/VCodeEditor.vue'
2626
import Drawer from '@tap/component/src/Drawer.vue'
2727
import { IconButton } from '@tap/component/src/icon-button'
28+
import { OverflowTooltip } from '@tap/component/src/overflow-tooltip'
2829
import i18n from '@tap/i18n'
2930
3031
import { calcTimeUnit, calcUnit, isNum } from '@tap/shared'
@@ -46,6 +47,7 @@ export default {
4647
VCodeEditor,
4748
IconButton,
4849
LineageGraph,
50+
OverflowTooltip,
4951
},
5052
props: {
5153
tag: {
@@ -466,16 +468,28 @@ export default {
466468
this.lastDataChangeTime = res?.lastDataChangeTime
467469
? dayjs(res?.lastDataChangeTime).format('YYYY-MM-DD HH:mm:ss')
468470
: '-'
469-
this.upstreamTableStatus = res?.upstreamTableStatus?.map((item) => {
470-
item.cdcDelayTime =
471-
isNum(item.cdcDelayTime) && item.cdcDelayTime >= 0
472-
? calcTimeUnit(item.cdcDelayTime, 2, {
473-
autoHideMs: true,
474-
})
475-
: '-'
476-
477-
return item
478-
})
471+
472+
this.upstreamTableStatus =
473+
res?.upstreamTableStatus
474+
?.sort((a, b) => {
475+
if (a.onDelayPath && !b.onDelayPath) {
476+
return -1
477+
} else if (!a.onDelayPath && b.onDelayPath) {
478+
return 1
479+
} else {
480+
return b.cdcDelayTime - a.cdcDelayTime
481+
}
482+
})
483+
?.map((item) => {
484+
item.cdcDelayTime =
485+
isNum(item.cdcDelayTime) && item.cdcDelayTime >= 0
486+
? calcTimeUnit(item.cdcDelayTime, 2, {
487+
autoHideMs: true,
488+
})
489+
: '-'
490+
491+
return item
492+
}) || []
479493
})
480494
},
481495
getApisData() {
@@ -843,12 +857,12 @@ export default {
843857
</span>
844858
<el-popover
845859
placement="bottom"
846-
trigger="hover"
847-
popper-style="min-width: 300px;max-width: 380px;width: auto;"
860+
trigger="click"
861+
popper-style="min-width: 400px;max-width: 480px;width: auto;"
848862
:disabled="!upstreamTableStatus.length || !cdcDelayTime"
849863
>
850-
<template #reference
851-
><span
864+
<template #reference>
865+
<span
852866
class="table-dec-txt text-nowrap inline-flex align-center gap-0.5"
853867
:class="{
854868
'color-primary cursor-pointer':
@@ -860,7 +874,41 @@ export default {
860874
></template
861875
>
862876
<div>
863-
<div class="flex align-center gap-1">
877+
<el-alert
878+
:closable="false"
879+
:title="$t('packages_ldp_task_delay_detail_logic')"
880+
type="info"
881+
show-icon
882+
class="align-items-start mb-3 logic-alert"
883+
>
884+
<template #title>
885+
<div>
886+
<div class="fw-sub fs-7 mb-1">
887+
{{ $t('packages_ldp_task_delay_detail_logic') }}
888+
</div>
889+
<ul
890+
class="ml-4 list-disc flex flex-column gap-0.5 text-xs lh-base"
891+
>
892+
<li class="list-disc">
893+
{{
894+
$t('packages_ldp_task_delay_detail_logic_tip1')
895+
}}
896+
</li>
897+
<li class="list-disc">
898+
{{
899+
$t('packages_ldp_task_delay_detail_logic_tip2')
900+
}}
901+
</li>
902+
<li class="list-disc color-warning">
903+
{{
904+
$t('packages_ldp_task_delay_detail_logic_tip3')
905+
}}
906+
</li>
907+
</ul>
908+
</div>
909+
</template>
910+
</el-alert>
911+
<!-- <div class="flex align-center gap-1">
864912
<div class="lh-base">
865913
<div class="fw-sub font-color-dark">
866914
{{ $t('packages_ldp_task_delay_detail') }}
@@ -871,7 +919,7 @@ export default {
871919
</div>
872920
<el-tooltip :hide-after="0" :teleported="false">
873921
<template #content>
874-
<div class="fw-sub fs-7">
922+
<div class="fw-sub fs-7 mb-1">
875923
{{ $t('packages_ldp_task_delay_detail_logic') }}
876924
</div>
877925
<ul
@@ -897,18 +945,23 @@ export default {
897945
</el-icon>
898946
</div>
899947
</el-tooltip>
900-
</div>
901-
<el-divider class="my-3" />
948+
</div> -->
949+
<!-- <el-divider class="my-3" /> -->
902950
<div class="mx-n3">
903951
<el-scrollbar :max-height="280" class="px-3">
904952
<div class="flex flex-column gap-2">
905953
<div
906954
v-for="item in upstreamTableStatus"
907955
:key="item"
908-
class="flex align-center gap-2 hover:bg-fill-color-light rounded-lg p-2 cursor-pointer task-item border"
956+
class="flex align-center gap-2 hover:bg-fill-color-light rounded-lg p-2 cursor-pointer task-item border overflow-hidden"
909957
@click="handleOpenTask(item)"
910958
>
911-
{{ item.taskName }}
959+
<OverflowTooltip
960+
:hide-after="0"
961+
placement="left"
962+
class="text-truncate"
963+
:text="item.taskName"
964+
/>
912965
<el-icon
913966
class="external-link-icon text-muted-foreground"
914967
>
@@ -917,7 +970,7 @@ export default {
917970
<el-tag
918971
size="small"
919972
class="px-1 ml-auto"
920-
:type="item.onDelayPath ? 'primary' : 'info'"
973+
:type="item.onDelayPath ? 'warning' : 'info'"
921974
>
922975
<span class="flex align-center gap-0.5">
923976
<el-icon><i-lucide-clock /></el-icon>
@@ -1601,4 +1654,9 @@ export default {
16011654
opacity: 1;
16021655
}
16031656
}
1657+
.logic-alert {
1658+
:deep(.el-alert__icon) {
1659+
margin-top: 4px;
1660+
}
1661+
}
16041662
</style>

packages/ldp/src/locale/lang/en.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,6 @@ export default {
6868
'Maximum data delay represents the longest time required for data changes generated in the source systems to be written into the model, after passing through all related synchronization and processing tasks.',
6969
packages_ldp_task_delay_detail_logic_tip2:
7070
'This metric aggregates the incremental delays across all upstream tables and their associated task pipelines involved in building the model, and takes the maximum value to indicate how late the most recently updated data in the model may be.',
71+
packages_ldp_task_delay_detail_logic_tip3:
72+
'Tasks included in this calculation are highlighted with their delay',
7173
}

packages/ldp/src/locale/lang/zh-CN.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,6 @@ export default {
6161
'最大数据延迟表示当前模型中,数据从源系统产生变更开始,经过所有参与的同步与处理任务,最终写入该模型所需的最长时间。',
6262
packages_ldp_task_delay_detail_logic_tip2:
6363
'该指标会综合计算构建此模型所涉及的所有上游表及其任务链路中的增量延迟,并取其中的最大值,反映模型中最晚更新的数据可能滞后的时间',
64+
packages_ldp_task_delay_detail_logic_tip3:
65+
'参与该计算的任务将会高亮显示其对应延迟',
6466
}

packages/ldp/src/locale/lang/zh-TW.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,6 @@ export default {
6161
'最大數據延遲表示當前模型中,數據從源系統產生變更開始,經過所有參與的同步與處理任務,最終寫入該模型所需的最長時間。',
6262
packages_ldp_task_delay_detail_logic_tip2:
6363
'該指標會綜合計算構建此模型所涉及的所有上游表及其任務鏈路中的增量延遲,並取其中的最大值,反映模型中最晚更新的數據可能滯後的時間',
64+
packages_ldp_task_delay_detail_logic_tip3:
65+
'參與該計算的任務將會高亮顯示其對應延遲',
6466
}

0 commit comments

Comments
 (0)