Skip to content

Commit da2b047

Browse files
committed
Move back handle query profile implementation outside
Fix comments - #1736 (comment)
1 parent 84014cf commit da2b047

File tree

1 file changed

+19
-10
lines changed
  • redisinsight/ui/src/pages/workbench/components/wb-results/WBResults

1 file changed

+19
-10
lines changed

redisinsight/ui/src/pages/workbench/components/wb-results/WBResults/WBResults.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ const WBResults = (props: Props) => {
5252
</div>
5353
)
5454

55+
const handleQueryProfile = (
56+
profileType: ProfileQueryType,
57+
commandExecution: { command: string, mode?: RunQueryMode, resultsMode?: ResultsMode }
58+
) => {
59+
const { command, mode, resultsMode } = commandExecution
60+
const profileQuery = generateProfileQueryForCommand(command, profileType)
61+
if (profileQuery) {
62+
onQueryProfile(
63+
profileQuery,
64+
null,
65+
{ mode, results: resultsMode, clearEditor: false, },
66+
)
67+
}
68+
}
69+
5570
return (
5671
<div className={cx(styles.container)}>
5772
<div ref={scrollDivRef} />
@@ -90,16 +105,10 @@ const WBResults = (props: Props) => {
90105
resultsMode={resultsMode}
91106
db={db}
92107
onQueryOpen={() => onQueryOpen(id)}
93-
onQueryProfile={(profileType: ProfileQueryType) => {
94-
const profileQuery = generateProfileQueryForCommand(command, profileType)
95-
if (profileQuery) {
96-
return onQueryProfile(
97-
profileQuery,
98-
null,
99-
{ mode, results: resultsMode, clearEditor: false, },
100-
)
101-
}
102-
}}
108+
onQueryProfile={profileType => handleQueryProfile(
109+
profileType,
110+
{ command, mode, resultsMode },
111+
)}
103112
onQueryReRun={() => onQueryReRun(
104113
command,
105114
null,

0 commit comments

Comments
 (0)