Skip to content

Commit e180d11

Browse files
authored
Merge pull request #199 from RedisInsight/feature/bugfix
#RIVS-290, #RIVS-291
2 parents 067f4b8 + 4ac9ac8 commit e180d11

File tree

13 files changed

+66
-50
lines changed

13 files changed

+66
-50
lines changed

.circleci/config.yml

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,6 @@ aliases:
3535
when:
3636
not: *manual-build-conditions
3737

38-
licenses-generate: &licensesGenerate
39-
run:
40-
name: Generate license file for all vscode dependencies
41-
command: |
42-
sudo npm i -g license-checker
43-
sudo license-checker --json --out licenses.json
44-
shell: /bin/bash
45-
46-
licenses-generate-windows: &licensesGenerateWindows
47-
run:
48-
name: Generate license file for all vscode dependencies
49-
command: |
50-
npm i -g license-checker
51-
license-checker --json --out licenses.json
52-
shell: powershell.exe
53-
5438
orbs:
5539
node: circleci/node@5.3.0
5640
win: circleci/windows@5.0.0
@@ -205,7 +189,6 @@ jobs:
205189
name: Install dependencies
206190
command: |
207191
yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
208-
- <<: *licensesGenerate
209192
- run:
210193
name: Build .vsix package
211194
command: |
@@ -215,13 +198,13 @@ jobs:
215198
216199
if [ << parameters.env >> == 'prod' ]; then
217200
echo "RI_SEGMENT_WRITE_KEY='$RI_SEGMENT_WRITE_KEY'" >> $envFile
218-
yarn package:prod --out ${packagePath}
201+
yarn package:prod --target linux-x64 --out ${packagePath}
219202
exit 0;
220203
fi
221204
222205
echo "RI_SEGMENT_WRITE_KEY='$RI_SEGMENT_WRITE_KEY_STAGE'" >> $envFile
223206
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
224-
yarn package:stage --out ${packagePath}
207+
yarn package:stage --target linux-x64 --out ${packagePath}
225208
- persist_to_workspace:
226209
root: .
227210
paths:
@@ -255,7 +238,6 @@ jobs:
255238
command: |
256239
yarn install
257240
no_output_timeout: 15m
258-
- <<: *licensesGenerate
259241
- run:
260242
name: Build .vsix package
261243
command: |
@@ -320,7 +302,6 @@ jobs:
320302
yarn install
321303
shell: bash.exe
322304
no_output_timeout: 15m
323-
- <<: *licensesGenerateWindows
324305
- run:
325306
name: Build .vsix package
326307
command: |
@@ -330,12 +311,12 @@ jobs:
330311
331312
if [ << parameters.env >> == 'prod' ]; then
332313
echo "RI_SEGMENT_WRITE_KEY='$RI_SEGMENT_WRITE_KEY'" >> $envFile
333-
yarn package:prod --out ${packagePath}
314+
yarn package:prod --target win32-x64 --out ${packagePath}
334315
exit 0;
335316
fi
336317
337318
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
338-
yarn package:stage --out ${packagePath}
319+
yarn package:stage --target win32-x64 --out ${packagePath}
339320
shell: bash.exe
340321
no_output_timeout: 20m
341322
- persist_to_workspace:

src/webviews/src/assets/modules/RedisGears2.svg

Lines changed: 5 additions & 5 deletions
Loading

src/webviews/src/components/popover-delete/PopoverDelete.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { PopupActions, PopupPosition } from 'reactjs-popup/dist/types'
88

99
import { RedisString } from 'uiSrc/interfaces'
1010
import { DEFAULT_POPOVER_MAX_WIDTH } from 'uiSrc/constants'
11+
import { RiButton } from 'uiSrc/ui'
1112
import styles from './styles.module.scss'
1213

1314
export interface Props {
@@ -76,15 +77,14 @@ const PopoverDelete = (props: Props) => {
7677
handleButtonClick?.()
7778
}}
7879
trigger={(open) => (
79-
<VSCodeButton
80-
appearance={!triggerText ? 'icon' : 'primary'}
80+
<RiButton
8181
disabled={disabled}
8282
className={cx(styles.trigger, triggerClassName, { '!flex': open })}
8383
aria-label="remove item"
8484
data-testid={testid ? `${testid}-trigger` : 'remove-trigger'}
8585
>
8686
{triggerText || <VscTrash />}
87-
</VSCodeButton>
87+
</RiButton>
8888
)}
8989
>
9090
<div

src/webviews/src/modules/keys-tree/KeysTree.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ export const KeysTree = ({ database }: Props) => {
173173
statusSelected={selectedKeyName}
174174
statusOpen={statusOpen}
175175
loading={loading || constructingTree}
176-
// commonFilterType={commonFilterType}
177-
commonFilterType={null}
178176
setConstructingTree={setConstructingTree}
179177
webworkerFn={constructKeysToTree}
180178
onStatusSelected={handleStatusSelected}

src/webviews/src/modules/keys-tree/components/virtual-tree/VirtualTree.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export interface Props {
2626
loading: boolean
2727
deleting?: boolean
2828
sorting?: SortOrder
29-
commonFilterType: Nullable<KeyTypes>
3029
statusSelected: Nullable<string>,
3130
database: Database
3231
statusOpen: OpenedNodes
@@ -52,7 +51,6 @@ const VirtualTree = (props: Props) => {
5251
database,
5352
deleting = false,
5453
sorting = DEFAULT_TREE_SORTING,
55-
commonFilterType = null,
5654
onStatusOpen,
5755
onStatusSelected,
5856
setConstructingTree,
@@ -143,13 +141,12 @@ const VirtualTree = (props: Props) => {
143141
): void => {
144142
keysApi.fetchKeysMetadataTree(
145143
itemsInit,
146-
commonFilterType,
147144
controller.current?.signal,
148145
(loadedItems) =>
149146
onSuccessFetchedMetadata(loadedItems),
150147
() => { rerender({}) },
151148
)
152-
}, [commonFilterType])
149+
}, [])
153150

154151
const onSuccessFetchedMetadata = useCallback((
155152
loadedItems: any[],
@@ -254,8 +251,8 @@ const VirtualTree = (props: Props) => {
254251
const onItemsRendered = () => {
255252
if (isNotRendered.current) {
256253
isNotRendered.current = false
257-
rerender({})
258254
}
255+
rerender({})
259256
}
260257

261258
return (

src/webviews/src/modules/keys-tree/hooks/interface.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export interface KeysThunks {
4747
fetchMorePatternKeysAction: (cursor: string, count?: number) => void
4848
fetchKeysMetadataTree: (
4949
keys: RedisString[][],
50-
filter: Nullable<KeyTypes>,
5150
signal?: AbortSignal,
5251
onSuccessAction?: (data: KeyInfo[]) => void,
5352
onFailAction?: () => void,

src/webviews/src/modules/keys-tree/hooks/tests/useKeys.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ describe('useKeys', () => {
365365
// Act
366366
useKeysStore.getState().fetchKeysMetadataTree(
367367
data.map(({ name }, i) => ([i, name])) as any,
368-
null,
369368
controller.signal,
370369
onSuccessMock,
371370
)

src/webviews/src/modules/keys-tree/hooks/useKeysThunks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,14 @@ KeysThunks
151151
// Asynchronous thunk action
152152
fetchKeysMetadataTree: async (
153153
keys: RedisString[][],
154-
filter: Nullable<KeyTypes>,
155154
signal?: AbortSignal,
156155
onSuccessAction?: (data: KeyInfo[]) => void,
157156
onFailAction?: () => void,
158157
) => {
159158
try {
160159
const { data } = await apiService.post<KeyInfo[]>(
161160
getDatabaseUrl(get().databaseId, ApiEndpoints.KEYS_METADATA),
162-
{ keys: keys.map(([,nameBuffer]) => nameBuffer), type: filter || undefined },
161+
{ keys: keys.map(([,nameBuffer]) => nameBuffer), type: get().filter || undefined },
163162
{ params: { encoding: getEncoding() }, signal },
164163
)
165164

src/webviews/src/modules/manual-connection/manual-connection-form/ManualConnectionForm.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { FormikErrors, useFormik } from 'formik'
22
import { isEmpty, pick } from 'lodash'
33
import React, { useEffect, useRef, useState } from 'react'
44
import { createPortal } from 'react-dom'
5-
import Popup from 'reactjs-popup'
65
import { VSCodeButton, VSCodeDivider } from '@vscode/webview-ui-toolkit/react'
76

87
import { VscInfo } from 'react-icons/vsc'
@@ -25,6 +24,7 @@ import {
2524
SSHDetails,
2625
} from 'uiSrc/components'
2726
import { useCertificatesStore } from 'uiSrc/store'
27+
import { Tooltip } from 'uiSrc/ui'
2828

2929
export interface Props {
3030
formFields: DbConnectionInfo
@@ -52,7 +52,7 @@ const ManualConnectionForm = (props: Props) => {
5252
onSubmit,
5353
onHostNamePaste,
5454
submitButtonText,
55-
// loading,
55+
loading,
5656
isEditMode,
5757
isCloneMode,
5858
setIsCloneMode,
@@ -83,7 +83,7 @@ const ManualConnectionForm = (props: Props) => {
8383

8484
const formRef = useRef<HTMLDivElement>(null)
8585

86-
const submitIsDisable = () => !isEmpty(errors)
86+
const submitIsDisable = () => !isEmpty(errors) || loading
8787

8888
const validate = (values: DbConnectionInfo) => {
8989
const errs = getFormErrors(values)
@@ -156,13 +156,12 @@ const ManualConnectionForm = (props: Props) => {
156156
return !submitIsDisabled
157157
? Btn
158158
: (
159-
<Popup
159+
<Tooltip
160160
position="top center"
161-
trigger={Btn}
162-
on="hover"
161+
content={!isEmpty(errors) && getRequiredFieldsText(errors)}
163162
>
164-
{getRequiredFieldsText(errors)}
165-
</Popup>
163+
{Btn}
164+
</Tooltip>
166165
)
167166
}
168167

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react'
2+
import { instance, mock } from 'ts-mockito'
3+
4+
import { render } from 'testSrc/helpers'
5+
import { RiButton, Props } from './RiButton'
6+
7+
const mockedProps = mock<Props>()
8+
9+
describe('RiButton', () => {
10+
it('should render', () => {
11+
expect(render(<RiButton {...instance(mockedProps)} />)).toBeTruthy()
12+
})
13+
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, { ButtonHTMLAttributes } from 'react'
2+
import cx from 'classnames'
3+
4+
import styles from './styles.module.scss'
5+
6+
export interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {}
7+
8+
// https://react-popup.elazizi.com/component-api#trigger
9+
export const RiButton = React.forwardRef<HTMLButtonElement, Props>(({ children, className, ...props }, ref) => (
10+
<button
11+
ref={ref}
12+
{...props}
13+
className={cx(styles.button, className)}
14+
>
15+
{children}
16+
</button>
17+
))
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.button {
2+
@apply flex justify-center items-center text-vscode-foreground min-h-[22px] min-w-[22px];
3+
border-radius: 5px;
4+
5+
svg {
6+
@apply min-w-4 min-h-4;
7+
}
8+
9+
&:hover {
10+
background-color: var(--button-icon-hover-background);
11+
}
12+
}
13+

src/webviews/src/ui/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export { Spinner } from './spinner/Spinner'
1111
export { Spacer } from './spacer/Spacer'
1212
export { PromoLink } from './promo-link/PromoLink'
1313
export { Tooltip } from './tooltip/Tooltip'
14+
export { RiButton } from './button/RiButton'
1415

1516
export type { RadioGroupOption } from './radio-group/RadioGroup'
1617
export type { SelectOption } from './select/Select'

0 commit comments

Comments
 (0)