From 5865f1ca777f8d17d3665925afa2006439666e50 Mon Sep 17 00:00:00 2001 From: Ali <83188384+testA113@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:48:21 +1200 Subject: [PATCH] fix(app): update summary with ingresses [EE-5847] (#9973) Co-authored-by: testa113 --- .../views/summary/resources/applicationResources.js | 8 ++++---- app/kubernetes/views/summary/summaryController.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/kubernetes/views/summary/resources/applicationResources.js b/app/kubernetes/views/summary/resources/applicationResources.js index 287e10475..d8992761a 100644 --- a/app/kubernetes/views/summary/resources/applicationResources.js +++ b/app/kubernetes/views/summary/resources/applicationResources.js @@ -20,7 +20,7 @@ const { CREATE, UPDATE, DELETE } = KubernetesResourceActions; * Get summary of Kubernetes resources to be created, updated or deleted * @param {KubernetesApplicationFormValues} formValues */ -export default function (formValues, oldFormValues = {}) { +export function getApplicationResources(formValues, oldFormValues = {}) { if (oldFormValues instanceof KubernetesApplicationFormValues) { const resourceSummary = getUpdatedApplicationResources(oldFormValues, formValues); return resourceSummary; @@ -139,9 +139,9 @@ function getUpdatedApplicationResources(oldFormValues, newFormValues) { } // Ingress - const oldIngresses = KubernetesIngressConverter.applicationFormValuesToIngresses(oldFormValues, oldService.Name); - const newServicePorts = newFormValues.Services.flatMap((service) => service.Ports); const oldServicePorts = oldFormValues.Services.flatMap((service) => service.Ports); + const oldIngresses = generateNewIngressesFromFormPaths(oldFormValues.OriginalIngresses, oldServicePorts, oldServicePorts); + const newServicePorts = newFormValues.Services.flatMap((service) => service.Ports); const newIngresses = generateNewIngressesFromFormPaths(newFormValues.OriginalIngresses, newServicePorts, oldServicePorts); resources.push(...getIngressUpdateSummary(oldIngresses, newIngresses)); } else if (!oldService && newService) { @@ -190,7 +190,7 @@ function getApplicationResourceType(app) { function getIngressUpdateSummary(oldIngresses, newIngresses) { const ingressesSummaries = newIngresses .map((newIng) => { - const oldIng = _.find(oldIngresses, { Name: newIng.Name }); + const oldIng = oldIngresses.find((oldIng) => oldIng.Name === newIng.Name); return getIngressUpdateResourceSummary(oldIng, newIng); }) .filter((s) => s); // remove nulls diff --git a/app/kubernetes/views/summary/summaryController.js b/app/kubernetes/views/summary/summaryController.js index 9fe014039..f318f8b66 100644 --- a/app/kubernetes/views/summary/summaryController.js +++ b/app/kubernetes/views/summary/summaryController.js @@ -3,7 +3,7 @@ import { KubernetesConfigurationFormValues } from 'Kubernetes/models/configurati import { KubernetesResourcePoolFormValues } from 'Kubernetes/models/resource-pool/formValues'; import { KubernetesApplicationFormValues } from 'Kubernetes/models/application/formValues'; import { KubernetesResourceActions, KubernetesResourceTypes } from 'Kubernetes/models/resource-types/models'; -import getApplicationResources from './resources/applicationResources'; +import { getApplicationResources } from './resources/applicationResources'; import getNamespaceResources from './resources/namespaceResources'; import getConfigurationResources from './resources/configurationResources';