mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-31 18:10:50 +01:00
加入树形结构文件目录
This commit is contained in:
@@ -38,8 +38,7 @@ const actions = {
|
||||
},
|
||||
getFileContent ({ commit, rootState }, payload) {
|
||||
const { path } = payload
|
||||
const spiderId = rootState.spider.spiderForm._id
|
||||
return request.get(`/spiders/${spiderId}/file`, { path })
|
||||
return request.get(`/file`, { path })
|
||||
.then(response => {
|
||||
commit('SET_FILE_CONTENT', response.data.data)
|
||||
})
|
||||
|
||||
@@ -38,7 +38,10 @@ const state = {
|
||||
previewCrawlData: [],
|
||||
|
||||
// template list
|
||||
templateList: []
|
||||
templateList: [],
|
||||
|
||||
// spider file tree
|
||||
fileTree: {}
|
||||
}
|
||||
|
||||
const getters = {}
|
||||
@@ -86,6 +89,9 @@ const mutations = {
|
||||
},
|
||||
SET_TEMPLATE_LIST (state, value) {
|
||||
state.templateList = value
|
||||
},
|
||||
SET_FILE_TREE (state, value) {
|
||||
state.fileTree = value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,6 +191,11 @@ const actions = {
|
||||
const { id } = payload
|
||||
const res = await request.get(`/spiders/${id}/schedules`)
|
||||
commit('schedule/SET_SCHEDULE_LIST', res.data.data, { root: true })
|
||||
},
|
||||
async getFileTree ({ state, commit }, payload) {
|
||||
const { id } = payload
|
||||
const res = await request.get(`/spiders/${id}/file/tree`)
|
||||
commit('SET_FILE_TREE', res.data.data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user