Skip to content

Commit

Permalink
[TestRun] Fix filter check, fix delete expandedExecutionIds
Browse files Browse the repository at this point in the history
  • Loading branch information
somenewacc committed Sep 4, 2023
1 parent 0dbcc40 commit d1ca5de
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tcms/testruns/static/testruns/js/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function pageTestrunsGetReadyHandler () {
jsonRPC('TestExecution.add_comment', [executionId, comment], () => {
const testExecutionRow = $(`.test-execution-${executionId}`)
animate(testExecutionRow, () => {
delete expandedExecutionIds[expandedExecutionIds.indexOf(executionId)]
expandedExecutionIds.splice(expandedExecutionIds.indexOf(executionId), 1)
})
})
})
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -730,7 +735,7 @@ function renderTestExecutionRow (testExecution) {
template.find('.one-click-bug-report-button').click(() => fileBugFromExecution(testExecution))

// remove from expanded list b/c data may have changed
delete expandedExecutionIds[expandedExecutionIds.indexOf(testExecution.id)]
expandedExecutionIds.splice(expandedExecutionIds.indexOf(testExecution.id), 1)

// WARNING: only comments related stuff below
if (!permissions.addComment) {
Expand All @@ -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())
})
})
}
Expand Down Expand Up @@ -923,7 +927,7 @@ function removeCases (testRunId, testCaseIds) {
.data('test-execution-id')
$(`.test-execution-case-${testCaseId}`).remove()

delete expandedExecutionIds[expandedExecutionIds.indexOf(tePK)]
expandedExecutionIds.splice(expandedExecutionIds.indexOf(tePK), 1)
delete allExecutions[tePK]

const testExecutionCountEl = $('.test-executions-count')
Expand Down

0 comments on commit d1ca5de

Please sign in to comment.