mirror of https://github.com/portainer/portainer
fix(app): update summary with ingresses [EE-5847] (#9974)
Co-authored-by: testa113 <testa113>pull/9988/head
parent
18e40cd973
commit
82faf20c68
|
@ -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
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
Loading…
Reference in New Issue