mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
Fix VariableValueType typing to match API type
And adapt formUtil functions to handle undefined values
This commit is contained in:
@@ -10,7 +10,7 @@ export type TemplateVariable =
|
||||
| components["schemas"]["TemplateVariablePathComponent"]
|
||||
| components["schemas"]["TemplateVariableBoolean"];
|
||||
export type TemplateSecret = components["schemas"]["TemplateSecret"];
|
||||
export type VariableValueType = (string | boolean | number) | undefined;
|
||||
export type VariableValueType = string | boolean | number;
|
||||
export type VariableData = { [key: string]: VariableValueType };
|
||||
export type SecretData = { [key: string]: string };
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export function metadataFormEntryDescription(what: string): FormEntry {
|
||||
};
|
||||
}
|
||||
|
||||
export function templateVariableFormEntry(variable: TemplateVariable, variableValue: VariableValueType): FormEntry {
|
||||
export function templateVariableFormEntry(variable: TemplateVariable, variableValue?: VariableValueType): FormEntry {
|
||||
const common_fields = {
|
||||
name: variable.name,
|
||||
label: variable.label ?? variable.name,
|
||||
@@ -166,7 +166,7 @@ export function createFormDataToPayload(template: TemplateSummary, formData: any
|
||||
return payload;
|
||||
}
|
||||
|
||||
export function formDataTypedGet(variableDefinition: TemplateVariable, formData: any): VariableValueType {
|
||||
export function formDataTypedGet(variableDefinition: TemplateVariable, formData: any): VariableValueType | undefined {
|
||||
// galaxy form library doesn't type values traditionally, so add a typed
|
||||
// access to the data if coming back as string. Though it does seem to be
|
||||
// typed properly - this might not be needed anymore?
|
||||
|
||||
Reference in New Issue
Block a user