Fix IPv6 prefix length links to use separate /prefixlength6/<len> route
The prefix length links for IPv6 prefixes were incorrectly pointing to /prefixlength/<len> which would show IPv4 prefixes. Added a new route /prefixlength6/<len> specifically for IPv6 prefixes and updated the template to use the correct URL based on whether displaying IPv4 or IPv6 prefix distributions. Also refactored handlePrefixLength to explicitly handle only IPv4 prefixes and created handlePrefixLength6 for IPv6 prefixes, removing the ambiguous auto-detection based on mask length value.
This commit is contained in:
@@ -236,12 +236,16 @@
|
||||
// Sort by mask length
|
||||
distribution.sort((a, b) => a.mask_length - b.mask_length);
|
||||
|
||||
// Determine the URL path based on whether this is IPv4 or IPv6
|
||||
const isIPv6 = elementId.includes('ipv6');
|
||||
const urlPath = isIPv6 ? '/prefixlength6/' : '/prefixlength/';
|
||||
|
||||
distribution.forEach(item => {
|
||||
const metric = document.createElement('div');
|
||||
metric.className = 'metric';
|
||||
metric.innerHTML = `
|
||||
<span class="metric-label">/${item.mask_length}</span>
|
||||
<a href="/prefixlength/${item.mask_length}" class="metric-value metric-link">${formatNumber(item.count)}</a>
|
||||
<a href="${urlPath}${item.mask_length}" class="metric-value metric-link">${formatNumber(item.count)}</a>
|
||||
`;
|
||||
container.appendChild(metric);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user