Skip to content

Commit 93971a7

Browse files
Merge pull request #242 from RedisInsight/release/1.2.0
Release/1.2.0
2 parents 8868301 + 9c6d18e commit 93971a7

File tree

43 files changed

+298
-85
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+298
-85
lines changed

.env

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
NODE_ENV='production'
66
RI_BASE_APP_URL='http://localhost'
77
RI_APP_PORT=5541
8-
RI_APP_VERSION='1.0.0'
8+
RI_APP_VERSION='1.2.0'
99
RI_APP_PREFIX='api'
1010
RI_APP_FOLDER_NAME='.redis-for-vscode'
11-
RI_CDN_PATH='https://s3.us-east-1.amazonaws.com/redisinsight.test/public/zalenski/vscode/web-mini'
11+
RI_CDN_PATH='https://s3.amazonaws.com/redisinsight.download/public/releases/2.64.0/web-mini'
1212
RI_WITHOUT_BACKEND=false
1313
# RI_WITHOUT_BACKEND=true
1414
RI_STDOUT_LOGGER=false

.github/workflows/aws.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
AWS_DISTRIBUTION_ID: ${{ secrets.AWS_DISTRIBUTION_ID }}
99
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
1010
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
11-
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
11+
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
1212

1313
jobs:
1414
release-private:

.github/workflows/release-prod.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
name: Run all tests
1111
uses: ./.github/workflows/tests.yml
1212
secrets: inherit
13+
with:
14+
group_tests: 'without_e2e'
15+
pre_release: true
1316

1417
builds-prod:
1518
name: Create all builds for release

.github/workflows/release-stage.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
name: Release stage tests
1111
uses: ./.github/workflows/tests.yml
1212
secrets: inherit
13+
with:
14+
group_tests: 'without_e2e'
15+
pre_release: true
1316

1417
builds:
1518
name: Release stage builds

.github/workflows/tests.yml

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ on:
2222
description: Run group of tests
2323
type: string
2424
default: 'all'
25+
pre_release:
26+
description: Is pre-release
27+
default: false
28+
type: boolean
2529

2630
jobs:
2731
frontend-tests:

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redis-for-vscode",
3-
"version": "1.0.0",
3+
"version": "1.2.0",
44
"displayName": "Redis for VS Code",
55
"description": "Visually interact with data and build queries in Redis",
66
"license": "SEE LICENSE IN LICENSE",
@@ -44,7 +44,7 @@
4444
"vscode": "^1.87.0"
4545
},
4646
"activationEvents": [
47-
"onStartupFinished"
47+
"onView:ri-sidebar-view"
4848
],
4949
"contributes": {
5050
"viewsContainers": {

scripts/downloadBackend.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ async function downloadRedisBackendArchive(
8282
})
8383
}
8484

85-
function getNormalizedString(string: string) {
86-
return string?.startsWith('D:')
85+
function getNormalizedCIString(string: string) {
86+
return string?.startsWith('D:') && process.env.CI
8787
? upath.normalize(string).replace('D:', '/d')
8888
: string
8989
}
@@ -96,9 +96,9 @@ function unzipRedisServer(redisInsideArchivePath: string, extractDir: string) {
9696

9797
cp.spawnSync('tar', [
9898
'-xf',
99-
getNormalizedString(redisInsideArchivePath),
99+
getNormalizedCIString(redisInsideArchivePath),
100100
'-C',
101-
getNormalizedString(extractDir),
101+
getNormalizedCIString(extractDir),
102102
'--strip-components',
103103
'1',
104104
'api',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import * as useCliSettingsThunks from 'uiSrc/modules/cli/hooks/cli-settings/useCliSettingsThunks'
2+
import { constants } from 'testSrc/helpers'
3+
import { processCliAction } from 'uiSrc/actions'
4+
5+
vi.spyOn(useCliSettingsThunks, 'addCli')
6+
7+
beforeEach(() => {
8+
vi.stubGlobal('ri', { })
9+
})
10+
11+
describe('processCliAction', () => {
12+
it('should call addCli', () => {
13+
processCliAction(constants.VSCODE_CLI_ACTION)
14+
expect(useCliSettingsThunks.addCli).toBeCalled()
15+
})
16+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as useSelectedKey from 'uiSrc/store/hooks/use-selected-key-store/useSelectedKeyStore'
2+
import { selectKeyAction } from 'uiSrc/actions'
3+
import { constants } from 'testSrc/helpers'
4+
5+
6+
vi.spyOn(useSelectedKey, 'fetchKeyInfo')
7+
8+
9+
beforeEach(() => {
10+
vi.stubGlobal('ri', { })
11+
12+
useSelectedKey.useSelectedKeyStore.setState((state) => ({
13+
...state,
14+
data: constants.KEY_INFO,
15+
}))
16+
})
17+
18+
describe('selectKeyAction', () => {
19+
it('should call fetchKeyInfo', () => {
20+
selectKeyAction(constants.VSCODE_SELECT_KEY_ACTION)
21+
expect(useSelectedKey.fetchKeyInfo).toBeCalled()
22+
})
23+
})

src/webviews/src/components/auto-refresh/AutoRefresh.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ const AutoRefresh = React.memo(({
199199
</Tooltip>
200200

201201
<Popover
202+
closeOnEscape
203+
closeOnDocumentClick
202204
repositionOnResize
203205
keepTooltipInside={false}
204206
open={isPopoverOpen}

src/webviews/src/components/auto-refresh/styles.module.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121

2222
:global(.popover-auto-refresh-content) {
23-
@apply max-w-[225px] w-[225px] #{!important};
24-
23+
@apply pr-[26px] #{!important};
2524
}
2625

2726
.switch {

src/webviews/src/constants/core/storage.ts

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ enum StorageItem {
3232
databaseId = 'databaseId',
3333
openTreeNode = 'openTreeNode',
3434
openTreeDatabase = 'openTreeDatabase',
35+
keysTreeFilter = 'keysTreeFilter',
3536
}
3637

3738
export { StorageItem }

src/webviews/src/modules/key-details-header/KeyDetailsHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const KeyDetailsHeader = ({
157157
</div>
158158
)}
159159
</AutoSizer>
160-
{(loading || refreshing) && <div className="table-loading" />}
160+
{(loading || refreshing) && <div className="data-loading" />}
161161
</div>
162162
)
163163
}

src/webviews/src/modules/key-details/components/hash-details/HashDetails.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const HashDetails = (props: Props) => {
8484
),
8585
children,
8686
<AddItemsAction key={3} title={l10n.t('Add Fields')} openAddItemPanel={openAddItemPanel} />,
87-
]), [])
87+
]), [showTtl, isExpireFieldsAvailable])
8888

8989
return (
9090
<div className="fluid flex-column relative">

src/webviews/src/modules/key-details/components/string-details/StringDetails.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const StringDetails = (props: Props) => {
103103
setEditItem(!editItem)
104104
}}
105105
/>,
106-
]), [])
106+
]), [isStringEditable, isEditable])
107107

108108
return (
109109
<div className="fluid flex-column relative">

src/webviews/src/modules/keys-tree/components/database-wrapper/DatabaseWrapper.spec.tsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { apiService, vscodeApi } from 'uiSrc/services'
88
import * as useContext from 'uiSrc/store/hooks/use-context/useContext'
99
import * as useSelectedKeyStore from 'uiSrc/store/hooks/use-selected-key-store/useSelectedKeyStore'
1010
import { Database } from 'uiSrc/store'
11+
import * as useDatabasesStore from 'uiSrc/store'
1112
import { constants, fireEvent, render, waitForStack } from 'testSrc/helpers'
1213
import { DatabaseWrapper, Props } from './DatabaseWrapper'
1314
import * as useKeys from '../../hooks/useKeys'
@@ -39,12 +40,23 @@ const resetKeysTreeMock = vi.fn();
3940
resetKeysTree: resetKeysTreeMock,
4041
}))
4142

43+
vi.spyOn(useDatabasesStore, 'fetchDatabaseOverviewById')
44+
4245
describe('DatabaseWrapper', () => {
4346
it('should render', () => {
4447
expect(render(<DatabaseWrapper {...mockedProps} />)).toBeTruthy()
4548
})
4649

47-
it('should call fetchPatternKeysAction action after click on refresh icon', async () => {
50+
it('should call fetchDatabaseOverviewById action after click on refresh icon', async () => {
51+
const { queryByTestId } = render(<DatabaseWrapper {...mockedProps} />)
52+
53+
fireEvent.click(queryByTestId('refresh-databases')!)
54+
await waitForStack()
55+
56+
expect(useDatabasesStore.fetchDatabaseOverviewById).toBeCalled()
57+
})
58+
59+
it('should call fetchPatternKeysAction action after click on logical database refresh icon', async () => {
4860
const { queryByTestId } = render(<DatabaseWrapper {...mockedProps} />)
4961

5062
fireEvent.click(queryByTestId(`database-${mockDatabase.id}`)!)

src/webviews/src/modules/keys-tree/components/database-wrapper/DatabaseWrapper.tsx

+42-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useState } from 'react'
22
import cx from 'classnames'
3-
import { VscEdit } from 'react-icons/vsc'
4-
import { isUndefined, toNumber } from 'lodash'
3+
import { VscEdit, VscRefresh } from 'react-icons/vsc'
4+
import { isUndefined, toNumber, isEqual } from 'lodash'
55
import * as l10n from '@vscode/l10n'
66
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react'
77

@@ -11,7 +11,7 @@ import {
1111
getRedisModulesSummary,
1212
sendEventTelemetry,
1313
} from 'uiSrc/utils'
14-
import { ContextStoreProvider, Database, DatabaseOverview, checkConnectToDatabase, deleteDatabases } from 'uiSrc/store'
14+
import { ContextStoreProvider, Database, DatabaseOverview, checkConnectToDatabase, deleteDatabases, fetchDatabaseOverviewById } from 'uiSrc/store'
1515
import { Chevron, DatabaseIcon, Tooltip } from 'uiSrc/ui'
1616
import { PopoverDelete } from 'uiSrc/components'
1717
import { POPOVER_WINDOW_BORDER_WIDTH, StorageItem, VscodeMessageAction } from 'uiSrc/constants'
@@ -28,9 +28,29 @@ export interface Props {
2828
database: Database
2929
}
3030

31+
const LogicalDatabase = (
32+
{ database, open, dbTotal }:
33+
{ database: Database, open?: boolean, dbTotal?: number },
34+
) => (
35+
<ContextStoreProvider >
36+
<KeysStoreProvider>
37+
<LogicalDatabaseWrapper database={database}>
38+
<KeysTreeHeader
39+
database={database}
40+
open={open}
41+
dbTotal={dbTotal}
42+
>
43+
<KeysTree database={database} />
44+
</KeysTreeHeader>
45+
</LogicalDatabaseWrapper>
46+
</KeysStoreProvider>
47+
</ContextStoreProvider>
48+
)
49+
3150
export const DatabaseWrapper = React.memo(({ database }: Props) => {
3251
const { id, name } = database
3352

53+
const [loading, setLoading] = useState<boolean>(false)
3454
const [showTree, setShowTree] = useState<boolean>(false)
3555
const [totalKeysPerDb, setTotalKeysPerDb] = useState<Maybe<Record<string, number>>>(undefined)
3656

@@ -82,6 +102,16 @@ export const DatabaseWrapper = React.memo(({ database }: Props) => {
82102
vscodeApi.postMessage({ action: VscodeMessageAction.EditDatabase, data: { database } })
83103
}
84104

105+
const refreshHandle = async () => {
106+
setLoading(true)
107+
const overview = await fetchDatabaseOverviewById(id)
108+
setLoading(false)
109+
110+
if (!isEqual(totalKeysPerDb, overview?.totalKeysPerDb)) {
111+
setTotalKeysPerDb(overview?.totalKeysPerDb)
112+
}
113+
}
114+
85115
const deleteDatabaseHandle = () => {
86116
deleteDatabases([database])
87117
}
@@ -95,25 +125,6 @@ export const DatabaseWrapper = React.memo(({ database }: Props) => {
95125
})
96126
}
97127

98-
const LogicalDatabase = (
99-
{ database, open, dbTotal }:
100-
{ database: Database, open?: boolean, dbTotal?: number },
101-
) => (
102-
<ContextStoreProvider>
103-
<KeysStoreProvider>
104-
<LogicalDatabaseWrapper database={database}>
105-
<KeysTreeHeader
106-
database={database}
107-
open={open}
108-
dbTotal={dbTotal}
109-
>
110-
<KeysTree database={database} />
111-
</KeysTreeHeader>
112-
</LogicalDatabaseWrapper>
113-
</KeysStoreProvider>
114-
</ContextStoreProvider>
115-
)
116-
117128
return (
118129
<div className={cx('flex w-full flex-col')}>
119130
<div className={cx('flex justify-between flex-1 min-h-[22px] flex-row group')}>
@@ -138,6 +149,14 @@ export const DatabaseWrapper = React.memo(({ database }: Props) => {
138149
</Tooltip>
139150
</div>
140151
<div className="flex pr-3.5">
152+
<VSCodeButton
153+
appearance="icon"
154+
onClick={refreshHandle}
155+
className={cx('hidden', 'group-hover:!flex', { '!flex': showTree })}
156+
data-testid="refresh-databases"
157+
>
158+
<VscRefresh />
159+
</VSCodeButton>
141160
<VSCodeButton
142161
appearance="icon"
143162
onClick={editHandle}
@@ -160,6 +179,7 @@ export const DatabaseWrapper = React.memo(({ database }: Props) => {
160179
/>
161180
</div>
162181
</div>
182+
{loading && <div className="data-loading" />}
163183
{showTree && (<>
164184
{!isUndefined(totalKeysPerDb) && Object.keys(totalKeysPerDb).map((databaseIndex) => (
165185
<LogicalDatabase

src/webviews/src/modules/keys-tree/components/keys-summary/KeysSummary.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ export const KeysSummary = (props: Props) => {
159159
)} */}
160160

161161
<div className={cx('hidden', 'pr-3.5', 'group-hover:!flex', { '!flex': showTree })}>
162+
<KeyTreeFilter />
162163
<Tooltip
164+
repositionOnResize
163165
keepTooltipInside={false}
164166
content={l10n.t('Sort by key names displayed')}
165-
position="bottom right"
167+
position="bottom center"
166168
>
167169
<VSCodeButton
168170
appearance="icon"
@@ -172,7 +174,6 @@ export const KeysSummary = (props: Props) => {
172174
{isSortingASC ? <BiSortDown /> : <BiSortUp />}
173175
</VSCodeButton>
174176
</Tooltip>
175-
<KeyTreeFilter />
176177
<VSCodeButton appearance="icon" onClick={addKeyClickHandle} data-testid="add-key-button">
177178
<VscAdd />
178179
</VSCodeButton>

0 commit comments

Comments
 (0)