From 2d409b6535757c468a64f470361fca2c31e9cfcd Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Fri, 22 Nov 2019 00:07:38 +0100 Subject: [PATCH] :zap: Support also numbers as values in options and multiOptions --- .../editor-ui/src/components/ParameterInput.vue | 17 +++++++++++++---- packages/workflow/src/Interfaces.ts | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/editor-ui/src/components/ParameterInput.vue b/packages/editor-ui/src/components/ParameterInput.vue index 29dba2cbe5..51b139baa5 100644 --- a/packages/editor-ui/src/components/ParameterInput.vue +++ b/packages/editor-ui/src/components/ParameterInput.vue @@ -326,11 +326,20 @@ export default mixins( // and the error is not displayed on the node in the workflow const validOptions = this.parameterOptions!.map((options: INodePropertyOptions) => options.value); - if (this.displayValue === null || !validOptions.includes(this.displayValue as string)) { - if (issues.parameters === undefined) { - issues.parameters = {}; + const checkValues: string[] = []; + if (Array.isArray(this.displayValue)) { + checkValues.push.apply(checkValues, this.displayValue); + } else { + checkValues.push(this.displayValue as string); + } + + for (const checkValue of checkValues) { + if (checkValue === null || !validOptions.includes(checkValue)) { + if (issues.parameters === undefined) { + issues.parameters = {}; + } + issues.parameters[this.parameter.name] = [`The value "${checkValue}" is not supported!`]; } - issues.parameters[this.parameter.name] = [`The value "${this.displayValue}" is not supported!`]; } } else if (this.remoteParameterOptionsLoadingIssues !== null) { if (issues.parameters === undefined) { diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index f0c821c35a..660096d7c1 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -343,7 +343,7 @@ export interface INodeProperties { export interface INodePropertyOptions { name: string; - value: string; + value: string | number; description?: string; }