index.tsx 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import { Col, message, Row, Tooltip } from 'antd';
  2. import Guide from '../components/Guide';
  3. // import Statistics from '../components/Statistics';
  4. // import Pie from '@/pages/home/components/Pie';
  5. import { getMenuPathByCode, MENUS_CODE } from '@/utils/menu';
  6. // import { useEffect, useState } from 'react';
  7. // import { map } from 'rxjs';
  8. // import useSendWebsocketMessage from '@/hooks/websocket/useSendWebsocketMessage';
  9. import useHistory from '@/hooks/route/useHistory';
  10. import Body from '@/pages/home/components/Body';
  11. import Steps from '@/pages/home/components/Steps';
  12. import BaseStatistics from '../components/BaseStatistics';
  13. import { QuestionCircleOutlined } from '@ant-design/icons';
  14. const Ops = () => {
  15. // const [subscribeTopic] = useSendWebsocketMessage();
  16. const history = useHistory();
  17. const accessPermission = getMenuPathByCode(MENUS_CODE['link/AccessConfig']);
  18. const logPermission = getMenuPathByCode(MENUS_CODE['Log']);
  19. const linkPermission = getMenuPathByCode(MENUS_CODE['link/DashBoard']);
  20. // const [cpuValue, setCpuValue] = useState<number>(0);
  21. // const [jvmValue, setJvmValue] = useState<number>(0);
  22. // useEffect(() => {
  23. // const cpuRealTime = subscribeTopic!(
  24. // `operations-statistics-system-info-cpu-realTime`,
  25. // `/dashboard/systemMonitor/stats/info/realTime`,
  26. // {
  27. // type: 'cpu',
  28. // interval: '2s',
  29. // agg: 'avg',
  30. // },
  31. // )
  32. // ?.pipe(map((res) => res.payload))
  33. // .subscribe((payload: any) => {
  34. // setCpuValue(payload.value?.systemUsage || 0);
  35. // });
  36. //
  37. // const jvmRealTime = subscribeTopic!(
  38. // `operations-statistics-system-info-memory-realTime`,
  39. // `/dashboard/systemMonitor/stats/info/realTime`,
  40. // {
  41. // type: 'memory',
  42. // interval: '2s',
  43. // agg: 'avg',
  44. // },
  45. // )
  46. // ?.pipe(map((res) => res.payload))
  47. // .subscribe((payload: any) => {
  48. // setJvmValue(payload.value?.jvmHeapUsage || 0);
  49. // });
  50. //
  51. // return () => {
  52. // cpuRealTime?.unsubscribe();
  53. // jvmRealTime?.unsubscribe();
  54. // };
  55. // }, []);
  56. const guideOpsList: any[] = [
  57. {
  58. key: 'product',
  59. name: '设备接入配置',
  60. english: 'STEP1',
  61. auth: !!accessPermission,
  62. url: accessPermission,
  63. },
  64. {
  65. key: 'device',
  66. name: '日志排查',
  67. english: 'STEP2',
  68. auth: !!logPermission,
  69. url: logPermission,
  70. param: {
  71. key: 'system',
  72. },
  73. },
  74. {
  75. key: 'rule-engine',
  76. name: '实时监控',
  77. english: 'STEP3',
  78. auth: !!linkPermission,
  79. url: linkPermission,
  80. param: {
  81. save: true,
  82. },
  83. },
  84. ];
  85. return (
  86. <Row gutter={24}>
  87. <Col span={14}>
  88. <Guide title="运维引导" data={guideOpsList} />
  89. </Col>
  90. <Col span={10}>
  91. <BaseStatistics />
  92. </Col>
  93. <Col span={24}>
  94. <Body title={'平台架构图'} english={'PLATFORM ARCHITECTURE DIAGRAM'} />
  95. </Col>
  96. <Col span={24}>
  97. <Steps
  98. title={
  99. <span>
  100. 运维管理推荐步骤
  101. <Tooltip title="请根据业务需要对下述步骤进行选择性操作。">
  102. <QuestionCircleOutlined style={{ paddingLeft: 12 }} />
  103. </Tooltip>
  104. </span>
  105. }
  106. data={[
  107. {
  108. title: '协议管理',
  109. content: '根据业务需求自定义开发对应的产品(设备模型)接入协议,并上传到平台。',
  110. url: require('/public/images/home/bottom-1.png'),
  111. onClick: () => {
  112. const url = getMenuPathByCode(MENUS_CODE['link/Protocol']);
  113. if (!!url) {
  114. history.push(url);
  115. } else {
  116. message.warning('暂无权限,请联系管理员');
  117. }
  118. },
  119. },
  120. {
  121. title: '证书管理',
  122. content: '统一维护平台内的证书,用于数据通信加密。',
  123. url: require('/public/images/home/bottom-6.png'),
  124. onClick: () => {
  125. const url = getMenuPathByCode(MENUS_CODE['link/Certificate']);
  126. if (!!url) {
  127. history.push(url);
  128. } else {
  129. message.warning('暂无权限,请联系管理员');
  130. }
  131. },
  132. },
  133. {
  134. title: '网络组件',
  135. content: '根据不同的传输类型配置平台底层网络组件相关参数。',
  136. url: require('/public/images/home/bottom-3.png'),
  137. onClick: () => {
  138. const url = getMenuPathByCode(MENUS_CODE['link/Type']);
  139. if (!!url) {
  140. history.push(url);
  141. } else {
  142. message.warning('暂无权限,请联系管理员');
  143. }
  144. },
  145. },
  146. {
  147. title: '设备接入网关',
  148. content: '根据不同的传输类型,关联消息协议,配置设备接入网关相关参数。',
  149. url: require('/public/images/home/bottom-4.png'),
  150. onClick: () => {
  151. const url = getMenuPathByCode(MENUS_CODE['link/AccessConfig']);
  152. if (!!url) {
  153. history.push(url);
  154. } else {
  155. message.warning('暂无权限,请联系管理员');
  156. }
  157. },
  158. },
  159. {
  160. title: '日志管理',
  161. content: '监控系统日志,及时处理系统异常。',
  162. url: require('/public/images/home/bottom-5.png'),
  163. onClick: () => {
  164. const url = getMenuPathByCode(MENUS_CODE['Log']);
  165. if (!!url) {
  166. history.push(url, {
  167. key: 'system',
  168. });
  169. } else {
  170. message.warning('暂无权限,请联系管理员');
  171. }
  172. },
  173. },
  174. ]}
  175. />
  176. </Col>
  177. </Row>
  178. );
  179. };
  180. export default Ops;