Skip to content

Commit bcfa7ae

Browse files
author
ALENA NABOKA
committed
Merge branch 'main' into e2e/feature/RI-2904-enablement-area
# Conflicts: # tests/e2e/pageObjects/workbench-page.ts
2 parents ee44a4d + 7c107dc commit bcfa7ae

File tree

198 files changed

+5082
-543
lines changed

Some content is hidden

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

198 files changed

+5082
-543
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ vendor
5858

5959
# Parcel
6060
.parcel-cache
61+
62+
# caches
63+
.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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
'rehype-stringify': '<rootDir>/redisinsight/__mocks__/rehypeStringify.js',
1717
'unist-util-visit': '<rootDir>/redisinsight/__mocks__/unistUtilsVisit.js',
1818
'react-children-utilities': '<rootDir>/redisinsight/__mocks__/react-children-utilities.js',
19+
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
1920
},
2021
setupFiles: [
2122
'<rootDir>/redisinsight/ui/src/setup-env.ts',
@@ -38,6 +39,11 @@ module.exports = {
3839
transformIgnorePatterns: [
3940
'node_modules/(?!(monaco-editor|react-monaco-editor)/)',
4041
],
42+
// TODO: add tests for plugins
43+
modulePathIgnorePatterns: [
44+
'<rootDir>/redisinsight/ui/src/packages',
45+
'<rootDir>/redisinsight/ui/src/mocks',
46+
],
4147
coverageThreshold: {
4248
global: {
4349
statements: 70,

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
"@testing-library/user-event": "^14.4.3",
111111
"@types/axios": "^0.14.0",
112112
"@types/classnames": "^2.2.11",
113+
"@types/d3": "^7.4.0",
113114
"@types/date-fns": "^2.6.0",
114115
"@types/detect-port": "^1.3.0",
115116
"@types/electron-store": "^3.2.0",
@@ -121,6 +122,7 @@
121122
"@types/jsonpath": "^0.2.0",
122123
"@types/lodash": "^4.14.171",
123124
"@types/node": "14.14.10",
125+
"@types/react": "^18.0.20",
124126
"@types/react-dom": "^18.0.5",
125127
"@types/react-monaco-editor": "^0.16.0",
126128
"@types/react-redux": "^7.1.12",
@@ -216,6 +218,7 @@
216218
"buffer": "^6.0.3",
217219
"classnames": "^2.3.1",
218220
"connection-string": "^4.3.2",
221+
"d3": "^7.6.1",
219222
"date-fns": "^2.16.1",
220223
"detect-port": "^1.3.0",
221224
"electron-context-menu": "^3.1.0",
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+
}

redisinsight/api/migration/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { sni1650278664000 } from "./1650278664000-sni";
1616
import { notification1655821010349 } from './1655821010349-notification';
1717
import { notificationCategory1659687030433 } from './1659687030433-notification-category';
1818
import { workbenchMode1660664717573 } from './1660664717573-workbench-mode';
19+
import { workbenchGroupMode1663093411715 } from './1663093411715-workbench-group-mode';
1920

2021
export default [
2122
initialMigration1614164490968,
@@ -36,4 +37,5 @@ export default [
3637
notification1655821010349,
3738
notificationCategory1659687030433,
3839
workbenchMode1660664717573,
40+
workbenchGroupMode1663093411715,
3941
];

redisinsight/api/src/modules/workbench/dto/create-command-execution.dto.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ export enum RunQueryMode {
1616
ASCII = 'ASCII',
1717
}
1818

19+
export enum ResultsMode {
20+
Default = 'DEFAULT',
21+
GroupMode = 'GROUP_MODE',
22+
}
23+
1924
export class CreateCommandExecutionDto {
2025
@ApiProperty({
2126
type: String,
@@ -38,6 +43,19 @@ export class CreateCommandExecutionDto {
3843
})
3944
mode?: RunQueryMode = RunQueryMode.ASCII;
4045

46+
@ApiPropertyOptional({
47+
description: 'Workbench group mode',
48+
default: ResultsMode.Default,
49+
enum: ResultsMode,
50+
})
51+
@IsOptional()
52+
@IsEnum(ResultsMode, {
53+
message: `resultsMode must be a valid enum value. Valid values: ${Object.values(
54+
ResultsMode,
55+
)}.`,
56+
})
57+
resultsMode?: ResultsMode;
58+
4159
@ApiPropertyOptional({
4260
description: 'Execute command for nodes with defined role',
4361
default: ClusterNodeRole.All,

redisinsight/api/src/modules/workbench/dto/create-command-executions.dto.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from 'class-validator';
55
import { Type } from 'class-transformer';
66
import { ClusterSingleNodeOptions } from 'src/modules/cli/dto/cli.dto';
7-
import { ClusterNodeRole, RunQueryMode } from './create-command-execution.dto';
7+
import { ClusterNodeRole, RunQueryMode, ResultsMode } from './create-command-execution.dto';
88

99
export class CreateCommandExecutionsDto {
1010
@ApiProperty({
@@ -29,6 +29,14 @@ export class CreateCommandExecutionsDto {
2929
})
3030
mode?: RunQueryMode = RunQueryMode.ASCII;
3131

32+
@IsOptional()
33+
@IsEnum(ResultsMode, {
34+
message: `resultsMode must be a valid enum value. Valid values: ${Object.values(
35+
ResultsMode,
36+
)}.`,
37+
})
38+
resultsMode?: ResultsMode;
39+
3240
@ApiPropertyOptional({
3341
description: 'Execute command for nodes with defined role',
3442
default: ClusterNodeRole.All,

redisinsight/api/src/modules/workbench/entities/command-execution.entity.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, JoinColumn, Index,
33
} from 'typeorm';
44
import { DatabaseInstanceEntity } from 'src/modules/core/models/database-instance.entity';
5-
import { RunQueryMode } from 'src/modules/workbench/dto/create-command-execution.dto';
5+
import { RunQueryMode, ResultsMode } from 'src/modules/workbench/dto/create-command-execution.dto';
66
import { Transform } from 'class-transformer';
77

88
@Entity('command_execution')
@@ -43,6 +43,20 @@ export class CommandExecutionEntity {
4343
@Column({ nullable: true })
4444
role?: string;
4545

46+
@Column({ nullable: true })
47+
resultsMode?: string = ResultsMode.Default;
48+
49+
@Column({ nullable: true })
50+
@Transform((object) => JSON.stringify(object), { toClassOnly: true })
51+
@Transform((string) => {
52+
try {
53+
return JSON.parse(string);
54+
} catch (e) {
55+
return undefined;
56+
}
57+
}, { toPlainOnly: true })
58+
summary?: string;
59+
4660
@Column({ nullable: true })
4761
@Transform((object) => JSON.stringify(object), { toClassOnly: true })
4862
@Transform((string) => {

redisinsight/api/src/modules/workbench/models/command-execution.ts

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2+
import { IsDefined } from 'class-validator';
23
import { CommandExecutionResult } from 'src/modules/workbench/models/command-execution-result';
3-
import { ClusterNodeRole, RunQueryMode } from 'src/modules/workbench/dto/create-command-execution.dto';
4+
import { ClusterNodeRole, RunQueryMode, ResultsMode } from 'src/modules/workbench/dto/create-command-execution.dto';
45
import { ClusterSingleNodeOptions } from 'src/modules/cli/dto/cli.dto';
56
import { Expose } from 'class-transformer';
67

8+
export class ResultsSummary {
9+
@ApiProperty({
10+
description: 'Total number of commands executed',
11+
type: Number,
12+
})
13+
@IsDefined()
14+
total: number;
15+
16+
@ApiProperty({
17+
description: 'Total number of successful commands executed',
18+
type: Number,
19+
})
20+
@IsDefined()
21+
success: number;
22+
23+
@ApiProperty({
24+
description: 'Total number of failed commands executed',
25+
type: Number,
26+
})
27+
@IsDefined()
28+
fail: number;
29+
}
30+
731
export class CommandExecution {
832
@ApiProperty({
933
description: 'Command execution id',
@@ -34,6 +58,21 @@ export class CommandExecution {
3458
@Expose()
3559
mode?: RunQueryMode = RunQueryMode.ASCII;
3660

61+
@ApiPropertyOptional({
62+
description: 'Workbench result mode',
63+
default: ResultsMode.Default,
64+
enum: ResultsMode,
65+
})
66+
@Expose()
67+
resultsMode?: ResultsMode = ResultsMode.Default;
68+
69+
@ApiPropertyOptional({
70+
description: 'Workbench executions summary',
71+
type: () => ResultsSummary,
72+
})
73+
@Expose()
74+
summary?: ResultsSummary;
75+
3776
@ApiProperty({
3877
description: 'Command execution result',
3978
type: () => CommandExecutionResult,
@@ -42,6 +81,13 @@ export class CommandExecution {
4281
@Expose()
4382
result: CommandExecutionResult[];
4483

84+
@ApiPropertyOptional({
85+
description: 'Result did not stored in db',
86+
type: Boolean,
87+
})
88+
@Expose()
89+
isNotStored?: boolean;
90+
4591
@ApiPropertyOptional({
4692
description: 'Nodes roles where command was executed',
4793
default: ClusterNodeRole.All,

0 commit comments

Comments
 (0)