Skip to content

Commit 9a636c2

Browse files
Merge pull request #2188 from RedisInsight/feature/RI-4502_triggered_functions
Feature/ri 4502 triggered functions
2 parents 2a930db + 20e531c commit 9a636c2

File tree

204 files changed

+10748
-402
lines changed

Some content is hidden

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

204 files changed

+10748
-402
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ orbs:
173173
executors:
174174
linux-executor:
175175
machine:
176-
image: ubuntu-2004:202010-01
176+
image: ubuntu-2004:2023.04.2
177177
linux-executor-dlc:
178178
machine:
179-
image: ubuntu-2004:202010-01
179+
image: ubuntu-2004:2023.04.2
180180
docker_layer_caching: true
181181

182182
jobs:

configs/webpack.config.renderer.dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ const configuration: webpack.Configuration = {
232232

233233
new ReactRefreshWebpackPlugin(),
234234

235-
new MonacoWebpackPlugin({ languages: ['json'], features: ['!rename'] }),
235+
new MonacoWebpackPlugin({ languages: ['json', 'javascript', 'typescript'], features: ['!rename'] }),
236236

237237
...htmlPagesNames.map((htmlPageName) => (
238238
new HtmlWebpackPlugin({

configs/webpack.config.renderer.prod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const configuration: webpack.Configuration = {
180180
},
181181

182182
plugins: [
183-
new MonacoWebpackPlugin({ languages: ['json'], features: ['!rename'] }),
183+
new MonacoWebpackPlugin({ languages: ['json', 'javascript', 'typescript'], features: ['!rename'] }),
184184

185185
new webpack.EnvironmentPlugin({
186186
NODE_ENV: 'production',

configs/webpack.config.web.common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default {
7070

7171
new HtmlWebpackPlugin({ template: 'index.html.ejs' }),
7272

73-
new MonacoWebpackPlugin({ languages: ['json'], features: ['!rename'] }),
73+
new MonacoWebpackPlugin({ languages: ['json', 'javascript', 'typescript'], features: ['!rename'] }),
7474

7575
new webpack.IgnorePlugin({
7676
checkResource(resource) {

redisinsight/__mocks__/monacoMock.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ export default function MonacoEditor(props) {
1515
createContextKey: jest.fn(),
1616
focus: jest.fn(),
1717
onDidChangeCursorPosition: jest.fn(),
18+
onDidAttemptReadOnlyEdit: jest.fn(),
1819
executeEdits: jest.fn(),
19-
updateOptions: jest.fn()
20+
updateOptions: jest.fn(),
21+
setSelection: jest.fn(),
2022
},
2123
// monaco
2224
{
@@ -57,3 +59,7 @@ export const languages = {
5759
InsertAsSnippet: 4
5860
}
5961
}
62+
63+
export const monaco = {
64+
Selection: jest.fn().mockImplementation(() => { return {} })
65+
}

redisinsight/api/src/__mocks__/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ export * from './browser-history';
2424
export * from './database-recommendation';
2525
export * from './feature';
2626
export * from './cloud-autodiscovery';
27+
export * from './triggered-functions';
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export const mockCommonLibraryReply = [
2+
'api_version', '1.0',
3+
'engine', 'js',
4+
'configuration', null,
5+
'name', 'libraryName',
6+
'pending_jobs', 0,
7+
'user', 'default',
8+
];
9+
10+
export const mockSimpleLibraryReply = [
11+
'api_version', '1.0',
12+
'engine', 'js',
13+
'configuration', null,
14+
'functions', ['foo'],
15+
'keyspace_triggers', ['keyspace'],
16+
'cluster_functions', ['cluster'],
17+
'stream_triggers', ['stream'],
18+
'name', 'libraryName',
19+
'pending_jobs', 0,
20+
'user', 'default',
21+
];
22+
23+
export const mockVerboseLibraryReply = [
24+
'api_version', '1.0',
25+
'engine', 'js',
26+
'configuration', null,
27+
'name', 'libraryName',
28+
'pending_jobs', 0,
29+
'user', 'default',
30+
'functions', [['name', 'function', 'description', 'description', 'is_async', 1, 'flags', ['flag1']]],
31+
'keyspace_triggers', [],
32+
'cluster_functions', ['foo', 'bar'],
33+
'stream_triggers', [[
34+
'name', 'stream', 'description', 'description', 'prefix', 'prefix', 'trim', 0, 'window', 1, 'streams', [['key', 'value']],
35+
]],
36+
];

redisinsight/api/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { NotificationModule } from 'src/modules/notification/notification.module
1515
import { BulkActionsModule } from 'src/modules/bulk-actions/bulk-actions.module';
1616
import { ClusterMonitorModule } from 'src/modules/cluster-monitor/cluster-monitor.module';
1717
import { DatabaseAnalysisModule } from 'src/modules/database-analysis/database-analysis.module';
18+
import { TriggeredFunctionsModule } from 'src/modules/triggered-functions/triggered-functions.module';
1819
import { ServerModule } from 'src/modules/server/server.module';
1920
import { LocalDatabaseModule } from 'src/local-database.module';
2021
import { CoreModule } from 'src/core.module';
@@ -59,6 +60,7 @@ const PATH_CONFIG = config.get('dir_path');
5960
CustomTutorialModule.register(),
6061
DatabaseAnalysisModule,
6162
DatabaseImportModule,
63+
TriggeredFunctionsModule,
6264
...(SERVER_CONFIG.staticContent
6365
? [
6466
ServeStaticModule.forRoot({

redisinsight/api/src/app.routes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { SlowLogModule } from 'src/modules/slow-log/slow-log.module';
66
import { PubSubModule } from 'src/modules/pub-sub/pub-sub.module';
77
import { ClusterMonitorModule } from 'src/modules/cluster-monitor/cluster-monitor.module';
88
import { DatabaseAnalysisModule } from 'src/modules/database-analysis/database-analysis.module';
9+
import { TriggeredFunctionsModule } from 'src/modules/triggered-functions/triggered-functions.module';
910
import { BulkActionsModule } from 'src/modules/bulk-actions/bulk-actions.module';
1011
import { DatabaseRecommendationModule } from 'src/modules/database-recommendation/database-recommendation.module';
1112

@@ -49,6 +50,10 @@ export const routes: Routes = [
4950
path: '/:dbInstance',
5051
module: DatabaseRecommendationModule,
5152
},
53+
{
54+
path: '/:dbInstance',
55+
module: TriggeredFunctionsModule,
56+
},
5257
],
5358
},
5459
];

redisinsight/api/src/common/constants/recommendations.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export enum SearchVisualizationCommands {
2-
FT_INFO = "FT.INFO",
3-
FT_SEARCH = "FT.SEARCH",
4-
FT_AGGREGATE = "FT.AGGREGATE",
5-
FT_PROFILE = "FT.PROFILE",
6-
FT_EXPLAIN = "FT.EXPLAIN",
7-
TS_RANGE = "TS.RANGE",
8-
TS_MRANGE = "TS.MRANGE",
2+
FT_INFO = 'FT.INFO',
3+
FT_SEARCH = 'FT.SEARCH',
4+
FT_AGGREGATE = 'FT.AGGREGATE',
5+
FT_PROFILE = 'FT.PROFILE',
6+
FT_EXPLAIN = 'FT.EXPLAIN',
7+
TS_RANGE = 'TS.RANGE',
8+
TS_MRANGE = 'TS.MRANGE',
99
}
1010

1111
export const LUA_SCRIPT_RECOMMENDATION_COUNT = 10;
@@ -23,3 +23,4 @@ export const COMBINE_SMALL_STRINGS_TO_HASHES_RECOMMENDATION_KEYS_COUNT = 10;
2323
export const SEARCH_HASH_RECOMMENDATION_KEYS_FOR_CHECK = 50;
2424
export const SEARCH_HASH_RECOMMENDATION_KEYS_LENGTH = 2;
2525
export const RTS_KEYS_FOR_CHECK = 100;
26+
export const LUA_TO_FUNCTIONS_RECOMMENDATION_COUNT = 0;

0 commit comments

Comments
 (0)