Skip to content

Add user autocomplete for test run assignee updates#4356

Open
gondamol wants to merge 1 commit into
kiwitcms:masterfrom
gondamol:rfe-user-autocomplete-test-run
Open

Add user autocomplete for test run assignee updates#4356
gondamol wants to merge 1 commit into
kiwitcms:masterfrom
gondamol:rfe-user-autocomplete-test-run

Conversation

@gondamol

@gondamol gondamol commented May 20, 2026

Copy link
Copy Markdown

Summary

  • replace the Test Run bulk assignee prompt() with a Bootstrap modal
  • add a reusable typeahead.js user autocomplete backed by the existing User.filter JSON-RPC method
  • keep manual assignee entry available when the user lacks auth.view_user
  • keep the existing TestExecution.update flow and add view coverage for modal visibility/permission text

Fixes #2510

Verification

  • cd tcms && .\node_modules\.bin\eslint.cmd static\js\jsonrpc.js testruns\static\testruns\js\get.js
  • git diff --check

Test Coverage

  • Added view assertions for the assignee modal and auth.view_user-dependent help text.

Copilot AI review requested due to automatic review settings May 20, 2026 13:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Test Run “bulk change assignee” UX by replacing the prompt() flow with a Bootstrap modal and adding a typeahead-backed user autocomplete powered by the existing User.filter JSON-RPC method. It also extends Django view coverage to assert that the assignee UI elements are only visible when the user has the necessary permissions.

Changes:

  • Replace bulk assignee prompt() with a Bootstrap modal form in the Test Run “get” page.
  • Add a typeahead.js user autocomplete that queries User.filter and maps the selected display value back to a username for TestExecution.update.
  • Add view tests that check modal visibility based on testruns.change_testexecution permission.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tcms/testruns/tests/test_views.py Adds assertions ensuring the new assignee modal is present/absent depending on permissions.
tcms/testruns/templates/testruns/get.html Introduces the Bootstrap modal markup for changing assignees in bulk.
tcms/testruns/static/testruns/js/get.js Implements modal open/submit behavior and adds the User.filter-backed typeahead autocomplete.
Comments suppressed due to low confidence (1)

tcms/testruns/static/testruns/js/get.js:880

  • The modal is closed by simulating a click on the close button. This is fragile (depends on the specific button selector) and bypasses Bootstrap’s modal API. Prefer closing with $('#change-assignee-modal').modal('hide') so the logic keeps working if the modal header markup changes.

        changeAssigneeBulk(selected.executionIds, assignee)
        $('#change-assignee-modal button.close').click()
        return false
    })

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</div>
</div>

{% if perms.testruns.change_testexecution %}
Comment thread tcms/testruns/static/testruns/js/get.js Outdated
Comment on lines +262 to +266
function userAutoComplete (selector, cache) {
$(`${selector}.typeahead`).typeahead({
minLength: 1,
highlight: true
}, {
Comment thread tcms/testruns/static/testruns/js/get.js Outdated
Comment on lines +286 to +300
if (isNaN(query)) {
if (query.length < 3) {
return
}

rpcQuery = { username__icontains: query }
if (query.indexOf('@') > -1) {
rpcQuery = { email__icontains: query }
}
}

jsonRPC('User.filter', rpcQuery, function (data) {
return processAsync(data)
})
}
@gondamol gondamol force-pushed the rfe-user-autocomplete-test-run branch from ad61aa8 to 7576bcc Compare May 20, 2026 15:28
@gondamol

gondamol commented May 20, 2026

Copy link
Copy Markdown
Author

Updated the branch to address the review points:

  • autocomplete now initializes only when the page reports perms.auth.view_user; users without that permission still get the modal and can enter an exact username/email/user ID manually
  • moved the reusable user typeahead setup into tcms/static/js/jsonrpc.js
  • replaced the close-button click with $('#change-assignee-modal').modal('hide')
  • extended the view assertions for the user-view permission flag/help text

Rechecked:

  • cd tcms && .\node_modules\.bin\eslint.cmd static\js\jsonrpc.js testruns\static\testruns\js\get.js
  • git diff --check

@atodorov atodorov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to duplicate/build on top of
#4353 which in itself very much resembles #3250.

If you are willing to work on this we need to resolve comments on older contributions first, then build on top of that, not starting everything from scratch.

I will comment on the other PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFE: Show drop down w/ auto-complete for user selection in Test Run Page

3 participants