From 646d3d65fba6c6cbb7402d7cc45fd373ceb6620e Mon Sep 17 00:00:00 2001 From: Scott Dickerson Date: Mon, 15 Jul 2024 17:43:01 -0400 Subject: [PATCH] :bug: Don't use "mvn://::" for an empty binary source in applications (#2015) When creating an application, if the "Binary (Java)" source is not specified, we want to store an empty string as the `binary` value and not `"mvn://::`. This also applied to editing an existing application. Resolves: #2014 Resolves: https://issues.redhat.com/browse/MTA-3238 Signed-off-by: Scott J Dickerson --- .../application-form/application-form.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/app/pages/applications/components/application-form/application-form.tsx b/client/src/app/pages/applications/components/application-form/application-form.tsx index ab3a5cb7c3..d3164386fc 100644 --- a/client/src/app/pages/applications/components/application-form/application-form.tsx +++ b/client/src/app/pages/applications/components/application-form/application-form.tsx @@ -263,12 +263,12 @@ export const useApplicationFormHook = ({ }); const onValidSubmit = (formValues: FormValues) => { - let binaryValue = formValues.packaging - ? `${formValues.group}:${formValues.artifact}:${formValues.version}:${formValues.packaging}` - : `${formValues.group}:${formValues.artifact}:${formValues.version}`; - if (!binaryValue.startsWith("mvn://")) { - binaryValue = `mvn://${binaryValue}`; - } + const binaryValues = [ + formValues.group, + formValues.artifact, + formValues.version, + formValues.packaging, + ].filter(Boolean); const payload: New = { name: formValues.name.trim(), @@ -294,7 +294,8 @@ export const useApplicationFormHook = ({ path: formValues.rootPath.trim(), } : undefined, - binary: binaryValue, + binary: + binaryValues.length > 0 ? `mvn://${binaryValues.join(":")}` : undefined, // Values not editable on the form but still need to be passed through identities: application?.identities ?? undefined,