Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add iTop integration #2133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
32 changes: 32 additions & 0 deletions src/content/itop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

// Main function
togglbutton.render(
// Specify selector for element button needs to hook into
// Make sure to include :not(.toggl) to avoid duplicates
'.ibo-object-details[data-object-class="Incident"] .ibo-panel--header .ibo-panel--header-left .ibo-panel--titles .ibo-panel--title:not(.toggl),.ibo-object-details[data-object-class="Problem"] .ibo-panel--header .ibo-panel--header-left .ibo-panel--titles .ibo-panel--title:not(.toggl),.ibo-object-details[data-object-class="UserRequest"] .ibo-panel--header .ibo-panel--header-left .ibo-panel--titles .ibo-panel--title:not(.toggl)',
{ observe: true },
function (elem) {
// Create timer link element
const link = togglbutton.createTimerLink({
description: getTitle(elem),
projectName: 'My Project',
tags: [getTitle(elem)]
});
// You can also pass function to description, projectName, and tags arguments

// Add Space
elem.appendChild(document.createTextNode (" "));
// Add link to element
elem.appendChild(link);
}
);

function getTitle (parent) {
//const el = parent.querySelector('.title');
return getIncident(parent) + ' - ' + $('.ibo-field[data-attribute-code="title"] .ibo-field--value').textContent.trim();
}

function getIncident(parent) {
return parent ? parent.textContent.trim() : '';
}
4 changes: 4 additions & 0 deletions src/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ export default {
url: '*://*.intercom.com/*',
name: 'Intercom'
},
'combodo.com': {
url: '*://*.combodo.com/*',
name: 'iTop'
},
'jira.com': {
url: '*://*.jira.com/*',
name: 'Jira',
Expand Down