From 3fa411e072ceb926579b80b85e5b4dfe19108245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E4=BA=8C=E7=8C=9B?= Date: Mon, 2 Dec 2019 23:19:27 +0800 Subject: [PATCH] U web improve --- spug_web/src/pages/monitor/Table.js | 35 +++++++++++++++++++++++------ spug_web/src/pages/monitor/index.js | 9 +++++--- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/spug_web/src/pages/monitor/Table.js b/spug_web/src/pages/monitor/Table.js index 832bc3a..813060d 100644 --- a/spug_web/src/pages/monitor/Table.js +++ b/spug_web/src/pages/monitor/Table.js @@ -1,12 +1,13 @@ import React from 'react'; import { observer } from 'mobx-react'; -import { Table, Divider, Modal, message } from 'antd'; +import { Table, Divider, Modal, Tag, message } from 'antd'; import { LinkButton } from 'components'; import ComForm from './Form'; import http from 'libs/http'; import store from './store'; import hostStore from '../host/store'; import lds from 'lodash'; +import moment from "moment"; @observer class ComTable extends React.Component { @@ -57,11 +58,23 @@ class ComTable extends React.Component { render: value => `${value}分钟` }, { title: '状态', - dataIndex: 'xx' + render: info => { + if (info.is_active) { + if (info['latest_status'] === 0) { + return 正常 + } else if (info['latest_status'] === 1) { + return 异常 + } else { + return 待检测 + } + } else { + return 未启用 + } + } }, { - title: '备注', - dataIndex: 'desc', - ellipsis: true + title: '更新于', + dataIndex: 'latest_run_time', + render: value => value ? moment(value).fromNow() : null }, { title: '操作', render: info => ( @@ -109,8 +122,16 @@ class ComTable extends React.Component { if (store.f_name) { data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase())) } - if (store.f_status) { - data = data.filter(item => String(item['is_active']) === store.f_status) + if (store.f_status !== undefined) { + if (store.f_status === -3) { + data = data.filter(item => !item['is_active']) + } else if (store.f_status === -2) { + data = data.filter(item => item['is_active']) + } else if (store.f_status === -1) { + data = data.filter(item => item['is_active'] && !item['latest_status_alias']) + } else { + data = data.filter(item => item['latest_status'] === store.f_status) + } } return ( diff --git a/spug_web/src/pages/monitor/index.js b/spug_web/src/pages/monitor/index.js index c8c1261..cf3af30 100644 --- a/spug_web/src/pages/monitor/index.js +++ b/spug_web/src/pages/monitor/index.js @@ -9,12 +9,15 @@ export default function () { - store.f_name = e.target.value} placeholder="请输入"/> + store.f_name = e.target.value} placeholder="请输入"/>