From 8d43290f0ec6bedeb9e0c6743670aaebf82b10e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Fri, 27 Dec 2024 19:17:46 +0100 Subject: [PATCH] feat: remove the outgoing registrar from diagram to make it simpler --- .../watchlist/diagram/watchlistToEdges.tsx | 7 ++++- .../watchlist/diagram/watchlistToNodes.tsx | 29 ++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/assets/components/tracking/watchlist/diagram/watchlistToEdges.tsx b/assets/components/tracking/watchlist/diagram/watchlistToEdges.tsx index 8c5aac3..b4cc977 100644 --- a/assets/components/tracking/watchlist/diagram/watchlistToEdges.tsx +++ b/assets/components/tracking/watchlist/diagram/watchlistToEdges.tsx @@ -6,8 +6,13 @@ import {rolesToColor} from "../../../../utils/functions/rolesToColor"; export function domainEntitiesToEdges(d: Domain, withRegistrar = false) { const rdapRoleTranslated = rdapRoleTranslation() + const sponsor = d.entities.find(e => !e.deleted && e.roles.includes('sponsor')) return d.entities - .filter(e => !e.deleted && (!withRegistrar ? !e.roles.includes('registrar') : true)) + .filter(e => + !e.deleted && + (withRegistrar || !e.roles.includes('registrar')) && + (!sponsor || !e.roles.includes('registrar') || e.roles.includes('sponsor')) + ) .map(e => ({ id: `e-${d.ldhName}-${e.entity.handle}`, source: e.roles.includes('registrant') || e.roles.includes('registrar') ? e.entity.handle : d.ldhName, diff --git a/assets/components/tracking/watchlist/diagram/watchlistToNodes.tsx b/assets/components/tracking/watchlist/diagram/watchlistToNodes.tsx index 967328c..1909185 100644 --- a/assets/components/tracking/watchlist/diagram/watchlistToNodes.tsx +++ b/assets/components/tracking/watchlist/diagram/watchlistToNodes.tsx @@ -12,18 +12,25 @@ export const domainToNode = (d: Domain) => ({ } }) -export const domainEntitiesToNode = (d: Domain, withRegistrar = false) => d.entities - .filter(e => !e.deleted && (!withRegistrar ? !e.roles.includes('registrar') : true)) - .map(e => { - return { - id: e.entity.handle, - type: e.roles.includes('registrant') || e.roles.includes('registrar') ? 'input' : 'output', - data: {label: entityToName(e)}, - style: { - width: 200 +export const domainEntitiesToNode = (d: Domain, withRegistrar = false) => { + const sponsor = d.entities.find(e => !e.deleted && e.roles.includes('sponsor')) + return d.entities + .filter(e => + !e.deleted && + (withRegistrar || !e.roles.includes('registrar')) && + (!sponsor || !e.roles.includes('registrar') || e.roles.includes('sponsor')) + ) + .map(e => { + return { + id: e.entity.handle, + type: e.roles.includes('registrant') || e.roles.includes('registrar') ? 'input' : 'output', + data: {label: entityToName(e)}, + style: { + width: 200 + } } - } - }) + }) +} export const tldToNode = (tld: Tld) => ({ id: tld.tld,