Skip to content

Commit 2d44a99

Browse files
committed
refactor(api): Unify interface naming and adjust service topology parameters
1 parent 3295434 commit 2d44a99

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

ui-vue3/src/api/mock/mockApp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import Mock from 'mockjs'
1919
import devTool from '@/utils/DevToolUtil'
2020

21-
Mock.mock(devTool.mockUrl('/interface/graph'), 'get', () => {
21+
Mock.mock(devTool.mockUrl('/application/graph'), 'get', () => {
2222
return {
2323
code: 'Success',
2424
message: 'success',

ui-vue3/src/api/service/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ export const updateAppGrayIsolation = (appName: string, graySets: Array<any>): P
175175
})
176176
}
177177

178-
export const getInterfaceGraph = (serviceName: string): Promise<any> => {
178+
export const getApplicationGraph = (serviceName: string): Promise<any> => {
179179
return request({
180-
url: '/interface/graph',
180+
url: '/application/graph',
181181
method: 'get',
182182
params: { serviceName }
183183
})

ui-vue3/src/api/service/service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const searchService = (params: any): Promise<any> => {
2727
}
2828

2929
export const getServiceDetail = (params: any): Promise<any> => {
30-
return request({
30+
return request({
3131
url: '/service/detail',
3232
method: 'get',
3333
params
@@ -137,9 +137,12 @@ export const updateParamRouteAPI = (data: {
137137
})
138138
}
139139

140-
export const getServiceGraph = (): Promise<any> => {
140+
export const getServiceGraph = (serviceName: string): Promise<any> => {
141141
return request({
142142
url: '/service/graph',
143-
method: 'get'
143+
method: 'get',
144+
params: {
145+
serviceName
146+
}
144147
})
145148
}

ui-vue3/src/views/resources/applications/tabs/topology.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
<script setup lang="tsx">
4949
import { PRIMARY_COLOR } from '@/base/constants'
50-
import { getApplicationDetail, getInterfaceGraph } from '@/api/service/app'
50+
import { getApplicationDetail, getApplicationGraph } from '@/api/service/app'
5151
import { HTTP_STATUS } from '@/base/http/constants'
5252
import { computed, defineComponent, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue'
5353
import type { PropType } from 'vue'
@@ -268,7 +268,7 @@ let resizeHandler: (() => void) | null = null
268268
onMounted(async () => {
269269
try {
270270
const serviceName = String(route.params?.pathId ?? '')
271-
const res = await getInterfaceGraph(serviceName)
271+
const res = await getApplicationGraph(serviceName)
272272
if (res?.code !== HTTP_STATUS.SUCCESS) return
273273
274274
const graphData = buildGraphData(res?.data)

ui-vue3/src/views/resources/services/tabs/topology.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ const renderTopology = (graphData: any) => {
272272
const nodeData: any = serviceName ? graphRef.value?.getNodeData(serviceName) : undefined
273273
const params = {
274274
serviceName: serviceName,
275-
side: nodeData?.type ?? 'application',
275+
side: nodeData?.rule ?? 'provider',
276276
version: route.params?.version || '',
277277
group: route.params?.group || ''
278278
}
@@ -321,7 +321,9 @@ const renderTopology = (graphData: any) => {
321321
let resizeHandler: (() => void) | null = null
322322
onMounted(async () => {
323323
try {
324-
const res = await getServiceGraph()
324+
const serviceName = String(route.params?.pathId ?? '')
325+
console.log('topology', serviceName)
326+
const res = await getServiceGraph(serviceName)
325327
if (res?.code !== HTTP_STATUS.SUCCESS) return
326328
const graphData = buildGraphData(res?.data)
327329
renderTopology(graphData)

0 commit comments

Comments
 (0)