diff --git a/deepfence_frontend/apps/dashboard/api-spec.json b/deepfence_frontend/apps/dashboard/api-spec.json index 5e3ec8e04e..9e8f04fab0 100644 --- a/deepfence_frontend/apps/dashboard/api-spec.json +++ b/deepfence_frontend/apps/dashboard/api-spec.json @@ -12795,6 +12795,7 @@ "active": { "type": "boolean" }, "cloud_provider": { "type": "string" }, "compliance_percentage": { "type": "number" }, + "host_node_id": { "type": "string" }, "last_scan_id": { "type": "string" }, "last_scan_status": { "type": "string" }, "node_id": { "type": "string" }, @@ -13147,6 +13148,7 @@ "type": "object", "properties": { "count": { "type": "integer" }, + "ips": { "type": "array", "items": {}, "nullable": true }, "node_id": { "type": "string" }, "node_name": { "type": "string" } } diff --git a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelCloudNodeAccountInfo.ts b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelCloudNodeAccountInfo.ts index 4ebcd0f20d..866fa402b0 100644 --- a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelCloudNodeAccountInfo.ts +++ b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelCloudNodeAccountInfo.ts @@ -37,6 +37,12 @@ export interface ModelCloudNodeAccountInfo { * @memberof ModelCloudNodeAccountInfo */ compliance_percentage?: number; + /** + * + * @type {string} + * @memberof ModelCloudNodeAccountInfo + */ + host_node_id?: string; /** * * @type {string} @@ -97,6 +103,7 @@ export function ModelCloudNodeAccountInfoFromJSONTyped(json: any, ignoreDiscrimi 'active': !exists(json, 'active') ? undefined : json['active'], 'cloud_provider': !exists(json, 'cloud_provider') ? undefined : json['cloud_provider'], 'compliance_percentage': !exists(json, 'compliance_percentage') ? undefined : json['compliance_percentage'], + 'host_node_id': !exists(json, 'host_node_id') ? undefined : json['host_node_id'], 'last_scan_id': !exists(json, 'last_scan_id') ? undefined : json['last_scan_id'], 'last_scan_status': !exists(json, 'last_scan_status') ? undefined : json['last_scan_status'], 'node_id': !exists(json, 'node_id') ? undefined : json['node_id'], @@ -118,6 +125,7 @@ export function ModelCloudNodeAccountInfoToJSON(value?: ModelCloudNodeAccountInf 'active': value.active, 'cloud_provider': value.cloud_provider, 'compliance_percentage': value.compliance_percentage, + 'host_node_id': value.host_node_id, 'last_scan_id': value.last_scan_id, 'last_scan_status': value.last_scan_status, 'node_id': value.node_id, diff --git a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelConnection.ts b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelConnection.ts index 7652e6eec7..d89c21437e 100644 --- a/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelConnection.ts +++ b/deepfence_frontend/apps/dashboard/src/api/generated/models/ModelConnection.ts @@ -25,6 +25,12 @@ export interface ModelConnection { * @memberof ModelConnection */ count?: number; + /** + * + * @type {Array} + * @memberof ModelConnection + */ + ips?: Array | null; /** * * @type {string} @@ -59,6 +65,7 @@ export function ModelConnectionFromJSONTyped(json: any, ignoreDiscriminator: boo return { 'count': !exists(json, 'count') ? undefined : json['count'], + 'ips': !exists(json, 'ips') ? undefined : json['ips'], 'node_id': !exists(json, 'node_id') ? undefined : json['node_id'], 'node_name': !exists(json, 'node_name') ? undefined : json['node_name'], }; @@ -74,6 +81,7 @@ export function ModelConnectionToJSON(value?: ModelConnection | null): any { return { 'count': value.count, + 'ips': value.ips, 'node_id': value.node_id, 'node_name': value.node_name, }; diff --git a/deepfence_frontend/apps/dashboard/src/features/topology/components/node-details/SummaryTables.tsx b/deepfence_frontend/apps/dashboard/src/features/topology/components/node-details/SummaryTables.tsx index 5fdfb059ac..3d2fcb5aa2 100644 --- a/deepfence_frontend/apps/dashboard/src/features/topology/components/node-details/SummaryTables.tsx +++ b/deepfence_frontend/apps/dashboard/src/features/topology/components/node-details/SummaryTables.tsx @@ -294,6 +294,33 @@ export const ConnectionsTable = ({ }, ]); + const expandedConnections = useMemo(() => { + const newConnections: ModelConnection[] = []; + connections.forEach((connection) => { + const ipsMap: Record = {}; + if (connection.ips?.length) { + connection.ips.forEach((ip) => { + if (ipsMap[ip]) { + ipsMap[ip] += 1; + } else { + ipsMap[ip] = 1; + } + }); + Object.keys(ipsMap).forEach((ip) => { + newConnections.push({ + ...connection, + node_id: ip, + node_name: ip, + count: ipsMap[ip], + }); + }); + } else { + newConnections.push(connection); + } + }); + return newConnections; + }, [connections]); + const columns = useMemo(() => { return [ columnHelper.accessor('node_name', { @@ -324,7 +351,7 @@ export const ConnectionsTable = ({ />