Skip to content

Commit dee1683

Browse files
committed
Revert "Add ability to run a profile/explain right from the query card tab of"
This reverts commit 3e20c4f.
1 parent 58a0ccc commit dee1683

File tree

7 files changed

+2
-150
lines changed

7 files changed

+2
-150
lines changed

redisinsight/ui/src/assets/img/workbench/vis_tag_cloud.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

redisinsight/ui/src/components/query-card/QueryCard.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import cx from 'classnames'
44
import { EuiLoadingContent, keys } from '@elastic/eui'
55
import { useParams } from 'react-router-dom'
66

7-
import { WBQueryType, ProfileQueryType } from 'uiSrc/pages/workbench/constants'
7+
import { WBQueryType } from 'uiSrc/pages/workbench/constants'
88
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
99
import {
1010
getWBQueryType,
@@ -44,7 +44,6 @@ export interface Props {
4444
onQueryDelete: () => void
4545
onQueryReRun: () => void
4646
onQueryOpen: () => void
47-
onQueryProfile: (type: ProfileQueryType) => void
4847
}
4948

5049
const getDefaultPlugin = (views: IPluginVisualization[], query: string) =>
@@ -76,7 +75,6 @@ const QueryCard = (props: Props) => {
7675
createdAt,
7776
onQueryOpen,
7877
onQueryDelete,
79-
onQueryProfile,
8078
onQueryReRun,
8179
loading,
8280
emptyCommand,
@@ -188,7 +186,6 @@ const QueryCard = (props: Props) => {
188186
setSelectedValue={changeViewTypeSelected}
189187
onQueryDelete={onQueryDelete}
190188
onQueryReRun={onQueryReRun}
191-
onQueryProfile={onQueryProfile}
192189
/>
193190
{isOpen && (
194191
<>

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { numberWithSpaces } from 'uiSrc/utils/numbers'
3232
import { ThemeContext } from 'uiSrc/contexts/themeContext'
3333
import { appPluginsSelector } from 'uiSrc/slices/app/plugins'
3434
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
35-
import { getViewTypeOptions, WBQueryType, getProfileViewTypeOptions, ProfileQueryType, isCommandAllowedForProfile } from 'uiSrc/pages/workbench/constants'
35+
import { getViewTypeOptions, WBQueryType } from 'uiSrc/pages/workbench/constants'
3636
import { IPluginVisualization } from 'uiSrc/slices/interfaces'
3737
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
3838
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
@@ -70,7 +70,6 @@ export interface Props {
7070
setSelectedValue: (type: WBQueryType, value: string) => void
7171
onQueryDelete: () => void
7272
onQueryReRun: () => void
73-
onQueryProfile: (type: ProfileQueryType) => void
7473
}
7574

7675
const getExecutionTimeString = (value: number): string => {
@@ -239,30 +238,6 @@ const QueryCardHeader = (props: Props) => {
239238
}
240239
})
241240

242-
const profileOptions: EuiSuperSelectOption<any>[] = (getProfileViewTypeOptions() as any[]).map((item) => {
243-
const { value, id, text } = item
244-
return {
245-
value: id ?? value,
246-
inputDisplay: (
247-
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
248-
<EuiIcon
249-
className={styles.iconDropdownOption}
250-
type={'visTagCloud'}
251-
data-testid={`view-type-selected-${value}-${id}`}
252-
/>
253-
</div>
254-
),
255-
dropdownDisplay: (
256-
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
257-
<span>{truncateText(text, 20)}</span>
258-
</div>
259-
),
260-
'data-test-subj': `profile-type-option-${value}-${id}`,
261-
}
262-
})
263-
264-
const canCommandProfile = isCommandAllowedForProfile(query.split(' ')[0].toLowerCase())
265-
266241
const indexForSeparator = findIndex(pluginsOptions, (option) => !option.internal)
267242
if (indexForSeparator > -1) {
268243
modifiedOptions.splice(indexForSeparator + 1, 0, {
@@ -346,26 +321,6 @@ const QueryCardHeader = (props: Props) => {
346321
</EuiToolTip>
347322
)}
348323
</EuiFlexItem>
349-
<EuiFlexItem
350-
grow={false}
351-
className={cx(styles.buttonIcon, styles.viewTypeIcon)}
352-
onClick={onDropDownViewClick}
353-
>
354-
{isOpen && profileOptions.length > 1 && canCommandProfile && !summaryText && (
355-
<div className={styles.dropdownWrapper}>
356-
<div className={styles.dropdown}>
357-
<EuiSuperSelect
358-
options={profileOptions}
359-
itemClassName={cx(styles.changeViewItem, styles.dropdownProfileItem)}
360-
className={cx(styles.changeView, styles.dropdownProfileIcon)}
361-
valueOfSelected={ProfileQueryType.Profile}
362-
onChange={(value: ProfileQueryType) => onQueryProfile(value)}
363-
data-testid="run-profile-type"
364-
/>
365-
</div>
366-
</div>
367-
)}
368-
</EuiFlexItem>
369324
<EuiFlexItem
370325
grow={false}
371326
className={cx(styles.buttonIcon, styles.viewTypeIcon)}

redisinsight/ui/src/components/query-card/QueryCardHeader/styles.module.scss

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,6 @@ $marginIcon: 12px;
127127
height: 40px;
128128
}
129129

130-
.dropdownProfileIcon {
131-
padding: inherit !important;
132-
:global {
133-
.euiSuperSelectControl.euiFormControlLayoutIcons {
134-
display: none !important;
135-
}
136-
}
137-
}
138-
139-
.dropdownProfileOption {
140-
display: inherit !important;
141-
}
142-
143-
.dropdownProfileItem {
144-
:global {
145-
.euiContextMenu__icon {
146-
display: none !important;
147-
}
148-
}
149-
}
150-
151130
.dropdown {
152131
width: 168px;
153132
position: absolute;

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import cx from 'classnames'
33
import { EuiIcon, EuiText } from '@elastic/eui'
44

55
import { Theme } from 'uiSrc/constants'
6-
import { ProfileQueryType } from 'uiSrc/pages/workbench/constants'
7-
import { generateProfileQueryForCommand } from 'uiSrc/pages/workbench/utils'
86
import { CodeButtonParams } from 'uiSrc/pages/workbench/components/enablement-area/interfaces'
97
import { Nullable } from 'uiSrc/utils'
108
import QueryCard from 'uiSrc/components/query-card'
@@ -88,16 +86,6 @@ const WBResults = (props: Props) => {
8886
resultsMode={resultsMode}
8987
db={db}
9088
onQueryOpen={() => onQueryOpen(id)}
91-
onQueryProfile={(profileType: ProfileQueryType) => {
92-
const profileQuery = generateProfileQueryForCommand(command, profileType)
93-
if (profileQuery) {
94-
return onQueryReRun(
95-
profileQuery,
96-
null,
97-
{ mode, results: resultsMode, clearEditor: false, },
98-
)
99-
}
100-
}}
10189
onQueryReRun={() => onQueryReRun(
10290
command,
10391
null,

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

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,6 @@ export const VIEW_TYPE_OPTIONS = [
2727
export const getViewTypeOptions = () =>
2828
[...VIEW_TYPE_OPTIONS]
2929

30-
31-
export const SEARCH_COMMANDS = ['ft.search', 'ft.aggregate']
32-
export const GRAPH_COMMANDS = ['graph.query']
33-
34-
const ALLOWED_PROFILE_COMMANDS = [...SEARCH_COMMANDS, ...GRAPH_COMMANDS]
35-
36-
export function isCommandAllowedForProfile(cmd: string) {
37-
return ALLOWED_PROFILE_COMMANDS.includes(cmd)
38-
}
39-
40-
export enum ProfileQueryType {
41-
Profile = 'Profile',
42-
Explain = 'Explain'
43-
}
44-
45-
const PROFILE_VIEW_TYPE_OPTIONS = [
46-
{
47-
id: ProfileQueryType.Profile,
48-
text: 'Profile the command',
49-
name: 'Profile',
50-
value: WBQueryType.Text,
51-
},
52-
{
53-
id: ProfileQueryType.Explain,
54-
text: 'Explain the command',
55-
name: 'Explain',
56-
value: WBQueryType.Text,
57-
},
58-
]
59-
60-
export const getProfileViewTypeOptions = () =>
61-
[...PROFILE_VIEW_TYPE_OPTIONS]
62-
63-
6430
export enum ModuleCommandPrefix {
6531
RediSearch = 'FT.',
6632
}

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

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)