F 修复任务计划和监控中心更新时间会被错误的刷新问题

pull/22/head
vapao 2020-01-21 23:29:44 +08:00
parent ce1abd0c90
commit a9d1e281bb
4 changed files with 14 additions and 4 deletions

View File

@ -85,7 +85,6 @@ class ComTable extends React.Component {
}, {
title: '更新于',
dataIndex: 'latest_run_time',
render: value => value ? moment(value).fromNow() : null
}, {
title: '操作',
render: info => (

View File

@ -5,6 +5,7 @@
*/
import { observable } from "mobx";
import http from 'libs/http';
import moment from "moment";
class Store {
@observable records = [];
@ -18,7 +19,13 @@ class Store {
fetchRecords = () => {
this.isFetching = true;
http.get('/api/monitor/')
.then(res => this.records = res)
.then(res => {
res.map(item => {
const value = item['latest_run_time'];
item['latest_run_time'] = value ? moment(value).fromNow() : null
});
this.records = res
})
.finally(() => this.isFetching = false)
};

View File

@ -58,9 +58,8 @@ class ComTable extends React.Component {
}
},
}, {
title: '最近时间',
title: '更新于',
dataIndex: 'latest_run_time',
render: value => value ? moment(value).fromNow() : 'N/A'
}, {
title: '描述信息',
dataIndex: 'desc',

View File

@ -5,6 +5,7 @@
*/
import { observable } from "mobx";
import http from 'libs/http';
import moment from "moment";
class Store {
@observable records = [];
@ -23,6 +24,10 @@ class Store {
this.isFetching = true;
http.get('/api/schedule/')
.then(({types, tasks}) => {
tasks.map(item => {
const value = item['latest_run_time'];
item['latest_run_time'] = value ? moment(value).fromNow() : null
});
this.records = tasks;
this.types = types
})