diff --git a/code/web/client/src/sections/edition/actions/index.js b/code/web/client/src/sections/edition/actions/index.js
index de91fa9..4d6bf5c 100644
--- a/code/web/client/src/sections/edition/actions/index.js
+++ b/code/web/client/src/sections/edition/actions/index.js
@@ -71,6 +71,17 @@ export function postVersion(data) {
});
}
+export function delGateway(id) {
+ return dispatch => basicAction({
+ type: 'delete',
+ dispatch: dispatch,
+ actionType: 'DELETE_GATEWAY',
+ url: ApiTable.delGateway.replace('{id}', id),
+ msg: { option: '删除网关' },
+ reducer: { name: '' }
+ });
+}
+
export function gatewaySsh(id) {
return dispatch => basicAction({
type: 'post',
@@ -109,6 +120,7 @@ export default {
getGateways,
getGatewayStatus,
ableGateway,
+ delGateway,
gatewaySsh,
rebootGateway,
restartGateway,
diff --git a/code/web/client/src/sections/edition/containers/gateway.jsx b/code/web/client/src/sections/edition/containers/gateway.jsx
index 51626ab..2e58e79 100644
--- a/code/web/client/src/sections/edition/containers/gateway.jsx
+++ b/code/web/client/src/sections/edition/containers/gateway.jsx
@@ -5,7 +5,7 @@ import { push } from 'react-router-redux';
import { Popconfirm, Button, Popover, Skeleton, Table, Tag } from '@douyinfe/semi-ui';
import { SkeletonScreen } from "$components";
import GatewayStatusModal from './gatewayStatusModal'
-import GatewayEditModal from './gatewayEditModal'
+import GatewayModal from './gatewayModal'
const GatewayManage = props => {
const { dispatch, user, error, actions } = props
@@ -14,8 +14,9 @@ const GatewayManage = props => {
const [tableData, setTableData] = useState([]);
const [limits, setLimits] = useState()//每页实际条数
const [detailV, setDetailV] = useState(false)
- const [editV, setEditV] = useState(false)
const [dataToModal, setDataToModal] = useState(null)
+ const [deviceModalV, setDeviceModalV] = useState(false)
+
useEffect(() => {
getTableData(query)
}, [])
@@ -100,12 +101,23 @@ const GatewayManage = props => {
{
- setEditV(true)
+ setDeviceModalV(true)
setDataToModal(record)
}}>编辑
- {
- }}>删除
+ {
+ dispatch(edition.delGateway(record.id)).then(r => {
+ if (r.success) {
+ getTableData(query)
+ }
+ })
+ }}>
+ 删除
+
+
更多...
@@ -158,103 +170,105 @@ const GatewayManage = props => {
}
return (
- <>
-
-
-
-
- 设备管理
-
-
- 对NVR(网络硬盘录像机)设备节点的管理
-
-
{
-
- }}
- >
- 新增设备
-
-
-
-
-
- {
- return {`共${Math.ceil(total / limits)}页,${total}项`}
- },
- onChange: (page, pageSize) => {
- setQuery({ limit: pageSize, page: page - 1 });
- getTableData({ limit: pageSize, page: page - 1 });
- }
- }}
+ <>
+
+
-
- {
- detailV ? setDetailV(false)}
- dataToModal={dataToModal} /> : ''
- }
- {
- editV ? setEditV(false)}
- dataToModal={dataToModal} /> : ''
- }
-
- >
-
+
+
+ 设备列表
+
+
+ 对网关设备添加、编辑、删除以及远程控制等的管理页面
+
+
{
+ setDeviceModalV(true)
+ }}
+ >
+ 新增网关
+
+
+
+
+
+ {
+ return {`共${Math.ceil(total / limits)}页,${total}项`}
+ },
+ onChange: (page, pageSize) => {
+ setQuery({ limit: pageSize, page: page - 1 });
+ getTableData({ limit: pageSize, page: page - 1 });
+ }
+ }}
+ />
+
+ {
+ detailV ? setDetailV(false)}
+ dataToModal={dataToModal} /> : ''
+ }
+ {
+ deviceModalV ? setDeviceModalV(false)}
+ dataToModal={dataToModal} /> : ''
+ }
+
+ >
+
);
}
diff --git a/code/web/client/src/sections/edition/containers/gatewayEditModal.jsx b/code/web/client/src/sections/edition/containers/gatewayEditModal.jsx
deleted file mode 100644
index 6bd0051..0000000
--- a/code/web/client/src/sections/edition/containers/gatewayEditModal.jsx
+++ /dev/null
@@ -1,33 +0,0 @@
-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 (
- 关闭]}>
-
-
- )
-}
-
-function mapStateToProps(state) {
- const { auth, global } = state;
- return {
- user: auth.user,
- error: auth.error,
- actions: global.actions,
- };
-}
-
-export default connect(mapStateToProps)(GatewayEditModal);
\ No newline at end of file
diff --git a/code/web/client/src/sections/edition/containers/gatewayModal.jsx b/code/web/client/src/sections/edition/containers/gatewayModal.jsx
new file mode 100644
index 0000000..790de5b
--- /dev/null
+++ b/code/web/client/src/sections/edition/containers/gatewayModal.jsx
@@ -0,0 +1,130 @@
+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 GatewayModal = (props) => {
+ const { dispatch, actions, user, onCancel, dataToModal } = props;
+ const { edition } = actions;
+ const api = useRef()
+ //初始化
+ useEffect(() => {
+
+ }, []);
+
+ return (
+ {
+ api.current.validate().then(r => {
+ // for (let key in r) {
+ // if (['major', 'minor', 'patch', 'build'].includes(key)) {
+ // r[key] = Number(r[key])
+ // }
+ // }
+ // dispatch(edition.postVersion({ ...r, createdAt: moment().format("YYYY-MM-DD HH:MM:SS") })).then(res => {
+ // if (res.success) {
+ // requestData()
+ // setaddVersion(false)
+ // }
+ // })
+ })
+ }}
+ width={610}
+ onCancel={() => onCancel(0)}
+ >
+ {/*
+
+
+
+
+ beta
+ alpha
+ release
+ LTS
+
+
+
+
+
+ */}
+
+ )
+}
+
+function mapStateToProps(state) {
+ const { auth, global } = state;
+ return {
+ user: auth.user,
+ error: auth.error,
+ actions: global.actions,
+ };
+}
+
+export default connect(mapStateToProps)(GatewayModal);
\ No newline at end of file
diff --git a/code/web/client/src/utils/webapi.js b/code/web/client/src/utils/webapi.js
index 34a6fe8..c946129 100644
--- a/code/web/client/src/utils/webapi.js
+++ b/code/web/client/src/utils/webapi.js
@@ -8,6 +8,8 @@ export const ApiTable = {
getGateways: 'v1/edges',
ableGateway: 'v1/edge/{id}/enable',
getGatewayStatus: 'v1/edge/{id}/metrics',
+ delGateway: 'v1/edge/{id}',
+
gatewaySsh: 'v1/edge/{id}/ssh',
rebootGateway: 'v1/edge/{id}/reboot',
restartGateway: 'v1/edge/{id}/restart',