diff --git a/spug_web/src/pages/monitor/Table.js b/spug_web/src/pages/monitor/Table.js index ff0be36..0b27409 100644 --- a/spug_web/src/pages/monitor/Table.js +++ b/spug_web/src/pages/monitor/Table.js @@ -85,7 +85,6 @@ class ComTable extends React.Component { }, { title: '更新于', dataIndex: 'latest_run_time', - render: value => value ? moment(value).fromNow() : null }, { title: '操作', render: info => ( diff --git a/spug_web/src/pages/monitor/store.js b/spug_web/src/pages/monitor/store.js index 6ea9cfc..cf6901f 100644 --- a/spug_web/src/pages/monitor/store.js +++ b/spug_web/src/pages/monitor/store.js @@ -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) }; diff --git a/spug_web/src/pages/schedule/Table.js b/spug_web/src/pages/schedule/Table.js index e27dd3d..92a058e 100644 --- a/spug_web/src/pages/schedule/Table.js +++ b/spug_web/src/pages/schedule/Table.js @@ -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', diff --git a/spug_web/src/pages/schedule/store.js b/spug_web/src/pages/schedule/store.js index 4a45879..5f6558d 100644 --- a/spug_web/src/pages/schedule/store.js +++ b/spug_web/src/pages/schedule/store.js @@ -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 })