diff --git a/spug_api/apps/monitor/views.py b/spug_api/apps/monitor/views.py index ed0cae7..59f0705 100644 --- a/spug_api/apps/monitor/views.py +++ b/spug_api/apps/monitor/views.py @@ -121,9 +121,14 @@ def get_overview(request): 'type': item.get_type_display(), 'target': key, 'desc': item.desc, - 'status': '1' if item.is_active else '0', + 'status': '0', 'latest_run_time': item.latest_run_time, } + if item.is_active: + if item.latest_run_time: + data[key]['status'] = '1' + else: + data[key]['status'] = '10' if item.is_active: for key, val in rds.hgetall(f'spug:det:{item.id}').items(): prefix, key = key.decode().split('_', 1) diff --git a/spug_web/src/pages/monitor/MonitorCard.js b/spug_web/src/pages/monitor/MonitorCard.js index b6284dd..fc158d4 100644 --- a/spug_web/src/pages/monitor/MonitorCard.js +++ b/spug_web/src/pages/monitor/MonitorCard.js @@ -9,21 +9,22 @@ import { Card, Input, Select, Space, Tooltip, Spin, message } from 'antd'; import { FrownOutlined, RedoOutlined, SyncOutlined } from '@ant-design/icons'; import styles from './index.module.less'; import { http, includes } from 'libs'; -import moment from 'moment'; import store from './store'; -const ColorMap = { - '0': '#cccccc', - '1': '#009400', - '2': '#ffba00', - '3': '#fa383e', +const StyleMap = { + '0': {background: '#99999933', border: '2px solid #999', color: '#999999'}, + '1': {background: '#16a98733', border: '2px solid #16a987', color: '#16a987'}, + '2': {background: '#ffba0033', border: '2px solid #ffba00', color: '#ffba00'}, + '3': {background: '#f2655d33', border: '2px solid #f2655d', color: '#f2655d'}, + '10': {background: '#99999919', border: '2px dashed #999999'} } const StatusMap = { '1': '正常', '2': '警告', '3': '紧急', - '0': '禁用', + '0': '未激活', + '10': '待调度' } let AutoReload = null @@ -37,14 +38,12 @@ function CardItem(props) {