Skip to content

Commit

Permalink
fix(youtrack): Fix Toggl button disappeared after UI update (#2270)
Browse files Browse the repository at this point in the history
* fix(youtrack): Fix Toggl button disappeared after UI update

Closes #2265

* feat(youtrack): Update domain and integration for issues

---------

Co-authored-by: Shrey Gupta <[email protected]>
  • Loading branch information
pkvach and with-shrey authored Mar 5, 2024
1 parent 3057fb4 commit 0f0e92c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions src/content/youtrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ togglbutton.render(
}
);

/* new view for single issues — since YouTrack 2023.3 */
togglbutton.render(
'div[data-test="issue-container"]:not(.toggl)',
{ observe: true },
function (elem) {
console.log('Toggl Button: Reporter info not found.')
const reporterInfo = elem.querySelector('span[data-test="reporter-info"]');
if (reporterInfo === null) {
console.log('Toggl Button: Reporter info not found.')
return;
}
const reporterInfoContainer = reporterInfo.parentElement;

const issueIdElem = reporterInfoContainer.querySelector('a[href*="issue/"] > span');
const issueId = issueIdElem ? issueIdElem.textContent.trim() : "";

const issueTitleElem = elem.querySelector('h1');
const issueTitle = issueTitleElem ? issueTitleElem.textContent.trim() : "";

const link = togglbutton.createTimerLink({
description: issueId + ' ' + issueTitle,
projectName: issueId.split('-')[0]
});

reporterInfoContainer.insertBefore(link, reporterInfo);
}
);

// Agile board
togglbutton.render('.yt-agile-card:not(.toggl)', { observe: true }, function (
elem
Expand Down
4 changes: 2 additions & 2 deletions src/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,8 @@ export default {
name: 'Xero',
file: 'xero.js'
},
'myjetbrains.com': {
url: '*://*.myjetbrains.com/*',
'jetbrains.com': {
url: '*://*.jetbrains.com/*',
name: 'YouTrack',
file: 'youtrack.js'
},
Expand Down

0 comments on commit 0f0e92c

Please sign in to comment.