Fixed issue where willSave() was not detecting if targetPort was number

This commit is contained in:
Sean 2022-07-26 17:58:13 -04:00
parent a821401164
commit 75f1e04f83
2 changed files with 6 additions and 4 deletions

View File

@ -25,6 +25,7 @@ import { matching } from '@shell/utils/selector';
import { NAME as HARVESTER } from '@shell/config/product/harvester';
import { allHash } from '@shell/utils/promise';
import { isHarvesterSatisfiesVersion } from '@shell/utils/cluster';
import { Port } from '@shell/utils/validators/formRules';
const SESSION_AFFINITY_ACTION_VALUES = {
NONE: 'None',
@ -292,11 +293,12 @@ export default {
targetPortsStrOrInt(targetPorts = []) {
const neu = clone(targetPorts);
const isNumeric = /^\\d+$/;
neu.forEach((port, idx) => {
if (port?.targetPort && isNumeric.test(port.targetPort)) {
port.targetPort = parseInt(port.targetPort, 10);
const targetPort = new Port(port?.targetPort);
if (targetPort.isInt) {
port.targetPort = targetPort.int;
}
});

View File

@ -18,7 +18,7 @@ type ServicePort = {
idx: number
}
class Port {
export class Port {
empty: boolean;
int: number;
string: string;