Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dfd64c8
add virtualized table on workbench result test
vlad-dargel Oct 31, 2022
98499c1
upd
vlad-dargel Oct 31, 2022
8437196
return parallelism
vlad-dargel Oct 31, 2022
f27ec0d
#RI-3678 - display message when no namespaces
rsergeenko Nov 2, 2022
4722091
Merge pull request #1350 from RedisInsight/fe/feature/RI-3678_no-name…
rsergeenko Nov 2, 2022
9d35851
#RI-3740 - allow selecting text by double-click in cli
rsergeenko Nov 2, 2022
d5aa394
Merge pull request #1354 from RedisInsight/fe/feature/RI-3740_dbl-cli…
AlenaSY Nov 3, 2022
47f77ad
add tests for top namespaces message
vlad-dargel Nov 3, 2022
16af3b5
Merge pull request #1357 from RedisInsight/e2e/feature/RI-3678_no-nam…
vlad-dargel Nov 3, 2022
a0ea198
Merge pull request #1351 from RedisInsight/feature/RI-3678_no-namespa…
vlad-dargel Nov 3, 2022
b326b33
#RI-3744 - fix telemetry event
rsergeenko Nov 3, 2022
cc2a389
* fix cli input on click
rsergeenko Nov 3, 2022
865b236
Merge pull request #1360 from RedisInsight/fe/bugfix/fix-cli-click
rsergeenko Nov 3, 2022
050c428
#RI-3782 - fix cli cursor
rsergeenko Nov 4, 2022
5f9a7d5
Merge pull request #1365 from RedisInsight/fe/bugfix/RI-3782_fix-cli-…
rsergeenko Nov 4, 2022
91007e2
Merge pull request #1359 from RedisInsight/fe/bugfix/RI-3744_RI-3749_…
vlad-dargel Nov 4, 2022
026fa25
Merge branch 'main' into e2e/bugfix/virtualized-table-test
vlad-dargel Nov 4, 2022
e340af9
upd
vlad-dargel Nov 4, 2022
2a048fd
create index in Search Mode tests added
Nov 4, 2022
35562ca
fix comments
Nov 4, 2022
110d706
Merge pull request #1367 from RedisInsight/e2e/feature/RI-3760_create…
AlenaSY Nov 4, 2022
a1023df
Merge branch 'main' into feature/RI-2831_browser-redisearch
egor-zalenski Nov 4, 2022
fe49bb7
fix merge conflict
egor-zalenski Nov 4, 2022
5dad408
Merge pull request #1369 from RedisInsight/feature/RI-2831_browser-re…
vlad-dargel Nov 4, 2022
ecdf961
Merge pull request #1366 from RedisInsight/e2e/bugfix/virtualized-tab…
vlad-dargel Nov 7, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export interface Props {

const commandTabPosInit = 0
const commandHistoryPosInit = -1
const TIME_FOR_DOUBLE_CLICK = 300

const CliBody = (props: Props) => {
const { data, command = '', error, setCommand, onSubmit } = props

Expand All @@ -36,6 +38,7 @@ const CliBody = (props: Props) => {
const { loading, commandHistory: commandHistoryStore } = useSelector(outputSelector)
const { commandsArray } = useSelector(appRedisCommandsSelector)

const timerClickRef = useRef<NodeJS.Timeout>()
const scrollDivRef: Ref<HTMLDivElement> = useRef(null)
const dispatch = useDispatch()

Expand Down Expand Up @@ -149,44 +152,23 @@ const CliBody = (props: Props) => {

const isModifierKey = isModifiedEvent(event)

if (event.shiftKey && event.key === keys.TAB) {
onKeyDownShiftTab(event)
return
}

if (event.key === keys.TAB) {
onKeyDownTab(event, commandLine)
return
}
if (event.shiftKey && event.key === keys.TAB) return onKeyDownShiftTab(event)
if (event.key === keys.TAB) return onKeyDownTab(event, commandLine)

// reset command tab position
if (!event.shiftKey || (event.shiftKey && event.key !== 'Shift')) {
setCommandTabPos(commandTabPosInit)
}

if (event.key === keys.ENTER) {
onKeyDownEnter(commandLine, event)
return
}

if (event.key === keys.ARROW_UP && !isModifierKey) {
onKeyDownArrowUp(event)
return
}

if (event.key === keys.ARROW_DOWN && !isModifierKey) {
onKeyDownArrowDown(event)
return
}

if (event.key === keys.ESCAPE) {
onKeyEsc()
return
}
if (event.key === keys.ENTER) return onKeyDownEnter(commandLine, event)
if (event.key === keys.ARROW_UP && !isModifierKey) return onKeyDownArrowUp(event)
if (event.key === keys.ARROW_DOWN && !isModifierKey) return onKeyDownArrowDown(event)
if (event.key === keys.ESCAPE) return onKeyEsc()

if ((event.metaKey && event.key === 'k') || (event.ctrlKey && event.key === 'l')) {
onClearOutput(event)
}
return undefined
}

const updateMatchingCmds = (command: string = '') => {
Expand All @@ -212,15 +194,36 @@ const CliBody = (props: Props) => {
}

const onMouseUpOutput = () => {
if (!window.getSelection()?.toString()) {
inputEl?.focus()
document.execCommand('selectAll', false)
document.getSelection()?.collapseToEnd()
if (timerClickRef.current) {
clearTimeout(timerClickRef.current)
timerClickRef.current = undefined
return
}

if (window.getSelection()?.toString()) {
return
}

timerClickRef.current = setTimeout(() => {
const isInputFocused = document.activeElement === inputEl

if (!window.getSelection()?.toString() && !isInputFocused) {
inputEl?.focus()
document.execCommand('selectAll', false)
document.getSelection()?.collapseToEnd()
timerClickRef.current = undefined
}
}, TIME_FOR_DOUBLE_CLICK)
}

return (
<div className={styles.container} onMouseUp={onMouseUpOutput} role="textbox" tabIndex={0}>
<div
className={styles.container}
onMouseUp={onMouseUpOutput}
onKeyDown={() => {}}
role="textbox"
tabIndex={0}
>
<EuiFlexGroup
justifyContent="spaceBetween"
gutterSize="none"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { parseContentEditableChangeHtml } from 'uiSrc/components/ContentEditable
import styles from './styles.module.scss'

export interface Props {
command: string;
setInputEl: Function;
setCommand: (command: string) => void;
onKeyDown: (event: React.KeyboardEvent<HTMLSpanElement>) => void;
dbIndex: number;
command: string
setInputEl: Function
setCommand: (command: string) => void
onKeyDown: (event: React.KeyboardEvent<HTMLSpanElement>) => void
dbIndex: number
}

const CliInput = (props: Props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import CliAutocomplete from './CliAutocomplete'
import CliInput from './CliInput'

export interface Props {
command: string;
wordsTyped: number;
setInputEl: Function;
setCommand: (command: string) => void;
onKeyDown: (event: React.KeyboardEvent<HTMLSpanElement>) => void;
command: string
wordsTyped: number
setInputEl: Function
setCommand: (command: string) => void
onKeyDown: (event: React.KeyboardEvent<HTMLSpanElement>) => void
}

const CliInputWrapper = (props: Props) => {
Expand Down
20 changes: 13 additions & 7 deletions redisinsight/ui/src/components/query/QueryWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { without } from 'lodash'
import React from 'react'
import { useSelector } from 'react-redux'
import { EuiLoadingContent } from '@elastic/eui'
Expand Down Expand Up @@ -63,7 +64,11 @@ const QueryWrapper = (props: Props) => {

const sendEventSubmitTelemetry = (commandInit = query) => {
const eventData = (() => {
const commands = splitMonacoValuePerLines(commandInit)
const commands = without(
splitMonacoValuePerLines(commandInit)
.map((command) => removeMonacoComments(decode(command).trim())),
''
)

const [commandLine, ...rest] = commands.map((command = '') => {
const matchedCommand = REDIS_COMMANDS_ARRAY.find((commandName) =>
Expand All @@ -72,8 +77,7 @@ const QueryWrapper = (props: Props) => {
})

const multiCommands = getMultiCommands(rest).replaceAll('\n', ';')

const command = removeMonacoComments(decode([commandLine, multiCommands].join(';')).trim())
const command = [commandLine, multiCommands].join('') ? [commandLine, multiCommands].join(';') : null

return {
command,
Expand All @@ -85,10 +89,12 @@ const QueryWrapper = (props: Props) => {
}
})()

sendEventTelemetry({
event: TelemetryEvent.WORKBENCH_COMMAND_SUBMITTED,
eventData
})
if (eventData.command) {
sendEventTelemetry({
event: TelemetryEvent.WORKBENCH_COMMAND_SUBMITTED,
eventData
})
}
}

const handleSubmit = (value?: string) => {
Expand Down
6 changes: 3 additions & 3 deletions redisinsight/ui/src/constants/cliOutput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EuiLink, EuiTextColor } from '@elastic/eui'
import React from 'react'
import React, { Fragment } from 'react'
import { getRouterLinkProps } from 'uiSrc/services'

export const ClearCommand = 'clear'
Expand All @@ -17,7 +17,7 @@ export const InitOutputText = (
emptyOutput: boolean,
onClick: () => void,
) => [
<>
<Fragment key={Math.random()}>
{ emptyOutput && (
<span className="color-green" key={Math.random()}>
{'Try '}
Expand All @@ -32,7 +32,7 @@ export const InitOutputText = (
, our advanced CLI. Check out our Quick Guides to learn more about Redis capabilities.
</span>
)}
</>,
</Fragment>,
'\n\n',
'Connecting...',
'\n\n',
Expand Down
2 changes: 1 addition & 1 deletion redisinsight/ui/src/constants/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const GROUP_TYPES_DISPLAY = Object.freeze({
[KeyTypes.ReJSON]: 'JSON',
[KeyTypes.JSON]: 'JSON',
[KeyTypes.Stream]: 'Stream',
[ModulesKeyTypes.Graph]: 'GRAPH',
[ModulesKeyTypes.Graph]: 'Graph',
[ModulesKeyTypes.TimeSeries]: 'TS',
[CommandGroup.Bitmap]: 'Bitmap',
[CommandGroup.Cluster]: 'Cluster',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const BrowserRightPanel = (props: Props) => {
keyProp={selectedKey}
onCloseKey={closePanel}
onEditKey={onEditKey}
onDeleteKey={onSelectKey}
onRemoveKey={onSelectKey}
/>
)}
{isAddKeyPanelOpen && every([!isBulkActionsPanelOpen, !isCreateIndexPanelOpen], Boolean) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export const FILTER_KEY_TYPE_OPTIONS = [
color: GROUP_TYPES_COLORS[KeyTypes.ReJSON],
},
{
text: 'STREAM',
text: 'Stream',
value: KeyTypes.Stream,
color: GROUP_TYPES_COLORS[KeyTypes.Stream],
},
{
text: 'GRAPH',
text: 'Graph',
value: ModulesKeyTypes.Graph,
color: GROUP_TYPES_COLORS[ModulesKeyTypes.Graph],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ interface IHashField extends HashFieldDto {}

export interface Props {
isFooterOpen: boolean
onRemoveKey: () => void
}

const HashDetails = (props: Props) => {
const { isFooterOpen } = props
const { isFooterOpen, onRemoveKey } = props

const {
total,
Expand Down Expand Up @@ -135,7 +136,8 @@ const HashDetails = (props: Props) => {
setDeleting(`${field + suffix}`)
}, [])

const onSuccessRemoved = () => {
const onSuccessRemoved = (newTotalValue: number) => {
newTotalValue === 0 && onRemoveKey()
sendEventTelemetry({
event: getBasedOnViewTypeEvent(
viewType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { RedisResponseBuffer } from 'uiSrc/slices/interfaces'
import { getBasedOnViewTypeEvent, getRefreshEventData, sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
import {
formatBytes,
formatNameShort,
formatLongName,
isEqualBuffers,
isFormatEditable,
MAX_TTL_NUMBER,
Expand Down Expand Up @@ -117,7 +117,7 @@ const KeyDetailsHeader = ({

const keyNameRef = useRef<HTMLInputElement>(null)

const tooltipContent = formatNameShort(keyProp || '')
const tooltipContent = formatLongName(keyProp || '')

const onMouseEnterKey = () => {
setKeyIsHovering(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
EuiButtonIcon,
EuiToolTip
} from '@elastic/eui'
import { isNull } from 'lodash'
import { curryRight, isNull } from 'lodash'
import { useDispatch, useSelector } from 'react-redux'
import cx from 'classnames'
import {
Expand Down Expand Up @@ -49,14 +49,15 @@ export interface Props {
onToggleFullScreen: () => void
onClose: (key: RedisResponseBuffer) => void
onClosePanel: () => void
onRefresh: (key: RedisResponseBuffer, type: KeyTypes) => void
onRefresh: (key: RedisResponseBuffer, type: KeyTypes | ModulesKeyTypes) => void
onDelete: (key: RedisResponseBuffer, type: string) => void
onRemoveKey: () => void
onEditTTL: (key: RedisResponseBuffer, ttl: number) => void
onEditKey: (key: RedisResponseBuffer, newKey: RedisResponseBuffer, onFailure?: () => void) => void
}

const KeyDetails = ({ ...props }: Props) => {
const { onClosePanel } = props
const { onClosePanel, onRemoveKey } = props
const { loading, error = '', data } = useSelector(selectedKeySelector)
const { type: selectedKeyType, name: selectedKey } = useSelector(selectedKeyDataSelector) ?? {
type: KeyTypes.String,
Expand Down Expand Up @@ -130,7 +131,7 @@ const KeyDetails = ({ ...props }: Props) => {
setIsEdit={(isEdit) => setEditItem(isEdit)}
/>
),
[KeyTypes.Hash]: <HashDetails isFooterOpen={isAddItemPanelOpen} />,
[KeyTypes.Hash]: <HashDetails isFooterOpen={isAddItemPanelOpen} onRemoveKey={onRemoveKey} />,
[KeyTypes.List]: <ListDetails isFooterOpen={isAddItemPanelOpen || isRemoveItemPanelOpen} />,
[KeyTypes.ReJSON]: <RejsonDetailsWrapper />,
[KeyTypes.Stream]: <StreamDetailsWrapper isFooterOpen={isAddItemPanelOpen} />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface Props {
onToggleFullScreen: () => void
onCloseKey: () => void
onEditKey: (key: RedisResponseBuffer, newKey: RedisResponseBuffer) => void
onDeleteKey: () => void
onRemoveKey: () => void
keyProp: RedisResponseBuffer | null
}

Expand All @@ -42,7 +42,7 @@ const KeyDetailsWrapper = (props: Props) => {
onToggleFullScreen,
onCloseKey,
onEditKey,
onDeleteKey,
onRemoveKey,
keyProp
} = props

Expand Down Expand Up @@ -84,11 +84,11 @@ const KeyDetailsWrapper = (props: Props) => {
if (type === KeyTypes.String) {
dispatch(deleteKeyAction(key, () => {
dispatch(resetStringValue())
onDeleteKey()
onRemoveKey()
}))
return
}
dispatch(deleteKeyAction(key, onDeleteKey))
dispatch(deleteKeyAction(key, onRemoveKey))
}

const handleRefreshKey = (key: RedisResponseBuffer, type: KeyTypes | ModulesKeyTypes) => {
Expand Down Expand Up @@ -153,6 +153,7 @@ const KeyDetailsWrapper = (props: Props) => {
onClosePanel={handleClosePanel}
onRefresh={handleRefreshKey}
onDelete={handleDeleteKey}
onRemoveKey={onRemoveKey}
onEditTTL={handleEditTTL}
onEditKey={handleEditKey}
/>
Expand Down
2 changes: 1 addition & 1 deletion redisinsight/ui/src/pages/browser/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $breakpoint-to-hide-resize-panel: 1124px;
.resizePanelLeft {
min-width: 550px;
:global(.euiResizablePanel__content) {
@media (min-width: 1124px) {
@media (min-width: $breakpoint-to-hide-resize-panel) {
padding-right: 8px;
}
}
Expand Down
Loading