Compare commits

...
3 Commits
2 changed files with 16 additions and 5 deletions
+12 -4
View File
@@ -233,15 +233,23 @@ export class PipelinesService implements OnModuleInit {
const config_controls = (connector.config_controls || []).filter( const config_controls = (connector.config_controls || []).filter(
(config_control) => { (config_control) => {
const path: string = config_control.name; const path: string = config_control.name;
if (!objHasPath({ object: { properties }, path })) return false; if (!objHasPath({ object: { properties }, path })) return false;
const default_value = getObjValueFromPath({ let default_value = getObjValueFromPath({
object: { properties }, object: { properties },
path, path,
}); });
if (default_value != undefined)
if (default_value != undefined) {
if (
path === 'properties.spreadsheet_id' &&
typeof default_value === 'string'
)
default_value = 'https://docs.google.com/spreadsheets/d/'.concat(
default_value,
);
config_control.default_value = default_value; config_control.default_value = default_value;
}
return true; return true;
}, },
@@ -251,7 +259,7 @@ export class PipelinesService implements OnModuleInit {
pipeline: { pipeline: {
...pipeline, ...pipeline,
config_controls, config_controls,
properties: properties, properties,
}, },
}; };
} }
+4 -1
View File
@@ -1,4 +1,7 @@
export function getObjValueFromPath<T>(data: { object: T; path: string }): T { export function getObjValueFromPath<T extends object>(data: {
object: T;
path: string;
}): any {
const { object, path } = data; const { object, path } = data;
const keys = path.split('.'); const keys = path.split('.');