mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-31 18:10:50 +01:00
updated SiteList
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import request from '../../api/request'
|
||||
|
||||
const state = {
|
||||
// site list
|
||||
siteList: [],
|
||||
|
||||
// main category list
|
||||
mainCategoryList: [],
|
||||
|
||||
// (sub) category list
|
||||
categoryList: [],
|
||||
|
||||
// filter
|
||||
filter: {
|
||||
mainCategory: undefined,
|
||||
category: undefined
|
||||
},
|
||||
keyword: '',
|
||||
@@ -32,6 +40,12 @@ const mutations = {
|
||||
},
|
||||
SET_TOTAL_COUNT (state, value) {
|
||||
state.totalCount = value
|
||||
},
|
||||
SET_MAIN_CATEGORY_LIST (state, value) {
|
||||
state.mainCategoryList = value
|
||||
},
|
||||
SET_CATEGORY_LIST (state, value) {
|
||||
state.categoryList = value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +62,7 @@ const actions = {
|
||||
page_size: state.pageSize,
|
||||
keyword: state.keyword || undefined,
|
||||
filter: {
|
||||
main_category: state.filter.mainCategory || undefined,
|
||||
category: state.filter.category || undefined
|
||||
}
|
||||
})
|
||||
@@ -55,6 +70,20 @@ const actions = {
|
||||
commit('SET_SITE_LIST', response.data.items)
|
||||
commit('SET_TOTAL_COUNT', response.data.total_count)
|
||||
})
|
||||
},
|
||||
getMainCategoryList ({ state, commit }) {
|
||||
return request.get('/sites/get/get_main_category_list')
|
||||
.then(response => {
|
||||
commit('SET_MAIN_CATEGORY_LIST', response.data.items)
|
||||
})
|
||||
},
|
||||
getCategoryList ({ state, commit }) {
|
||||
return request.get('/sites/get/get_category_list', {
|
||||
'main_category': state.filter.mainCategory || undefined
|
||||
})
|
||||
.then(response => {
|
||||
commit('SET_CATEGORY_LIST', response.data.items)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,10 @@ const state = {
|
||||
dailyStats: [],
|
||||
|
||||
// spider node stats
|
||||
nodeStats: []
|
||||
nodeStats: [],
|
||||
|
||||
// filters
|
||||
filterSite: ''
|
||||
}
|
||||
|
||||
const getters = {}
|
||||
@@ -55,12 +58,20 @@ const mutations = {
|
||||
},
|
||||
SET_NODE_STATS (state, value) {
|
||||
state.nodeStats = value
|
||||
},
|
||||
SET_FILTER_SITE (state, value) {
|
||||
state.filterSite = value
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
getSpiderList ({ state, commit }) {
|
||||
return request.get('/spiders', {})
|
||||
let params = {}
|
||||
if (state.filterSite) {
|
||||
params.site = state.filterSite
|
||||
}
|
||||
console.log(params)
|
||||
return request.get('/spiders', params)
|
||||
.then(response => {
|
||||
commit('SET_SPIDER_LIST', response.data.items)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user