mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-15 23:49:09 +00:00
FIX: pipeline details now showing correct default values on s3 pipelines
This commit is contained in:
+2
-2
@@ -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": [],
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user