Skip to content

Commit b9d02ef

Browse files
authored
Merge pull request #2122 from RedisInsight/feature/RI-4399-beta_features
Feature/ri 4399 beta features
2 parents 5e9b165 + e149059 commit b9d02ef

File tree

134 files changed

+4252
-116
lines changed

Some content is hidden

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

134 files changed

+4252
-116
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { DatabaseEntity } from 'src/modules/database/entities/database.entity';
1515
import { SshOptionsEntity } from 'src/modules/ssh/entities/ssh-options.entity';
1616
import { BrowserHistoryEntity } from 'src/modules/browser/entities/browser-history.entity';
1717
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';
1820
import migrations from '../migration';
1921
import * as config from '../src/utils/config';
2022

@@ -40,6 +42,8 @@ const ormConfig = {
4042
BrowserHistoryEntity,
4143
SshOptionsEntity,
4244
CustomTutorialEntity,
45+
FeatureEntity,
46+
FeaturesConfigEntity,
4347
],
4448
migrations,
4549
};

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: 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { databaseCompressor1678182722874 } from './1678182722874-database-compre
3131
import { customTutorials1677135091633 } from './1677135091633-custom-tutorials';
3232
import { databaseRecommendations1681900503586 } from './1681900503586-database-recommendations';
3333
import { databaseRecommendationParams1683006064293 } from './1683006064293-database-recommendation-params';
34+
import { Feature1684931530343 } from './1684931530343-feature';
3435

3536
export default [
3637
initialMigration1614164490968,
@@ -66,4 +67,5 @@ export default [
6667
customTutorials1677135091633,
6768
databaseRecommendations1681900503586,
6869
databaseRecommendationParams1683006064293,
70+
Feature1684931530343,
6971
];

redisinsight/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand -w 1",
3232
"test:e2e": "jest --config ./test/jest-e2e.json -w 1",
3333
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js -d ./config/ormconfig.ts",
34-
"test:api": "ts-mocha --paths -p test/api/api.tsconfig.json --config ./test/api/.mocharc.yml",
34+
"test:api": "cross-env NODE_ENV=test ts-mocha --paths -p test/api/api.tsconfig.json --config ./test/api/.mocharc.yml",
3535
"test:api:cov": "nyc --reporter=html --reporter=text --reporter=text-summary yarn run test:api",
3636
"test:api:ci:cov": "nyc -r text -r text-summary -r html yarn run test:api --reporter mocha-multi-reporters --reporter-options configFile=test/api/reporters.json && nyc merge .nyc_output ./coverage/test-run-coverage.json",
3737
"typeorm:migrate": "cross-env NODE_ENV=staging yarn typeorm migration:generate ./migration/migration",

redisinsight/api/src/__mocks__/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const mockRepository = jest.fn(() => ({
6161
save: jest.fn(),
6262
insert: jest.fn(),
6363
update: jest.fn(),
64+
upsert: jest.fn(),
6465
delete: jest.fn(),
6566
remove: jest.fn(),
6667
createQueryBuilder: mockCreateQueryBuilder,

0 commit comments

Comments
 (0)