diff --git a/frontend/src/components/asnQuery.jsx b/frontend/src/components/asnQuery.jsx index 4691df5..f39ae53 100644 --- a/frontend/src/components/asnQuery.jsx +++ b/frontend/src/components/asnQuery.jsx @@ -68,7 +68,6 @@ class ASNQuery extends Component { reducedColour={reducedColour} filterWarningError={filterWarningError} apiCallUrl={this.state.apiCallUrl} - defaultSortSmallestFirst={true} />

Included in the following AS sets: diff --git a/frontend/src/components/prefixQuery.jsx b/frontend/src/components/prefixQuery.jsx index ca3512d..072520e 100644 --- a/frontend/src/components/prefixQuery.jsx +++ b/frontend/src/components/prefixQuery.jsx @@ -75,7 +75,6 @@ class PrefixQuery extends Component { apiCallUrl={leastSpecificOverlapPrefixes.apiCallUrl} reducedColour={reducedColour} filterWarningError={filterWarningError} - defaultSortSmallestFirst={true} /> } diff --git a/frontend/src/components/prefixTable/prefixTable.jsx b/frontend/src/components/prefixTable/prefixTable.jsx index 69f8dea..5aaf9be 100644 --- a/frontend/src/components/prefixTable/prefixTable.jsx +++ b/frontend/src/components/prefixTable/prefixTable.jsx @@ -27,9 +27,8 @@ class PrefixTable extends Component { } updateState() { - const defaultKey = this.props.defaultSortSmallestFirst ? 'prefixSmallestFirst' : 'prefix'; this.setState({ - sortedPrefixesData: sortPrefixesDataBy(this.props.prefixesData, defaultKey), + sortedPrefixesData: sortPrefixesDataBy(this.props.prefixesData, 'prefix'), irrSourceColumns: findIrrSourceColumns(this.props.prefixesData), }); @@ -92,7 +91,6 @@ PrefixTable.propTypes = { reducedColour: PropTypes.bool, filterWarningError: PropTypes.bool, apiCallUrl: PropTypes.string, - defaultSortSmallestFirst: PropTypes.bool, }; diff --git a/frontend/src/utils/prefixData.js b/frontend/src/utils/prefixData.js index fae28ed..e57e6ac 100644 --- a/frontend/src/utils/prefixData.js +++ b/frontend/src/utils/prefixData.js @@ -33,8 +33,7 @@ export function findLeastSpecific(queryPrefix, prefixesData) { } export function sortPrefixesDataBy(prefixesData, key, order = 'asc') { - if (key === 'prefix') key = 'prefixSortKeyIpPrefix'; - if (key === 'prefixSmallestFirst') key = 'prefixSortKeyReverseNetworklenIp'; + if (key === 'prefix') key = 'prefixSortKey'; if (key === 'bgpOrigins') key = 'bgpOrigins.0'; if (key === 'rpkiRoutes') key = 'rpkiRoutes.0.asn'; if (key.startsWith('irrRoutes')) key += '.0.asn'; diff --git a/irrexplorer/api/interfaces.py b/irrexplorer/api/interfaces.py index 232c33b..6ef0527 100644 --- a/irrexplorer/api/interfaces.py +++ b/irrexplorer/api/interfaces.py @@ -84,17 +84,14 @@ class PrefixSummary: # category_overall converted into a number for sorting goodness_overall: Optional[int] = 0 # Numerical IP plus prefix length. Used as sorting key in the frontend. - prefix_sort_key_ip_prefix: Optional[str] = None - # (128 - prefix length) plus numerical IP. Used as sorting key in the frontend. - prefix_sort_key_reverse_networklen_ip: Optional[str] = None + prefix_sort_key: Optional[str] = None def finalise_status(self): """ Set a few properties that depend on others. Should be called before returning to the user. """ - self.prefix_sort_key_ip_prefix = f"{self.prefix.network_address._ip}/{self.prefix.prefixlen}" - self.prefix_sort_key_reverse_networklen_ip = f"{128 - self.prefix.prefixlen}-{self.prefix.network_address._ip}" + self.prefix_sort_key = f"{self.prefix.network_address._ip}/{self.prefix.prefixlen}" if not self.messages: self.success("Everything looks good") diff --git a/irrexplorer/api/tests/test_report.py b/irrexplorer/api/tests/test_report.py index 69c37c3..62ab712 100644 --- a/irrexplorer/api/tests/test_report.py +++ b/irrexplorer/api/tests/test_report.py @@ -40,8 +40,7 @@ def test_report_good(): assert summary.messages == [ ReportMessage(category=MessageCategory.SUCCESS, text="Everything looks good"), ] - assert summary.prefix_sort_key_ip_prefix == "42540766411282592856903984951653826560/48" - assert summary.prefix_sort_key_reverse_networklen_ip == "80-42540766411282592856903984951653826560" + assert summary.prefix_sort_key == "42540766411282592856903984951653826560/48" def test_report_no_origin(): diff --git a/irrexplorer/tests/test_prefixes_asn.py b/irrexplorer/tests/test_prefixes_asn.py index af427d4..9ce965a 100644 --- a/irrexplorer/tests/test_prefixes_asn.py +++ b/irrexplorer/tests/test_prefixes_asn.py @@ -65,8 +65,7 @@ async def test_asn_valid(client, httpserver): "directOrigin": [ { "prefix": "192.0.2.0/24", - "prefixSortKeyIpPrefix": "3221225984/24", - "prefixSortKeyReverseNetworklenIp": "104-3221225984", + "prefixSortKey": "3221225984/24", "goodnessOverall": 0, "categoryOverall": "danger", "bgpOrigins": [64500], @@ -109,8 +108,7 @@ async def test_asn_valid(client, httpserver): "overlaps": [ { "prefix": "192.0.2.128/25", - "prefixSortKeyIpPrefix": "3221226112/25", - "prefixSortKeyReverseNetworklenIp": "103-3221226112", + "prefixSortKey": "3221226112/25", "goodnessOverall": 0, "categoryOverall": "danger", "bgpOrigins": [64501], @@ -146,8 +144,7 @@ async def test_asn_no_irr_data(client, httpserver): "directOrigin": [ { "prefix": "192.0.2.0/24", - "prefixSortKeyIpPrefix": "3221225984/24", - "prefixSortKeyReverseNetworklenIp": "104-3221225984", + "prefixSortKey": "3221225984/24", "goodnessOverall": 0, "categoryOverall": "danger", "bgpOrigins": [64500], diff --git a/irrexplorer/tests/test_prefixes_prefix.py b/irrexplorer/tests/test_prefixes_prefix.py index fb078a3..ecdd24f 100644 --- a/irrexplorer/tests/test_prefixes_prefix.py +++ b/irrexplorer/tests/test_prefixes_prefix.py @@ -89,8 +89,7 @@ async def test_prefix_valid(client, httpserver): expected = [ { "prefix": "192.0.2.0/24", - "prefixSortKeyIpPrefix": "3221225984/24", - "prefixSortKeyReverseNetworklenIp": "104-3221225984", + "prefixSortKey": "3221225984/24", "goodnessOverall": 0, "categoryOverall": "danger", "bgpOrigins": [64500], @@ -145,8 +144,7 @@ async def test_prefix_valid_rpki_as0(client, httpserver): expected = [ { "prefix": "192.0.2.0/24", - "prefixSortKeyIpPrefix": "3221225984/24", - "prefixSortKeyReverseNetworklenIp": "104-3221225984", + "prefixSortKey": "3221225984/24", "goodnessOverall": 0, "categoryOverall": "danger", "bgpOrigins": [], @@ -187,8 +185,7 @@ async def test_prefix_no_data(client, httpserver): expected = [ { "prefix": "192.0.2.0/24", - "prefixSortKeyIpPrefix": "3221225984/24", - "prefixSortKeyReverseNetworklenIp": "104-3221225984", + "prefixSortKey": "3221225984/24", "goodnessOverall": 0, "categoryOverall": "danger", "bgpOrigins": [64500],