Skip to content

Commit 067f4b8

Browse files
authored
Merge pull request #194 from RedisInsight/feature/RIVS-286_Support_decompressors
#RIVS-286 - Support decompressors
2 parents 6276364 + 4678f77 commit 067f4b8

File tree

46 files changed

+727
-199
lines changed

Some content is hidden

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

46 files changed

+727
-199
lines changed

.circleci/config.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ 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+
3854
orbs:
3955
node: circleci/node@5.3.0
4056
win: circleci/windows@5.0.0
@@ -189,6 +205,7 @@ jobs:
189205
name: Install dependencies
190206
command: |
191207
yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
208+
- <<: *licensesGenerate
192209
- run:
193210
name: Build .vsix package
194211
command: |
@@ -238,6 +255,7 @@ jobs:
238255
command: |
239256
yarn install
240257
no_output_timeout: 15m
258+
- <<: *licensesGenerate
241259
- run:
242260
name: Build .vsix package
243261
command: |
@@ -302,6 +320,7 @@ jobs:
302320
yarn install
303321
shell: bash.exe
304322
no_output_timeout: 15m
323+
- <<: *licensesGenerateWindows
305324
- run:
306325
name: Build .vsix package
307326
command: |
@@ -380,6 +399,15 @@ jobs:
380399
# Orchestrate jobs using workflows
381400
# See: https://circleci.com/docs/configuration-reference/#workflows
382401
workflows:
402+
license-checker:
403+
jobs:
404+
- licenses-check:
405+
name: Run License checker
406+
filters:
407+
branches:
408+
only:
409+
- /^license.*/
410+
383411
frontend-tests:
384412
<<: *ignore-for-manual-build
385413
jobs:

.eslintrc.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
'plugin:react-hooks/recommended',
1212
'airbnb-base',
1313
'airbnb-typescript',
14-
'plugin:sonarjs/recommended',
1514
// TODO: in a separate pull request enable and fix all classes sorting issues for tailwind
1615
// 'plugin:tailwindcss/recommended',
1716
],
@@ -88,9 +87,6 @@ module.exports = {
8887
'prefer-regex-literals': 'off',
8988
'react/display-name': 'off',
9089
'no-promise-executor-return': 'off',
91-
'sonarjs/no-duplicate-string': 'off',
92-
'sonarjs/cognitive-complexity': [1, 20],
93-
'sonarjs/no-identical-functions': [0, 5],
9490
'import/order': [
9591
1,
9692
{

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"**/yarn.lock": true,
4242
"*.{css,sass,scss}.d.ts": true,
4343
"pnpm-lock.yaml": true,
44-
"**/pnpm-lock.yaml": true
44+
"**/pnpm-lock.yaml": true,
45+
"**/test-extensions": true
4546
},
4647
"cSpell.words": ["githubocto", "tailwindcss", "webviews", "zustand"],
4748
"testing.automaticallyOpenPeekView": "never",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Redis for VS Code is the official Visual Studio Code extension that provides an intuitive and efficient GUI for Redis databases, developed by Redis.
44

5-
![Redis for VS Code](.github/Redis_for_VS_Code_main_screen.png)
5+
![Redis for VS Code](https://github.com/RedisInsight/Redis-for-VS-Code/blob/main/.github/Redis_for_VS_Code_main_screen.png)
66

77
## Key features:
88
* Universal Redis Support: Connect to any Redis instance, including Redis Community Edition, Redis Cloud, Redis Software, and Redis on Azure Cache.

Redis_for_VS_Code_main_screen.png

-1020 KB
Binary file not shown.

l10n/bundle.l10n.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"Key name*": "Key name*",
104104
"Encrypted data": "Encrypted data",
105105
"This database does not support the JSON data structure. Learn more about JSON support ": "This database does not support the JSON data structure. Learn more about JSON support ",
106-
"here.": "here.",
106+
"here. ": "here. ",
107107
"You can also create a ": "You can also create a ",
108108
"free Redis Cloud database": "free Redis Cloud database",
109109
" with built-in JSON support.": " with built-in JSON support.",

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
"@types/lodash": "^4.14.200",
180180
"@types/lodash-es": "^4.17.12",
181181
"@types/node": "^16.4.13",
182+
"@types/pako": "^2.0.3",
182183
"@types/react": "^18.2.0",
183184
"@types/react-dom": "^18.2.0",
184185
"@types/react-virtualized": "^9.21.28",
@@ -196,7 +197,6 @@
196197
"@vitest/ui": "^1.3.1",
197198
"@vscode/l10n-dev": "^0.0.35",
198199
"@vscode/vsce": "^3.0.0",
199-
"autoprefixer": "^10.4.16",
200200
"cross-env": "^7.0.3",
201201
"csv-parser": "^3.0.0",
202202
"csv-stringify": "^6.5.1",
@@ -212,12 +212,10 @@
212212
"eslint-plugin-react": "^7.35.0",
213213
"eslint-plugin-react-hooks": "^4.6.2",
214214
"eslint-plugin-react-refresh": "^0.4.4",
215-
"eslint-plugin-sonarjs": "^0.23.0",
216215
"eslint-plugin-tailwindcss": "^3.15.1",
217216
"googleapis": "^142.0.0",
218217
"html-entities": "^2.3.2",
219218
"husky": "^8.0.3",
220-
"identity-obj-proxy": "^3.0.0",
221219
"jsdom": "^22.1.0",
222220
"jsdom-worker": "^0.3.0",
223221
"lint-staged": "^15.0.2",
@@ -247,9 +245,11 @@
247245
"whatwg-fetch": "^3.6.19"
248246
},
249247
"dependencies": {
248+
"@stablelib/snappy": "^1.0.3",
250249
"@vscode/l10n": "^0.0.18",
251250
"@vscode/webview-ui-toolkit": "^1.4.0",
252251
"axios": "^1.5.1",
252+
"brotli-unicode": "^1.0.2",
253253
"buffer": "^6.0.3",
254254
"classnames": "^2.3.2",
255255
"connection-string": "^4.4.0",
@@ -259,6 +259,7 @@
259259
"dotenv": "^16.4.5",
260260
"file-saver": "^2.0.5",
261261
"formik": "^2.4.5",
262+
"fzstd": "^0.1.1",
262263
"history": "^5.3.0",
263264
"html-react-parser": "^5.0.6",
264265
"immer": "^9.0.21",
@@ -267,8 +268,10 @@
267268
"json-bigint": "^1.0.0",
268269
"jsonpath": "^1.1.1",
269270
"lodash": "^4.17.21",
271+
"lz4js": "^0.2.0",
270272
"monaco-editor": "^0.48.0",
271273
"msgpackr": "^1.10.1",
274+
"pako": "^2.1.0",
272275
"php-serialize": "^4.1.1",
273276
"pickleparser": "^0.2.1",
274277
"rawproto": "^0.7.15",

postcss.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ module.exports = {
55
'postcss-import': {},
66
'tailwindcss/nesting': {},
77
tailwindcss: {},
8-
autoprefixer: {},
98
},
109
}

src/Webview.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type WebviewOptions = {
1111
styleUri?: vscode.Uri
1212
nonce?: string
1313
message?: {
14+
action?: string
1415
data: object
1516
}
1617
column?: vscode.ViewColumn
@@ -113,6 +114,7 @@ abstract class Webview {
113114

114115
public abstract update(opts?: WebviewOptions): void
115116
public abstract setTitle(title: string): void
117+
public abstract postMessage(message: any): void
116118
}
117119

118120
export class WebviewPanel extends Webview implements vscode.Disposable {
@@ -211,6 +213,10 @@ export class WebviewPanel extends Webview implements vscode.Disposable {
211213
this.panel.title = title
212214
}
213215

216+
public postMessage(message: any) {
217+
this.panel.webview.postMessage(message)
218+
}
219+
214220
public dispose() {
215221
// Disposes of this instance
216222
// Next time getInstance() is called, it will construct a new instance

src/extension.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function activate(context: vscode.ExtensionContext) {
8484
viewId: ViewId.AddKey,
8585
handleMessage: (message) => handleMessage(message),
8686
message: args,
87-
})
87+
}).postMessage({ action: 'SetDatabase', data: { database: args.data?.database } })
8888
}),
8989

9090
vscode.commands.registerCommand('RedisForVSCode.addDatabase', (args) => {
@@ -159,22 +159,27 @@ export async function activate(context: vscode.ExtensionContext) {
159159

160160
vscode.commands.registerCommand('RedisForVSCode.addDatabaseClose', (args) => {
161161
WebviewPanel.getInstance({ viewId: ViewId.AddDatabase }).dispose()
162-
sidebarProvider.view?.webview.postMessage({ action: 'RefreshTree', data: args })
162+
sidebarProvider.view?.webview.postMessage({ action: 'AddDatabase', data: args })
163163
}),
164164

165165
vscode.commands.registerCommand('RedisForVSCode.editDatabaseClose', (args) => {
166166
WebviewPanel.getInstance({ viewId: ViewId.EditDatabase }).dispose()
167167
sidebarProvider.view?.webview.postMessage({ action: 'RefreshTree', data: args })
168+
169+
const keyDetailsWebview = WebviewPanel.instances[ViewId.Key]
170+
if (keyDetailsWebview) {
171+
keyDetailsWebview.postMessage({ action: 'SetDatabase', data: args })
172+
}
168173
}),
169174

170175
vscode.commands.registerCommand('RedisForVSCode.closeAddKeyAndRefresh', (args) => {
171176
WebviewPanel.getInstance({ viewId: ViewId.AddKey })?.dispose()
172-
sidebarProvider.view?.webview.postMessage({ action: 'RefreshTree', data: args })
177+
sidebarProvider.view?.webview.postMessage({ action: 'SetSelectedKeyAction', data: args })
173178
vscode.commands.executeCommand('RedisForVSCode.openKey', { action: 'SelectKey', data: args })
174179
}),
175180

176181
vscode.commands.registerCommand('RedisForVSCode.closeKeyAndRefresh', (args) => {
177-
sidebarProvider.view?.webview.postMessage({ action: 'RefreshTree', data: args })
182+
sidebarProvider.view?.webview.postMessage({ action: 'SetSelectedKeyAction', data: args })
178183
WebviewPanel.getInstance({ viewId: ViewId.Key })?.dispose()
179184
}),
180185

@@ -183,7 +188,7 @@ export async function activate(context: vscode.ExtensionContext) {
183188
}),
184189

185190
vscode.commands.registerCommand('RedisForVSCode.editKeyName', (args) => {
186-
sidebarProvider.view?.webview.postMessage({ action: 'RefreshTree', data: args })
191+
sidebarProvider.view?.webview.postMessage({ action: 'SetSelectedKeyAction', data: args })
187192
const title = getTitleForKey(args.keyInfo?.displayedKeyType, args.keyInfo?.newKeyString)
188193
WebviewPanel.getInstance({ viewId: ViewId.Key }).setTitle(title)
189194
}),

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ export const handleMessage = async (message: any = {}) => {
5353
vscode.commands.executeCommand('RedisForVSCode.addDatabase')
5454
break
5555
case 'CloseAddDatabase':
56-
vscode.commands.executeCommand('RedisForVSCode.addDatabaseClose')
56+
vscode.commands.executeCommand('RedisForVSCode.addDatabaseClose', message.data)
5757
break
5858
case 'CloseEditDatabase':
59-
vscode.commands.executeCommand('RedisForVSCode.editDatabaseClose', message)
59+
vscode.commands.executeCommand('RedisForVSCode.editDatabaseClose', message.data)
6060
break
6161
case 'UpdateSettings':
6262
await setUIStorageField('appInfo', {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { useDatabasesStore } from 'uiSrc/store'
2+
3+
export const addDatabaseAction = (message: any) => {
4+
if (message.data?.database?.id) {
5+
useDatabasesStore.getState().addDatabaseToList(message.data?.database!)
6+
}
7+
}

src/webviews/src/actions/addKeyAction.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/webviews/src/actions/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export { selectKeyAction } from './selectKeyAction'
2-
export { addKeyAction } from './addKeyAction'
3-
export { refreshTreeAction } from './refreshTreeAction'
2+
export { setSelectedKeyAction } from './setSelectedKeyAction'
3+
export { setDatabaseAction } from './setDatabaseAction'
44
export { processCliAction } from './processCliAction'
5+
export { refreshTreeAction } from './refreshTreeAction'
6+
export { addDatabaseAction } from './addDatabaseAction'

src/webviews/src/actions/processCliAction.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
import { VscodeMessageAction } from 'uiSrc/constants'
2-
import { PostMessage } from 'uiSrc/interfaces'
1+
import { CliAction } from 'uiSrc/interfaces'
32
import { addCli } from 'uiSrc/modules/cli/hooks/cli-settings/useCliSettingsThunks'
43
import { useDatabasesStore } from 'uiSrc/store'
54

6-
export const processCliAction = (message: PostMessage) => {
7-
if (
8-
message.action !== VscodeMessageAction.AddCli
9-
&& message.action !== VscodeMessageAction.OpenCli) {
10-
return
11-
}
12-
5+
export const processCliAction = (message: CliAction) => {
136
const prevDatabaseId = useDatabasesStore.getState().connectedDatabase?.id
147
const database = message?.data?.database
158

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
import { VscodeMessageAction } from 'uiSrc/constants'
2-
import { PostMessage } from 'uiSrc/interfaces'
3-
import { fetchDatabases, useSelectedKeyStore } from 'uiSrc/store'
1+
import { fetchDatabases, useDatabasesStore } from 'uiSrc/store'
42

5-
export const refreshTreeAction = (message: PostMessage) => {
6-
if (message.action !== VscodeMessageAction.RefreshTree) {
7-
return
8-
}
9-
if (message.data?.keyInfo?.key) {
10-
useSelectedKeyStore.getState().setSelectedKeyAction(message.data)
11-
} else {
12-
fetchDatabases()
13-
}
3+
export const refreshTreeAction = (message: any) => {
4+
fetchDatabases(() => {
5+
if (message.data?.database?.id) {
6+
useDatabasesStore.getState().setDatabaseToList(message.data?.database!)
7+
}
8+
})
149
}

src/webviews/src/actions/selectKeyAction.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import { VscodeMessageAction } from 'uiSrc/constants'
2-
import { PostMessage } from 'uiSrc/interfaces'
3-
import { fetchDatabaseOverview, fetchKeyInfo, setInitialStateByType, useDatabasesStore, useSelectedKeyStore } from 'uiSrc/store'
1+
import { SelectKeyAction } from 'uiSrc/interfaces'
2+
import {
3+
fetchDatabaseOverview,
4+
fetchKeyInfo,
5+
setInitialStateByType,
6+
useDatabasesStore,
7+
useSelectedKeyStore,
8+
} from 'uiSrc/store'
49
import { TelemetryEvent, isEqualBuffers, sendEventTelemetry } from 'uiSrc/utils'
510

6-
export const selectKeyAction = (message: PostMessage) => {
7-
if (message.action !== VscodeMessageAction.SelectKey) {
8-
return
9-
}
10-
11+
export const selectKeyAction = (message: SelectKeyAction) => {
1112
const { keyInfo, database } = message?.data
1213
const { key } = keyInfo || {}
1314
const prevKey = useSelectedKeyStore.getState().data?.name
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { SetDatabaseAction } from 'uiSrc/interfaces'
2+
import { useDatabasesStore } from 'uiSrc/store'
3+
4+
export const setDatabaseAction = (message: SetDatabaseAction) => {
5+
if (message.data?.database?.id) {
6+
window.ri.database = message.data.database
7+
useDatabasesStore.getState().setConnectedDatabase(message.data.database)
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { SelectedKeyAction } from 'uiSrc/interfaces'
2+
import { useSelectedKeyStore } from 'uiSrc/store'
3+
4+
export const setSelectedKeyAction = (message: SelectedKeyAction) => {
5+
if (message.data?.keyInfo?.key) {
6+
useSelectedKeyStore.getState().setSelectedKeyAction(message.data)
7+
}
8+
}

src/webviews/src/components/database-modules/DatabaseModules.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable sonarjs/no-nested-template-literals */
21
import React from 'react'
32
import cx from 'classnames'
43
import Popup from 'reactjs-popup'
@@ -39,7 +38,6 @@ const DatabaseModules = React.memo((props: Props) => {
3938
const { abbreviation = '', name = moduleName } = getModule(moduleName)
4039

4140
const moduleAlias = truncateText(name, 50)
42-
// eslint-disable-next-line sonarjs/no-nested-template-literals
4341
let icon = DEFAULT_MODULES_INFO[propName as RedisDefaultModules]?.icon
4442
const content = `${moduleAlias}${semanticVersion || version ? ` v. ${semanticVersion || version}` : ''}`
4543

src/webviews/src/components/virtual-table/styles.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ $borderColor: var(--vscode-tree-tableColumnsBorder);
118118
}
119119

120120
:global(.key-details-table) {
121-
@apply relative;
121+
@apply relative w-full;
122122
:global(.ReactVirtualized__Table__row) {
123123
font-size: 13px;
124124

0 commit comments

Comments
 (0)