1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 21:39:40 +02:00
portainer/app/react/azure/utils.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
652 B
TypeScript
Raw Normal View History

import { ContainerGroup } from './types';
export function getPorts(containerGroup: ContainerGroup) {
const addressPorts = containerGroup.properties.ipAddress
? containerGroup.properties.ipAddress.ports
: [];
const container = containerGroup.properties.containers.length
? containerGroup.properties.containers[0]
: null;
const containerPorts = container ? container.properties.ports : [];
return addressPorts.map((binding, index) => {
const port = containerPorts[index] ? containerPorts[index].port : undefined;
return {
container: port,
host: binding.port,
protocol: binding.protocol,
};
});
}