Skip to content

Commit

Permalink
fix: Add Sources tab to show all sources of a multi-source app (argop…
Browse files Browse the repository at this point in the history
…roj#17939)

Signed-off-by: Keith Chong <[email protected]>
  • Loading branch information
keithchong authored Apr 23, 2024
1 parent 56b796d commit 719dc83
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ export const ApplicationParameters = (props: {
} else {
const v: models.ApplicationSource[] = new Array<models.ApplicationSource>();
v.push(app.spec.source);
return getEditablePanel(attributes, props.details, 0, v);
return getEditablePanel(attributes, props.details, 0, v, true);
}

function getEditablePanel(panel: EditablePanelItem[], repoAppDetails: models.RepoAppDetails, ind: number, sources: models.ApplicationSource[]): any {
function getEditablePanel(panel: EditablePanelItem[], repoAppDetails: models.RepoAppDetails, ind: number, sources: models.ApplicationSource[], isSingleSource?: boolean): any {
const src: models.ApplicationSource = sources[ind];
let descriptionCollapsed: string;
let floatingTitle: string;
Expand Down Expand Up @@ -230,18 +230,20 @@ export const ApplicationParameters = (props: {
save={
props.save &&
(async (input: models.Application) => {
const updatedSrc = isSingleSource ? input.spec.source : input.spec.sources[ind];

function isDefined(item: any) {
return item !== null && item !== undefined;
}
function isDefinedWithVersion(item: any) {
return item !== null && item !== undefined && item.match(/:/);
}

if (src.helm && src.helm.parameters) {
src.helm.parameters = src.helm.parameters.filter(isDefined);
if (updatedSrc.helm && updatedSrc.helm.parameters) {
updatedSrc.helm.parameters = updatedSrc.helm.parameters.filter(isDefined);
}
if (src.kustomize && src.kustomize.images) {
src.kustomize.images = src.kustomize.images.filter(isDefinedWithVersion);
if (updatedSrc.kustomize && updatedSrc.kustomize.images) {
updatedSrc.kustomize.images = updatedSrc.kustomize.images.filter(isDefinedWithVersion);
}

let params = input.spec?.source?.plugin?.parameters;
Expand Down

0 comments on commit 719dc83

Please sign in to comment.