Skip to content

Commit ba9d760

Browse files
committed
feat(History.vue): implement task link navigation for task monitor and enhance styling for task names
1 parent c1d9826 commit ba9d760

2 files changed

Lines changed: 50 additions & 7 deletions

File tree

apps/daas/src/views/cluster/TaskRebalanceDrawer.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import { useI18n } from '@tap/i18n'
1111
import { computed, ref, watch } from 'vue'
1212
import { useRouter } from 'vue-router'
1313
14-
const emit = defineEmits<{
15-
(e: 'success'): void
16-
}>()
17-
1814
const { t } = useI18n()
1915
const router = useRouter()
2016

apps/daas/src/views/task-rebalance/History.vue

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,27 @@ import { dayjs } from '@tap/business/src/shared'
1616
import { Modal } from '@tap/component/src/modal'
1717
import { useI18n } from '@tap/i18n'
1818
import { computed, onUnmounted, ref, watch } from 'vue'
19+
import { useRouter } from 'vue-router'
1920
import TaskRebalanceDrawer from '../cluster/TaskRebalanceDrawer.vue'
2021
2122
const { t } = useI18n()
2223
const $has = useHas()
24+
const router = useRouter()
25+
26+
const SYNC_TYPE_ROUTE_MAP: Record<string, string> = {
27+
sync: 'TaskMonitor',
28+
migrate: 'MigrationMonitor',
29+
logCollector: 'SharedMiningMonitor',
30+
mem_cache: 'SharedCacheMonitor',
31+
connHeartbeat: 'HeartbeatMonitor',
32+
}
33+
34+
function openTaskMonitor(taskId: string, syncType: string) {
35+
const name = SYNC_TYPE_ROUTE_MAP[syncType]
36+
if (!name) return
37+
const { href } = router.resolve({ name, params: { id: taskId } })
38+
window.open(href, '_blank')
39+
}
2340
2441
const hasEditPermission = computed(() => {
2542
return $has('v2_task_rebalance_Edit')
@@ -620,10 +637,24 @@ onUnmounted(stopDetailPolling)
620637
>
621638
<el-table-column
622639
:label="t('daas_task_rebalance_history_col_task')"
623-
prop="taskName"
624640
min-width="180"
625-
show-overflow-tooltip
626-
/>
641+
>
642+
<template #default="{ row }">
643+
<el-link
644+
v-if="row.syncType"
645+
class="task-name-link"
646+
:underline="false"
647+
type="primary"
648+
@click="openTaskMonitor(row.taskId, row.syncType)"
649+
>
650+
<span class="ellipsis">{{ row.taskName }}</span>
651+
<el-icon class="task-name-link__icon ml-1">
652+
<i-lucide-external-link />
653+
</el-icon>
654+
</el-link>
655+
<span v-else class="ellipsis">{{ row.taskName }}</span>
656+
</template>
657+
</el-table-column>
627658
<el-table-column
628659
:label="t('daas_task_rebalance_history_col_source')"
629660
min-width="140"
@@ -718,6 +749,22 @@ onUnmounted(stopDetailPolling)
718749
</template>
719750

720751
<style lang="scss" scoped>
752+
.task-name-link {
753+
max-width: 100%;
754+
display: inline-flex;
755+
align-items: center;
756+
757+
&__icon {
758+
flex-shrink: 0;
759+
opacity: 0;
760+
transition: opacity 0.15s;
761+
}
762+
763+
&:hover .task-name-link__icon {
764+
opacity: 1;
765+
}
766+
}
767+
721768
.stat-card {
722769
border: 1px solid var(--el-border-color-lighter);
723770
background-color: var(--el-bg-color);

0 commit comments

Comments
 (0)