FIX: pipeline details now showing correct default values on s3 pipelines

This commit is contained in:
Gabriel Rosa
2022-11-09 17:35:18 -03:00
parent 5072a54ef6
commit 5fb8dae312
3 changed files with 20 additions and 12 deletions
+2 -2
View File
@@ -3277,9 +3277,9 @@
}
},
"info": {
"title": "Maestro - fix/customer-modules",
"title": "Maestro - fix/pipeline-details-bug",
"description": "Documentation for Maestro gateway",
"version": "9.11.2022 - 14:29",
"version": "9.11.2022 - 17:34",
"contact": {}
},
"tags": [],
+8 -10
View File
@@ -22,6 +22,7 @@ import { ConnectorClientService } from '../connector/client.service';
import { InputsService } from '../inputs/inputs.service';
import { RequestUser } from 'src/authentication/user.decorator';
import { TransformationsService } from '../transformations/transformations.service';
import { getObjValueFromPath } from 'src/utils/ObjValueFromPath';
export class PipelinesService implements OnModuleInit {
logger: DadosferaLogger;
@@ -213,16 +214,13 @@ export class PipelinesService implements OnModuleInit {
const connector = JSON.parse(res.connector);
const config_controls = connector.config_controls || [];
for (const key in pipelineProperties) {
const i = config_controls
.map((cc) => cc.name)
.indexOf(`properties.${key}`);
if (i > -1) {
config_controls[i] = {
...config_controls[i],
default_value: pipelineProperties[key],
};
}
for (const config_control of config_controls) {
const path: string = config_control.name;
const default_value = getObjValueFromPath({
object: { properties: pipelineProperties },
path,
});
if (default_value) config_control.default_value = default_value;
}
return {
+10
View File
@@ -0,0 +1,10 @@
export function getObjValueFromPath<T>(data: { object: T; path: string }): T {
const { object, path } = data;
const keys = path.split('.');
let value = JSON.parse(JSON.stringify(object));
for (const key of keys) {
if (value) value = value[key];
}
return value;
}