From 64d2174e46e56f35d01ad653cb5c3726a8663fe1 Mon Sep 17 00:00:00 2001 From: somenewacc <62895232+somenewacc@users.noreply.github.com> Date: Mon, 4 Sep 2023 20:56:07 +0300 Subject: [PATCH] [TestRun] Fix filter check on TestRun page when a TestRun is filtered via query param (?status_id=) if you change statuses then `stop_date` field will also change once all of the filtered TestExecution rows become non-neutral. This is a bug because the page isn't checking all TEs outside of the currently filtered selection! --- tcms/testruns/static/testruns/js/get.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tcms/testruns/static/testruns/js/get.js b/tcms/testruns/static/testruns/js/get.js index 52e6ff36ea..cfc06d4d49 100644 --- a/tcms/testruns/static/testruns/js/get.js +++ b/tcms/testruns/static/testruns/js/get.js @@ -242,6 +242,11 @@ export function pageTestrunsGetReadyHandler () { }) } +function isFiltered () { + const filterParams = new URLSearchParams(location.search) + return $('#toolbar-filter').val() !== '' || filterParams.has('status_id') +} + function filterTestExecutionsByProperty (runId, executions, filterBy, filterValue) { // no input => show all rows if (filterValue.trim().length === 0) { @@ -496,7 +501,7 @@ function getExpandArea (testExecution) { const $this = $(this) jsonRPC('TestExecution.update', [testExecution.id, testExecutionUpdateArgs(statusId)], execution => { // update TestRun if not filtered - reloadRowFor(execution, $('#toolbar-filter').val() === '') + reloadRowFor(execution, !isFiltered()) $this.parents('.list-group-item-container').addClass('hidden') // click the .list-group-item-header, not the .test-execution-element itself, because otherwise the handler will fail @@ -751,11 +756,10 @@ function changeStatusBulk (statusId) { } const updateArgs = testExecutionUpdateArgs(statusId) - const notFiltered = $('#toolbar-filter').val() === '' selected.executionIds.forEach(executionId => { jsonRPC('TestExecution.update', [executionId, updateArgs], execution => { // update TestRun if not filtered - reloadRowFor(execution, notFiltered) + reloadRowFor(execution, !isFiltered()) }) }) }