Skip to content

Commit 8016deb

Browse files
committed
Uopdate nodes request
1 parent 0330b6a commit 8016deb

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/QueryEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const QueryEditor: React.FC<Props> = ({ datasource, query, onChange, onRunQuery
4545
const { allDimensions, groupingByList, filters, units, fetchDimensions } = useFetchDimensions(baseUrl);
4646

4747
const filterList = React.useMemo(() => Object.keys(filters).map((s) => ({ label: s, value: s })), [filters]);
48-
const nodeList = React.useMemo(() => nodes?.map((c: any) => ({ label: c.name, value: c.id })), [nodes]);
48+
const nodeList = React.useMemo(() => nodes?.map((c: any) => ({ label: c.nm, value: c.nd })), [nodes]);
4949

5050
const { spaceId, roomId, nodes: allNodes, dimensions, groupBy, contextId, filterBy, filterValue } = query;
5151

@@ -97,7 +97,7 @@ const QueryEditor: React.FC<Props> = ({ datasource, query, onChange, onRunQuery
9797
if (allNodes && nodes.length > 0) {
9898
const filteredNodes: any[] = [];
9999
allNodes.forEach((element) => {
100-
const currentNode: any = nodes.find((n: any) => n.id === element);
100+
const currentNode: any = nodes.find((n: any) => n.nd === element);
101101
filteredNodes.push({ label: currentNode?.name, value: currentNode?.id });
102102
});
103103

@@ -111,7 +111,7 @@ const QueryEditor: React.FC<Props> = ({ datasource, query, onChange, onRunQuery
111111

112112
if (allNodes && nodes.length > 0) {
113113
allNodes.forEach((element) => {
114-
const currentNode: any = nodes.find((n: any) => n.id === element);
114+
const currentNode: any = nodes.find((n: any) => n.nd === element);
115115
filteredNodes.push({ label: currentNode?.name, value: currentNode?.id });
116116
});
117117
}

src/shared/hooks/useFetchNodes.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import React from 'react';
2-
import { Get } from 'shared/utils/request';
2+
import { Post } from 'shared/utils/request';
33

44
export const getNodes = async (spaceId: string, roomId: string, baseUrl: string) => {
5-
const response = await Get({ path: `/v2/spaces/${spaceId}/rooms/${roomId}/nodes`, baseUrl });
6-
return response?.data;
5+
const response = await Post({ path: `/v3/spaces/${spaceId}/rooms/${roomId}/nodes`, baseUrl, data: { scope: {
6+
nodes: [],
7+
} } });
8+
return response?.nodes;
79
};
810

911
export const useFetchNodes = (baseUrl: string) => {

0 commit comments

Comments
 (0)