Skip to content

Commit ce3e5dc

Browse files
committed
#RI-6549 - add cursor id for ft.aggregate result
1 parent d43ec77 commit ce3e5dc

File tree

4 files changed

+117
-4
lines changed

4 files changed

+117
-4
lines changed

redisinsight/ui/src/packages/redisearch/src/App.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable react/jsx-filename-extension */
22
import React from 'react'
3+
import { isArray } from 'lodash'
34
import { setHeaderText } from 'redisinsight-plugin-sdk'
45
import { appendIconComponentCache } from '@elastic/eui/es/components/icon/icon'
56

@@ -42,11 +43,19 @@ const App = (props: Props) => {
4243
commandUpper.startsWith(Command.Aggregate)
4344
|| (isProfileCommand && profileQueryType.toUpperCase() === ProfileType.Aggregate)
4445
) {
45-
const [matched, ...arrayResponse] = isProfileCommand ? response[0] : response
46+
const isResponseInArray = isArray(response[0])
47+
const [matched, ...arrayResponse] = isResponseInArray ? response[0] : response
4648
setHeaderText(`Matched:${matched}`)
4749

4850
const result = parseAggregateRawResponse(arrayResponse)
49-
return <TableResult query={command} result={result} matched={matched} />
51+
return (
52+
<TableResult
53+
query={command}
54+
result={result}
55+
matched={matched}
56+
cursorId={isResponseInArray ? response[1] : null}
57+
/>
58+
)
5059
}
5160

5261
if (

redisinsight/ui/src/packages/redisearch/src/components/TableResult/TableResult.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ export interface Props {
1717
query: string;
1818
result: any;
1919
matched?: number;
20+
cursorId?: null | number;
2021
}
2122

2223
const loadingMessage = 'loading...'
2324
const noResultsMessage = 'No results found.'
2425

2526
const TableResult = React.memo((props: Props) => {
26-
const { result, query, matched } = props
27+
const { result, query, matched, cursorId } = props
2728

2829
const [columns, setColumns] = useState<EuiBasicTableColumn<any>[]>([])
2930

@@ -102,7 +103,10 @@ const TableResult = React.memo((props: Props) => {
102103

103104
return (
104105
<div className={cx('queryResultsContainer', 'container')}>
105-
{!!matched && <div className={cx('matched')}>{`Matched: ${matched}`}</div>}
106+
<div className="queryHeader">
107+
{!!matched && <div className={cx('matched')}>{`Matched: ${matched}`}</div>}
108+
{!!cursorId && <div className={cx('matched')}>{`Cursor ID: ${cursorId}`}</div>}
109+
</div>
106110
{isDataArr && (
107111
<EuiInMemoryTable
108112
pagination
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
[
2+
{
3+
"status": "success",
4+
"response": [
5+
[
6+
50,
7+
[
8+
"category",
9+
"category0",
10+
"total_quantit",
11+
"9921",
12+
"avg_price",
13+
"528.235"
14+
],
15+
[
16+
"category",
17+
"category1",
18+
"total_quantit",
19+
"10572",
20+
"avg_price",
21+
"536.8"
22+
],
23+
[
24+
"category",
25+
"category10",
26+
"total_quantit",
27+
"9564",
28+
"avg_price",
29+
"486.76"
30+
],
31+
[
32+
"category",
33+
"category11",
34+
"total_quantit",
35+
"10605",
36+
"avg_price",
37+
"494.415"
38+
],
39+
[
40+
"category",
41+
"category12",
42+
"total_quantit",
43+
"9991",
44+
"avg_price",
45+
"506.77"
46+
],
47+
[
48+
"category",
49+
"category13",
50+
"total_quantit",
51+
"9980",
52+
"avg_price",
53+
"479.96"
54+
],
55+
[
56+
"category",
57+
"category14",
58+
"total_quantit",
59+
"9786",
60+
"avg_price",
61+
"514.145"
62+
],
63+
[
64+
"category",
65+
"category15",
66+
"total_quantit",
67+
"10164",
68+
"avg_price",
69+
"510.15"
70+
],
71+
[
72+
"category",
73+
"category16",
74+
"total_quantit",
75+
"10035",
76+
"avg_price",
77+
"494.715"
78+
],
79+
[
80+
"category",
81+
"category17",
82+
"total_quantit",
83+
"10589",
84+
"avg_price",
85+
"507.645"
86+
]
87+
],
88+
940326616
89+
]
90+
}
91+
]

redisinsight/ui/src/packages/redisearch/src/styles/styles.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ html {
3737
word-break: break-word;
3838
}
3939

40+
.queryHeader {
41+
display: flex;
42+
align-items: center;
43+
44+
.matched {
45+
margin-right: 12px;
46+
}
47+
}
48+
4049
.matched {
4150
color: var(--euiColorFullShade);
4251
padding-bottom: 12px;

0 commit comments

Comments
 (0)