Skip to content

Commit 5a16d71

Browse files
authored
Merge pull request #1867 from RedisInsight/feature/RI-4075_livetime_recommendations
#RI-4075 - Livetime recommendations
2 parents c66bf77 + 43f579b commit 5a16d71

File tree

352 files changed

+14406
-1777
lines changed

Some content is hidden

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

352 files changed

+14406
-1777
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Add reviewers for the most sensitive folders
22
33
4+
/redisinsight/api/config/features-config.json [email protected] [email protected] [email protected]

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ vendor
5959

6060
# E2E tests report
6161
/tests/e2e/report
62+
/tests/e2e/results
63+
/tests/e2e/remote
6264
/tests/e2e/.redisinsight-v2
6365

6466
# Parcel

redisinsight/api/config/default.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,18 @@ export default {
195195
},
196196
],
197197
connections: {
198-
timeout: parseInt(process.env.CONNECTIONS_TIMEOUT_DEFAULT, 10) || 30 * 1_000 // 30 sec
198+
timeout: parseInt(process.env.CONNECTIONS_TIMEOUT_DEFAULT, 10) || 30 * 1_000, // 30 sec
199199
},
200200
redisStack: {
201201
id: process.env.BUILD_TYPE === 'REDIS_STACK' ? process.env.REDIS_STACK_DATABASE_ID || 'redis-stack' : undefined,
202202
name: process.env.REDIS_STACK_DATABASE_NAME,
203203
host: process.env.REDIS_STACK_DATABASE_HOST,
204204
port: process.env.REDIS_STACK_DATABASE_PORT,
205205
},
206+
features_config: {
207+
url: process.env.RI_FEATURES_CONFIG_URL
208+
// eslint-disable-next-line max-len
209+
|| 'https://raw.githubusercontent.com/RedisInsight/RedisInsight/main/redisinsight/api/config/features-config.json',
210+
syncInterval: parseInt(process.env.RI_FEATURES_CONFIG_SYNC_INTERVAL, 10) || 1_000 * 60 * 60 * 4, // 4h
211+
},
206212
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": 1,
3+
"features": {
4+
"insightsRecommendations": {
5+
"flag": true,
6+
"perc": [],
7+
"filters": [
8+
{
9+
"name": "agreements.analytics",
10+
"value": true,
11+
"cond": "eq"
12+
},
13+
{
14+
"name": "config.server.buildType",
15+
"value": "ELECTRON",
16+
"cond": "eq"
17+
}
18+
]
19+
}
20+
}
21+
}

redisinsight/api/config/ormconfig.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { CommandExecutionEntity } from 'src/modules/workbench/entities/command-e
44
import { PluginStateEntity } from 'src/modules/workbench/entities/plugin-state.entity';
55
import { NotificationEntity } from 'src/modules/notification/entities/notification.entity';
66
import { DatabaseAnalysisEntity } from 'src/modules/database-analysis/entities/database-analysis.entity';
7+
import { DatabaseRecommendationEntity }
8+
from 'src/modules/database-recommendation/entities/database-recommendation.entity';
79
import { DataSource } from 'typeorm';
810
import { AgreementsEntity } from 'src/modules/settings/entities/agreements.entity';
911
import { SettingsEntity } from 'src/modules/settings/entities/settings.entity';
@@ -13,6 +15,8 @@ import { DatabaseEntity } from 'src/modules/database/entities/database.entity';
1315
import { SshOptionsEntity } from 'src/modules/ssh/entities/ssh-options.entity';
1416
import { BrowserHistoryEntity } from 'src/modules/browser/entities/browser-history.entity';
1517
import { CustomTutorialEntity } from 'src/modules/custom-tutorial/entities/custom-tutorial.entity';
18+
import { FeatureEntity } from 'src/modules/feature/entities/feature.entity';
19+
import { FeaturesConfigEntity } from 'src/modules/feature/entities/features-config.entity';
1620
import migrations from '../migration';
1721
import * as config from '../src/utils/config';
1822

@@ -34,9 +38,12 @@ const ormConfig = {
3438
PluginStateEntity,
3539
NotificationEntity,
3640
DatabaseAnalysisEntity,
41+
DatabaseRecommendationEntity,
3742
BrowserHistoryEntity,
3843
SshOptionsEntity,
3944
CustomTutorialEntity,
45+
FeatureEntity,
46+
FeaturesConfigEntity,
4047
],
4148
migrations,
4249
};

redisinsight/api/config/test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
export default {
22
server: {
33
env: 'test',
4-
requestTimeout: 1000,
4+
requestTimeout: parseInt(process.env.REQUEST_TIMEOUT, 10) || 1000,
5+
},
6+
db: {
7+
synchronize: process.env.DB_SYNC ? process.env.DB_SYNC === 'true' : true,
8+
migrationsRun: process.env.DB_MIGRATIONS ? process.env.DB_MIGRATIONS === 'true' : false,
59
},
610
profiler: {
711
logFileIdleThreshold: parseInt(process.env.PROFILER_LOG_FILE_IDLE_THRESHOLD, 10) || 1000 * 2, // 3sec
812
},
913
notifications: {
10-
updateUrl: 'https://s3.amazonaws.com/redisinsight.test/public/tests/notifications.json',
14+
updateUrl: process.env.NOTIFICATION_UPDATE_URL
15+
|| 'https://s3.amazonaws.com/redisinsight.test/public/tests/notifications.json',
16+
},
17+
features_config: {
18+
url: process.env.RI_FEATURES_CONFIG_URL
19+
|| 'http://localhost:5551/remote/features-config.json',
1120
},
1221
};
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 databaseRecommendations1681900503586 implements MigrationInterface {
4+
name = 'databaseRecommendations1681900503586'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`CREATE TABLE "database_recommendations" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "name" varchar NOT NULL, "read" boolean NOT NULL DEFAULT (0), "disabled" boolean NOT NULL DEFAULT (0), "vote" varchar, "hide" boolean NOT NULL DEFAULT (0), "createdAt" datetime NOT NULL DEFAULT (datetime('now')))`);
8+
await queryRunner.query(`CREATE INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5" ON "database_recommendations" ("databaseId") `);
9+
await queryRunner.query(`CREATE INDEX "IDX_d6107e5e16648b038c511f3b00" ON "database_recommendations" ("createdAt") `);
10+
await queryRunner.query(`DROP INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5"`);
11+
await queryRunner.query(`DROP INDEX "IDX_d6107e5e16648b038c511f3b00"`);
12+
await queryRunner.query(`CREATE TABLE "temporary_database_recommendations" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "name" varchar NOT NULL, "read" boolean NOT NULL DEFAULT (0), "disabled" boolean NOT NULL DEFAULT (0), "vote" varchar, "hide" boolean NOT NULL DEFAULT (0), "createdAt" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_2487bdd9dbde3fdf65bcb96fc52" FOREIGN KEY ("databaseId") REFERENCES "database_instance" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
13+
await queryRunner.query(`INSERT INTO "temporary_database_recommendations"("id", "databaseId", "name", "read", "disabled", "vote", "hide", "createdAt") SELECT "id", "databaseId", "name", "read", "disabled", "vote", "hide", "createdAt" FROM "database_recommendations"`);
14+
await queryRunner.query(`DROP TABLE "database_recommendations"`);
15+
await queryRunner.query(`ALTER TABLE "temporary_database_recommendations" RENAME TO "database_recommendations"`);
16+
await queryRunner.query(`CREATE INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5" ON "database_recommendations" ("databaseId") `);
17+
await queryRunner.query(`CREATE INDEX "IDX_d6107e5e16648b038c511f3b00" ON "database_recommendations" ("createdAt") `);
18+
}
19+
20+
public async down(queryRunner: QueryRunner): Promise<void> {
21+
await queryRunner.query(`DROP INDEX "IDX_d6107e5e16648b038c511f3b00"`);
22+
await queryRunner.query(`DROP INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5"`);
23+
await queryRunner.query(`ALTER TABLE "database_recommendations" RENAME TO "temporary_database_recommendations"`);
24+
await queryRunner.query(`CREATE TABLE "database_recommendations" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "name" varchar NOT NULL, "read" boolean NOT NULL DEFAULT (0), "disabled" boolean NOT NULL DEFAULT (0), "vote" varchar, "hide" boolean NOT NULL DEFAULT (0), "createdAt" datetime NOT NULL DEFAULT (datetime('now')))`);
25+
await queryRunner.query(`INSERT INTO "database_recommendations"("id", "databaseId", "name", "read", "disabled", "vote", "hide", "createdAt") SELECT "id", "databaseId", "name", "read", "disabled", "vote", "hide", "createdAt" FROM "temporary_database_recommendations"`);
26+
await queryRunner.query(`DROP TABLE "temporary_database_recommendations"`);
27+
await queryRunner.query(`CREATE INDEX "IDX_d6107e5e16648b038c511f3b00" ON "database_recommendations" ("createdAt") `);
28+
await queryRunner.query(`CREATE INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5" ON "database_recommendations" ("databaseId") `);
29+
await queryRunner.query(`DROP INDEX "IDX_d6107e5e16648b038c511f3b00"`);
30+
await queryRunner.query(`DROP INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5"`);
31+
await queryRunner.query(`DROP TABLE "database_recommendations"`);
32+
}
33+
34+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class databaseRecommendationParams1683006064293 implements MigrationInterface {
4+
name = 'databaseRecommendationParams1683006064293'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`DROP INDEX "IDX_d6107e5e16648b038c511f3b00"`);
8+
await queryRunner.query(`DROP INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5"`);
9+
await queryRunner.query(`CREATE TABLE "temporary_database_recommendations" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "name" varchar NOT NULL, "read" boolean NOT NULL DEFAULT (0), "disabled" boolean NOT NULL DEFAULT (0), "vote" varchar, "hide" boolean NOT NULL DEFAULT (0), "createdAt" datetime NOT NULL DEFAULT (datetime('now')), "params" blob, "encryption" varchar, CONSTRAINT "FK_2487bdd9dbde3fdf65bcb96fc52" FOREIGN KEY ("databaseId") REFERENCES "database_instance" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
10+
await queryRunner.query(`INSERT INTO "temporary_database_recommendations"("id", "databaseId", "name", "read", "disabled", "vote", "hide", "createdAt") SELECT "id", "databaseId", "name", "read", "disabled", "vote", "hide", "createdAt" FROM "database_recommendations"`);
11+
await queryRunner.query(`DROP TABLE "database_recommendations"`);
12+
await queryRunner.query(`ALTER TABLE "temporary_database_recommendations" RENAME TO "database_recommendations"`);
13+
await queryRunner.query(`CREATE INDEX "IDX_d6107e5e16648b038c511f3b00" ON "database_recommendations" ("createdAt") `);
14+
await queryRunner.query(`CREATE INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5" ON "database_recommendations" ("databaseId") `);
15+
}
16+
17+
public async down(queryRunner: QueryRunner): Promise<void> {
18+
await queryRunner.query(`DROP INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5"`);
19+
await queryRunner.query(`DROP INDEX "IDX_d6107e5e16648b038c511f3b00"`);
20+
await queryRunner.query(`ALTER TABLE "database_recommendations" RENAME TO "temporary_database_recommendations"`);
21+
await queryRunner.query(`CREATE TABLE "database_recommendations" ("id" varchar PRIMARY KEY NOT NULL, "databaseId" varchar NOT NULL, "name" varchar NOT NULL, "read" boolean NOT NULL DEFAULT (0), "disabled" boolean NOT NULL DEFAULT (0), "vote" varchar, "hide" boolean NOT NULL DEFAULT (0), "createdAt" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_2487bdd9dbde3fdf65bcb96fc52" FOREIGN KEY ("databaseId") REFERENCES "database_instance" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
22+
await queryRunner.query(`INSERT INTO "database_recommendations"("id", "databaseId", "name", "read", "disabled", "vote", "hide", "createdAt") SELECT "id", "databaseId", "name", "read", "disabled", "vote", "hide", "createdAt" FROM "temporary_database_recommendations"`);
23+
await queryRunner.query(`DROP TABLE "temporary_database_recommendations"`);
24+
await queryRunner.query(`CREATE INDEX "IDX_2487bdd9dbde3fdf65bcb96fc5" ON "database_recommendations" ("databaseId") `);
25+
await queryRunner.query(`CREATE INDEX "IDX_d6107e5e16648b038c511f3b00" ON "database_recommendations" ("createdAt") `);
26+
}
27+
28+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class Feature1684931530343 implements MigrationInterface {
4+
name = 'Feature1684931530343'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`CREATE TABLE "features" ("name" varchar PRIMARY KEY NOT NULL, "flag" boolean NOT NULL)`);
8+
await queryRunner.query(`CREATE TABLE "features_config" ("id" varchar PRIMARY KEY NOT NULL, "controlNumber" float, "data" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (datetime('now')))`);
9+
}
10+
11+
public async down(queryRunner: QueryRunner): Promise<void> {
12+
await queryRunner.query(`DROP TABLE "features_config"`);
13+
await queryRunner.query(`DROP TABLE "features"`);
14+
}
15+
16+
}

redisinsight/api/migration/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import { databaseAnalysisRecommendations1674660306971 } from './1674660306971-da
2929
import { databaseTimeout1675398140189 } from './1675398140189-database-timeout';
3030
import { databaseCompressor1678182722874 } from './1678182722874-database-compressor';
3131
import { customTutorials1677135091633 } from './1677135091633-custom-tutorials';
32+
import { databaseRecommendations1681900503586 } from './1681900503586-database-recommendations';
33+
import { databaseRecommendationParams1683006064293 } from './1683006064293-database-recommendation-params';
34+
import { Feature1684931530343 } from './1684931530343-feature';
3235

3336
export default [
3437
initialMigration1614164490968,
@@ -62,4 +65,7 @@ export default [
6265
databaseTimeout1675398140189,
6366
databaseCompressor1678182722874,
6467
customTutorials1677135091633,
68+
databaseRecommendations1681900503586,
69+
databaseRecommendationParams1683006064293,
70+
Feature1684931530343,
6571
];

0 commit comments

Comments
 (0)