diff --git a/client/src/api/configTemplates.ts b/client/src/api/configTemplates.ts index 34bbfa4fea37..248ea2b4b934 100644 --- a/client/src/api/configTemplates.ts +++ b/client/src/api/configTemplates.ts @@ -1,5 +1,7 @@ import { type components } from "@/api/schema"; +export type CreateInstancePayload = components["schemas"]["CreateInstancePayload"]; + export type Instance = | components["schemas"]["UserFileSourceModel"] | components["schemas"]["UserConcreteObjectStoreModel"]; @@ -10,9 +12,9 @@ export type TemplateVariable = | components["schemas"]["TemplateVariablePathComponent"] | components["schemas"]["TemplateVariableBoolean"]; export type TemplateSecret = components["schemas"]["TemplateSecret"]; -export type VariableValueType = (string | boolean | number) | undefined; -export type VariableData = { [key: string]: VariableValueType }; -export type SecretData = { [key: string]: string }; +export type VariableData = CreateInstancePayload["variables"]; +export type VariableValueType = VariableData[keyof VariableData]; +export type SecretData = CreateInstancePayload["secrets"]; export type PluginAspectStatus = components["schemas"]["PluginAspectStatus"]; export type PluginStatus = components["schemas"]["PluginStatus"]; diff --git a/client/src/components/ConfigTemplates/formUtil.ts b/client/src/components/ConfigTemplates/formUtil.ts index bf7479ff92b8..b6908259dcf9 100644 --- a/client/src/components/ConfigTemplates/formUtil.ts +++ b/client/src/components/ConfigTemplates/formUtil.ts @@ -1,4 +1,5 @@ import { + type CreateInstancePayload, type Instance, type PluginStatus, type SecretData, @@ -139,7 +140,7 @@ export function createTemplateForm(template: TemplateSummary, what: string): For return form; } -export function createFormDataToPayload(template: TemplateSummary, formData: any) { +export function createFormDataToPayload(template: TemplateSummary, formData: any): CreateInstancePayload { const variables = template.variables ?? []; const secrets = template.secrets ?? []; const variableData: VariableData = {}; @@ -155,7 +156,7 @@ export function createFormDataToPayload(template: TemplateSummary, formData: any } const name: string = formData._meta_name; const description: string = formData._meta_description; - const payload = { + const payload: CreateInstancePayload = { name: name, description: description, secrets: secretData, diff --git a/client/src/components/ObjectStore/Instances/types.ts b/client/src/components/ObjectStore/Instances/types.ts index 610d623fe9a0..0d533f0df32c 100644 --- a/client/src/components/ObjectStore/Instances/types.ts +++ b/client/src/components/ObjectStore/Instances/types.ts @@ -1,4 +1,3 @@ import { type components } from "@/api/schema/schema"; export type UserConcreteObjectStore = components["schemas"]["UserConcreteObjectStoreModel"]; -export type CreateInstancePayload = components["schemas"]["CreateInstancePayload"];