Skip to content

Commit a23f34b

Browse files
committed
feat: update folder retrieval to include id and refactor folder path handling
1 parent 7b9fae5 commit a23f34b

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

ui/src/api/system-resource-management/application.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ import { type Ref } from 'vue'
66

77
const prefix = '/system/resource/application'
88

9-
9+
/**
10+
* 获取全部应用
11+
* @param param
12+
* @param loading
13+
*/
14+
const getAllApplication: (param?: any, loading?: Ref<boolean>) => Promise<Result<any[]>> = (
15+
param,
16+
loading,
17+
) => {
18+
return get(`${prefix}`, param, loading)
19+
}
1020
/**
1121
* 获取分页应用
1222
* param {
@@ -314,6 +324,7 @@ const getMcpTools: (application_id: string, loading?: Ref<boolean>) => Promise<R
314324
}
315325

316326
export default {
327+
getAllApplication,
317328
getApplication,
318329
putApplication,
319330
delApplication,

ui/src/api/system-resource-management/folder.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@ import { Result } from '@/request/Result'
22
import { get, post, del, put } from '@/request/index'
33
import { type Ref } from 'vue'
44

5-
import useStore from '@/stores'
6-
const prefix: any = { _value: '/workspace/' }
7-
Object.defineProperty(prefix, 'value', {
8-
get: function () {
9-
const { user } = useStore()
10-
return this._value + user.getWorkspaceId()
11-
},
12-
})
5+
const prefix = '/system/resource'
6+
137

148
/**
159
* 获得文件夹列表
@@ -22,7 +16,7 @@ const getFolder: (
2216
data?: any,
2317
loading?: Ref<boolean>,
2418
) => Promise<Result<Array<any>>> = (source, data, loading) => {
25-
return get(`${prefix.value}/${source}/folder`, data, loading)
19+
return get(`${prefix}/${source}/folder`, data, loading)
2620
}
2721

2822

ui/src/components/workflow-dropdown-menu/application/index.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ const props = defineProps({
153153
const emit = defineEmits(['clickNodes', 'onmousedown'])
154154
155155
const apiType = computed(() => {
156-
if (route.path.includes('resource-management')) {
156+
if (route.path.includes('shared')) {
157+
return 'systemShare'
158+
} else if (route.path.includes('resource-management')) {
157159
return 'systemManage'
158160
} else {
159161
return 'workspace'
@@ -247,7 +249,7 @@ const toolTreeData = ref<any[]>([])
247249
const toolList = ref<any[]>([])
248250
249251
async function getToolFolder() {
250-
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {}, apiType.value, loading)
252+
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {id: props.id}, apiType.value, loading)
251253
toolTreeData.value = res.data
252254
folder.setCurrentFolder(res.data?.[0] || {})
253255
}
@@ -256,7 +258,7 @@ async function getToolList() {
256258
const res = await loadSharedApi({
257259
type: 'tool',
258260
isShared: folder.currentFolder?.id === 'share',
259-
systemType: 'workspace',
261+
systemType: apiType.value,
260262
}).getToolList({
261263
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
262264
tool_type: 'CUSTOM',
@@ -269,7 +271,7 @@ const applicationTreeData = ref<any[]>([])
269271
const applicationList = ref<any[]>([])
270272
271273
function getApplicationFolder() {
272-
folder.asyncGetFolder(SourceTypeEnum.APPLICATION, {}, apiType.value, loading).then((res: any) => {
274+
folder.asyncGetFolder(SourceTypeEnum.APPLICATION, {id: props.id}, apiType.value, loading).then((res: any) => {
273275
applicationTreeData.value = res.data
274276
folder.setCurrentFolder(res.data?.[0] || {})
275277
})
@@ -278,7 +280,7 @@ function getApplicationFolder() {
278280
async function getApplicationList() {
279281
const res = await loadSharedApi({
280282
type: 'application',
281-
systemType: 'workspace',
283+
systemType: apiType.value,
282284
}).getAllApplication({
283285
folder_id: folder.currentFolder?.id || user.getWorkspaceId(),
284286
})

ui/src/components/workflow-dropdown-menu/knowledge-inner/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ const toolTreeData = ref<any[]>([])
210210
const toolList = ref<any[]>([])
211211
212212
async function getToolFolder() {
213-
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {}, apiType.value, loading)
213+
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {id: props.id}, apiType.value, loading)
214214
toolTreeData.value = res.data
215215
folder.setCurrentFolder(res.data?.[0] || {})
216216
}

ui/src/components/workflow-dropdown-menu/knowledge/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ const toolTreeData = ref<any[]>([])
230230
const toolList = ref<any[]>([])
231231
232232
async function getToolFolder() {
233-
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {}, apiType.value, loading)
233+
const res: any = await folder.asyncGetFolder(SourceTypeEnum.TOOL, {id: props.id}, apiType.value, loading)
234234
toolTreeData.value = res.data
235235
folder.setCurrentFolder(res.data?.[0] || {})
236236
}

0 commit comments

Comments
 (0)