mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-25 17:42:25 +01:00
added system info
This commit is contained in:
@@ -20,6 +20,23 @@ const mutations = {
|
||||
},
|
||||
SET_ACTIVE_SPIDER (state, value) {
|
||||
state.activeSpider = value
|
||||
},
|
||||
SET_NODE_SYSTEM_INFO (state, payload) {
|
||||
const { id, systemInfo } = payload
|
||||
for (let i = 0; i < state.nodeList.length; i++) {
|
||||
if (state.nodeList[i]._id === id) {
|
||||
// Vue.set(state.nodeList[i], 'systemInfo', {})
|
||||
state.nodeList[i].systemInfo = systemInfo
|
||||
// for (const key in systemInfo) {
|
||||
// if (systemInfo.hasOwnProperty(key)) {
|
||||
// console.log(key)
|
||||
// state.nodeList[i].systemInfo[key] = systemInfo[key]
|
||||
// // Vue.set(state.nodeList[i].systemInfo, key, systemInfo[key])
|
||||
// }
|
||||
// }
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +44,15 @@ const actions = {
|
||||
getNodeList ({ state, commit }) {
|
||||
request.get('/nodes', {})
|
||||
.then(response => {
|
||||
commit('SET_NODE_LIST', response.data.data)
|
||||
commit('SET_NODE_LIST', response.data.data.map(d => {
|
||||
d.systemInfo = {
|
||||
os: '',
|
||||
arch: '',
|
||||
num_cpu: '',
|
||||
executables: []
|
||||
}
|
||||
return d
|
||||
}))
|
||||
})
|
||||
},
|
||||
editNode ({ state, dispatch }) {
|
||||
@@ -56,6 +81,12 @@ const actions = {
|
||||
.sort((a, b) => a.create_ts < b.create_ts ? 1 : -1),
|
||||
{ root: true })
|
||||
})
|
||||
},
|
||||
getNodeSystemInfo ({ state, commit }, id) {
|
||||
return request.get(`/nodes/${id}/system`)
|
||||
.then(response => {
|
||||
commit('SET_NODE_SYSTEM_INFO', { id, systemInfo: response.data.data })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user