Skip to content

Commit 2cf1c0e

Browse files
committed
Merge branch 'main' into e2e/bugfix/error-on-ft-search
2 parents de68918 + d7add5e commit 2cf1c0e

File tree

598 files changed

+20284
-5578
lines changed

Some content is hidden

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

598 files changed

+20284
-5578
lines changed

.circleci/config.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ jobs:
311311
- run:
312312
name: .AppImage tests
313313
command: |
314-
cd tests/e2e && export TEST_FILES=$(circleci tests glob "tests/**/*.e2e.ts" | circleci tests split) && cd ../..
314+
cd tests/e2e && export TEST_FILES=$(circleci tests glob "tests/**/*.e2e.ts" | circleci tests split --split-by=timings) && cd ../..
315315
.circleci/e2e/test.app-image.sh
316316
- when:
317317
condition:
@@ -348,7 +348,7 @@ jobs:
348348
- run: choco install nodejs --version=16.15.1
349349
- run:
350350
command: |
351-
cd tests/e2e && export TEST_FILES=$(circleci tests glob "tests/**/*.e2e.ts" | circleci tests split) && cd ../..
351+
cd tests/e2e && export TEST_FILES=$(circleci tests glob "tests/**/*.e2e.ts" | circleci tests split --split-by=timings) && cd ../..
352352
.circleci/e2e/test.exe.cmd
353353
shell: bash.exe
354354
- when:
@@ -400,7 +400,7 @@ jobs:
400400
- run:
401401
name: Run tests
402402
command: |
403-
cd tests/e2e && export TEST_FILES=$(circleci tests glob "tests/**/*.e2e.ts" | circleci tests split) && cd ../..
403+
cd tests/e2e && export TEST_FILES=$(circleci tests glob "tests/**/*.e2e.ts" | circleci tests split --split-by=timings) && cd ../..
404404
TEST_BIG_DB_DUMP=$TEST_BIG_DB_DUMP \
405405
docker-compose \
406406
-f tests/e2e/rte.docker-compose.yml \
@@ -414,7 +414,7 @@ jobs:
414414
- run:
415415
name: Run tests
416416
command: |
417-
cd tests/e2e && export TEST_FILES=$(circleci tests glob "tests/**/*.e2e.ts" | circleci tests split) && cd ../..
417+
cd tests/e2e && export TEST_FILES=$(circleci tests glob "tests/**/*.e2e.ts" | circleci tests split --split-by=timings) && cd ../..
418418
TEST_BIG_DB_DUMP=$TEST_BIG_DB_DUMP \
419419
docker-compose \
420420
-f tests/e2e/rte.docker-compose.yml \
@@ -1219,12 +1219,12 @@ workflows:
12191219
requires:
12201220
- Build docker image
12211221
# e2e desktop tests on AppImage build
1222-
- e2e-app-image:
1223-
name: E2ETest (AppImage) - Nightly
1224-
parallelism: 4
1225-
report: true
1226-
requires:
1227-
- Build app - Linux (stage)
1222+
# - e2e-app-image:
1223+
# name: E2ETest (AppImage) - Nightly
1224+
# parallelism: 4
1225+
# report: true
1226+
# requires:
1227+
# - Build app - Linux (stage)
12281228
# # e2e desktop tests on exe build
12291229
# - e2e-exe:
12301230
# name: E2ETest (exe) - Nightly

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ lerna-debug.log*
1616
# Tests
1717
/coverage
1818
/.nyc_output
19+
**/coverage
1920

2021
# IDEs and editors
2122
/.idea
@@ -58,3 +59,6 @@ vendor
5859

5960
# Parcel
6061
.parcel-cache
62+
63+
# caches
64+
.temp_cache

configs/webpack.config.web.dev.babel.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* https://webpack.js.org/concepts/hot-module-replacement/
66
*/
77

8+
import path from 'path';
89
import webpack from 'webpack';
910
import { merge } from 'webpack-merge';
1011
import ip from 'ip';
@@ -21,6 +22,18 @@ export default merge(commonConfig, {
2122

2223
mode: 'development',
2324

25+
cache: {
26+
type: 'filesystem',
27+
allowCollectingMemory: true,
28+
cacheDirectory: path.resolve(__dirname, '../.temp_cache'),
29+
name: 'webpack',
30+
maxAge: 86_400_000, // 1 day
31+
buildDependencies: {
32+
// This makes all dependencies of this file - build dependencies
33+
config: [__filename],
34+
}
35+
},
36+
2437
devtool: 'source-map',
2538

2639
entry: [

jest.config.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ const { TextDecoder, TextEncoder } = require('util');
33
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
44
module.exports = {
55
testURL: 'http://localhost/',
6+
runner: 'groups',
67
moduleNameMapper: {
7-
'\\.(jpg|jpeg|png|ico|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
8+
'\\.(jpg|jpeg|png|ico|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
89
'<rootDir>/redisinsight/__mocks__/fileMock.js',
10+
'\\.svg': '<rootDir>/redisinsight/__mocks__/svg.js',
911
'\\.(css|less|sass|scss)$': 'identity-obj-proxy',
1012
'uiSrc/(.*)': '<rootDir>/redisinsight/ui/src/$1',
1113
'monaco-editor': '<rootDir>/redisinsight/__mocks__/monacoMock.js',
@@ -16,6 +18,7 @@ module.exports = {
1618
'rehype-stringify': '<rootDir>/redisinsight/__mocks__/rehypeStringify.js',
1719
'unist-util-visit': '<rootDir>/redisinsight/__mocks__/unistUtilsVisit.js',
1820
'react-children-utilities': '<rootDir>/redisinsight/__mocks__/react-children-utilities.js',
21+
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
1922
},
2023
setupFiles: [
2124
'<rootDir>/redisinsight/ui/src/setup-env.ts',
@@ -38,6 +41,17 @@ module.exports = {
3841
transformIgnorePatterns: [
3942
'node_modules/(?!(monaco-editor|react-monaco-editor)/)',
4043
],
44+
// TODO: add tests for plugins
45+
modulePathIgnorePatterns: [
46+
'<rootDir>/redisinsight/ui/src/packages',
47+
'<rootDir>/redisinsight/ui/src/mocks',
48+
],
49+
coverageDirectory: './coverage',
50+
coveragePathIgnorePatterns: [
51+
'/node_modules/',
52+
'<rootDir>/redisinsight/api',
53+
'<rootDir>/redisinsight/ui/src/packages',
54+
],
4155
coverageThreshold: {
4256
global: {
4357
statements: 70,

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"test": "jest ./redisinsight/ui -w 1",
4040
"test:watch": "jest ./redisinsight/ui --watch -w 1",
4141
"test:cov": "jest ./redisinsight/ui --coverage -w 1",
42+
"test:cov:unit": "jest ./redisinsight/ui --group=-component --coverage -w 1",
43+
"test:cov:component": "jest ./redisinsight/ui --group=component --coverage -w 1",
4244
"type-check:ui": "tsc --project redisinsight/ui --noEmit"
4345
},
4446
"lint-staged": {
@@ -110,6 +112,7 @@
110112
"@testing-library/user-event": "^14.4.3",
111113
"@types/axios": "^0.14.0",
112114
"@types/classnames": "^2.2.11",
115+
"@types/d3": "^7.4.0",
113116
"@types/date-fns": "^2.6.0",
114117
"@types/detect-port": "^1.3.0",
115118
"@types/electron-store": "^3.2.0",
@@ -121,6 +124,7 @@
121124
"@types/jsonpath": "^0.2.0",
122125
"@types/lodash": "^4.14.171",
123126
"@types/node": "14.14.10",
127+
"@types/react": "^18.0.20",
124128
"@types/react-dom": "^18.0.5",
125129
"@types/react-monaco-editor": "^0.16.0",
126130
"@types/react-redux": "^7.1.12",
@@ -171,6 +175,7 @@
171175
"ioredis-mock": "^5.5.4",
172176
"ip": "^1.1.8",
173177
"jest": "^27.5.1",
178+
"jest-runner-groups": "^2.2.0",
174179
"jest-when": "^3.2.1",
175180
"lint-staged": "^10.2.11",
176181
"mini-css-extract-plugin": "^1.3.1",
@@ -216,6 +221,7 @@
216221
"buffer": "^6.0.3",
217222
"classnames": "^2.3.1",
218223
"connection-string": "^4.3.2",
224+
"d3": "^7.6.1",
219225
"date-fns": "^2.16.1",
220226
"detect-port": "^1.3.0",
221227
"electron-context-menu": "^3.1.0",

redisinsight/__mocks__/svg.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export default 'SvgrURL'
2+
export const ReactComponent = 'div'

redisinsight/api/config/default.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ export default {
140140
unsupportedCommands: JSON.parse(process.env.WORKBENCH_UNSUPPORTED_COMMANDS || '[]'),
141141
countBatch: parseInt(process.env.WORKBENCH_BATCH_SIZE, 10) || 5,
142142
},
143+
database_analysis: {
144+
maxItemsPerDb: parseInt(process.env.DATABASE_ANALYSIS_MAX_ITEMS_PER_DB, 10) || 5,
145+
},
143146
commands: [
144147
{
145148
name: 'main',

redisinsight/api/config/ormconfig.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ import { SettingsEntity } from 'src/modules/core/models/settings.entity';
88
import { CommandExecutionEntity } from 'src/modules/workbench/entities/command-execution.entity';
99
import { PluginStateEntity } from 'src/modules/workbench/entities/plugin-state.entity';
1010
import { NotificationEntity } from 'src/modules/notification/entities/notification.entity';
11+
import { DatabaseAnalysisEntity } from 'src/modules/database-analysis/entities/database-analysis.entity';
12+
import { DataSource } from 'typeorm';
1113
import migrations from '../migration';
1214
import * as config from '../src/utils/config';
1315

1416
const dbConfig = config.get('db');
15-
const ormConfig: TypeOrmModuleOptions = {
17+
18+
const ormConfig = {
1619
type: 'sqlite',
1720
database: dbConfig.database,
1821
synchronize: dbConfig.synchronize,
@@ -27,8 +30,10 @@ const ormConfig: TypeOrmModuleOptions = {
2730
CommandExecutionEntity,
2831
PluginStateEntity,
2932
NotificationEntity,
33+
DatabaseAnalysisEntity,
3034
],
3135
migrations,
3236
};
3337

34-
export default ormConfig;
38+
export const ormModuleOptions: TypeOrmModuleOptions = ormConfig as TypeOrmModuleOptions;
39+
export default new DataSource({ ...ormConfig, type: 'sqlite' });
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class workbenchGroupMode1663093411715 implements MigrationInterface {
4+
name = 'workbenchGroupMode1663093411715'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`DROP INDEX "IDX_5cd90dd6def1fd7c521e53fb2c"`);
8+
await queryRunner.query(`CREATE TABLE "temporary_command_execution" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "command" text NOT NULL, "result" text NOT NULL, "role" varchar, "nodeOptions" varchar, "encryption" varchar, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "mode" varchar, "resultsMode" varchar, "summary" varchar, CONSTRAINT "FK_ea8adfe9aceceb79212142206b8" FOREIGN KEY ("databaseId") REFERENCES "database_instance" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
9+
await queryRunner.query(`INSERT INTO "temporary_command_execution"("id", "databaseId", "command", "result", "role", "nodeOptions", "encryption", "createdAt", "mode") SELECT "id", "databaseId", "command", "result", "role", "nodeOptions", "encryption", "createdAt", "mode" FROM "command_execution"`);
10+
await queryRunner.query(`DROP TABLE "command_execution"`);
11+
await queryRunner.query(`ALTER TABLE "temporary_command_execution" RENAME TO "command_execution"`);
12+
await queryRunner.query(`CREATE INDEX "IDX_5cd90dd6def1fd7c521e53fb2c" ON "command_execution" ("createdAt") `);
13+
}
14+
15+
public async down(queryRunner: QueryRunner): Promise<void> {
16+
await queryRunner.query(`DROP INDEX "IDX_5cd90dd6def1fd7c521e53fb2c"`);
17+
await queryRunner.query(`ALTER TABLE "command_execution" RENAME TO "temporary_command_execution"`);
18+
await queryRunner.query(`CREATE TABLE "command_execution" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "command" text NOT NULL, "result" text NOT NULL, "role" varchar, "nodeOptions" varchar, "encryption" varchar, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "mode" varchar, CONSTRAINT "FK_ea8adfe9aceceb79212142206b8" FOREIGN KEY ("databaseId") REFERENCES "database_instance" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
19+
await queryRunner.query(`INSERT INTO "command_execution"("id", "databaseId", "command", "result", "role", "nodeOptions", "encryption", "createdAt", "mode") SELECT "id", "databaseId", "command", "result", "role", "nodeOptions", "encryption", "createdAt", "mode" FROM "temporary_command_execution"`);
20+
await queryRunner.query(`DROP TABLE "temporary_command_execution"`);
21+
await queryRunner.query(`CREATE INDEX "IDX_5cd90dd6def1fd7c521e53fb2c" ON "command_execution" ("createdAt") `);
22+
}
23+
24+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class databaseAnalysis1664785208236 implements MigrationInterface {
4+
name = 'databaseAnalysis1664785208236'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`CREATE TABLE "database_analysis" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "filter" blob, "delimiter" varchar NOT NULL, "progress" blob, "totalKeys" blob, "totalMemory" blob, "topKeysNsp" blob, "topMemoryNsp" blob, "topKeysLength" blob, "topKeysMemory" blob, "encryption" varchar, "createdAt" datetime NOT NULL DEFAULT (datetime('now')))`);
8+
await queryRunner.query(`CREATE INDEX "IDX_d174a8edc2201d6c5781f0126a" ON "database_analysis" ("databaseId") `);
9+
await queryRunner.query(`CREATE INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb" ON "database_analysis" ("createdAt") `);
10+
await queryRunner.query(`DROP INDEX "IDX_d174a8edc2201d6c5781f0126a"`);
11+
await queryRunner.query(`DROP INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb"`);
12+
await queryRunner.query(`CREATE TABLE "temporary_database_analysis" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "filter" blob, "delimiter" varchar NOT NULL, "progress" blob, "totalKeys" blob, "totalMemory" blob, "topKeysNsp" blob, "topMemoryNsp" blob, "topKeysLength" blob, "topKeysMemory" blob, "encryption" varchar, "createdAt" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_d174a8edc2201d6c5781f0126ae" FOREIGN KEY ("databaseId") REFERENCES "database_instance" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
13+
await queryRunner.query(`INSERT INTO "temporary_database_analysis"("id", "databaseId", "filter", "delimiter", "progress", "totalKeys", "totalMemory", "topKeysNsp", "topMemoryNsp", "topKeysLength", "topKeysMemory", "encryption", "createdAt") SELECT "id", "databaseId", "filter", "delimiter", "progress", "totalKeys", "totalMemory", "topKeysNsp", "topMemoryNsp", "topKeysLength", "topKeysMemory", "encryption", "createdAt" FROM "database_analysis"`);
14+
await queryRunner.query(`DROP TABLE "database_analysis"`);
15+
await queryRunner.query(`ALTER TABLE "temporary_database_analysis" RENAME TO "database_analysis"`);
16+
await queryRunner.query(`CREATE INDEX "IDX_d174a8edc2201d6c5781f0126a" ON "database_analysis" ("databaseId") `);
17+
await queryRunner.query(`CREATE INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb" ON "database_analysis" ("createdAt") `);
18+
}
19+
20+
public async down(queryRunner: QueryRunner): Promise<void> {
21+
await queryRunner.query(`DROP INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb"`);
22+
await queryRunner.query(`DROP INDEX "IDX_d174a8edc2201d6c5781f0126a"`);
23+
await queryRunner.query(`ALTER TABLE "database_analysis" RENAME TO "temporary_database_analysis"`);
24+
await queryRunner.query(`CREATE TABLE "database_analysis" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "filter" blob, "delimiter" varchar NOT NULL, "progress" blob, "totalKeys" blob, "totalMemory" blob, "topKeysNsp" blob, "topMemoryNsp" blob, "topKeysLength" blob, "topKeysMemory" blob, "encryption" varchar, "createdAt" datetime NOT NULL DEFAULT (datetime('now')))`);
25+
await queryRunner.query(`INSERT INTO "database_analysis"("id", "databaseId", "filter", "delimiter", "progress", "totalKeys", "totalMemory", "topKeysNsp", "topMemoryNsp", "topKeysLength", "topKeysMemory", "encryption", "createdAt") SELECT "id", "databaseId", "filter", "delimiter", "progress", "totalKeys", "totalMemory", "topKeysNsp", "topMemoryNsp", "topKeysLength", "topKeysMemory", "encryption", "createdAt" FROM "temporary_database_analysis"`);
26+
await queryRunner.query(`DROP TABLE "temporary_database_analysis"`);
27+
await queryRunner.query(`CREATE INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb" ON "database_analysis" ("createdAt") `);
28+
await queryRunner.query(`CREATE INDEX "IDX_d174a8edc2201d6c5781f0126a" ON "database_analysis" ("databaseId") `);
29+
await queryRunner.query(`DROP INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb"`);
30+
await queryRunner.query(`DROP INDEX "IDX_d174a8edc2201d6c5781f0126a"`);
31+
await queryRunner.query(`DROP TABLE "database_analysis"`);
32+
}
33+
34+
}

0 commit comments

Comments
 (0)