Skip to content

Commit

Permalink
fix(sentry): Fix Sentry integration not working (#2329)
Browse files Browse the repository at this point in the history
Closes #2328
  • Loading branch information
pkvach authored Sep 23, 2024
1 parent b2c4cfc commit c3d4f67
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/content/sentry.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
'use strict';

togglbutton.render('.group-detail:not(.toggl)', { observe: true }, function () {
const errType = $('h3 > span > span').textContent.trim();
const detail = $('.message').textContent.trim();
const project = $('.project-select').textContent.trim();
const description = errType + ': ' + detail;
togglbutton.render('.group-detail:not(.toggl)', { observe: true }, function (elem) {
const pageTitle = $('title').textContent.trim();

// Extract the project name from the page title, assuming it's the last part after ' — '
const pageTitleParts = pageTitle.split(' — ');
const projectName = pageTitleParts.length > 1 ? pageTitleParts[pageTitleParts.length - 1] : '';

const link = togglbutton.createTimerLink({
className: 'sentry',
description: description,
projectName: project
description: pageTitle,
projectName: projectName
});

$('.group-detail .nav-tabs').appendChild(link);
const tabListElement = elem.querySelector('ul[role="tablist"]');
if (tabListElement) {
tabListElement.appendChild(link);
}
});

0 comments on commit c3d4f67

Please sign in to comment.