mirror of https://github.com/openspug/spug
				
				
				
			F 修复任务计划和监控中心更新时间会被错误的刷新问题
							parent
							
								
									ce1abd0c90
								
							
						
					
					
						commit
						a9d1e281bb
					
				|  | @ -85,7 +85,6 @@ class ComTable extends React.Component { | |||
|   }, { | ||||
|     title: '更新于', | ||||
|     dataIndex: 'latest_run_time', | ||||
|     render: value => value ? moment(value).fromNow() : null | ||||
|   }, { | ||||
|     title: '操作', | ||||
|     render: info => ( | ||||
|  |  | |||
|  | @ -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) | ||||
|   }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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', | ||||
|  |  | |||
|  | @ -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 | ||||
|       }) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 vapao
						vapao