mirror of https://github.com/portainer/portainer
fix(app): update summary with ingresses [EE-5847] (#9973)
Co-authored-by: testa113 <testa113>pull/9989/head
parent
f59573f306
commit
5865f1ca77
|
@ -20,7 +20,7 @@ const { CREATE, UPDATE, DELETE } = KubernetesResourceActions;
|
||||||
* Get summary of Kubernetes resources to be created, updated or deleted
|
* Get summary of Kubernetes resources to be created, updated or deleted
|
||||||
* @param {KubernetesApplicationFormValues} formValues
|
* @param {KubernetesApplicationFormValues} formValues
|
||||||
*/
|
*/
|
||||||
export default function (formValues, oldFormValues = {}) {
|
export function getApplicationResources(formValues, oldFormValues = {}) {
|
||||||
if (oldFormValues instanceof KubernetesApplicationFormValues) {
|
if (oldFormValues instanceof KubernetesApplicationFormValues) {
|
||||||
const resourceSummary = getUpdatedApplicationResources(oldFormValues, formValues);
|
const resourceSummary = getUpdatedApplicationResources(oldFormValues, formValues);
|
||||||
return resourceSummary;
|
return resourceSummary;
|
||||||
|
@ -139,9 +139,9 @@ function getUpdatedApplicationResources(oldFormValues, newFormValues) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ingress
|
// 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 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);
|
const newIngresses = generateNewIngressesFromFormPaths(newFormValues.OriginalIngresses, newServicePorts, oldServicePorts);
|
||||||
resources.push(...getIngressUpdateSummary(oldIngresses, newIngresses));
|
resources.push(...getIngressUpdateSummary(oldIngresses, newIngresses));
|
||||||
} else if (!oldService && newService) {
|
} else if (!oldService && newService) {
|
||||||
|
@ -190,7 +190,7 @@ function getApplicationResourceType(app) {
|
||||||
function getIngressUpdateSummary(oldIngresses, newIngresses) {
|
function getIngressUpdateSummary(oldIngresses, newIngresses) {
|
||||||
const ingressesSummaries = newIngresses
|
const ingressesSummaries = newIngresses
|
||||||
.map((newIng) => {
|
.map((newIng) => {
|
||||||
const oldIng = _.find(oldIngresses, { Name: newIng.Name });
|
const oldIng = oldIngresses.find((oldIng) => oldIng.Name === newIng.Name);
|
||||||
return getIngressUpdateResourceSummary(oldIng, newIng);
|
return getIngressUpdateResourceSummary(oldIng, newIng);
|
||||||
})
|
})
|
||||||
.filter((s) => s); // remove nulls
|
.filter((s) => s); // remove nulls
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { KubernetesConfigurationFormValues } from 'Kubernetes/models/configurati
|
||||||
import { KubernetesResourcePoolFormValues } from 'Kubernetes/models/resource-pool/formValues';
|
import { KubernetesResourcePoolFormValues } from 'Kubernetes/models/resource-pool/formValues';
|
||||||
import { KubernetesApplicationFormValues } from 'Kubernetes/models/application/formValues';
|
import { KubernetesApplicationFormValues } from 'Kubernetes/models/application/formValues';
|
||||||
import { KubernetesResourceActions, KubernetesResourceTypes } from 'Kubernetes/models/resource-types/models';
|
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 getNamespaceResources from './resources/namespaceResources';
|
||||||
import getConfigurationResources from './resources/configurationResources';
|
import getConfigurationResources from './resources/configurationResources';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue