Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ By default, Violentmonkey will auto-update scripts from the original install loc
- Reviews show build status (if it's empty, there isn't a merge commit or a build configured)
- If a PR has bug work items associated with it, we add a label with the severity of such bugs (if SEV == 1 or 2)
- Repo pull request listings will also link to the overall account-wide PR dashboard
- Each PR is annotated with source branch name.
- Target branch is hidden for PRs targeting `main` or `master`.
- At [NI](https://www.ni.com), some labels get coloring (e.g. "bypass owners" gets a red background)
- At [NI](https://www.ni.com), reviews are annotated with how long you've been on it if it's been over 1 weekday and you haven't voted or commented

Expand Down
36 changes: 32 additions & 4 deletions src/azdo-pr-dashboard.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==

// @name More Awesome Azure DevOps (userscript)
// @version 3.10.0
// @version 3.11.0
// @author Alejandro Barreto (NI)
// @description Makes general improvements to the Azure DevOps experience, particularly around pull requests. Also contains workflow improvements for NI engineers.
// @license MIT
Expand Down Expand Up @@ -76,10 +76,12 @@
'agent-arbitration-status-off': 'Off',
});

eus.showTipOnce('release-2026-04-17', 'New in the AzDO userscript', `
<p>Highlights from the 2026-04-17 update!</p>
eus.showTipOnce('release-2026-05-01', 'New in the AzDO userscript', `
<p>Highlights from the 2026-05-01 update!</p>
<p>Changes to the PR dashboard view:</p>
<ul>
<li>Switch from Rebrandly to GitHub for update URL (#247)</li>
<li>Source branch name is now shown for each PR.</li>
<li>Target branch name is hidden if it's <code>main</code> or <code>master</code>.</li>
</ul>
<p>Comments, bugs, suggestions? File an issue on <a href="https://github.com/alejandro5042/azdo-userscripts" target="_blank">GitHub</a> 🧡</p>
`);
Expand Down Expand Up @@ -1255,6 +1257,11 @@
.swal2-html-container {
text-align: left;
}
.swal2-html-container code {
background-color: rgba(0,0,0,.06);
padding: 0.2em 0.4em;
border-radius: 0.2em;
}
.swal2-html-container li {
list-style: disc;
margin-left: 4ch;
Expand Down Expand Up @@ -1547,6 +1554,7 @@
await annotateBugsOnPullRequestRow(row, pr);
await annotateFileCountOnPullRequestRow(row, pr);
await annotateBuildStatusOnPullRequestRow(row, pr);
annotateSourceBranchOnPullRequestRow(row, pr);

if (votes.userVote === 0 && votes.missingVotes === 1 && votes.userIsRequired && !votes.userHasDeclined) {
annotatePullRequestTitle(row, 'repos-pr-list-late-review-pill', 'Last Reviewer', 'Everyone is waiting on you!');
Expand All @@ -1567,6 +1575,7 @@
await annotateBugsOnPullRequestRow(row, pr);
await annotateFileCountOnPullRequestRow(row, pr);
await annotateBuildStatusOnPullRequestRow(row, pr);
annotateSourceBranchOnPullRequestRow(row, pr);
}
}

Expand Down Expand Up @@ -1717,6 +1726,25 @@
annotatePullRequestLabel(row, 'build-status', tooltip, label);
}

function annotateSourceBranchOnPullRequestRow(row, pr) {
if (!pr.lastMergeCommit) return;

const sourceBranch = pr.sourceRefName.replace(/^refs\/heads\//, '');

const secondary = row.querySelector('.secondary-text span');
if (['refs/heads/master', 'refs/heads/main'].includes(pr.targetRefName)) {
// Hide target branch and icon if it's main or master, which is very common
secondary.querySelector('.ms-Icon--OpenSource').remove(); // Branch icon
secondary.querySelector('.monospaced-xs').remove(); // Branch name
secondary.innerHTML = secondary.innerHTML.replace('into ', '');
}

const sourceBranchAnnotation = `from
<span class="fluent-icons-enabled"><span aria-hidden="true" class="flex-noshrink fabric-icon ms-Icon--OpenSource"
></span></span><span class="monospaced-xs padding-horizontal-4">${sourceBranch}</span>`;
secondary.insertAdjacentHTML('beforeend', sourceBranchAnnotation);
}

function annotatePullRequestTitle(row, cssClass, message, tooltip) {
const blockingAnnotation = `
<div aria-label="Auto-complete" class="${cssClass} flex-noshrink margin-left-4 bolt-pill flex-row flex-center outlined compact" data-focuszone="focuszone-19" role="presentation" title="${tooltip}">
Expand Down
Loading