Skip to content

Commit f770a43

Browse files
committed
- Move queryProfile to parent and create a new telement event on the same.
1 parent fc31b41 commit f770a43

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ export interface Props {
2323
onQueryReRun: (query: string, commandId?: Nullable<string>, executeParams?: CodeButtonParams) => void
2424
onQueryDelete: (commandId: string) => void
2525
onQueryOpen: (commandId: string) => void
26+
onQueryProfile: (query: string, commandId?: Nullable<string>, executeParams?: CodeButtonParams) => void
2627
}
2728
const WBResults = (props: Props) => {
2829
const {
2930
items = [],
3031
activeMode,
3132
activeResultsMode,
3233
onQueryReRun,
34+
onQueryProfile,
3335
onQueryDelete,
3436
onQueryOpen,
3537
scrollDivRef
@@ -89,7 +91,7 @@ const WBResults = (props: Props) => {
8991
onQueryProfile={(profileType: ProfileQueryType) => {
9092
const profileQuery = generateProfileQueryForCommand(command, profileType)
9193
if (profileQuery) {
92-
return onQueryReRun(
94+
return onQueryProfile(
9395
profileQuery,
9496
null,
9597
{ mode, results: resultsMode, clearEditor: false, },

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface Props {
1313
onQueryReRun: (query: string, commandId?: Nullable<string>, executeParams?: CodeButtonParams) => void
1414
onQueryOpen: (commandId: string) => void
1515
onQueryDelete: (commandId: string) => void
16+
onQueryProfile: (query: string, commandId?: Nullable<string>, executeParams?: CodeButtonParams) => void
1617
}
1718

1819
const WBResultsWrapper = (props: Props) => (

redisinsight/ui/src/pages/workbench/components/wb-view/WBView/WBView.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ const WBView = (props: Props) => {
117117
onSubmit(query, commandId, executeParams)
118118
}
119119

120+
const handleProfile = (query?: string, commandId?: Nullable<string>, executeParams: CodeButtonParams = {}) => {
121+
sendEventSubmitTelemetry(TelemetryEvent.WORKBENCH_COMMAND_PROFILE, query, executeParams)
122+
onSubmit(query, commandId, executeParams)
123+
}
124+
120125
const sendEventSubmitTelemetry = (
121126
event: TelemetryEvent,
122127
commandInit = script,
@@ -236,6 +241,7 @@ const WBView = (props: Props) => {
236241
activeResultsMode={resultsMode}
237242
scrollDivRef={scrollDivRef}
238243
onQueryReRun={handleReRun}
244+
onQueryProfile={handleProfile}
239245
onQueryOpen={onQueryOpen}
240246
onQueryDelete={onQueryDelete}
241247
/>

redisinsight/ui/src/pages/workbench/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ProfileQueryType, SEARCH_COMMANDS, GRAPH_COMMANDS } from './constants'
22

3-
export function generateGraphProfileQuery(query: string, type: ProfileQueryType) {
3+
export const generateGraphProfileQuery = (query: string, type: ProfileQueryType) => {
44
return [`graph.${type.toLowerCase()}`, ...query.split(' ').slice(1)].join(' ')
55
}
66

7-
export function generateSearchProfileQuery(query: string, type: ProfileQueryType) {
7+
export const generateSearchProfileQuery = (query: string, type: ProfileQueryType) => {
88
const commandSplit = query.split(' ')
99
const cmd = commandSplit[0]
1010

@@ -18,7 +18,7 @@ export function generateSearchProfileQuery(query: string, type: ProfileQueryType
1818
}
1919
}
2020

21-
export function generateProfileQueryForCommand(query: string, type: ProfileQueryType) {
21+
export const generateProfileQueryForCommand = (query: string, type: ProfileQueryType) => {
2222
const cmd = query.split(' ')[0].toLowerCase()
2323

2424
if (GRAPH_COMMANDS.includes(cmd)) {

redisinsight/ui/src/telemetry/events.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export enum TelemetryEvent {
9898

9999
WORKBENCH_COMMAND_COPIED = 'WORKBENCH_COMMAND_COPIED',
100100
WORKBENCH_COMMAND_RUN_AGAIN = 'WORKBENCH_COMMAND_RUN_AGAIN',
101+
WORKBENCH_COMMAND_PROFILE = 'WORKBENCH_COMMAND_PROFILE',
101102
WORKBENCH_COMMAND_DELETE_COMMAND = 'WORKBENCH_COMMAND_DELETE_COMMAND',
102103
WORKBENCH_RESULTS_IN_FULL_SCREEN = 'WORKBENCH_RESULTS_IN_FULL_SCREEN',
103104
WORKBENCH_RESULTS_COLLAPSED = 'WORKBENCH_RESULTS_COLLAPSED',

0 commit comments

Comments
 (0)