7 changed files with 303 additions and 22 deletions
			
			
		| @ -1,6 +1,8 @@ | |||||
| 'use strict'; | 'use strict'; | ||||
| import Coming from './coming' | import Coming from './coming' | ||||
|  | import { SkeletonScreen } from './skeletonScreen' | ||||
| 
 | 
 | ||||
| export { | export { | ||||
|    Coming |    Coming, | ||||
|  |    SkeletonScreen | ||||
| }; | }; | ||||
|  | |||||
| @ -0,0 +1,18 @@ | |||||
|  | import React, { useState, useEffect } from "react"; | ||||
|  | import { Skeleton } from "@douyinfe/semi-ui"; | ||||
|  | 
 | ||||
|  | 
 | ||||
|  | export function SkeletonScreen () { | ||||
|  |    return <> | ||||
|  |       <Skeleton.Title style={{ width: "95%", height: 24, margin: "8px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "80%", height: 28, margin: "16px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "50%", height: 28, margin: "16px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "60%", height: 28, margin: "16px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "90%", height: 28, margin: "16px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "70%", height: 28, margin: "16px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "50%", height: 28, margin: "16px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "40%", height: 28, margin: "16px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "60%", height: 28, margin: "16px 20px" }} /> | ||||
|  |       <Skeleton.Title style={{ width: "40%", height: 28, margin: "16px 20px" }} /> | ||||
|  |    </> | ||||
|  | } | ||||
| @ -1,19 +1,56 @@ | |||||
| 'use strict'; | 'use strict'; | ||||
| 
 | 
 | ||||
| import { ApiTable,basicAction } from "$utils"; | import { basicAction } from '@peace/utils' | ||||
|  | import { ApiTable } from '$utils' | ||||
| 
 | 
 | ||||
| export function getVersions() { | export function getGateways (query = {}) { | ||||
|  |    return dispatch => basicAction({ | ||||
|  |       type: 'get', | ||||
|  |       dispatch: dispatch, | ||||
|  |       query: query, | ||||
|  |       actionType: 'GET_GATEWAY_LIST', | ||||
|  |       url: ApiTable.getGateways, | ||||
|  |       msg: { option: '查询网关列表' }, | ||||
|  |       reducer: { name: 'getGateways' } | ||||
|  |    }); | ||||
|  | } | ||||
|  | 
 | ||||
|  | export function getGatewayStatus (id) { | ||||
|  |    return dispatch => basicAction({ | ||||
|  |       type: 'get', | ||||
|  |       dispatch: dispatch, | ||||
|  |       actionType: 'GET_GATEWAY_STATUS', | ||||
|  |       url: ApiTable.getGatewayStatus.replace('{id}', id), | ||||
|  |       msg: { option: '查询网关状态指标' }, | ||||
|  |       reducer: { name: 'getGatewayStatus' } | ||||
|  |    }); | ||||
|  | } | ||||
|  | export function ableGateway (id, data) { | ||||
|  |    return dispatch => basicAction({ | ||||
|  |       type: 'put', | ||||
|  |       data: data, | ||||
|  |       dispatch: dispatch, | ||||
|  |       actionType: 'ABLE_GATEWAY', | ||||
|  |       url: ApiTable.ableGateway.replace('{id}', id), | ||||
|  |       msg: { option: '使能网关' }, | ||||
|  |    }); | ||||
|  | } | ||||
|  | 
 | ||||
|  | export function getVersions () { | ||||
|    return (dispatch) => |    return (dispatch) => | ||||
|      basicAction({ |       basicAction({ | ||||
|        type: "get", |          type: "get", | ||||
|        dispatch: dispatch, |          dispatch: dispatch, | ||||
|        actionType: "GET_CAMREA", |          actionType: "GET_CAMREA", | ||||
|        url: `${ApiTable.getVersions}`, |          url: `${ApiTable.getVersions}`, | ||||
|        msg: { option: "查询网关版本信息" }, |          msg: { option: "查询网关版本信息" }, | ||||
|        reducer: { name: "", params: { noClear: true } }, |          reducer: { name: "", params: { noClear: true } }, | ||||
|      }); |       }); | ||||
|  } | } | ||||
| 
 | 
 | ||||
| export default { | export default { | ||||
|    getVersions, |    getVersions, | ||||
|  |    getGateways, | ||||
|  |    getGatewayStatus, | ||||
|  |    ableGateway | ||||
| }; | }; | ||||
| @ -0,0 +1,33 @@ | |||||
|  | import React, { useEffect, useRef, useState } from 'react'; | ||||
|  | import moment from 'moment'; | ||||
|  | import { connect } from "react-redux"; | ||||
|  | import { Select, Modal, Form, Button } from "@douyinfe/semi-ui"; | ||||
|  | 
 | ||||
|  | const GatewayEditModal = (props) => { | ||||
|  |     const { dispatch, actions, user, onCancel, dataToModal } = props; | ||||
|  |     const { edition } = actions; | ||||
|  | 
 | ||||
|  |     //初始化 | ||||
|  |     useEffect(() => { | ||||
|  | 
 | ||||
|  |     }, []); | ||||
|  | 
 | ||||
|  |     return ( | ||||
|  |         <Modal title={dataToModal.name} | ||||
|  |             visible={true} destroyOnClose onCancel={onCancel} | ||||
|  |             footer={[<Button onClick={onCancel}>关闭</Button>]}> | ||||
|  |             <div></div> | ||||
|  |         </Modal> | ||||
|  |     ) | ||||
|  | } | ||||
|  | 
 | ||||
|  | function mapStateToProps(state) { | ||||
|  |     const { auth, global } = state; | ||||
|  |     return { | ||||
|  |         user: auth.user, | ||||
|  |         error: auth.error, | ||||
|  |         actions: global.actions, | ||||
|  |     }; | ||||
|  | } | ||||
|  | 
 | ||||
|  | export default connect(mapStateToProps)(GatewayEditModal); | ||||
| @ -0,0 +1,53 @@ | |||||
|  | import React, { useEffect, useRef, useState } from 'react'; | ||||
|  | import { connect } from "react-redux"; | ||||
|  | import { Select, Modal, Form, Button } from "@douyinfe/semi-ui"; | ||||
|  | 
 | ||||
|  | const GatewayStatusModal = (props) => { | ||||
|  |     const { dispatch, actions, user, onCancel, dataToModal } = props; | ||||
|  |     const { edition } = actions; | ||||
|  |     const [listData, setListData] = useState(null); | ||||
|  |     //初始化 | ||||
|  |     useEffect(() => { | ||||
|  |         dispatch(edition.getGatewayStatus(dataToModal.id)).then(res => {//查询网关状态指标 | ||||
|  |             if (res.success) { | ||||
|  |                 setListData(res.payload.data) | ||||
|  |             } | ||||
|  |         }) | ||||
|  |     }, []); | ||||
|  | 
 | ||||
|  |     const statusKeys = { | ||||
|  |         status: '状态', | ||||
|  |         streamIn: '流入', | ||||
|  |         streamOut: '流出', | ||||
|  |         memUsedPercent: '内存使用', | ||||
|  |         diskPercent: '磁盘使用', | ||||
|  |         timeDiff: '时间偏差(最新心跳 服务器时间-设备时间)', | ||||
|  |         uptime: '本次在线时常',//??? | ||||
|  |         sysVersion: '系统', | ||||
|  |         status: '软件信息',//??? | ||||
|  |         status: '配置版本',//??? | ||||
|  |         acqConfVersion: '采集参数版本',//??? | ||||
|  |         pluginVersion: '插件版本', | ||||
|  |         load1: 'Load1', | ||||
|  |         load5: 'Load5', | ||||
|  |         load15: 'Load15', | ||||
|  |     } | ||||
|  |     return ( | ||||
|  |         <Modal title={dataToModal.name} | ||||
|  |             visible={true} destroyOnClose onCancel={onCancel} | ||||
|  |             footer={[<Button onClick={onCancel}>关闭</Button>]}> | ||||
|  |             <div></div> | ||||
|  |         </Modal> | ||||
|  |     ) | ||||
|  | } | ||||
|  | 
 | ||||
|  | function mapStateToProps(state) { | ||||
|  |     const { auth, global } = state; | ||||
|  |     return { | ||||
|  |         user: auth.user, | ||||
|  |         error: auth.error, | ||||
|  |         actions: global.actions, | ||||
|  |     }; | ||||
|  | } | ||||
|  | 
 | ||||
|  | export default connect(mapStateToProps)(GatewayStatusModal); | ||||
					Loading…
					
					
				
		Reference in new issue