@@ -22,6 +22,7 @@ import {
2222import { getConnectors , getSupervisor } from ' @tap/api/src/core/proxy'
2323import {
2424 fetchWorkers ,
25+ getProcessInfo ,
2526 queryAllBindWorker ,
2627 unbindByProcessId ,
2728} from ' @tap/api/src/core/workers'
@@ -80,10 +81,6 @@ interface SearchParams {
8081 keyword: string
8182}
8283
83- interface ApiResponse <T > {
84- items: T []
85- }
86-
8784interface ClusterData {
8885 uuid: string
8986 id? : string
@@ -144,33 +141,21 @@ const childRules = ref()
144141const tree = ref ()
145142const engineTable = ref ()
146143const tagForm = ref ()
147- const editAgentForm = ref ()
148144
149145// State
150146const hideDownload = ref (import .meta .env .VUE_APP_HIDE_CLUSTER_DOWNLOAD )
151147const waterfallData = ref ([])
152148const currentData = ref <ClusterData | null >(null )
153149const dialogForm = ref (false )
154- const activeIndex = ref (' 1' )
155- const serveStatus = ref (' ' )
156- const isStop = ref (false )
157- const engineState = ref (' ' )
158- const managementState = ref (' ' )
159- const apiServerState = ref (' ' )
160150const editItem = ref ({})
161151const timer = ref (null )
162- const downLoadAgetntdialog = ref (false )
163152const editAgentDialog = ref (false )
164- const deleteDialogVisible = ref (false )
165- const downLoadNum = ref (0 )
166153const version = ref (null )
167154const ips = ref ([])
168155const custIP = ref (' ' )
169156const custId = ref (' ' )
170157const agentName = ref (' ' )
171158const currentNde = ref ({})
172- const delData = ref (' ' )
173- const processIdData = ref ([])
174159const searchParams = ref <SearchParams >({
175160 keyword: ' ' ,
176161})
@@ -562,6 +547,25 @@ const getDataApi = async (noFilter?: boolean) => {
562547 }, 0 )
563548 }
564549 }
550+ // Fetch running task counts
551+ if (processId .length > 0 ) {
552+ try {
553+ const processData = await getProcessInfo (processId )
554+ if (processData ) {
555+ for (const item of clusterData ) {
556+ const pid = item .systemInfo ?.process_id
557+ if (pid && (processData as any )[pid ]) {
558+ ;(item as any ).runningTaskNum = (processData as any )[
559+ pid
560+ ].runningTaskNum
561+ }
562+ }
563+ }
564+ } catch {
565+ /* ignore */
566+ }
567+ }
568+
565569 waterfallData .value = clusterData
566570
567571 apiServerData .value = _apiServerData
@@ -626,6 +630,16 @@ const getStatus = (type: string) => {
626630 return STATUS_MAP [type ] || ' -'
627631}
628632
633+ const navigateToTaskList = (item : any , syncType : ' migrate' | ' sync' ) => {
634+ const processId = item .systemInfo ?.process_id
635+ if (! processId ) return
636+ const routeName = syncType === ' migrate' ? ' migrateList' : ' dataflowList'
637+ router .push ({
638+ name: routeName ,
639+ query: { agentId: processId , status: ' running' },
640+ })
641+ }
642+
629643const openNetStatDialog = (row : any ) => {
630644 netStatDialog .visible = true
631645 netStatDialog .data = row .engine .netStat || []
@@ -1389,7 +1403,7 @@ const onUpdateLicenseSuccess = () => {
13891403 <div class =" flex-1 border rounded-xl p-4" >
13901404 <div class =" flex align-center justify-content-between mb-3" >
13911405 <span class =" section-title font-color-dark fs-6 fw-sub"
1392- >API server </span
1406+ >API Server </span
13931407 >
13941408 </div >
13951409 <ElTable :data =" apiServerData " >
@@ -1488,12 +1502,38 @@ const onUpdateLicenseSuccess = () => {
14881502 <h2 class =" name fs-6" >
14891503 {{ item.agentName || item.systemInfo.hostname }}
14901504 </h2 >
1491- <div class =" uuid fs-8 my-1 " >
1505+ <div class =" uuid fs-8 my-2 " >
14921506 {{ item.systemInfo.uuid }}
14931507 </div >
1494- <span class =" ip" >{{
1495- item.custIP ? item.custIP : item.systemInfo.ip
1496- }}</span >
1508+ <div class =" flex gap-2" >
1509+ <span class =" ip" >{{
1510+ item.custIP ? item.custIP : item.systemInfo.ip
1511+ }}</span >
1512+ <el-tag
1513+ v-if =" item.runningTaskNum?.migrate > 0"
1514+ type =" primary"
1515+ size =" small"
1516+ class =" cursor-pointer"
1517+ @click.stop =" navigateToTaskList(item, 'migrate')"
1518+ >
1519+ {{ $t('public_task_type_migrate')
1520+ }}<span class =" ml-1 fw-bold" >{{
1521+ item.runningTaskNum?.migrate || 0
1522+ }}</span >
1523+ </el-tag >
1524+ <el-tag
1525+ v-if =" item.runningTaskNum?.sync > 0"
1526+ type =" primary"
1527+ size =" small"
1528+ class =" cursor-pointer"
1529+ @click.stop =" navigateToTaskList(item, 'sync')"
1530+ >
1531+ {{ $t('public_task_type_sync')
1532+ }}<span class =" ml-1 fw-bold" >{{
1533+ item.runningTaskNum?.sync || 0
1534+ }}</span >
1535+ </el-tag >
1536+ </div >
14971537 </div >
14981538 </div >
14991539 <div
@@ -1749,7 +1789,7 @@ const onUpdateLicenseSuccess = () => {
17491789 </el-row >
17501790 <el-row :gutter =" 16" class =" data-list" >
17511791 <el-col :span =" 6" >
1752- <span class =" txt fw-normal" >API server </span >
1792+ <span class =" txt fw-normal" >API Server </span >
17531793 </el-col >
17541794 <el-col :span =" 4" >
17551795 <span
@@ -1763,7 +1803,7 @@ const onUpdateLicenseSuccess = () => {
17631803 `status-${item.apiServer.serviceStatus}`,
17641804 'status',
17651805 ]"
1766- >{{ getStatus(item.apiServer.status ) }}</span
1806+ >{{ getStatus(item.apiServer.serviceStatus ) }}</span
17671807 >
17681808 </el-col >
17691809 <el-col :span =" 10" >
@@ -2133,7 +2173,6 @@ const onUpdateLicenseSuccess = () => {
21332173 @close =" editAgentDialog = false"
21342174 >
21352175 <el-form
2136- ref =" editAgentForm"
21372176 label-width =" 100px"
21382177 class =" edit-agent-form"
21392178 label-position =" top"
@@ -2174,11 +2213,9 @@ const onUpdateLicenseSuccess = () => {
21742213 <ElButton @click =" editAgentDialog = false " >{{
21752214 $t('public_button_cancel')
21762215 }}</ElButton >
2177- <ElButton
2178- type="primary"
2179- @click =" submitEditAgent (' editAgentForm' )"
2180- >{{ $t('public_button_confirm') }}</ElButton
2181- >
2216+ <ElButton type="primary" @click =" submitEditAgent " >{{
2217+ $t('public_button_confirm')
2218+ }}</ElButton >
21822219 </div >
21832220 </template >
21842221 </el-dialog >
0 commit comments