3cd5f46613
* nomad: canonicalize alloc shared resources to populate ports * ui: network ports * ui: remove unused task network references and update tests with new shared ports model * ui: lint * ui: revert auto formatting * ui: remove unused page objects * structs: remove unrelated test from bad conflict resolution * ui: formatting
19 lines
354 B
JavaScript
19 lines
354 B
JavaScript
import ApplicationSerializer from './application';
|
|
import isIp from 'is-ip';
|
|
|
|
export default class PortSerializer extends ApplicationSerializer {
|
|
attrs = {
|
|
hostIp: 'HostIP',
|
|
};
|
|
|
|
normalize(typeHash, hash) {
|
|
const ip = hash.HostIP;
|
|
|
|
if (isIp.v6(ip)) {
|
|
hash.HostIP = `[${ip}]`;
|
|
}
|
|
|
|
return super.normalize(...arguments);
|
|
}
|
|
}
|