5555import { PRIMARY_COLOR } from ' @/base/constants'
5656import { HTTP_STATUS } from ' @/base/http/constants'
5757import { getServiceDetail , getServiceGraph } from ' @/api/service/service'
58+ import { getApplicationDetail } from ' @/api/service/app'
5859import { computed , defineComponent , onBeforeUnmount , onMounted , ref , shallowRef , watch } from ' vue'
5960import type { PropType } from ' vue'
6061import { VueNode } from ' g6-extension-vue'
@@ -224,7 +225,6 @@ const buildGraphData = (raw: any) => {
224225
225226 return { nodes , edges }
226227}
227-
228228const renderTopology = (graphData : any ) => {
229229 const root = document .getElementById (' topology' )
230230 if (! root ) return
@@ -270,12 +270,6 @@ const renderTopology = (graphData: any) => {
270270 const handleNodeClick = async (e : any ) => {
271271 const serviceName = String (e ?.target ?.id ?? ' ' )
272272 const nodeData: any = serviceName ? graphRef .value ?.getNodeData (serviceName ) : undefined
273- const params = {
274- serviceName: serviceName ,
275- side: nodeData ?.rule ?? ' provider' ,
276- version: route .params ?.version || ' ' ,
277- group: route .params ?.group || ' '
278- }
279273
280274 if (! serviceName ) return
281275
@@ -284,7 +278,7 @@ const renderTopology = (graphData: any) => {
284278 currentDetailKey .value = serviceName
285279 detailError .value = ' '
286280
287- const cacheKey = ` ${serviceName }|${ params . side }|${ params . version }|${ params . group } `
281+ const cacheKey = ` ${serviceName } `
288282 const cached = detailCache .get (cacheKey )
289283 if (cached ) {
290284 detailData .value = cached
@@ -294,7 +288,13 @@ const renderTopology = (graphData: any) => {
294288
295289 detailLoading .value = true
296290 try {
297- const res = await getServiceDetail (params )
291+ let res
292+ if (nodeData .type === ' application' ) {
293+ res = await getApplicationDetail (nodeData .id )
294+ } else if (nodeData .type === ' service' ) {
295+ res = await getServiceDetail (nodeData .id )
296+ }
297+ console .log (' res' , res )
298298 if (res ?.code !== HTTP_STATUS .SUCCESS ) {
299299 detailError .value = String (res ?.message ?? ' 请求失败' )
300300 detailData .value = {}
0 commit comments