Skip to content

Commit

Permalink
Hide +/- button for TP when 0 children shown on Search Test Plans page
Browse files Browse the repository at this point in the history
this is the Expand/Collapse button in the first columns of the table.
It shouldn't be visible if there's nothing we can show under it!
  • Loading branch information
atodorov committed Nov 28, 2023
1 parent b02f2db commit 5c29eda
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tcms/testplans/static/testplans/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,18 @@ export function pageTestplansSearchReadyHandler () {
$('.children-not-shown-message').hide()

data.each(function (row) {
if (row.children__count && row.children__count > hiddenChildRows[row.id].length) {
$(`.test-plan-row-${row.id} .children-not-shown-message`).show()
if (row.children__count) {
const selectedChildren = hiddenChildRows[row.id] ? hiddenChildRows[row.id] : []

// some children are filtered out, display imbalance icon
if (row.children__count > selectedChildren.length) {
$(`.test-plan-row-${row.id} .children-not-shown-message`).show()
}

// all children filtered out, hide +/- button
if (selectedChildren.length === 0) {
$(`.test-plan-row-${row.id} .dt-control`).toggleClass('dt-control')
}
}
})
},
Expand Down

0 comments on commit 5c29eda

Please sign in to comment.