mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix if else in workflow
This commit is contained in:
@@ -91,12 +91,24 @@ export default class IfElse extends ComponentCode {
|
||||
},
|
||||
});
|
||||
|
||||
const serialize: Function = (arg: any): any => {
|
||||
if (typeof arg === 'string') {
|
||||
return arg.replace(/\n/g, '');
|
||||
}
|
||||
|
||||
return arg;
|
||||
};
|
||||
|
||||
const script: VMScript = new VMScript(
|
||||
`module.exports = function() {
|
||||
|
||||
const input1 = ${(args['input-1'] as string) || ''};
|
||||
const input1 = ${
|
||||
serialize(args['input-1'] as string) || ''
|
||||
};
|
||||
|
||||
const input2 = ${(args['input-2'] as string) || ''};
|
||||
const input2 = ${
|
||||
serialize(args['input-2'] as string) || ''
|
||||
};
|
||||
|
||||
return input1 ${
|
||||
(args['operator'] as string) || '=='
|
||||
|
||||
Reference in New Issue
Block a user