Skip to content

Commit

Permalink
Fix VariableValueType typing to match API type
Browse files Browse the repository at this point in the history
And adapt formUtil functions to handle undefined values
  • Loading branch information
davelopez committed Jul 9, 2024
1 parent 93c3cdd commit f5dad9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/src/api/configTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ConfigTemplates/formUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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?
Expand Down

0 comments on commit f5dad9d

Please sign in to comment.