|
|
@@ -12,11 +12,14 @@ class TaskList extends React.Component {
|
|
|
componentDidMount() {
|
|
|
this.timer = setInterval(() => {
|
|
|
this.props.tasks.forEach((x) => {
|
|
|
- axios.get(BACKEND_URL + "/result/" + x).then(r => {
|
|
|
- this.state.details[x] = r.data.data
|
|
|
- this.state.details[x]['status'] = r.data.msg
|
|
|
- this.setState(this.state.details)
|
|
|
- })
|
|
|
+
|
|
|
+ if (!(x in this.state.details) || this.state.details[x]['status'] == 'running') {
|
|
|
+ axios.get(BACKEND_URL + "/result/" + x).then(r => {
|
|
|
+ this.state.details[x] = r.data.data
|
|
|
+ this.state.details[x]['status'] = r.data.msg
|
|
|
+ this.setState(this.state.details)
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
}, 2000)
|
|
|
}
|
|
|
@@ -38,10 +41,24 @@ class TaskList extends React.Component {
|
|
|
return <></>;
|
|
|
}
|
|
|
|
|
|
+ let data = ""
|
|
|
+ let advice = ""
|
|
|
+ let raw = ""
|
|
|
+
|
|
|
+ try {
|
|
|
+ raw = JSON.stringify(details.result.raw)
|
|
|
+ data = JSON.stringify(details.result.analysis.data)
|
|
|
+ advice = JSON.stringify(details.result.analysis.advice)
|
|
|
+ } catch (e) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<Collapse.Panel header={"任务 ID: " + x} key={x}>
|
|
|
<p>状态: {details.status}</p>
|
|
|
- <p>结果: {JSON.stringify(details.data)}</p>
|
|
|
+ <p>建议: {advice}</p>
|
|
|
+ <p>评分: {data}</p>
|
|
|
+ <p>原始数据: {raw}</p>
|
|
|
</Collapse.Panel>
|
|
|
)
|
|
|
})
|