adapt changes to golang api

This commit is contained in:
Marvin Zhang
2019-07-21 16:48:58 +08:00
parent 95d30691a0
commit ece3659155
40 changed files with 263 additions and 2004 deletions

View File

@@ -27,27 +27,11 @@ const actions = {
getNodeList ({ state, commit }) {
request.get('/nodes', {})
.then(response => {
commit('SET_NODE_LIST', response.data.items)
})
},
addNode ({ state, dispatch }) {
request.put('/nodes', {
name: state.nodeForm.name,
ip: state.nodeForm.ip,
port: state.nodeForm.port,
description: state.nodeForm.description
})
.then(() => {
dispatch('getNodeList')
commit('SET_NODE_LIST', response.data.data)
})
},
editNode ({ state, dispatch }) {
request.post(`/nodes/${state.nodeForm._id}`, {
name: state.nodeForm.name,
ip: state.nodeForm.ip,
port: state.nodeForm.port,
description: state.nodeForm.description
})
request.post(`/nodes/${state.nodeForm._id}`, state.nodeForm)
.then(() => {
dispatch('getNodeList')
})
@@ -61,23 +45,14 @@ const actions = {
getNodeData ({ state, commit }, id) {
request.get(`/nodes/${id}`)
.then(response => {
commit('SET_NODE_FORM', response.data)
})
},
getDeployList ({ state, commit }, id) {
return request.get(`/nodes/${id}/get_deploys`)
.then(response => {
commit('deploy/SET_DEPLOY_LIST',
response.data.items.map(d => d)
.sort((a, b) => a.finish_ts < b.finish_ts ? 1 : -1),
{ root: true })
commit('SET_NODE_FORM', response.data.data)
})
},
getTaskList ({ state, commit }, id) {
return request.get(`/nodes/${id}/get_tasks`)
return request.get(`/nodes/${id}/tasks`)
.then(response => {
commit('task/SET_TASK_LIST',
response.data.items.map(d => d)
response.data.data.map(d => d)
.sort((a, b) => a.create_ts < b.create_ts ? 1 : -1),
{ root: true })
})