diff --git a/web/portal/brand/src/entities/ProxyTrunk/ProxyTrunk.tsx b/web/portal/brand/src/entities/ProxyTrunk/ProxyTrunk.tsx index 98104e2276..24a4b85d56 100644 --- a/web/portal/brand/src/entities/ProxyTrunk/ProxyTrunk.tsx +++ b/web/portal/brand/src/entities/ProxyTrunk/ProxyTrunk.tsx @@ -27,7 +27,13 @@ const ProxyTrunk: EntityInterface = { iden: 'ProxyTrunk', title: _('Proxy Trunks', { count: 2 }), path: '/proxy_trunks', - toStr: (row: ProxyTrunkPropertyList) => `${row.ip}`, + toStr: (row: ProxyTrunkPropertyList) => { + const ip = row.advertisedIp ? row.advertisedIp : row.ip; + + const label = `${row.name} (${ip})`; + + return label; + }, properties, acl: { ...defaultEntityBehavior.acl, diff --git a/web/portal/brand/src/entities/ProxyTrunk/ProxyTrunkProperties.ts b/web/portal/brand/src/entities/ProxyTrunk/ProxyTrunkProperties.ts index b0cea6e291..96a3f79278 100644 --- a/web/portal/brand/src/entities/ProxyTrunk/ProxyTrunkProperties.ts +++ b/web/portal/brand/src/entities/ProxyTrunk/ProxyTrunkProperties.ts @@ -7,6 +7,7 @@ import { export type ProxyTrunkPropertyList = { name?: T; ip?: T; + advertisedIp?: T; id?: T; }; diff --git a/web/portal/brand/src/entities/ProxyTrunk/SelectOptions.ts b/web/portal/brand/src/entities/ProxyTrunk/SelectOptions.ts index cb8baa0dfe..af31a1482a 100644 --- a/web/portal/brand/src/entities/ProxyTrunk/SelectOptions.ts +++ b/web/portal/brand/src/entities/ProxyTrunk/SelectOptions.ts @@ -3,6 +3,8 @@ import defaultEntityBehavior from '@irontec/ivoz-ui/entities/DefaultEntityBehavi import { SelectOptionsType } from '@irontec/ivoz-ui/entities/EntityInterface'; import store from 'store'; +import { ProxyTrunkPropertiesList } from './ProxyTrunkProperties'; + const ProxyTrunkSelectOptions: SelectOptionsType = ({ callback, cancelToken, @@ -12,11 +14,11 @@ const ProxyTrunkSelectOptions: SelectOptionsType = ({ return defaultEntityBehavior.fetchFks( `${ProxyTrunk.path}?_order[ip]=ASC`, - ['id', 'ip'], - (data) => { + ['id', 'name', 'ip', 'advertisedIp'], + (data: ProxyTrunkPropertiesList) => { const options: DropdownChoices = []; for (const item of data) { - options.push({ id: item.id, label: item.ip }); + options.push({ id: item.id as number, label: ProxyTrunk.toStr(item) }); } callback(options); diff --git a/web/portal/platform/src/entities/ProxyTrunk/ProxyTrunk.tsx b/web/portal/platform/src/entities/ProxyTrunk/ProxyTrunk.tsx index 61b60fc133..abb041e4d2 100644 --- a/web/portal/platform/src/entities/ProxyTrunk/ProxyTrunk.tsx +++ b/web/portal/platform/src/entities/ProxyTrunk/ProxyTrunk.tsx @@ -66,8 +66,13 @@ const ProxyTrunk: EntityInterface = { iden: 'ProxyTrunk', title: _('Proxy Trunk', { count: 2 }), path: '/proxy_trunks', - toStr: (row: ProxyTrunkPropertyList) => - `${row.name} (${row.ip})`, + toStr: (row: ProxyTrunkPropertyList) => { + const ip = row.advertisedIp ? row.advertisedIp : row.ip; + + const label = `${row.name} (${ip})`; + + return label; + }, columns: ['name', 'ip', 'advertisedIp'], properties, ChildDecorator, diff --git a/web/portal/platform/src/entities/ProxyTrunk/SelectOptions.ts b/web/portal/platform/src/entities/ProxyTrunk/SelectOptions.ts index 72c8c14251..e9efb51828 100644 --- a/web/portal/platform/src/entities/ProxyTrunk/SelectOptions.ts +++ b/web/portal/platform/src/entities/ProxyTrunk/SelectOptions.ts @@ -14,14 +14,11 @@ const ProxyTrunkSelectOptions: SelectOptionsType = ({ return defaultEntityBehavior.fetchFks( `${ProxyTrunk.path}?_order[name]=ASC`, - ['id', 'ip', 'name'], + ['id', 'ip', 'name', 'advertisedIp'], (data: ProxyTrunkPropertiesList) => { const options: DropdownChoices = []; for (const item of data) { - options.push({ - id: item.id as number, - label: `${item.name} (${item.ip})`, - }); + options.push({ id: item.id as number, label: ProxyTrunk.toStr(item) }); } callback(options);