From 82ba19e26821febe377c224c65ec7e950c7ec8ac Mon Sep 17 00:00:00 2001 From: Keith Chong Date: Mon, 24 Jun 2024 13:08:16 -0400 Subject: [PATCH] fix: Bug in edit support in Sources tab; Input to loader (#17588) (#18800) --- .../application-parameters.tsx | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ui/src/app/applications/components/application-parameters/application-parameters.tsx b/ui/src/app/applications/components/application-parameters/application-parameters.tsx index 3961b61d26656c..9f5073a838bad3 100644 --- a/ui/src/app/applications/components/application-parameters/application-parameters.tsx +++ b/ui/src/app/applications/components/application-parameters/application-parameters.tsx @@ -247,7 +247,7 @@ export const ApplicationParameters = (props: { )} - getSourceFromSources(application, index)}> + getSourceFromAppSources(src, app.metadata.name, app.spec.project, index, 0)}> {(details: models.RepoAppDetails) => getEditablePanelForOneSource(details, index, source)} @@ -986,17 +986,12 @@ function gatherDetails( } // For Sources field. Get one source with index i from the list -async function getSourceFromSources(app: models.Application, i: number) { - const sources: models.ApplicationSource[] = app.spec.sources; - if (sources && i < sources.length) { - const aSource = sources[i]; - const repoDetail = await services.repos.appDetails(aSource, app.metadata.name, app.spec.project, i, 0).catch(() => ({ - type: 'Directory' as models.AppSourceType, - path: aSource.path - })); - return repoDetail; - } - return null; +async function getSourceFromAppSources(aSource: models.ApplicationSource, name: string, project: string, index: number, version: number) { + const repoDetail = await services.repos.appDetails(aSource, name, project, index, version).catch(() => ({ + type: 'Directory' as models.AppSourceType, + path: aSource.path + })); + return repoDetail; } // Delete when source field is removed