changed the way how task is saved to database

This commit is contained in:
Marvin Zhang
2019-03-16 21:29:30 +08:00
parent 826fe50f1e
commit b27a36befc
4 changed files with 5 additions and 13 deletions

View File

@@ -1,5 +1,4 @@
import request from '../../api/request'
import dayjs from 'dayjs'
const state = {
// NodeList
@@ -69,10 +68,8 @@ const actions = {
return request.get(`/nodes/${id}/get_deploys`)
.then(response => {
commit('deploy/SET_DEPLOY_LIST',
response.data.items.map(d => {
if (d.finish_ts) d.finish_ts = dayjs(d.finish_ts.$date).format('YYYY-MM-DD HH:mm:ss')
return d
}).sort((a, b) => a.finish_ts < b.finish_ts ? 1 : -1),
response.data.items.map(d => d)
.sort((a, b) => a.finish_ts < b.finish_ts ? 1 : -1),
{ root: true })
})
},
@@ -80,11 +77,8 @@ const actions = {
return request.get(`/nodes/${id}/get_tasks`)
.then(response => {
commit('task/SET_TASK_LIST',
response.data.items.map(d => {
if (d.create_ts) d.create_ts = dayjs(d.create_ts.$date).format('YYYY-MM-DD HH:mm:ss')
if (d.finish_ts) d.finish_ts = dayjs(d.finish_ts.$date).format('YYYY-MM-DD HH:mm:ss')
return d
}).sort((a, b) => a.create_ts < b.create_ts ? 1 : -1),
response.data.items.map(d => d)
.sort((a, b) => a.create_ts < b.create_ts ? 1 : -1),
{ root: true })
})
}