fix(frontend): Validate previous if the containerPort is not undefined [EE-1555] (#5827)

pull/5004/merge
Luis Louis 2021-11-02 18:25:40 -04:00 committed by GitHub
parent 3fb8a232b8
commit b285219a58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -28,7 +28,16 @@ export function ContainerGroupViewModel(data) {
this.Name = data.name; this.Name = data.name;
this.Location = data.location; this.Location = data.location;
this.IPAddress = data.properties.ipAddress ? data.properties.ipAddress.ip : ''; this.IPAddress = data.properties.ipAddress ? data.properties.ipAddress.ip : '';
this.Ports = addressPorts.length ? addressPorts.map((binding, index) => ({ container: containerPorts[index].port, host: binding.port, protocol: binding.protocol })) : []; this.Ports = addressPorts.length
? addressPorts.map((binding, index) => {
const port = (containerPorts[index] && containerPorts[index].port) || undefined;
return {
container: port,
host: binding.port,
protocol: binding.protocol,
};
})
: [];
this.Image = container.properties.image || ''; this.Image = container.properties.image || '';
this.OSType = data.properties.osType; this.OSType = data.properties.osType;
this.AllocatePublicIP = data.properties.ipAddress && data.properties.ipAddress.type === 'Public'; this.AllocatePublicIP = data.properties.ipAddress && data.properties.ipAddress.type === 'Public';