|
|
@@ -1,16 +1,14 @@
|
|
|
import type { ActionType, ProColumns } from '@jetlinks/pro-table';
|
|
|
import ProTable from '@jetlinks/pro-table';
|
|
|
-import { InstanceModel, service } from '@/pages/device/Instance';
|
|
|
+import { service } from '@/pages/device/Instance';
|
|
|
import { useParams } from 'umi';
|
|
|
import type { EventMetadata } from '@/pages/device/Product/typings';
|
|
|
import SearchComponent from '@/components/SearchComponent';
|
|
|
import moment from 'moment';
|
|
|
import { Form, Modal } from 'antd';
|
|
|
import { SearchOutlined } from '@ant-design/icons';
|
|
|
-import { useEffect, useRef, useState } from 'react';
|
|
|
+import { useRef, useState } from 'react';
|
|
|
import MonacoEditor from 'react-monaco-editor';
|
|
|
-import useSendWebsocketMessage from '@/hooks/websocket/useSendWebsocketMessage';
|
|
|
-import { map } from 'rxjs/operators';
|
|
|
|
|
|
interface Props {
|
|
|
data: Partial<EventMetadata>;
|
|
|
@@ -21,8 +19,8 @@ const EventLog = (props: Props) => {
|
|
|
const { data } = props;
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
const [searchParams, setSearchParams] = useState<any>({ pageSize: 10 });
|
|
|
- const device = InstanceModel.detail;
|
|
|
- const [subscribeTopic] = useSendWebsocketMessage();
|
|
|
+ // const device = InstanceModel.detail;
|
|
|
+ // const [subscribeTopic] = useSendWebsocketMessage();
|
|
|
|
|
|
const columns: ProColumns<MetadataLogData>[] = [
|
|
|
{
|
|
|
@@ -70,24 +68,24 @@ const EventLog = (props: Props) => {
|
|
|
/**
|
|
|
* 订阅事件数据
|
|
|
*/
|
|
|
- const subscribeEvent = () => {
|
|
|
- const id = `instance-info-event-${device.id}-${device.productId}`;
|
|
|
- const topic = `/dashboard/device/${device.productId}/events/realTime`;
|
|
|
- subscribeTopic!(id, topic, {
|
|
|
- deviceId: device.id,
|
|
|
- })
|
|
|
- ?.pipe(map((res) => res.payload))
|
|
|
- .subscribe((payload: any) => {
|
|
|
- const { value } = payload;
|
|
|
- if (value) {
|
|
|
- actionRef.current?.reload?.();
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
+ // const subscribeEvent = () => {
|
|
|
+ // const id = `instance-info-event-${device.id}-${device.productId}`;
|
|
|
+ // const topic = `/dashboard/device/${device.productId}/events/realTime`;
|
|
|
+ // subscribeTopic!(id, topic, {
|
|
|
+ // deviceId: device.id,
|
|
|
+ // })
|
|
|
+ // ?.pipe(map((res) => res.payload))
|
|
|
+ // .subscribe((payload: any) => {
|
|
|
+ // const { value } = payload;
|
|
|
+ // if (value) {
|
|
|
+ // actionRef.current?.reload?.();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // };
|
|
|
|
|
|
- useEffect(() => {
|
|
|
- subscribeEvent();
|
|
|
- }, []);
|
|
|
+ // useEffect(() => {
|
|
|
+ // subscribeEvent();
|
|
|
+ // }, []);
|
|
|
|
|
|
const createColumn = (): ProColumns[] =>
|
|
|
data.valueType?.type === 'object'
|