Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions redisinsight/ui/src/assets/img/workbench/vis_tag_cloud.svg

This file was deleted.

5 changes: 1 addition & 4 deletions redisinsight/ui/src/components/query-card/QueryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cx from 'classnames'
import { EuiLoadingContent, keys } from '@elastic/eui'
import { useParams } from 'react-router-dom'

import { WBQueryType, ProfileQueryType } from 'uiSrc/pages/workbench/constants'
import { WBQueryType } from 'uiSrc/pages/workbench/constants'
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
import {
getWBQueryType,
Expand Down Expand Up @@ -44,7 +44,6 @@ export interface Props {
onQueryDelete: () => void
onQueryReRun: () => void
onQueryOpen: () => void
onQueryProfile: (type: ProfileQueryType) => void
}

const getDefaultPlugin = (views: IPluginVisualization[], query: string) =>
Expand Down Expand Up @@ -76,7 +75,6 @@ const QueryCard = (props: Props) => {
createdAt,
onQueryOpen,
onQueryDelete,
onQueryProfile,
onQueryReRun,
loading,
emptyCommand,
Expand Down Expand Up @@ -188,7 +186,6 @@ const QueryCard = (props: Props) => {
setSelectedValue={changeViewTypeSelected}
onQueryDelete={onQueryDelete}
onQueryReRun={onQueryReRun}
onQueryProfile={onQueryProfile}
/>
{isOpen && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { numberWithSpaces } from 'uiSrc/utils/numbers'
import { ThemeContext } from 'uiSrc/contexts/themeContext'
import { appPluginsSelector } from 'uiSrc/slices/app/plugins'
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import { getViewTypeOptions, WBQueryType, getProfileViewTypeOptions, ProfileQueryType, isCommandAllowedForProfile } from 'uiSrc/pages/workbench/constants'
import { getViewTypeOptions, WBQueryType } from 'uiSrc/pages/workbench/constants'
import { IPluginVisualization } from 'uiSrc/slices/interfaces'
import { RunQueryMode, ResultsMode, ResultsSummary } from 'uiSrc/slices/interfaces/workbench'
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
Expand Down Expand Up @@ -70,7 +70,6 @@ export interface Props {
setSelectedValue: (type: WBQueryType, value: string) => void
onQueryDelete: () => void
onQueryReRun: () => void
onQueryProfile: (type: ProfileQueryType) => void
}

const getExecutionTimeString = (value: number): string => {
Expand Down Expand Up @@ -239,30 +238,6 @@ const QueryCardHeader = (props: Props) => {
}
})

const profileOptions: EuiSuperSelectOption<any>[] = (getProfileViewTypeOptions() as any[]).map((item) => {
const { value, id, text } = item
return {
value: id ?? value,
inputDisplay: (
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
<EuiIcon
className={styles.iconDropdownOption}
type="visTagCloud"
data-testid={`view-type-selected-${value}-${id}`}
/>
</div>
),
dropdownDisplay: (
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}>
<span>{truncateText(text, 20)}</span>
</div>
),
'data-test-subj': `profile-type-option-${value}-${id}`,
}
})

const canCommandProfile = isCommandAllowedForProfile(query)

const indexForSeparator = findIndex(pluginsOptions, (option) => !option.internal)
if (indexForSeparator > -1) {
modifiedOptions.splice(indexForSeparator + 1, 0, {
Expand Down Expand Up @@ -346,26 +321,6 @@ const QueryCardHeader = (props: Props) => {
</EuiToolTip>
)}
</EuiFlexItem>
<EuiFlexItem
grow={false}
className={cx(styles.buttonIcon, styles.viewTypeIcon)}
onClick={onDropDownViewClick}
>
{isOpen && canCommandProfile && !summaryText && (
<div className={styles.dropdownWrapper}>
<div className={styles.dropdown}>
<EuiSuperSelect
options={profileOptions}
itemClassName={cx(styles.changeViewItem, styles.dropdownProfileItem)}
className={cx(styles.changeView, styles.dropdownProfileIcon)}
valueOfSelected={ProfileQueryType.Profile}
onChange={(value: ProfileQueryType) => onQueryProfile(value)}
data-testid="run-profile-type"
/>
</div>
</div>
)}
</EuiFlexItem>
<EuiFlexItem
grow={false}
className={cx(styles.buttonIcon, styles.viewTypeIcon)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,6 @@ $marginIcon: 12px;
height: 40px;
}

.dropdownProfileIcon {
padding: inherit !important;
:global {
.euiSuperSelectControl.euiFormControlLayoutIcons {
display: none !important;
}
}
}

.dropdownProfileOption {
display: inherit !important;
}

.dropdownProfileItem {
:global {
.euiContextMenu__icon {
display: none !important;
}
}
}

.dropdown {
width: 168px;
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import cx from 'classnames'
import { EuiIcon, EuiText } from '@elastic/eui'

import { Theme } from 'uiSrc/constants'
import { ProfileQueryType } from 'uiSrc/pages/workbench/constants'
import { generateProfileQueryForCommand } from 'uiSrc/pages/workbench/utils'
import { CodeButtonParams } from 'uiSrc/pages/workbench/components/enablement-area/interfaces'
import { Nullable } from 'uiSrc/utils'
import QueryCard from 'uiSrc/components/query-card'
Expand All @@ -23,15 +21,13 @@ export interface Props {
onQueryReRun: (query: string, commandId?: Nullable<string>, executeParams?: CodeButtonParams) => void
onQueryDelete: (commandId: string) => void
onQueryOpen: (commandId: string) => void
onQueryProfile: (query: string, commandId?: Nullable<string>, executeParams?: CodeButtonParams) => void
}
const WBResults = (props: Props) => {
const {
items = [],
activeMode,
activeResultsMode,
onQueryReRun,
onQueryProfile,
onQueryDelete,
onQueryOpen,
scrollDivRef
Expand Down Expand Up @@ -90,16 +86,6 @@ const WBResults = (props: Props) => {
resultsMode={resultsMode}
db={db}
onQueryOpen={() => onQueryOpen(id)}
onQueryProfile={(profileType: ProfileQueryType) => {
const profileQuery = generateProfileQueryForCommand(command, profileType)
if (profileQuery) {
return onQueryProfile(
profileQuery,
null,
{ mode, results: resultsMode, clearEditor: false, },
)
}
}}
onQueryReRun={() => onQueryReRun(
command,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface Props {
onQueryReRun: (query: string, commandId?: Nullable<string>, executeParams?: CodeButtonParams) => void
onQueryOpen: (commandId: string) => void
onQueryDelete: (commandId: string) => void
onQueryProfile: (query: string, commandId?: Nullable<string>, executeParams?: CodeButtonParams) => void
}

const WBResultsWrapper = (props: Props) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ const WBView = (props: Props) => {
onSubmit(query, commandId, executeParams)
}

const handleProfile = (query?: string, commandId?: Nullable<string>, executeParams: CodeButtonParams = {}) => {
sendEventSubmitTelemetry(TelemetryEvent.WORKBENCH_COMMAND_PROFILE, query, executeParams)
onSubmit(query, commandId, executeParams)
}

const sendEventSubmitTelemetry = (
event: TelemetryEvent,
commandInit = script,
Expand Down Expand Up @@ -241,7 +236,6 @@ const WBView = (props: Props) => {
activeResultsMode={resultsMode}
scrollDivRef={scrollDivRef}
onQueryReRun={handleReRun}
onQueryProfile={handleProfile}
onQueryOpen={onQueryOpen}
onQueryDelete={onQueryDelete}
/>
Expand Down
34 changes: 0 additions & 34 deletions redisinsight/ui/src/pages/workbench/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,6 @@ export const VIEW_TYPE_OPTIONS = [
export const getViewTypeOptions = () =>
[...VIEW_TYPE_OPTIONS]


export const SEARCH_COMMANDS = ['ft.search', 'ft.aggregate']
export const GRAPH_COMMANDS = ['graph.query']

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

export const isCommandAllowedForProfile = (query: string) => {
return ALLOWED_PROFILE_COMMANDS.includes(query?.split(' ')?.[0]?.toLowerCase())
}

export enum ProfileQueryType {
Profile = 'Profile',
Explain = 'Explain'
}

const PROFILE_VIEW_TYPE_OPTIONS = [
{
id: ProfileQueryType.Profile,
text: 'Profile the command',
name: 'Profile',
value: WBQueryType.Text,
},
{
id: ProfileQueryType.Explain,
text: 'Explain the command',
name: 'Explain',
value: WBQueryType.Text,
},
]

export const getProfileViewTypeOptions = () =>
[...PROFILE_VIEW_TYPE_OPTIONS]


export enum ModuleCommandPrefix {
RediSearch = 'FT.',
}
Expand Down
79 changes: 0 additions & 79 deletions redisinsight/ui/src/pages/workbench/utils.spec.ts

This file was deleted.

41 changes: 0 additions & 41 deletions redisinsight/ui/src/pages/workbench/utils.ts

This file was deleted.

1 change: 0 additions & 1 deletion redisinsight/ui/src/telemetry/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export enum TelemetryEvent {

WORKBENCH_COMMAND_COPIED = 'WORKBENCH_COMMAND_COPIED',
WORKBENCH_COMMAND_RUN_AGAIN = 'WORKBENCH_COMMAND_RUN_AGAIN',
WORKBENCH_COMMAND_PROFILE = 'WORKBENCH_COMMAND_PROFILE',
WORKBENCH_COMMAND_DELETE_COMMAND = 'WORKBENCH_COMMAND_DELETE_COMMAND',
WORKBENCH_RESULTS_IN_FULL_SCREEN = 'WORKBENCH_RESULTS_IN_FULL_SCREEN',
WORKBENCH_RESULTS_COLLAPSED = 'WORKBENCH_RESULTS_COLLAPSED',
Expand Down