Skip to content

Commit

Permalink
Merge pull request #223 from RedisInsight/feature/RIVS-31_Logical_dat…
Browse files Browse the repository at this point in the history
…abases

#RI-31 - Logical databases
  • Loading branch information
vlad-dargel authored Dec 17, 2024
2 parents 31fed37 + 0736188 commit 5fb96aa
Show file tree
Hide file tree
Showing 115 changed files with 2,854 additions and 1,251 deletions.
599 changes: 7 additions & 592 deletions .circleci/config.yml

Large diffs are not rendered by default.

610 changes: 610 additions & 0 deletions .circleci/config.yml.backup

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ RI_APP_PORT=5541
RI_APP_VERSION='1.0.0'
RI_APP_PREFIX='api'
RI_APP_FOLDER_NAME='.redis-for-vscode'
RI_CDN_PATH='https://s3.amazonaws.com/redisinsight.download/public/releases/2.54.1/web-mini'
RI_CDN_PATH='https://s3.us-east-1.amazonaws.com/redisinsight.test/public/zalenski/vscode/web-mini'
RI_WITHOUT_BACKEND=false
# RI_WITHOUT_BACKEND=true
RI_STDOUT_LOGGER=false
RI_AUTO_BOOTSTRAP=false
RI_MIGRATE_OLD_FOLDERS=false
RI_BUILD_TYPE='VS_CODE'
RI_ENCRYPTION_KEYTAR=false
RI_ANALYTICS_START_EVENTS=true
RI_AGREEMENTS_PATH='../../webviews/resources/agreements-spec.json'
RI_ENCRYPTION_KEYTAR_SERVICE="redis-for-vscode"
# RI_SEGMENT_WRITE_KEY='SEGMENT_WRITE_KEY'
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ module.exports = {
'function-paren-newline': 'off',
'prefer-regex-literals': 'off',
'react/display-name': 'off',
'react/jsx-indent-props': [2, 2],
'react/jsx-indent': [2, 2],
'no-promise-executor-return': 'off',
'import/order': [
1,
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/install-all-build-libs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ runs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.15'
node-version: '20.18.0'

- name: Install dependencies for root package.js
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pipeline-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: ./.github/actions/download-backend

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

- name: Build linux package (production)
if: inputs.environment == 'production'
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Build linux package (staging)
if: inputs.environment == 'staging'
run: |
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" ${{ env.envFile }}
yarn package:stage --target linux-x64 --out ${packagePath}
- uses: actions/upload-artifact@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pipeline-build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: ./.github/actions/install-all-build-libs

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

- name: Download backend x64
uses: ./.github/actions/download-backend
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Build macos x64 package (staging)
if: inputs.environment != 'production'
run: |
sed -i '' "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
sed -i '' "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" ${{ env.envFile }}
yarn package:stage --target darwin-x64 --out ${packagePath}-x64.vsix
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Build macos arm64 package (staging)
if: inputs.environment != 'production'
run: |
sed -i '' "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
sed -i '' "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" ${{ env.envFile }}
yarn package:stage --target darwin-arm64 --out ${packagePath}-arm64.vsix
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pipeline-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: ./.github/actions/download-backend

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

- name: Build windows package (production)
if: inputs.environment == 'production'
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Build windows package (staging)
if: inputs.environment == 'staging'
run: |
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" $envFile
sed -i "s/^RI_APP_FOLDER_NAME=.*/RI_APP_FOLDER_NAME='.redis-for-vscode-stage'/" ${{ env.envFile }}
yarn package:stage --target win32-x64 --out ${{ env.packagePath }}
- uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-e2e-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.15'
node-version: '20.18.0'

- name: Download linux artifact
uses: actions/download-artifact@v4
Expand Down
47 changes: 32 additions & 15 deletions .github/workflows/tests-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ on:
workflow_call:

env:
SLACK_AUDIT_REPORT_CHANNEL: ${{ secrets.SLACK_AUDIT_REPORT_CHANNEL }}
SLACK_AUDIT_REPORT_KEY: ${{ secrets.SLACK_AUDIT_REPORT_KEY }}
AWS_BUCKET_NAME_TEST: ${{ vars.AWS_BUCKET_NAME_TEST }}
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
AWS_DISTRIBUTION_ID: ${{ secrets.AWS_DISTRIBUTION_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
REPORT_NAME: "report-vscode-fe"
S3_PATH: "report-vscode-fe"

jobs:
unit-tests:
Expand All @@ -18,21 +26,30 @@ jobs:
- name: Unit tests UI
run: yarn test:cov

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
- name: Get current date
id: date
if: always()
with:
check_name: 'FE Unit tests summary'
comment_mode: 'failures'
files: reports/junit.xml
uses: RedisInsight/RedisInsight/.github/actions/get-current-date@873a0ebf55c85d3127bb4efb4d0636d9ab838226

- name: Generate test results
uses: dorny/test-reporter@v1

- name: Deploy 🚀
if: always()
run: |
GZIP_FILE=html.meta.json.gz
S3_SUB_PATH="test-reports/${{ steps.date.outputs.date }}/${{ github.run_id }}/${{ env.REPORT_NAME }}"
aws s3 cp report/ s3://${AWS_BUCKET_NAME_TEST}/public/${S3_SUB_PATH} --recursive --exclude "*.gz"
# s3 modified "gzip" content-type
# https://github.com/aws/aws-cli/issues/1131
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
echo "S3_SUB_PATH=${S3_SUB_PATH}" >> $GITHUB_ENV
- name: Add link to report in the workflow summary
if: always()
with:
name: 'Test results: FE unit tests'
path: reports/junit.xml
reporter: jest-junit
list-tests: 'failed'
list-suites: 'failed'
fail-on-error: 'false'
run: |
link="${{ vars.DEFAULT_TEST_REPORTS_URL }}/${S3_SUB_PATH}/index.html"
echo "[${link}](${link})" >> $GITHUB_STEP_SUMMARY
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ coverage
/.nyc_output
**/coverage
reports
report

# IDEs and editors
/.idea
Expand Down
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"source.fixAll.eslint": "explicit"
},
"eslint.validate": ["javascript", "typescript"],
"eslint.workingDirectories": [
{ "directory": "./", "changeProcessCWD": true }
],
"files.associations": {
"*.css": "postcss",
"*.scss": "postcss"
Expand All @@ -35,6 +38,7 @@
".eslintcache": true,
"bower_components": true,
"release": true,
"src/webviews/public": true,
"npm-debug.log.*": true,
"tests/**/__snapshots__": true,
"yarn.lock": true,
Expand All @@ -44,7 +48,13 @@
"**/pnpm-lock.yaml": true,
"**/test-extensions": true
},
"cSpell.words": ["githubocto", "tailwindcss", "webviews", "zustand"],
"cSpell.words": [
"githubocto",
"keyspace",
"tailwindcss",
"webviews",
"zustand"
],
"testing.automaticallyOpenPeekView": "never",
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
Expand Down
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ vite.config.mjs
# test
coverage
test
report
reports
tests
test-workspace
.vscode-test
Expand Down
5 changes: 1 addition & 4 deletions l10n/bundle.l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"Key Name": "Key Name",
" will be deleted.": " will be deleted.",
"Delete": "Delete",
"will be deleted from Redis for VS Code.": "will be deleted from Redis for VS Code.",
"will be removed from Redis for VS Code.": "will be removed from Redis for VS Code.",
"Key Size": "Key Size",
"Key Size: ": "Key Size: ",
"Length": "Length",
Expand Down Expand Up @@ -295,9 +295,6 @@
"Host:": "Host:",
"Database Index:": "Database Index:",
"Modules:": "Modules:",
"Select Logical Database": "Select Logical Database",
"Database Index": "Database Index",
"Enter Database Index": "Enter Database Index",
"No decompression": "No decompression",
"Enable automatic data decompression": "Enable automatic data decompression",
"Decompression format": "Decompression format",
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"download:backend": "tsc ./scripts/downloadBackend.ts && node ./scripts/downloadBackend.js",
"dev": "vite dev",
"dev:key": "cross-env RI_DATA_ROUTE=main/key vite dev",
"dev:database": "cross-env RI_DATA_ROUTE=main/add_database vite dev",
"dev:sidebar": "cross-env RI_DATA_ROUTE=sidebar vite dev",
"l10n:collect": "npx @vscode/l10n-dev export -o ./l10n ./src",
"watch": "tsc -watch -p ./",
Expand Down Expand Up @@ -194,9 +195,9 @@
"@vitejs/plugin-react": "^4.2.1",
"@vitejs/plugin-react-swc": "^3.6.0",
"@vitest/coverage-v8": "^1.3.1",
"@vitest/ui": "^1.3.1",
"@vitest/ui": "^1.6.0",
"@vscode/l10n-dev": "^0.0.35",
"@vscode/vsce": "^3.0.0",
"@vscode/vsce": "^3.2.1",
"cross-env": "^7.0.3",
"csv-parser": "^3.0.0",
"csv-stringify": "^6.5.1",
Expand Down Expand Up @@ -236,6 +237,7 @@
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.4.5",
"upath": "^2.0.1",
"uuid": "^9.0.1",
"vite": "^5.2.10",
"vite-plugin-react-click-to-component": "^3.0.0",
Expand Down Expand Up @@ -286,7 +288,7 @@
"react-inlinesvg": "^4.1.1",
"react-monaco-editor": "^0.55.0",
"react-router-dom": "^6.17.0",
"react-select": "^5.8.0",
"react-select": "^5.8.3",
"react-spinners": "^0.13.8",
"react-virtualized": "^9.22.5",
"react-virtualized-auto-sizer": "^1.0.20",
Expand Down
19 changes: 18 additions & 1 deletion scripts/downloadBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import * as fs from 'fs'
import * as path from 'path'
import * as cp from 'child_process'
import * as dotenv from 'dotenv'
import * as upath from 'upath'
import { parse as parseUrl } from 'url'


dotenv.config({
path: [
path.join(__dirname, '..', '.env'),
Expand Down Expand Up @@ -80,13 +82,28 @@ async function downloadRedisBackendArchive(
})
}

function getNormalizedString(string: string) {
return string?.startsWith('D:')
? upath.normalize(string).replace('D:', '/d')
: string
}

function unzipRedisServer(redisInsideArchivePath: string, extractDir: string) {
// tar does not create extractDir by default
if (!fs.existsSync(extractDir)) {
fs.mkdirSync(extractDir)
}

cp.spawnSync('tar', ['-xf', redisInsideArchivePath, '-C', extractDir, '--strip-components', '1', 'api'])
cp.spawnSync('tar', [
'-xf',
getNormalizedString(redisInsideArchivePath),
'-C',
getNormalizedString(extractDir),
'--strip-components',
'1',
'api',
])


// remove tutorials
fs.rmSync(tutorialsPath, { recursive: true, force: true });
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export async function activate(context: vscode.ExtensionContext) {

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

const keyDetailsWebview = WebviewPanel.instances[ViewId.Key]
if (keyDetailsWebview) {
Expand Down
33 changes: 32 additions & 1 deletion src/resources/agreements-spec.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "1.0.2",
"agreements": {
"analytics": {
"defaultValue": false,
Expand Down Expand Up @@ -35,6 +35,37 @@
"title": "Server Side Public License",
"label": "I have read and understood the Terms",
"requiredText": "Accept the Server Side Public License"
},
"encryption": {
"conditional": true,
"checker": "KEYTAR",
"defaultOption": "false",
"options": {
"true": {
"defaultValue": true,
"displayInSetting": false,
"required": false,
"editable": true,
"disabled": false,
"category": "privacy",
"since": "1.0.2",
"title": "Encryption",
"label": "Encrypt sensitive information",
"description": "Select to encrypt sensitive information using system keychain. Otherwise, this information is stored locally in plain text, which may incur security risk."
},
"false": {
"defaultValue": false,
"displayInSetting": false,
"required": false,
"editable": true,
"disabled": true,
"category": "privacy",
"since": "1.0.2",
"title": "Encryption",
"label": "Encrypt sensitive information",
"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."
}
}
}
}
}
4 changes: 3 additions & 1 deletion src/webviews/src/actions/processCliAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { useDatabasesStore } from 'uiSrc/store'

export const processCliAction = (message: CliAction) => {
const prevDatabaseId = useDatabasesStore.getState().connectedDatabase?.id
const prevDatabaseIndex = useDatabasesStore.getState().connectedDatabase?.db
const database = message?.data?.database
const dbIndex = database?.db ?? 0

if (prevDatabaseId === database?.id) {
if (prevDatabaseId! + prevDatabaseIndex === database?.id + dbIndex) {
return
}
window.ri.database = database
Expand Down
Loading

0 comments on commit 5fb96aa

Please sign in to comment.