Skip to content

Commit 1dacc45

Browse files
committed
Show ID - Status for each TestExecution line in TestRun view page
- only bug ID is shown instead of the full URL - hovering the mouse over the `ID - Status` text will display bug title - only the last bug attached to a TestExecution record is shown b/c there could be many others - Works also when attaching a new link to a bug and/or creating a new bug via 1-click bug reporting. Closes #3748
1 parent 77bf3c8 commit 1dacc45

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

tcms/testruns/static/testruns/js/get.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ const permissions = {
2424
}
2525
const autocompleteCache = {}
2626

27+
function showLastBugForTe (testExecutionRow, bugUrl) {
28+
const jsBugs = testExecutionRow.find('.js-bugs')
29+
jsBugs.removeClass('hidden')
30+
31+
const lastBugAnchor = jsBugs.find('a')
32+
lastBugAnchor.attr('href', bugUrl)
33+
34+
jsonRPC('Bug.details', bugUrl, (details) => {
35+
lastBugAnchor.text(`${details.id} - ${details.status}`)
36+
lastBugAnchor.attr('title', details.title)
37+
})
38+
}
39+
2740
export function pageTestrunsGetReadyHandler () {
2841
permissions.removeTag = $('#test_run_pk').data('perm-remove-tag') === 'True'
2942
permissions.addComment = $('#test_run_pk').data('perm-add-comment') === 'True'
@@ -596,7 +609,8 @@ function renderAdditionalInformation (testRunId, execution) {
596609
}
597610
})
598611
for (const teId of Object.keys(withDefects)) {
599-
$(`.test-execution-${teId}`).find('.js-bugs').removeClass('hidden')
612+
const lastBug = withDefects[teId]
613+
showLastBugForTe($(`.test-execution-${teId}`), lastBug.url)
600614
}
601615
})
602616

@@ -850,6 +864,7 @@ function fileBugFromExecution (execution) {
850864

851865
// unescape b/c Issue #1533
852866
const targetUrl = result.response.replace(/&/g, '&')
867+
showLastBugForTe($(`.test-execution-${execution.id}`), targetUrl)
853868
window.open(targetUrl, '_blank')
854869
})
855870
return false
@@ -880,7 +895,7 @@ function addLinkToExecutions (testExecutionIDs) {
880895
const testExecutionRow = $(`div.list-group-item.test-execution-${testExecutionId}`)
881896
animate(testExecutionRow, () => {
882897
if (link.is_defect) {
883-
testExecutionRow.find('.js-bugs').removeClass('hidden')
898+
showLastBugForTe(testExecutionRow, link.url)
884899
}
885900
const ul = testExecutionRow.find('.test-execution-hyperlinks')
886901
ul.append(renderLink(link))

tcms/testruns/templates/testruns/get.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,9 @@ <h5><span class="test-executions-count"></span> {% trans 'records' %}</h5>
376376
<span class="fa fa-search"></span>
377377
<span class="test-execution-tester"></span>
378378
</div>
379-
<div title="{% trans 'Bugs' %}" class="list-view-pf-additional-info-item js-bugs hidden">
379+
<div title="{% trans 'Last bug' %}" class="list-view-pf-additional-info-item js-bugs hidden">
380380
<span class="fa fa-bug kiwi-color-red"></span>
381+
<a href="#" target="_blank" title="{% trans 'Last bug' %}"></a>
381382
</div>
382383
</div>
383384
<div class="list-view-pf-additional-info" style="width: 30%;">

0 commit comments

Comments
 (0)