Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
a439387
#RI-3527-add luascript recommendation
AmirAllayarovSofteq Nov 10, 2022
4cce0ee
#RI-3527-add luascript recommendation
AmirAllayarovSofteq Nov 10, 2022
74cbda3
#RI-3527-remove deprecated code
AmirAllayarovSofteq Nov 10, 2022
af41505
#RI-3527-remove deprecated code
AmirAllayarovSofteq Nov 10, 2022
5b1175e
Merge branch 'feature/RI-3238/prepare_for_docker' of https://github.c…
AmirAllayarovSofteq Nov 10, 2022
5d018b4
#RI-3527-fix recommendation be
AmirAllayarovSofteq Nov 10, 2022
d85f125
#RI-3527-add tests, implement demo improvements
AmirAllayarovSofteq Nov 11, 2022
97d8f79
#RI-3527-resolve comments
AmirAllayarovSofteq Nov 14, 2022
9328fa2
#RI-3527-remove unnsessusary code
AmirAllayarovSofteq Nov 14, 2022
76eaf7f
#RI-3527-add null condition to recommendation view
AmirAllayarovSofteq Nov 14, 2022
84d0445
#RI-3527-remove unnsessusary code
AmirAllayarovSofteq Nov 14, 2022
7116488
#RI-3527-remove commented code
AmirAllayarovSofteq Nov 14, 2022
34dafdf
#RI-3527-remove o;d provider
AmirAllayarovSofteq Nov 14, 2022
73def34
#RI-3527-resolve comments
AmirAllayarovSofteq Nov 14, 2022
d1a60b7
add tests for avoid dynamic lua script recommendation
vlad-dargel Nov 14, 2022
0807a40
#RI-3527-resolve comments
AmirAllayarovSofteq Nov 14, 2022
050743f
Merge branch 'feature/RI-3238/prepare_for_docker' of https://github.c…
AmirAllayarovSofteq Nov 14, 2022
3d9ec8d
Merge branch 'feature/RI-3527_lua_scripts' into e2e/feature/RI-3527_a…
vlad-dargel Nov 15, 2022
70101a2
#RI-3527-resolve comments
AmirAllayarovSofteq Nov 15, 2022
f8518aa
Merge branch 'feature/RI-3238/prepare_for_docker' of https://github.c…
AmirAllayarovSofteq Nov 15, 2022
b596d5f
#RI-3527-fix unit tests
AmirAllayarovSofteq Nov 15, 2022
49cebaa
#RI-3527-add more tests
AmirAllayarovSofteq Nov 16, 2022
f42c03f
#RI-3527-add more tests
AmirAllayarovSofteq Nov 16, 2022
2b7f284
#RI-3527-update recommendation merge
AmirAllayarovSofteq Nov 16, 2022
074998a
RI-3527-resolve comments
AmirAllayarovSofteq Nov 16, 2022
907086c
Merge pull request #1393 from RedisInsight/e2e/feature/RI-3527_avoid-…
vlad-dargel Nov 16, 2022
025d9d8
Merge branch 'feature/RI-3238/prepare_for_docker' into feature/RI-352…
vlad-dargel Nov 16, 2022
058878b
#RI-3527-fix recommendation styles
AmirAllayarovSofteq Nov 17, 2022
027308f
add tests for use smaller keys and big hash
vlad-dargel Nov 17, 2022
bff1701
upd
vlad-dargel Nov 17, 2022
14b9182
change host and port
vlad-dargel Nov 17, 2022
5941414
Merge pull request #1408 from RedisInsight/e2e/feature/RI-3565_use-sm…
vlad-dargel Nov 17, 2022
f6418eb
#RI-3571,3564,3560 - recommendations
AmirAllayarovSofteq Nov 29, 2022
e79d949
#RI-3571-3564-3560 - recommendations
AmirAllayarovSofteq Nov 29, 2022
55df458
Merge pull request #1458 from RedisInsight/fe/feature/RI-3571-3564-35…
AmirAllayarovSofteq Nov 29, 2022
f2978cd
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
AmirAllayarovSofteq Nov 29, 2022
48cb92c
Merge branch 'feature/RI-3527_lua_scripts' of https://github.com/Redi…
AmirAllayarovSofteq Nov 29, 2022
4a98faa
Merge branch 'feature/RI-3571-3564-3560_recommendations' of https://g…
AmirAllayarovSofteq Nov 29, 2022
7caa3d8
#RI-3571-resolve conflicts
AmirAllayarovSofteq Nov 29, 2022
d81f1f9
resolve comments
AmirAllayarovSofteq Nov 30, 2022
7113bb3
resolve comments
AmirAllayarovSofteq Nov 30, 2022
d6e6877
Merge pull request #1457 from RedisInsight/be/feature/RI-3571-3564-35…
AmirAllayarovSofteq Nov 30, 2022
92a6fff
add badges test
AmirAllayarovSofteq Nov 30, 2022
9d5815f
add initial tests
vlad-dargel Nov 30, 2022
becab1a
Merge branch 'feature/RI-3571-3564-3560_recommendations' into e2e/fea…
vlad-dargel Nov 30, 2022
52a66af
add recommendations tests
vlad-dargel Nov 30, 2022
23d4797
#RI-3562- update recommendation text
AmirAllayarovSofteq Nov 30, 2022
fc7cb77
last tests
vlad-dargel Nov 30, 2022
19008eb
update badge styles
AmirAllayarovSofteq Nov 30, 2022
fd674df
fix
vlad-dargel Dec 1, 2022
cd05808
Merge pull request #1466 from RedisInsight/e2e/feature/RI-3571-3564-3…
vlad-dargel Dec 1, 2022
7a54049
Merge pull request #1465 from RedisInsight/feature/RI-3571-3564-3560_…
nmammadli Dec 1, 2022
e17fa55
#RI-3569 - add comression for list recommendation
AmirAllayarovSofteq Dec 2, 2022
ce466e7
#RI-3569-fix big data tests
AmirAllayarovSofteq Dec 2, 2022
1a7de58
#RI-3573 - add big strings recommendation
AmirAllayarovSofteq Dec 5, 2022
e7bc9fd
#RI-3569 - fix IT test
AmirAllayarovSofteq Dec 5, 2022
6052cc6
#RI-3569 - fix big data test
AmirAllayarovSofteq Dec 5, 2022
796b418
#RI-3569 - update test
AmirAllayarovSofteq Dec 5, 2022
c479493
#RI-3569 - fix cloud IT
AmirAllayarovSofteq Dec 5, 2022
06eb860
#RI-3569 - fix cloud IT
AmirAllayarovSofteq Dec 5, 2022
38b47c4
#RI-3569 - remove unused code
AmirAllayarovSofteq Dec 5, 2022
79ed366
updates for recommendations
vlad-dargel Dec 6, 2022
987f2c4
Merge pull request #1480 from RedisInsight/e2e/feature/RI-3560_enable…
vlad-dargel Dec 7, 2022
68d67ee
Merge pull request #1474 from RedisInsight/feature/RI-3569_compressio…
vlad-dargel Dec 7, 2022
0c8adb4
#RI-3563-3568 - add bigSets and zsetHashtableToZiplist recommendations
AmirAllayarovSofteq Dec 8, 2022
8b3f4b4
#RI-3563-3568 - fix IT
AmirAllayarovSofteq Dec 8, 2022
78228ee
#RI-3563-3568 - add bigSets and ZsetHastableToZiplist recommendations
AmirAllayarovSofteq Dec 8, 2022
e34e07f
#RI-3563-3568 - fix integration test
AmirAllayarovSofteq Dec 8, 2022
254e72e
#RI-3563-3568 0 remove commented code
AmirAllayarovSofteq Dec 8, 2022
4e4ffb3
Merge pull request #1490 from RedisInsight/be/feature/RI-3563-3568_re…
AmirAllayarovSofteq Dec 8, 2022
37ecace
Merge pull request #1491 from RedisInsight/fe/feature/RI-3563-3568_re…
AmirAllayarovSofteq Dec 8, 2022
d1bf159
#RI-3563 - change recommendation title
AmirAllayarovSofteq Dec 8, 2022
33835f6
Merge pull request #1493 from RedisInsight/feature/RI-3563-3568_recom…
vlad-dargel Dec 8, 2022
3948df8
#RI-3883 - add telemtry in recommendations
AmirAllayarovSofteq Dec 11, 2022
e46737f
#RI-3883 - resolve comments
AmirAllayarovSofteq Dec 12, 2022
e63cf91
#RI-3570 - add big connected clients recommendation
AmirAllayarovSofteq Dec 13, 2022
6d8884b
Merge pull request #1496 from RedisInsight/feature/RI-3883_recommenda…
vlad-dargel Dec 13, 2022
9d4446a
Merge branch 'feature/RI-3527_lua_scripts' of https://github.com/Redi…
AmirAllayarovSofteq Dec 14, 2022
389ef2e
#RI-3570 - resolve comments
AmirAllayarovSofteq Dec 14, 2022
f7c9831
#RI-3574 - add set password recommendation
AmirAllayarovSofteq Dec 14, 2022
e90956b
#RI-3574 - change public to private
AmirAllayarovSofteq Dec 14, 2022
1b4154e
#RI-3574 - fix IT
AmirAllayarovSofteq Dec 15, 2022
ee095e9
#RI-3574 - fix IT
AmirAllayarovSofteq Dec 15, 2022
bcae1c1
Merge pull request #1498 from RedisInsight/feature/RI-3570_big_connec…
nmammadli Dec 15, 2022
14dfd61
Merge pull request #1503 from RedisInsight/feature/RI-3574_set_passwo…
vlad-dargel Dec 16, 2022
5cb805a
#RI-3899 - change badges icon location
AmirAllayarovSofteq Dec 20, 2022
09205a5
#RI-3899 - resolve comments
AmirAllayarovSofteq Dec 20, 2022
b654af7
#RI-3942 - add rts recommendation
AmirAllayarovSofteq Dec 23, 2022
7aef853
#RI-3942 - add rts recommendation
AmirAllayarovSofteq Dec 23, 2022
979a0ea
#RI-3942 - update link
AmirAllayarovSofteq Dec 28, 2022
4473851
#RI-3942 - fix IT
AmirAllayarovSofteq Dec 28, 2022
5307ba8
#RI-3942 - resolve comments
AmirAllayarovSofteq Dec 29, 2022
36545b7
#RI-3969 - fix styles
AmirAllayarovSofteq Dec 29, 2022
40caef0
Merge pull request #1541 from RedisInsight/bugfix/RI-3969_icons_sticky
AmirAllayarovSofteq Dec 29, 2022
5197bc2
Merge pull request #1530 from RedisInsight/fe/feature-RI-3942_rts_rec…
AmirAllayarovSofteq Dec 29, 2022
e2c9e88
Merge branch 'feature/RI-3942_rts_recommendation' of https://github.c…
AmirAllayarovSofteq Dec 29, 2022
153f99f
#RI-3899 - fix styles
AmirAllayarovSofteq Dec 29, 2022
19f965c
Merge branch 'feature/RI-3899_badges_location' of https://github.com/…
AmirAllayarovSofteq Dec 29, 2022
f6ecd3d
Merge pull request #1521 from RedisInsight/feature/RI-3899_badges_loc…
vlad-dargel Dec 29, 2022
54296e5
Merge branch 'feature/RI-3942_rts_recommendation' of https://github.c…
AmirAllayarovSofteq Dec 29, 2022
70408ee
#RI-3942 - workaround determine only on first shard
AmirAllayarovSofteq Dec 30, 2022
40025e8
Merge pull request #1529 from RedisInsight/be/feature/RI-3942_rts_rec…
AmirAllayarovSofteq Dec 30, 2022
599a10e
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
AmirAllayarovSofteq Jan 3, 2023
d60678d
Merge branch 'feature/RI-3942_rts_recommendation' of https://github.c…
AmirAllayarovSofteq Jan 4, 2023
29d15cd
Merge branch 'feature/RI-3527_lua_scripts' of https://github.com/Redi…
AmirAllayarovSofteq Jan 4, 2023
9777561
#RI-3941 - add redisstack link
AmirAllayarovSofteq Jan 4, 2023
a02461a
#RI-3941 - resolve comments
AmirAllayarovSofteq Jan 5, 2023
9e0f074
#RI-3941 - resolve comments
AmirAllayarovSofteq Jan 5, 2023
b984ce1
Merge pull request #1562 from RedisInsight/feature/RI-3941_redisstack…
AmirAllayarovSofteq Jan 5, 2023
6144ba0
Merge pull request #1563 from RedisInsight/feature/RI-3942_rts_recomm…
AmirAllayarovSofteq Jan 5, 2023
6f68e58
#RI-3955-3972 - add redis version recommendation
AmirAllayarovSofteq Jan 9, 2023
bcfcf1a
#RI-3955-3972 - add redis search recommendation
AmirAllayarovSofteq Jan 9, 2023
c87c862
#RI-3972 - add IT test
AmirAllayarovSofteq Jan 9, 2023
35b0bbf
#RI-3972 - add IT reJson test
AmirAllayarovSofteq Jan 9, 2023
aeffc00
#RI-3972 - fix test
AmirAllayarovSofteq Jan 9, 2023
6b1ba84
#RI-3972 - fix test
AmirAllayarovSofteq Jan 9, 2023
38ef44d
#RI-3972 - fix pass IT
AmirAllayarovSofteq Jan 9, 2023
d341e96
#RI-3972 - update search modules
AmirAllayarovSofteq Jan 9, 2023
e094714
#RI-3972 - resolve comments
AmirAllayarovSofteq Jan 9, 2023
21a3742
Merge pull request #1574 from RedisInsight/feature/RI-3955-3972_recom…
AmirAllayarovSofteq Jan 9, 2023
9fdf092
#RI-3527 - fix recommendation indexes
AmirAllayarovSofteq Jan 9, 2023
9018324
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
AmirAllayarovSofteq Jan 10, 2023
d9eb141
#RI-3973 - update rts recommendation
AmirAllayarovSofteq Jan 10, 2023
b89f8a0
Merge pull request #1578 from RedisInsight/feature/RI-3973_rts_recomm…
AmirAllayarovSofteq Jan 10, 2023
110acd7
#RI-3971 - add search indexes recommnedation
AmirAllayarovSofteq Jan 11, 2023
cdd74a9
#RI-3927 - add recommendations tab highlighting
rsergeenko Jan 11, 2023
9588cc1
#RI-3572-dangerous commands recommendation
AmirAllayarovSofteq Jan 12, 2023
84ba9b9
#RI-3971 - add one node recommendations
AmirAllayarovSofteq Jan 12, 2023
f732f16
#RI-3572 - add check renamed command function
AmirAllayarovSofteq Jan 12, 2023
7434698
#RI-3971 - update json file
AmirAllayarovSofteq Jan 12, 2023
5bf7366
#RI-3971 - remove unused code
AmirAllayarovSofteq Jan 12, 2023
653fd01
#RI-3572 - resolve comments
AmirAllayarovSofteq Jan 12, 2023
dde3360
#RI-4014 - fix re-rendering, fix highlighting if no count, fix click …
rsergeenko Jan 12, 2023
ecaa5e1
Merge pull request #1593 from RedisInsight/fe/bugfix/RI-4014
rsergeenko Jan 12, 2023
e43a114
Merge pull request #1584 from RedisInsight/fe/feature/RI_3927_highlig…
vlad-dargel Jan 12, 2023
3ab1be1
#RI-4023 - update no recommendations message
AmirAllayarovSofteq Jan 16, 2023
d808d7c
#RI-4023 - update styles
AmirAllayarovSofteq Jan 17, 2023
03aada0
#RI-4023 - resolve comments
AmirAllayarovSofteq Jan 17, 2023
4365412
Merge pull request #1600 from RedisInsight/feature/RI-4023_no-recomme…
AmirAllayarovSofteq Jan 17, 2023
af9e00d
#RI-4027 - fix redis version
AmirAllayarovSofteq Jan 18, 2023
623030d
#RI-3977 - add recommendation voting
AmirAllayarovSofteq Jan 19, 2023
edbc363
#RI-3977 - add recommendation voting
AmirAllayarovSofteq Jan 19, 2023
09788d1
Merge pull request #1613 from RedisInsight/fe/feature/RI-3977_recomme…
AmirAllayarovSofteq Jan 19, 2023
07d183f
#RI-3977 - fix IT
AmirAllayarovSofteq Jan 19, 2023
9cd2006
Merge pull request #1614 from RedisInsight/be/feature/RI-3977_recomme…
AmirAllayarovSofteq Jan 19, 2023
b5ccb09
#3977 - demo comments resolve
AmirAllayarovSofteq Jan 20, 2023
109bcc3
Add upvote recommendations test and page object for recommendations
nmammadli Jan 23, 2023
0aabc97
Update recommendations-page.ts
nmammadli Jan 23, 2023
d9c1d91
Update recommendations-page.ts
nmammadli Jan 23, 2023
af09d55
Update database-recommendations.e2e.ts
nmammadli Jan 23, 2023
e4b40fe
Refactor
nmammadli Jan 24, 2023
84570dc
Merge pull request #1590 from RedisInsight/feature/RI-3971-3572_add_r…
nmammadli Jan 24, 2023
ccf980c
Update memory-efficiency-actions.ts
nmammadli Jan 24, 2023
0999ce7
Merge pull request #1621 from RedisInsight/e2e/feature/RI-3977_recomm…
nmammadli Jan 24, 2023
d0f4913
Merge pull request #1615 from RedisInsight/feature/RI-3977_recommenda…
nmammadli Jan 24, 2023
939cde8
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
AmirAllayarovSofteq Jan 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class databaseAnalysisRecommendations1668420950002 implements MigrationInterface {
name = 'databaseAnalysisRecommendations1668420950002'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "IDX_d174a8edc2201d6c5781f0126a"`);
await queryRunner.query(`DROP INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb"`);
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')), "expirationGroups" blob, "recommendations" blob, CONSTRAINT "FK_d174a8edc2201d6c5781f0126ae" FOREIGN KEY ("databaseId") REFERENCES "database_instance" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
await queryRunner.query(`INSERT INTO "temporary_database_analysis"("id", "databaseId", "filter", "delimiter", "progress", "totalKeys", "totalMemory", "topKeysNsp", "topMemoryNsp", "topKeysLength", "topKeysMemory", "encryption", "createdAt", "expirationGroups") SELECT "id", "databaseId", "filter", "delimiter", "progress", "totalKeys", "totalMemory", "topKeysNsp", "topMemoryNsp", "topKeysLength", "topKeysMemory", "encryption", "createdAt", "expirationGroups" FROM "database_analysis"`);
await queryRunner.query(`DROP TABLE "database_analysis"`);
await queryRunner.query(`ALTER TABLE "temporary_database_analysis" RENAME TO "database_analysis"`);
await queryRunner.query(`CREATE INDEX "IDX_d174a8edc2201d6c5781f0126a" ON "database_analysis" ("databaseId") `);
await queryRunner.query(`CREATE INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb" ON "database_analysis" ("createdAt") `);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb"`);
await queryRunner.query(`DROP INDEX "IDX_d174a8edc2201d6c5781f0126a"`);
await queryRunner.query(`ALTER TABLE "database_analysis" RENAME TO "temporary_database_analysis"`);
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')), "expirationGroups" blob, CONSTRAINT "FK_d174a8edc2201d6c5781f0126ae" FOREIGN KEY ("databaseId") REFERENCES "database_instance" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
await queryRunner.query(`INSERT INTO "database_analysis"("id", "databaseId", "filter", "delimiter", "progress", "totalKeys", "totalMemory", "topKeysNsp", "topMemoryNsp", "topKeysLength", "topKeysMemory", "encryption", "createdAt", "expirationGroups") SELECT "id", "databaseId", "filter", "delimiter", "progress", "totalKeys", "totalMemory", "topKeysNsp", "topMemoryNsp", "topKeysLength", "topKeysMemory", "encryption", "createdAt", "expirationGroups" FROM "temporary_database_analysis"`);
await queryRunner.query(`DROP TABLE "temporary_database_analysis"`);
await queryRunner.query(`CREATE INDEX "IDX_fdd0daeb4d8f226cf1ff79bebb" ON "database_analysis" ("createdAt") `);
await queryRunner.query(`CREATE INDEX "IDX_d174a8edc2201d6c5781f0126a" ON "database_analysis" ("databaseId") `);
}

}
2 changes: 2 additions & 0 deletions redisinsight/api/migration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { databaseAnalysis1664785208236 } from './1664785208236-database-analysis
import { databaseAnalysisExpirationGroups1664886479051 } from './1664886479051-database-analysis-expiration-groups';
import { workbenchExecutionTime1667368983699 } from './1667368983699-workbench-execution-time';
import { database1667477693934 } from './1667477693934-database';
import { databaseAnalysisRecommendations1668420950002 } from './1668420950002-database-analysis-recommendations';
import { databaseNew1670252337342 } from './1670252337342-database-new';
import { sshOptions1673035852335 } from './1673035852335-ssh-options';
import { workbenchAndAnalysisDbIndex1673934231410 } from './1673934231410-workbench_and_analysis_db';
Expand Down Expand Up @@ -49,6 +50,7 @@ export default [
databaseAnalysisExpirationGroups1664886479051,
workbenchExecutionTime1667368983699,
database1667477693934,
databaseAnalysisRecommendations1668420950002,
databaseNew1670252337342,
sshOptions1673035852335,
workbenchAndAnalysisDbIndex1673934231410,
Expand Down
3 changes: 2 additions & 1 deletion redisinsight/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"body-parser": "^1.19.0",
"class-transformer": "^0.2.3",
"class-validator": "^0.12.2",
"date-fns": "^2.29.3",
"detect-port": "^1.5.1",
"dotenv": "^16.0.0",
"express": "^4.17.1",
Expand All @@ -63,6 +64,7 @@
"lodash": "^4.17.20",
"nest-router": "^1.0.9",
"nest-winston": "^1.4.0",
"node-version-compare": "^1.0.3",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.5.6",
"socket.io": "^4.4.0",
Expand Down Expand Up @@ -105,7 +107,6 @@
"mocha": "^8.4.0",
"mocha-junit-reporter": "^2.0.0",
"mocha-multi-reporters": "^1.5.1",
"node-version-compare": "^1.0.3",
"nyc": "^15.1.0",
"object-diff": "^0.0.4",
"rimraf": "^3.0.2",
Expand Down
6 changes: 6 additions & 0 deletions redisinsight/api/src/__mocks__/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ export const mockRedisNoAuthError: ReplyError = {
message: 'NOAUTH authentication is required',
};

export const mockRedisNoPasswordError: ReplyError = {
name: 'ReplyError',
command: 'AUTH',
message: 'ERR Client sent AUTH, but no password is set',
};

export const mockRedisNoPermError: ReplyError = {
name: 'ReplyError',
command: 'GET',
Expand Down
1 change: 1 addition & 0 deletions redisinsight/api/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from './redis-commands';
export * from './telemetry-events';
export * from './app-events';
export * from './redis-connection';
export * from './recommendations';
29 changes: 29 additions & 0 deletions redisinsight/api/src/constants/recommendations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const RECOMMENDATION_NAMES = Object.freeze({
LUA_SCRIPT: 'luaScript',
BIG_HASHES: 'bigHashes',
BIG_STRINGS: 'bigStrings',
BIG_SETS: 'bigSets',
BIG_AMOUNT_OF_CONNECTED_CLIENTS: 'bigAmountOfConnectedClients',
USE_SMALLER_KEYS: 'useSmallerKeys',
AVOID_LOGICAL_DATABASES: 'avoidLogicalDatabases',
COMBINE_SMALL_STRINGS_TO_HASHES: 'combineSmallStringsToHashes',
INCREASE_SET_MAX_INTSET_ENTRIES: 'increaseSetMaxIntsetEntries',
HASH_HASHTABLE_TO_ZIPLIST: 'hashHashtableToZiplist',
COMPRESS_HASH_FIELD_NAMES: 'compressHashFieldNames',
COMPRESSION_FOR_LIST: 'compressionForList',
ZSET_HASHTABLE_TO_ZIPLIST: 'zSetHashtableToZiplist',
SET_PASSWORD: 'setPassword',
RTS: 'RTS',
REDIS_VERSION: 'redisVersion',
REDIS_SEARCH: 'redisSearch',
SEARCH_INDEXES: 'searchIndexes',
DANGEROUS_COMMANDS: 'dangerousCommands',
});

export const ONE_NODE_RECOMMENDATIONS = [
RECOMMENDATION_NAMES.LUA_SCRIPT,
RECOMMENDATION_NAMES.DANGEROUS_COMMANDS,
RECOMMENDATION_NAMES.AVOID_LOGICAL_DATABASES,
RECOMMENDATION_NAMES.RTS,
RECOMMENDATION_NAMES.REDIS_VERSION,
];
2 changes: 2 additions & 0 deletions redisinsight/api/src/constants/regex.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const ARG_IN_QUOTATION_MARKS_REGEX = /"[^"]*|'[^']*'|"+/g;
export const IS_INTEGER_NUMBER_REGEX = /^\d+$/;
export const IS_NUMBER_REGEX = /^-?\d*(\.\d+)?$/;
export const IS_NON_PRINTABLE_ASCII_CHARACTER = /[^ -~\u0007\b\t\n\r]/;
export const IP_ADDRESS_REGEX = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
export const PRIVATE_IP_ADDRESS_REGEX = /(^127\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)/;
export const IS_TIMESTAMP = /^(\d{10}|\d{13}|\d{16}|\d{19})$/;
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
Body,
Controller, Get, Param, Post, UseInterceptors, UsePipes, ValidationPipe,
Controller, Get, Param, Post, Patch, UseInterceptors, UsePipes, ValidationPipe,
} from '@nestjs/common';
import { ApiEndpoint } from 'src/decorators/api-endpoint.decorator';
import { ApiTags } from '@nestjs/swagger';
import { DatabaseAnalysisService } from 'src/modules/database-analysis/database-analysis.service';
import { DatabaseAnalysis, ShortDatabaseAnalysis } from 'src/modules/database-analysis/models';
import { BrowserSerializeInterceptor } from 'src/common/interceptors';
import { ApiQueryRedisStringEncoding, ClientMetadataParam } from 'src/common/decorators';
import { CreateDatabaseAnalysisDto } from 'src/modules/database-analysis/dto';
import { CreateDatabaseAnalysisDto, RecommendationVoteDto } from 'src/modules/database-analysis/dto';
import { ClientMetadata } from 'src/common/models';

@UseInterceptors(BrowserSerializeInterceptor)
Expand Down Expand Up @@ -72,4 +72,30 @@ export class DatabaseAnalysisController {
): Promise<ShortDatabaseAnalysis[]> {
return this.service.list(databaseId);
}

@Patch(':id')
@ApiEndpoint({
description: 'Update database instance by id',
statusCode: 200,
responses: [
{
status: 200,
description: 'Updated database instance\' response',
type: DatabaseAnalysis,
},
],
})
@UsePipes(
new ValidationPipe({
transform: true,
whitelist: true,
forbidNonWhitelisted: true,
}),
)
async modify(
@Param('id') id: string,
@Body() dto: RecommendationVoteDto,
): Promise<DatabaseAnalysis> {
return await this.service.vote(id, dto);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { DatabaseAnalyzer } from 'src/modules/database-analysis/providers/databa
import { DatabaseAnalysisProvider } from 'src/modules/database-analysis/providers/database-analysis.provider';
import { KeysScanner } from 'src/modules/database-analysis/scanner/keys-scanner';
import { KeyInfoProvider } from 'src/modules/database-analysis/scanner/key-info/key-info.provider';
import { RecommendationModule } from 'src/modules/recommendation/recommendation.module';

@Module({
imports: [RecommendationModule],
controllers: [DatabaseAnalysisController],
providers: [
DatabaseAnalysisService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { HttpException, Injectable, Logger } from '@nestjs/common';
import { isNull, flatten, concat } from 'lodash';
import { RecommendationService } from 'src/modules/recommendation/recommendation.service';
import { catchAclError } from 'src/utils';
import { ONE_NODE_RECOMMENDATIONS } from 'src/constants';
import { DatabaseAnalyzer } from 'src/modules/database-analysis/providers/database-analyzer';
import { plainToClass } from 'class-transformer';
import { DatabaseAnalysis, ShortDatabaseAnalysis } from 'src/modules/database-analysis/models';
import { DatabaseAnalysisProvider } from 'src/modules/database-analysis/providers/database-analysis.provider';
import { CreateDatabaseAnalysisDto } from 'src/modules/database-analysis/dto';
import { CreateDatabaseAnalysisDto, RecommendationVoteDto } from 'src/modules/database-analysis/dto';
import { KeysScanner } from 'src/modules/database-analysis/scanner/keys-scanner';
import { DatabaseConnectionService } from 'src/modules/database/database-connection.service';
import { ClientMetadata } from 'src/common/models';
Expand All @@ -15,6 +18,7 @@ export class DatabaseAnalysisService {

constructor(
private readonly databaseConnectionService: DatabaseConnectionService,
private readonly recommendationService: RecommendationService,
private readonly analyzer: DatabaseAnalyzer,
private readonly databaseAnalysisProvider: DatabaseAnalysisProvider,
private readonly scanner: KeysScanner,
Expand Down Expand Up @@ -50,11 +54,34 @@ export class DatabaseAnalysisService {
progress.total += nodeResult.progress.total;
});

let recommendationToExclude = [];

const recommendations = await scanResults.reduce(async (previousPromise, nodeResult, idx) => {
const jobsArray = await previousPromise;
const nodeRecommendations = await this.recommendationService.getRecommendations({
client: nodeResult.client,
keys: nodeResult.keys,
total: progress.total,
globalClient: client,
exclude: recommendationToExclude,
});
if (idx === 0) {
recommendationToExclude = concat(recommendationToExclude, ONE_NODE_RECOMMENDATIONS);
}
const foundedRecommendations = nodeRecommendations.filter((recommendation) => !isNull(recommendation));
const foundedRecommendationNames = foundedRecommendations.map(({ name }) => name);
recommendationToExclude = concat(recommendationToExclude, foundedRecommendationNames);
recommendationToExclude.push(...foundedRecommendationNames);
jobsArray.push(foundedRecommendations);
return flatten(jobsArray);
}, Promise.resolve([]));

const analysis = plainToClass(DatabaseAnalysis, await this.analyzer.analyze({
databaseId: clientMetadata.databaseId,
db: client?.options?.db || 0,
...dto,
progress,
recommendations,
}, [].concat(...scanResults.map((nodeResult) => nodeResult.keys))));

client.disconnect();
Expand Down Expand Up @@ -86,4 +113,13 @@ export class DatabaseAnalysisService {
async list(databaseId: string): Promise<ShortDatabaseAnalysis[]> {
return this.databaseAnalysisProvider.list(databaseId);
}

/**
* Set user vote for recommendation
* @param id
* @param recommendation
*/
async vote(id: string, recommendation: RecommendationVoteDto): Promise<DatabaseAnalysis> {
return this.databaseAnalysisProvider.recommendationVote(id, recommendation);
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './create-database-analysis.dto';
export * from './recommendation-vote.dto';
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsString } from 'class-validator';

export class RecommendationVoteDto {
@ApiProperty({
description: 'Recommendation name',
type: String,
})
@IsString()
name: string;

@ApiProperty({
description: 'User vote',
type: String,
})
@IsString()
vote: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ export class DatabaseAnalysisEntity {
@Column({ nullable: true })
encryption: string;

@Column({ nullable: true, type: 'blob' })
@DataAsJsonString()
@Expose()
recommendations: string;

@Column({ nullable: true })
@Expose()
@IsInt()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { ScanFilter } from 'src/modules/database-analysis/models/scan-filter';
import { AnalysisProgress } from 'src/modules/database-analysis/models/analysis-progress';
import { SumGroup } from 'src/modules/database-analysis/models/sum-group';
import { Recommendation } from 'src/modules/database-analysis/models/recommendation';

export class DatabaseAnalysis {
@ApiProperty({
Expand Down Expand Up @@ -116,6 +117,14 @@ export class DatabaseAnalysis {
@Type(() => SumGroup)
expirationGroups: SumGroup[];

@ApiProperty({
description: 'Recommendations',
isArray: true,
type: () => Recommendation,
})
@Expose()
@Type(() => Recommendation)
recommendations: Recommendation[];
@ApiPropertyOptional({
description: 'Logical database number.',
type: Number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './simple-summary';
export * from './database-analysis';
export * from './short-database-analysis';
export * from './sum-group';
export * from './recommendation';
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Expose } from 'class-transformer';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class Recommendation {
@ApiProperty({
description: 'Recommendation name',
type: String,
example: 'luaScript',
})
@Expose()
name: string;

@ApiPropertyOptional({
description: 'Additional recommendation params',
example: 'luaScript',
})
@Expose()
params?: any;

@ApiPropertyOptional({
description: 'User vote',
example: 'useful',
})
@Expose()
vote?: string;
}
Loading