Skip to content
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "/dashboard",
"dependencies": {
"@devtron-labs/devtron-fe-common-lib": "4.0.11",
"@devtron-labs/devtron-fe-common-lib": "4.0.11-pre-0",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@sentry/browser": "7.119.1",
"@sentry/integrations": "7.50.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ const NodeListSearchFilter = ({
handleQueryParamsUpdate((queryObject) => {
const updatedQueryObject = structuredClone(queryObject)

if (filtersToApply.length) {
updatedQueryObject[nodeSearchKey] = filtersToApply.map(({ value }) => value).join(',')
// NOTE: drop any entry with a falsy value before persisting to the query string so a
// stray blank filter can never be appended alongside a real one (which would otherwise
// neutralize the filter entirely, since an empty value matches every node)
const nonEmptyFiltersToApply = filtersToApply.filter(({ value }) => !!value)

if (nonEmptyFiltersToApply.length) {
updatedQueryObject[nodeSearchKey] = nonEmptyFiltersToApply.map(({ value }) => value).join(',')
} else {
delete updatedQueryObject[nodeSearchKey]
}
Expand Down Expand Up @@ -223,10 +228,12 @@ const NodeListSearchFilter = ({
[NODE_SEARCH_KEYS.NODE_GROUP]: appliedFilters[NODE_SEARCH_KEYS.NODE_GROUP]
.filter(({ value }) => !!value)
.map(({ value }) => value),
[NODE_SEARCH_KEYS.LABEL]: appliedFilters[NODE_SEARCH_KEYS.LABEL].map(({ value }) => value),
[NODE_K8S_VERSION_FILTER_KEY]: appliedFilters[NODE_K8S_VERSION_FILTER_KEY].map(
({ value }) => value,
),
[NODE_SEARCH_KEYS.LABEL]: appliedFilters[NODE_SEARCH_KEYS.LABEL]
.filter(({ value }) => !!value)
.map(({ value }) => value),
[NODE_K8S_VERSION_FILTER_KEY]: appliedFilters[NODE_K8S_VERSION_FILTER_KEY].filter(
({ value }) => !!value,
).map(({ value }) => value),
}}
onRemoveFilter={handleRemoveFilter}
clearFilters={handleClearFilters}
Expand Down
9 changes: 7 additions & 2 deletions src/components/ResourceBrowser/ResourceList/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ export const isItemASearchMatchForNodeListing = (item: Record<string, any>, sear
)
}

return String(item[objectKey] ?? '').includes(trimmedText) && isFound
// NOTE: exact match is required here since a substring/includes match would
// incorrectly match distinct but similarly named values (e.g. filtering by
// node group 'presto-gateway' should not also match 'presto-gateway-2')
return String(item[objectKey] ?? '') === trimmedText && isFound
})
}, true)

Expand Down Expand Up @@ -537,7 +540,9 @@ export const getNodeSearchKeysOptionsList = (rows: NodeListSearchFilterType['row
}
})

if (!acc.nodeGroups.has(curr.data.nodeGroup as string)) {
// NOTE: skip nodes without a node group (e.g. control-plane/master nodes) so an
// empty-value option never gets added to the node group filter list
if (curr.data.nodeGroup && !acc.nodeGroups.has(curr.data.nodeGroup as string)) {
acc.nodeGroups.set(curr.data.nodeGroup as string, {
label: `${curr.data.nodeGroup}`,
value: curr.data.nodeGroup as string,
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1738,9 +1738,9 @@ __metadata:
languageName: node
linkType: hard

"@devtron-labs/devtron-fe-common-lib@npm:4.0.11":
version: 4.0.11
resolution: "@devtron-labs/devtron-fe-common-lib@npm:4.0.11"
"@devtron-labs/devtron-fe-common-lib@npm:4.0.11-pre-0":
version: 4.0.11-pre-0
resolution: "@devtron-labs/devtron-fe-common-lib@npm:4.0.11-pre-0"
dependencies:
"@codemirror/autocomplete": "npm:6.18.6"
"@codemirror/lang-json": "npm:6.0.1"
Expand Down Expand Up @@ -1794,7 +1794,7 @@ __metadata:
react-select: 5.8.0
rxjs: ^7.8.1
yaml: ^2.8.3
checksum: 10c0/054e4e16280ac7de048aeeb13d23f281d2963ece4b0ec36622dc4326fe500e3e9fd239423ecae64a442133271ac47728f33fc2ed505097994591c946d1749bde
checksum: 10c0/620d3dccb52dab3e555a9b133b8fc1494caf4b751cd7361eacead4a21affd8d5f3ad8f50ffa642d930dcd6e530f402f75e4c5b322ee26ba988cbb72a57f9c859
languageName: node
linkType: hard

Expand Down Expand Up @@ -5529,7 +5529,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "dashboard@workspace:."
dependencies:
"@devtron-labs/devtron-fe-common-lib": "npm:4.0.11"
"@devtron-labs/devtron-fe-common-lib": "npm:4.0.11-pre-0"
"@esbuild-plugins/node-globals-polyfill": "npm:0.2.3"
"@playwright/test": "npm:^1.32.1"
"@sentry/browser": "npm:7.119.1"
Expand Down
Loading