Skip to content

Commit f49f356

Browse files
#RI-5750 - update dru run dto
1 parent d6cc543 commit f49f356

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
import { ApiProperty } from '@nestjs/swagger';
22
import { Expose } from 'class-transformer';
3-
import { IsNotEmpty, IsString, Validate } from 'class-validator';
4-
import { SerializedJsonValidator } from 'src/validators';
3+
import { IsNotEmpty } from 'class-validator';
54

65
export class RdiDryRunJobDto {
76
@ApiProperty({
87
description: 'Input data',
9-
type: String,
8+
type: Object,
109
})
1110
@Expose()
1211
@IsNotEmpty()
13-
@IsString()
14-
@Validate(SerializedJsonValidator)
15-
input: string;
12+
input_data: object;
1613

1714
@ApiProperty({
1815
description: 'Job file',
19-
type: String,
16+
type: Object,
2017
})
2118
@Expose()
2219
@IsNotEmpty()
23-
@IsString()
24-
job: string;
20+
job: object;
2521
}

redisinsight/api/src/modules/rdi/rdi-pipeline.controller.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import {
22
Body,
33
ClassSerializerInterceptor, Controller, Get, Post, UseInterceptors, UsePipes, ValidationPipe,
4-
Req, Param,
4+
Param,
55
} from '@nestjs/common';
66
import { Rdi, RdiPipeline, RdiClientMetadata } from 'src/modules/rdi/models';
77
import { ApiTags } from '@nestjs/swagger';
8-
import { Request } from 'express';
98
import { ApiEndpoint } from 'src/decorators/api-endpoint.decorator';
109
import { RdiPipelineService } from 'src/modules/rdi/rdi-pipeline.service';
1110
import { RequestRdiClientMetadata } from 'src/modules/rdi/decorators';

redisinsight/ui/src/pages/rdi/pipeline-management/components/jobs-panel/Panel.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from '@elastic/eui'
1414
import { useDispatch, useSelector } from 'react-redux'
1515
import { useParams } from 'react-router-dom'
16+
import yaml from 'js-yaml'
1617

1718
import { PipelineJobsTabs } from 'uiSrc/slices/interfaces/rdi'
1819
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
@@ -107,10 +108,12 @@ const DryRunJobPanel = (props: Props) => {
107108
id: rdiInstanceId,
108109
},
109110
})
110-
dispatch(rdiDryRunJob(rdiInstanceId, input, job))
111+
dispatch(rdiDryRunJob(rdiInstanceId, JSON.parse(input), yaml.load(job)))
111112
}
112113

113-
const isSelectAvailable = selectedTab === PipelineJobsTabs.Output && !!results?.output && (results?.output?.length > 1)
114+
const isSelectAvailable = selectedTab === PipelineJobsTabs.Output
115+
&& !!results?.output
116+
&& (results?.output?.length > 1)
114117

115118
const Tabs = useCallback(() => (
116119
<EuiTabs className={styles.tabs}>

redisinsight/ui/src/slices/rdi/dryRun.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export default rdiPipelineSlice.reducer
5050
// Asynchronous thunk action
5151
export function rdiDryRunJob(
5252
rdiInstanceId: string,
53-
input: string,
54-
job: string,
53+
input_data: object,
54+
job: unknown,
5555
onSuccessAction?: (data: IDryRunJobResults) => void,
5656
onFailAction?: () => void,
5757
) {
@@ -61,7 +61,7 @@ export function rdiDryRunJob(
6161
const { data, status } = await apiService.post<IDryRunJobResults>(
6262
`rdi/${rdiInstanceId}/pipeline/dry-run-job`,
6363
{
64-
input,
64+
input_data,
6565
job,
6666
}
6767
)

redisinsight/ui/src/slices/tests/rdi/dryRun.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('rdi dry run slice', () => {
126126

127127
// Act
128128
await store.dispatch<any>(
129-
rdiDryRunJob('123', "{ name: 'Johny' }", 'job string')
129+
rdiDryRunJob('123', { name: 'Johny' }, {})
130130
)
131131

132132
// Assert
@@ -151,7 +151,7 @@ describe('rdi dry run slice', () => {
151151

152152
// Act
153153
await store.dispatch<any>(
154-
rdiDryRunJob('123', "{ name: 'Johny' }", 'job string')
154+
rdiDryRunJob('123', { name: 'Johny' }, {})
155155
)
156156

157157
// Assert

0 commit comments

Comments
 (0)