Skip to content

Commit 58a0ccc

Browse files
committed
Revert "Fix comments - #1537 (review)"
This reverts commit fc31b41.
1 parent efaa720 commit 58a0ccc

File tree

4 files changed

+13
-93
lines changed

4 files changed

+13
-93
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ const QueryCardHeader = (props: Props) => {
247247
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
248248
<EuiIcon
249249
className={styles.iconDropdownOption}
250-
type="visTagCloud"
250+
type={'visTagCloud'}
251251
data-testid={`view-type-selected-${value}-${id}`}
252252
/>
253253
</div>
@@ -261,7 +261,7 @@ const QueryCardHeader = (props: Props) => {
261261
}
262262
})
263263

264-
const canCommandProfile = isCommandAllowedForProfile(query)
264+
const canCommandProfile = isCommandAllowedForProfile(query.split(' ')[0].toLowerCase())
265265

266266
const indexForSeparator = findIndex(pluginsOptions, (option) => !option.internal)
267267
if (indexForSeparator > -1) {
@@ -351,7 +351,7 @@ const QueryCardHeader = (props: Props) => {
351351
className={cx(styles.buttonIcon, styles.viewTypeIcon)}
352352
onClick={onDropDownViewClick}
353353
>
354-
{isOpen && canCommandProfile && !summaryText && (
354+
{isOpen && profileOptions.length > 1 && canCommandProfile && !summaryText && (
355355
<div className={styles.dropdownWrapper}>
356356
<div className={styles.dropdown}>
357357
<EuiSuperSelect

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export const GRAPH_COMMANDS = ['graph.query']
3333

3434
const ALLOWED_PROFILE_COMMANDS = [...SEARCH_COMMANDS, ...GRAPH_COMMANDS]
3535

36-
export const isCommandAllowedForProfile = (query: string) => {
37-
return ALLOWED_PROFILE_COMMANDS.includes(query.split(' ')[0].toLowerCase())
36+
export function isCommandAllowedForProfile(cmd: string) {
37+
return ALLOWED_PROFILE_COMMANDS.includes(cmd)
3838
}
3939

4040
export enum ProfileQueryType {

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

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

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

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

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

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

1111
if (type === ProfileQueryType.Explain) {
12-
return [`ft.${type.toLowerCase()}`, ...commandSplit.slice(1)].join(' ')
12+
return [`ft.${type}`, ...commandSplit.slice(1)].join(' ')
1313
} else {
14-
let index = commandSplit[1]
15-
16-
const queryType = cmd.split('.')[1] // SEARCH / AGGREGATE
17-
return [`ft.${type.toLowerCase()}`, index, queryType, 'QUERY', ...commandSplit.slice(2)].join(' ')
14+
const index = commandSplit[1]
15+
const queryType = key.split('.')[1] // SEARCH / AGGREGATE
16+
return [`ft.${type}`, index, queryType, 'QUERY', ...commandSplit.slice(2)].join(' ')
1817
}
1918
}
2019

0 commit comments

Comments
 (0)