Skip to content

Commit 5fb96aa

Browse files
authored
Merge pull request #223 from RedisInsight/feature/RIVS-31_Logical_databases
#RI-31 - Logical databases
2 parents 31fed37 + 0736188 commit 5fb96aa

File tree

115 files changed

+2854
-1251
lines changed

Some content is hidden

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

115 files changed

+2854
-1251
lines changed

.circleci/config.yml

Lines changed: 7 additions & 592 deletions
Large diffs are not rendered by default.

.circleci/config.yml.backup

Lines changed: 610 additions & 0 deletions
Large diffs are not rendered by default.

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ RI_APP_PORT=5541
88
RI_APP_VERSION='1.0.0'
99
RI_APP_PREFIX='api'
1010
RI_APP_FOLDER_NAME='.redis-for-vscode'
11-
RI_CDN_PATH='https://s3.amazonaws.com/redisinsight.download/public/releases/2.54.1/web-mini'
11+
RI_CDN_PATH='https://s3.us-east-1.amazonaws.com/redisinsight.test/public/zalenski/vscode/web-mini'
1212
RI_WITHOUT_BACKEND=false
1313
# RI_WITHOUT_BACKEND=true
1414
RI_STDOUT_LOGGER=false
1515
RI_AUTO_BOOTSTRAP=false
1616
RI_MIGRATE_OLD_FOLDERS=false
1717
RI_BUILD_TYPE='VS_CODE'
18-
RI_ENCRYPTION_KEYTAR=false
1918
RI_ANALYTICS_START_EVENTS=true
2019
RI_AGREEMENTS_PATH='../../webviews/resources/agreements-spec.json'
20+
RI_ENCRYPTION_KEYTAR_SERVICE="redis-for-vscode"
2121
# RI_SEGMENT_WRITE_KEY='SEGMENT_WRITE_KEY'

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ module.exports = {
8686
'function-paren-newline': 'off',
8787
'prefer-regex-literals': 'off',
8888
'react/display-name': 'off',
89+
'react/jsx-indent-props': [2, 2],
90+
'react/jsx-indent': [2, 2],
8991
'no-promise-executor-return': 'off',
9092
'import/order': [
9193
1,

.github/actions/install-all-build-libs/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ runs:
88
- name: Setup Node
99
uses: actions/setup-node@v4
1010
with:
11-
node-version: '20.15'
11+
node-version: '20.18.0'
1212

1313
- name: Install dependencies for root package.js
1414
shell: bash

.github/workflows/pipeline-build-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: ./.github/actions/download-backend
3636

3737
- name: Set RI_SEGMENT_WRITE_KEY to .env file
38-
run: echo "RI_SEGMENT_WRITE_KEY='$RI_SEGMENT_WRITE_KEY'" >> $envFile
38+
run: echo "RI_SEGMENT_WRITE_KEY='${{ env.RI_SEGMENT_WRITE_KEY }}'" >> ${{ env.envFile }}
3939

4040
- name: Build linux package (production)
4141
if: inputs.environment == 'production'
@@ -45,7 +45,7 @@ jobs:
4545
- name: Build linux package (staging)
4646
if: inputs.environment == 'staging'
4747
run: |
48-
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
48+
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" ${{ env.envFile }}
4949
yarn package:stage --target linux-x64 --out ${packagePath}
5050
5151
- uses: actions/upload-artifact@v4

.github/workflows/pipeline-build-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: ./.github/actions/install-all-build-libs
2929

3030
- name: Set RI_SEGMENT_WRITE_KEY to .env file
31-
run: echo "RI_SEGMENT_WRITE_KEY='$RI_SEGMENT_WRITE_KEY'" >> $envFile
31+
run: echo "RI_SEGMENT_WRITE_KEY='${{ env.RI_SEGMENT_WRITE_KEY }}'" >> ${{ env.envFile }}
3232

3333
- name: Download backend x64
3434
uses: ./.github/actions/download-backend
@@ -38,7 +38,7 @@ jobs:
3838
- name: Build macos x64 package (staging)
3939
if: inputs.environment != 'production'
4040
run: |
41-
sed -i '' "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
41+
sed -i '' "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" ${{ env.envFile }}
4242
4343
yarn package:stage --target darwin-x64 --out ${packagePath}-x64.vsix
4444
@@ -55,7 +55,7 @@ jobs:
5555
- name: Build macos arm64 package (staging)
5656
if: inputs.environment != 'production'
5757
run: |
58-
sed -i '' "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
58+
sed -i '' "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" ${{ env.envFile }}
5959
6060
yarn package:stage --target darwin-arm64 --out ${packagePath}-arm64.vsix
6161

.github/workflows/pipeline-build-windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: ./.github/actions/download-backend
2626

2727
- name: Set RI_SEGMENT_WRITE_KEY to .env file
28-
run: echo "RI_SEGMENT_WRITE_KEY='$RI_SEGMENT_WRITE_KEY'" >> $envFile
28+
run: echo "RI_SEGMENT_WRITE_KEY='${{ env.RI_SEGMENT_WRITE_KEY }}'" >> ${{ env.envFile }}
2929

3030
- name: Build windows package (production)
3131
if: inputs.environment == 'production'
@@ -35,7 +35,7 @@ jobs:
3535
- name: Build windows package (staging)
3636
if: inputs.environment == 'staging'
3737
run: |
38-
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
38+
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" ${{ env.envFile }}
3939
yarn package:stage --target win32-x64 --out ${{ env.packagePath }}
4040
4141
- uses: actions/upload-artifact@v4

.github/workflows/tests-e2e-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup Node
2929
uses: actions/setup-node@v4
3030
with:
31-
node-version: '20.15'
31+
node-version: '20.18.0'
3232

3333
- name: Download linux artifact
3434
uses: actions/download-artifact@v4

.github/workflows/tests-frontend.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ on:
33
workflow_call:
44

55
env:
6+
SLACK_AUDIT_REPORT_CHANNEL: ${{ secrets.SLACK_AUDIT_REPORT_CHANNEL }}
67
SLACK_AUDIT_REPORT_KEY: ${{ secrets.SLACK_AUDIT_REPORT_KEY }}
8+
AWS_BUCKET_NAME_TEST: ${{ vars.AWS_BUCKET_NAME_TEST }}
9+
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
10+
AWS_DISTRIBUTION_ID: ${{ secrets.AWS_DISTRIBUTION_ID }}
11+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
12+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
13+
REPORT_NAME: "report-vscode-fe"
14+
S3_PATH: "report-vscode-fe"
715

816
jobs:
917
unit-tests:
@@ -18,21 +26,30 @@ jobs:
1826
- name: Unit tests UI
1927
run: yarn test:cov
2028

21-
- name: Publish Test Results
22-
uses: EnricoMi/publish-unit-test-result-action@v2
29+
- name: Get current date
30+
id: date
2331
if: always()
24-
with:
25-
check_name: 'FE Unit tests summary'
26-
comment_mode: 'failures'
27-
files: reports/junit.xml
32+
uses: RedisInsight/RedisInsight/.github/actions/get-current-date@873a0ebf55c85d3127bb4efb4d0636d9ab838226
2833

29-
- name: Generate test results
30-
uses: dorny/test-reporter@v1
34+
35+
- name: Deploy 🚀
36+
if: always()
37+
run: |
38+
39+
GZIP_FILE=html.meta.json.gz
40+
S3_SUB_PATH="test-reports/${{ steps.date.outputs.date }}/${{ github.run_id }}/${{ env.REPORT_NAME }}"
41+
42+
aws s3 cp report/ s3://${AWS_BUCKET_NAME_TEST}/public/${S3_SUB_PATH} --recursive --exclude "*.gz"
43+
44+
# s3 modified "gzip" content-type
45+
# https://github.com/aws/aws-cli/issues/1131
46+
aws s3 cp report/${GZIP_FILE} s3://${AWS_BUCKET_NAME_TEST}/public/${S3_SUB_PATH}/${GZIP_FILE} --content-type "application/x-gzip" --metadata-directive REPLACE
47+
48+
echo "S3_SUB_PATH=${S3_SUB_PATH}" >> $GITHUB_ENV
49+
50+
51+
- name: Add link to report in the workflow summary
3152
if: always()
32-
with:
33-
name: 'Test results: FE unit tests'
34-
path: reports/junit.xml
35-
reporter: jest-junit
36-
list-tests: 'failed'
37-
list-suites: 'failed'
38-
fail-on-error: 'false'
53+
run: |
54+
link="${{ vars.DEFAULT_TEST_REPORTS_URL }}/${S3_SUB_PATH}/index.html"
55+
echo "[${link}](${link})" >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ coverage
2020
/.nyc_output
2121
**/coverage
2222
reports
23+
report
2324

2425
# IDEs and editors
2526
/.idea

.vscode/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"source.fixAll.eslint": "explicit"
1111
},
1212
"eslint.validate": ["javascript", "typescript"],
13+
"eslint.workingDirectories": [
14+
{ "directory": "./", "changeProcessCWD": true }
15+
],
1316
"files.associations": {
1417
"*.css": "postcss",
1518
"*.scss": "postcss"
@@ -35,6 +38,7 @@
3538
".eslintcache": true,
3639
"bower_components": true,
3740
"release": true,
41+
"src/webviews/public": true,
3842
"npm-debug.log.*": true,
3943
"tests/**/__snapshots__": true,
4044
"yarn.lock": true,
@@ -44,7 +48,13 @@
4448
"**/pnpm-lock.yaml": true,
4549
"**/test-extensions": true
4650
},
47-
"cSpell.words": ["githubocto", "tailwindcss", "webviews", "zustand"],
51+
"cSpell.words": [
52+
"githubocto",
53+
"keyspace",
54+
"tailwindcss",
55+
"webviews",
56+
"zustand"
57+
],
4858
"testing.automaticallyOpenPeekView": "never",
4959
"[typescriptreact]": {
5060
"editor.defaultFormatter": "dbaeumer.vscode-eslint"

.vscodeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ vite.config.mjs
2828
# test
2929
coverage
3030
test
31+
report
32+
reports
3133
tests
3234
test-workspace
3335
.vscode-test

l10n/bundle.l10n.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"Key Name": "Key Name",
4242
" will be deleted.": " will be deleted.",
4343
"Delete": "Delete",
44-
"will be deleted from Redis for VS Code.": "will be deleted from Redis for VS Code.",
44+
"will be removed from Redis for VS Code.": "will be removed from Redis for VS Code.",
4545
"Key Size": "Key Size",
4646
"Key Size: ": "Key Size: ",
4747
"Length": "Length",
@@ -295,9 +295,6 @@
295295
"Host:": "Host:",
296296
"Database Index:": "Database Index:",
297297
"Modules:": "Modules:",
298-
"Select Logical Database": "Select Logical Database",
299-
"Database Index": "Database Index",
300-
"Enter Database Index": "Enter Database Index",
301298
"No decompression": "No decompression",
302299
"Enable automatic data decompression": "Enable automatic data decompression",
303300
"Decompression format": "Decompression format",

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
"download:backend": "tsc ./scripts/downloadBackend.ts && node ./scripts/downloadBackend.js",
144144
"dev": "vite dev",
145145
"dev:key": "cross-env RI_DATA_ROUTE=main/key vite dev",
146+
"dev:database": "cross-env RI_DATA_ROUTE=main/add_database vite dev",
146147
"dev:sidebar": "cross-env RI_DATA_ROUTE=sidebar vite dev",
147148
"l10n:collect": "npx @vscode/l10n-dev export -o ./l10n ./src",
148149
"watch": "tsc -watch -p ./",
@@ -194,9 +195,9 @@
194195
"@vitejs/plugin-react": "^4.2.1",
195196
"@vitejs/plugin-react-swc": "^3.6.0",
196197
"@vitest/coverage-v8": "^1.3.1",
197-
"@vitest/ui": "^1.3.1",
198+
"@vitest/ui": "^1.6.0",
198199
"@vscode/l10n-dev": "^0.0.35",
199-
"@vscode/vsce": "^3.0.0",
200+
"@vscode/vsce": "^3.2.1",
200201
"cross-env": "^7.0.3",
201202
"csv-parser": "^3.0.0",
202203
"csv-stringify": "^6.5.1",
@@ -236,6 +237,7 @@
236237
"ts-node": "^10.9.1",
237238
"tsconfig-paths": "^4.2.0",
238239
"typescript": "^5.4.5",
240+
"upath": "^2.0.1",
239241
"uuid": "^9.0.1",
240242
"vite": "^5.2.10",
241243
"vite-plugin-react-click-to-component": "^3.0.0",
@@ -286,7 +288,7 @@
286288
"react-inlinesvg": "^4.1.1",
287289
"react-monaco-editor": "^0.55.0",
288290
"react-router-dom": "^6.17.0",
289-
"react-select": "^5.8.0",
291+
"react-select": "^5.8.3",
290292
"react-spinners": "^0.13.8",
291293
"react-virtualized": "^9.22.5",
292294
"react-virtualized-auto-sizer": "^1.0.20",

scripts/downloadBackend.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import * as fs from 'fs'
33
import * as path from 'path'
44
import * as cp from 'child_process'
55
import * as dotenv from 'dotenv'
6+
import * as upath from 'upath'
67
import { parse as parseUrl } from 'url'
78

9+
810
dotenv.config({
911
path: [
1012
path.join(__dirname, '..', '.env'),
@@ -80,13 +82,28 @@ async function downloadRedisBackendArchive(
8082
})
8183
}
8284

85+
function getNormalizedString(string: string) {
86+
return string?.startsWith('D:')
87+
? upath.normalize(string).replace('D:', '/d')
88+
: string
89+
}
90+
8391
function unzipRedisServer(redisInsideArchivePath: string, extractDir: string) {
8492
// tar does not create extractDir by default
8593
if (!fs.existsSync(extractDir)) {
8694
fs.mkdirSync(extractDir)
8795
}
8896

89-
cp.spawnSync('tar', ['-xf', redisInsideArchivePath, '-C', extractDir, '--strip-components', '1', 'api'])
97+
cp.spawnSync('tar', [
98+
'-xf',
99+
getNormalizedString(redisInsideArchivePath),
100+
'-C',
101+
getNormalizedString(extractDir),
102+
'--strip-components',
103+
'1',
104+
'api',
105+
])
106+
90107

91108
// remove tutorials
92109
fs.rmSync(tutorialsPath, { recursive: true, force: true });

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export async function activate(context: vscode.ExtensionContext) {
164164

165165
vscode.commands.registerCommand('RedisForVSCode.editDatabaseClose', (args) => {
166166
WebviewPanel.getInstance({ viewId: ViewId.EditDatabase }).dispose()
167-
sidebarProvider.view?.webview.postMessage({ action: 'RefreshTree', data: args })
167+
sidebarProvider.view?.webview.postMessage({ action: 'UpdateDatabaseInList', data: args })
168168

169169
const keyDetailsWebview = WebviewPanel.instances[ViewId.Key]
170170
if (keyDetailsWebview) {

src/resources/agreements-spec.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.1",
2+
"version": "1.0.2",
33
"agreements": {
44
"analytics": {
55
"defaultValue": false,
@@ -35,6 +35,37 @@
3535
"title": "Server Side Public License",
3636
"label": "I have read and understood the Terms",
3737
"requiredText": "Accept the Server Side Public License"
38+
},
39+
"encryption": {
40+
"conditional": true,
41+
"checker": "KEYTAR",
42+
"defaultOption": "false",
43+
"options": {
44+
"true": {
45+
"defaultValue": true,
46+
"displayInSetting": false,
47+
"required": false,
48+
"editable": true,
49+
"disabled": false,
50+
"category": "privacy",
51+
"since": "1.0.2",
52+
"title": "Encryption",
53+
"label": "Encrypt sensitive information",
54+
"description": "Select to encrypt sensitive information using system keychain. Otherwise, this information is stored locally in plain text, which may incur security risk."
55+
},
56+
"false": {
57+
"defaultValue": false,
58+
"displayInSetting": false,
59+
"required": false,
60+
"editable": true,
61+
"disabled": true,
62+
"category": "privacy",
63+
"since": "1.0.2",
64+
"title": "Encryption",
65+
"label": "Encrypt sensitive information",
66+
"description": "Install or enable the system keychain to encrypt and securely store your sensitive information added before using the application. Otherwise, this information will be stored locally in plain text and may lead to security risks."
67+
}
68+
}
3869
}
3970
}
4071
}

src/webviews/src/actions/processCliAction.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import { useDatabasesStore } from 'uiSrc/store'
44

55
export const processCliAction = (message: CliAction) => {
66
const prevDatabaseId = useDatabasesStore.getState().connectedDatabase?.id
7+
const prevDatabaseIndex = useDatabasesStore.getState().connectedDatabase?.db
78
const database = message?.data?.database
9+
const dbIndex = database?.db ?? 0
810

9-
if (prevDatabaseId === database?.id) {
11+
if (prevDatabaseId! + prevDatabaseIndex === database?.id + dbIndex) {
1012
return
1113
}
1214
window.ri.database = database

0 commit comments

Comments
 (0)