diff --git a/redisinsight/ui/src/components/base/forms/buttons/ToggleButton.tsx b/redisinsight/ui/src/components/base/forms/buttons/ToggleButton.tsx new file mode 100644 index 0000000000..445cc4d49c --- /dev/null +++ b/redisinsight/ui/src/components/base/forms/buttons/ToggleButton.tsx @@ -0,0 +1 @@ +export { ToggleButton } from '@redis-ui/components' diff --git a/redisinsight/ui/src/components/base/forms/buttons/index.ts b/redisinsight/ui/src/components/base/forms/buttons/index.ts index 6500e979e0..5adf5f966a 100644 --- a/redisinsight/ui/src/components/base/forms/buttons/index.ts +++ b/redisinsight/ui/src/components/base/forms/buttons/index.ts @@ -5,5 +5,6 @@ export { EmptyButton } from 'uiSrc/components/base/forms/buttons/EmptyButton' export { IconButton } from 'uiSrc/components/base/forms/buttons/IconButton' export { PrimaryButton } from 'uiSrc/components/base/forms/buttons/PrimaryButton' export { SecondaryButton } from 'uiSrc/components/base/forms/buttons/SecondaryButton' +export { ToggleButton } from 'uiSrc/components/base/forms/buttons/ToggleButton' export type { IconType } from 'uiSrc/components/base/forms/buttons/IconButton' diff --git a/redisinsight/ui/src/components/base/forms/combo-box/AutoTag.tsx b/redisinsight/ui/src/components/base/forms/combo-box/AutoTag.tsx index 7171552d9a..13087b4e52 100644 --- a/redisinsight/ui/src/components/base/forms/combo-box/AutoTag.tsx +++ b/redisinsight/ui/src/components/base/forms/combo-box/AutoTag.tsx @@ -3,7 +3,7 @@ import { Chip, FormField, Input } from '@redis-ui/components' import cn from 'classnames' import styled from 'styled-components' import { CancelSlimIcon } from 'uiSrc/components/base/icons' -import { CommonProps } from 'uiSrc/components/base/theme/types' +import { CommonProps, Theme } from 'uiSrc/components/base/theme/types' import { Row } from 'uiSrc/components/base/layout/flex' import { IconButton } from 'uiSrc/components/base/forms/buttons' @@ -128,6 +128,13 @@ export const AutoTag = ({ } } + const handleBlur: React.FocusEventHandler = (e) => { + const tag = (e.target as HTMLInputElement).value.trim() + if (tag !== null && tag.length > 0) { + createOption(tag) + } + } + function getPlaceholder() { return selectedOptions?.length && selectedOptions.length > 0 ? undefined @@ -186,6 +193,7 @@ export const AutoTag = ({ placeholder={getPlaceholder()} onChange={handleInputChange} onKeyDown={handleEnter} + onBlur={handleBlur} value={tag} data-test-subj="autoTagInput" /> @@ -210,7 +218,8 @@ const StyledWrapper = styled(Row)` position: relative; border: 1px solid ${({ theme }) => theme.semantic.color.border.neutral600}; border-radius: 0.4rem; - padding: 0.15rem 0.5rem; + padding: ${({ theme }: { theme: Theme }) => + `${theme.core.space.space000} ${theme.core.space.space050}`}; background-color: ${({ theme }) => theme.semantic.color.background.neutral100}; ` diff --git a/redisinsight/ui/src/pages/browser/components/key-tree/KeyTreeSettings/KeyTreeSettings.tsx b/redisinsight/ui/src/pages/browser/components/key-tree/KeyTreeSettings/KeyTreeSettings.tsx index 7bbcea86a2..66791f61b1 100644 --- a/redisinsight/ui/src/pages/browser/components/key-tree/KeyTreeSettings/KeyTreeSettings.tsx +++ b/redisinsight/ui/src/pages/browser/components/key-tree/KeyTreeSettings/KeyTreeSettings.tsx @@ -1,5 +1,4 @@ import React, { useCallback, useEffect, useState } from 'react' -import cx from 'classnames' import { useDispatch, useSelector } from 'react-redux' import { useParams } from 'react-router-dom' import { isEqual } from 'lodash' @@ -19,7 +18,7 @@ import { } from 'uiSrc/slices/app/context' import { comboBoxToArray } from 'uiSrc/utils' -import { Col, FlexItem } from 'uiSrc/components/base/layout/flex' +import {Col, FlexItem, Row} from 'uiSrc/components/base/layout/flex' import { IconButton, PrimaryButton, @@ -30,11 +29,10 @@ import { AutoTag, AutoTagOption, } from 'uiSrc/components/base/forms/combo-box/AutoTag' -import { RiIcon } from 'uiSrc/components/base/icons/RiIcon' import { RiSelect } from 'uiSrc/components/base/forms/select/RiSelect' import { RiPopover } from 'uiSrc/components/base' import { Theme } from 'uiSrc/components/base/theme/types' -import styles from './styles.module.scss' +import { FormField } from 'uiSrc/components/base/forms/FormField' export interface Props { loading: boolean @@ -42,10 +40,7 @@ export interface Props { const sortOptions = [SortOrder.ASC, SortOrder.DESC].map((value) => ({ value, inputDisplay: ( - + Key name {value} ), @@ -142,69 +137,64 @@ const KeyTreeSettings = ({ loading }: Props) => { setSorting(value) } + const StyledCol = styled(Col)` + width: 300px; + ` + return ( -
- - - - - - setDelimiters([...delimiters, { label: del }]) - } - onChange={(selectedOptions) => setDelimiters(selectedOptions)} - className={styles.combobox} - data-testid="delimiter-combobox" - /> - - -
- - Sort by -
+ + + + + setDelimiters([...delimiters, { label: del }]) + } + onChange={(selectedOptions) => setDelimiters(selectedOptions)} + data-testid="delimiter-combobox" + /> + + + option.inputDisplay ?? option.value} + valueRender={({ option }) => + option.inputDisplay ?? option.value + } value={sorting} - className={styles.select} onChange={(value: SortOrder) => onChangeSort(value)} data-testid="tree-view-sorting-select" /> - - -
- - Cancel - - - Apply - -
-
- -
-
+ + + + + + + Cancel + + + Apply + + + + + ) } diff --git a/redisinsight/ui/src/pages/browser/components/key-tree/KeyTreeSettings/styles.module.scss b/redisinsight/ui/src/pages/browser/components/key-tree/KeyTreeSettings/styles.module.scss deleted file mode 100644 index bbca5995a7..0000000000 --- a/redisinsight/ui/src/pages/browser/components/key-tree/KeyTreeSettings/styles.module.scss +++ /dev/null @@ -1,95 +0,0 @@ -.container { - margin-left: 8px; - margin-top: 1px; - - :global(.euiPopover), - .anchorWrapper { - height: 100%; - } -} - -.popoverWrapper { - width: 300px; - padding: 14px 16px !important; - border: none !important; - background-color: var(--euiColorLightestShade) !important; - - :global { - .euiPopover__panelArrow { - &::before, - &::after { - border-bottom-color: var(--euiColorLightestShade) !important; - } - } - .euiFormControlLayout { - min-height: 26px !important; - height: auto !important; - width: auto; - } - } - - .select { - width: 188px; - height: 24px !important; - font-size: 12px; - border-radius: 4px; - background-color: var(--euiColorEmptyShade) !important; - } -} - -.label { - display: flex; - width: 66px; - font-size: 12px; - color: var(--euiTextSubduedColor) !important; -} - -.title { - font-size: 14px; - font-weight: 500; -} - -.row { - flex-direction: row !important; - align-items: center; - justify-content: space-between; -} - -.sortIcon { - margin-right: 4px; -} - -.selectItem { - min-height: 24px !important; -} - -.footer { - width: 100%; - display: flex; - justify-content: flex-end; - padding-top: 4px; - - button { - margin-left: 8px; - } -} - -.combobox { - padding-bottom: 6px; - - :global(.euiComboBox__input) { - height: 30px !important; - } - :global(.euiComboBox__inputWrap) { - max-height: 200px; - overflow: auto; - max-width: 210px !important; - padding: 2px 4px !important; - min-height: 34px !important; - border-radius: 4px !important; - } - :global(.euiComboBoxPlaceholder) { - height: 30px !important; - line-height: 30px; - } -} diff --git a/redisinsight/ui/src/pages/browser/components/keys-header/KeysHeader.tsx b/redisinsight/ui/src/pages/browser/components/keys-header/KeysHeader.tsx index 96a219d091..abe03b12d0 100644 --- a/redisinsight/ui/src/pages/browser/components/keys-header/KeysHeader.tsx +++ b/redisinsight/ui/src/pages/browser/components/keys-header/KeysHeader.tsx @@ -1,15 +1,9 @@ /* eslint-disable react/destructuring-assignment */ /* eslint-disable react/no-this-in-sfc */ -import cx from 'classnames' import React, { Ref, useRef, useState } from 'react' import { useDispatch, useSelector } from 'react-redux' import AutoSizer from 'react-virtualized-auto-sizer' -import { - IconType, - ColumnsIcon, - EqualIcon, - FoldersIcon, -} from 'uiSrc/components/base/icons' +import { IconType, EqualIcon, FoldersIcon } from 'uiSrc/components/base/icons' import KeysSummary from 'uiSrc/components/keys-summary' import { SCAN_COUNT_DEFAULT, @@ -50,15 +44,15 @@ import { RiPopover, RiTooltip } from 'uiSrc/components/base' import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features' import { BrowserColumns, KeyValueFormat } from 'uiSrc/constants' -import { FlexItem, Row } from 'uiSrc/components/base/layout/flex' +import { Col, FlexItem, Row } from 'uiSrc/components/base/layout/flex' import { setConnectivityError } from 'uiSrc/slices/app/connectivity' import { Checkbox } from 'uiSrc/components/base/forms/checkbox/Checkbox' import { RiIcon } from 'uiSrc/components/base/icons/RiIcon' import styles from './styles.module.scss' import { ButtonGroup } from 'uiSrc/components/base/forms/button-group/ButtonGroup' import styled from 'styled-components' -import {TextButton} from '@redis-ui/components' -import {Text} from 'uiSrc/components/base/text' +import { ToggleButton } from 'uiSrc/components/base/forms/buttons' +import { Text } from 'uiSrc/components/base/text' const HIDE_REFRESH_LABEL_WIDTH = 640 @@ -368,65 +362,75 @@ const KeysHeader = (props: Props) => { panelClassName={styles.popoverWrapper} closePopover={() => setColumnsConfigShown(false)} button={ - Columns - + } > - - + + + + + + changeColumnsShown( + e.target.checked, + BrowserColumns.Size, + ) + } + data-testid="show-key-size" + className={styles.checkbox} + /> + + + + + + + + + changeColumnsShown( e.target.checked, - BrowserColumns.Size, + BrowserColumns.TTL, ) } - data-testid="show-key-size" - className={styles.checkbox} + data-testid="show-ttl" /> - - - - - - - - changeColumnsShown(e.target.checked, BrowserColumns.TTL) - } - data-testid="show-ttl" - /> + - - {ViewSwitch()} - + {ViewSwitch()}