ui(admin): show alias in allocation dropdown; fixes #3434
This commit is contained in:
parent
9b7cea5d04
commit
34da772db7
2 changed files with 14 additions and 4 deletions
|
@ -12,19 +12,29 @@ export interface Allocation {
|
|||
relations: {
|
||||
server?: Server;
|
||||
}
|
||||
|
||||
getDisplayText (): string;
|
||||
}
|
||||
|
||||
export const rawDataToAllocation = ({ attributes }: FractalResponseData): Allocation => ({
|
||||
id: attributes.id,
|
||||
ip: attributes.ip,
|
||||
port: attributes.port,
|
||||
alias: attributes.ip_alias || null,
|
||||
alias: attributes.alias || null,
|
||||
serverId: attributes.server_id,
|
||||
assigned: attributes.assigned,
|
||||
|
||||
relations: {
|
||||
server: attributes.relationships?.server?.object === 'server' ? rawDataToServer(attributes.relationships.server as FractalResponseData) : undefined,
|
||||
},
|
||||
|
||||
// TODO: If IP is an IPv6, wrap IP in [].
|
||||
getDisplayText (): string {
|
||||
if (attributes.alias !== null) {
|
||||
return `${attributes.ip}:${attributes.port} (${attributes.alias})`;
|
||||
}
|
||||
return `${attributes.ip}:${attributes.port}`;
|
||||
},
|
||||
});
|
||||
|
||||
export interface Filters {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue