From 72dc12a1f715dea9c17cf18805d3e326739b004e Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Thu, 13 Jul 2023 14:12:35 -0400 Subject: [PATCH 1/2] ui: fix Topology node state filter "Ineligible" and "Draining" are not determined by the node status, but are rather inferred from other fields. --- ui/app/controllers/topology.js | 7 +++- ui/tests/acceptance/topology-test.js | 49 ++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/ui/app/controllers/topology.js b/ui/app/controllers/topology.js index 4612c4bf491d..a28d6253b6a0 100644 --- a/ui/app/controllers/topology.js +++ b/ui/app/controllers/topology.js @@ -170,8 +170,13 @@ export default class TopologyControllers extends Controller.extend(Searchable) { selectionClass, selectionNodePool, } = this; + const matchState = + selectionState.includes(node.status) || + (selectionState.includes('ineligible') && !node.isEligible) || + (selectionState.includes('draining') && node.isDraining); + return ( - (selectionState.length ? selectionState.includes(node.status) : true) && + (selectionState.length ? matchState : true) && (selectionVersion.length ? selectionVersion.includes(node.version) : true) && diff --git a/ui/tests/acceptance/topology-test.js b/ui/tests/acceptance/topology-test.js index d541e804c947..84c614ac45a0 100644 --- a/ui/tests/acceptance/topology-test.js +++ b/ui/tests/acceptance/topology-test.js @@ -334,6 +334,12 @@ module('Acceptance | topology', function (hooks) { nodeClass: 'foo-bar-baz', }); + // Make sure we have at least one node draining and one ineligible. + server.create('node', { + schedulingEligibility: 'ineligible', + }); + server.create('node', 'draining'); + // Create node pool exclusive for these nodes. server.create('node-pool', { name: 'test-node-pool' }); server.createList('node', 3, { @@ -342,16 +348,32 @@ module('Acceptance | topology', function (hooks) { server.createList('allocation', 5); + // Count draining and ineligible nodes. + const counts = { + ineligible: 0, + draining: 0, + }; + server.db.nodes.forEach((n) => { + if (n.schedulingEligibility === 'ineligible') { + counts['ineligible'] += 1; + } + if (n.drain) { + counts['draining'] += 1; + } + }); + await Topology.visit(); - assert.dom('[data-test-topo-viz-node]').exists({ count: 15 }); + assert.dom('[data-test-topo-viz-node]').exists({ count: 17 }); + // Test search. await typeIn('input.node-search', server.schema.nodes.first().name); assert.dom('[data-test-topo-viz-node]').exists({ count: 1 }); await typeIn('input.node-search', server.schema.nodes.first().name); assert.dom('[data-test-topo-viz-node]').doesNotExist(); await click('[title="Clear search"]'); - assert.dom('[data-test-topo-viz-node]').exists({ count: 15 }); + assert.dom('[data-test-topo-viz-node]').exists({ count: 17 }); + // Test node class filter. await Topology.facets.class.toggle(); await Topology.facets.class.options .findOneBy('label', 'foo-bar-baz') @@ -361,6 +383,29 @@ module('Acceptance | topology', function (hooks) { .findOneBy('label', 'foo-bar-baz') .toggle(); + // Test ineligible state filter. + await Topology.facets.state.toggle(); + await Topology.facets.state.options + .findOneBy('label', 'Ineligible') + .toggle(); + assert + .dom('[data-test-topo-viz-node]') + .exists({ count: counts['ineligible'] }); + await Topology.facets.state.options + .findOneBy('label', 'Ineligible') + .toggle(); + await Topology.facets.state.toggle(); + + // Test draining state filter. + await Topology.facets.state.toggle(); + await Topology.facets.state.options.findOneBy('label', 'Draining').toggle(); + assert + .dom('[data-test-topo-viz-node]') + .exists({ count: counts['draining'] }); + await Topology.facets.state.options.findOneBy('label', 'Draining').toggle(); + await Topology.facets.state.toggle(); + + // Test node pool filter. await Topology.facets.nodePool.toggle(); await Topology.facets.nodePool.options .findOneBy('label', 'test-node-pool') From 30425d36dda678e88dcaad156c4739c7e4c40569 Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Thu, 13 Jul 2023 14:15:10 -0400 Subject: [PATCH 2/2] changelog: add entry for #17940 --- .changelog/17940.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/17940.txt diff --git a/.changelog/17940.txt b/.changelog/17940.txt new file mode 100644 index 000000000000..a40be61310ae --- /dev/null +++ b/.changelog/17940.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fixed a bug that prevented nodes from being filtered by the "Ineligible" and "Draining" state filters +```