Skip to content

Commit

Permalink
[frontend] fix redirectionUtils in horizontal bars (OpenCTI-Platform#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit authored Apr 22, 2024
1 parent e7b4870 commit b532809
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,14 @@ const useDistributionGraphData = () => {
});
};

const buildDistributionRedirectionUtils = (distributionData: DistributionQueryData, selection: Selection) => {
// only build redirections on names distribution
if (selection.attribute === 'name') {
return distributionData.flatMap((n) => {
if (!n || !n.entity) return [];
return {
id: n.entity.id,
entity_type: n.entity?.entity_type === 'Workspace' ? n.entity.type : n.entity.entity_type,
};
});
}
return undefined;
const buildDistributionRedirectionUtils = (distributionData: DistributionQueryData) => {
return distributionData.flatMap((n) => {
if (!n || !n.entity || !n.entity.id) return [];
return {
id: n.entity.id,
entity_type: n.entity?.entity_type === 'Workspace' ? n.entity.type : n.entity.entity_type,
};
});
};

/**
Expand All @@ -102,7 +98,7 @@ const useDistributionGraphData = () => {
name: selection.label || t_i18n(defaultGraphLabel),
data: buildDistributionGraphData(distributionData, selection),
}],
redirectionUtils: buildDistributionRedirectionUtils(distributionData, selection),
redirectionUtils: buildDistributionRedirectionUtils(distributionData),
};
};

Expand Down

0 comments on commit b532809

Please sign in to comment.