From 52ba1e18b09445aa4065019bd75d3a2d120fd417 Mon Sep 17 00:00:00 2001 From: Greg Jacobs Date: Sat, 1 Jun 2024 12:33:51 -0400 Subject: [PATCH] Initial Commit --- CHANGELOG.md | 22 ++++++ README.MD | 23 ++++++ src/data/completeissuetypelist.txt | 38 ++++++++++ src/data/excelissuetypes.txt | 27 ++++++++ src/helpers/dag.js | 18 +++++ src/helpers/hashid.js | 21 ++++++ src/helpers/jira.js | 26 +++++++ src/helpers/moids.js | 26 +++++++ src/helpers/rbc-di-featureflags.js | 96 ++++++++++++++++++++++++++ src/helpers/workspace.js | 91 ++++++++++++++++++++++++ src/ideas/network-checker.js | 36 ++++++++++ src/ideas/newideashere.txt | 1 + src/ideas/released/featureflagging.txt | 9 +++ src/scratchpad/listChecker.js | 14 ++++ 14 files changed, 448 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 README.MD create mode 100644 src/data/completeissuetypelist.txt create mode 100644 src/data/excelissuetypes.txt create mode 100644 src/helpers/dag.js create mode 100644 src/helpers/hashid.js create mode 100644 src/helpers/jira.js create mode 100644 src/helpers/moids.js create mode 100644 src/helpers/rbc-di-featureflags.js create mode 100644 src/helpers/workspace.js create mode 100644 src/ideas/network-checker.js create mode 100644 src/ideas/newideashere.txt create mode 100644 src/ideas/released/featureflagging.txt create mode 100644 src/scratchpad/listChecker.js diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..50b4184 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [0.0.1] - 2025-06-01 + +### Added +- [helpers/dag.js](src/helpers/dag.js) +- [helpers/hashid.js](src/helpers/hashid.js) +- [helpers/jira.js](src/helpers/jira.js) +- [helpers/moids.js](src/helpers/moids.js) +- [helpers/rbc-di-featureflags.js](src/helpers/rbc-di-featureflags.js) +- [helpers/workspace.js](src/helpers/workspace.js) +- [ideas/newideashere.txt](src/ideas/newideashere.txt) +- [ideas/released/featureflagging.txt](src/ideas/released/featureflagging.txt) +- [data folder](src/data) +- [complete issue type list](src/data/completeissuetypelist.txt) +- [excel issue types srini found ](src/data/excelissuetypes.txt) +- [scratchpad folder](src/scratchpad) +- [list checker](src/scratchpad/listChecker.js) +- [README.md](README.MD) +- [CHANGELOG.md](CHANGELOG.md) \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..a7a2177 --- /dev/null +++ b/README.MD @@ -0,0 +1,23 @@ +# Project Title + +This project contains several files that perform various tasks. Here's a brief overview of each file: + +## DAG + +This JavaScript file contains a bookmarklet function that prompts the user for a list of DAG Task numbers, separated by commas. For each provided number, it opens a new browser tab with the corresponding DAG Task details page. If the user doesn't provide any input, it opens the default DAG Tasks page in a new tab. This can be useful for quickly accessing multiple DAG Task details pages based on user input. + +## hashid + +This JavaScript file contains a bookmarklet function that takes a string, decodes it using decodeURIComponent, alerts the decoded string, and copies the result to the clipboard. + +## jira.js + +This JavaScript file contains a bookmarklet function that prompts the user for a JIRA ticket number and then opens a new browser tab with the corresponding JIRA page for that ticket. + +## moid.js + +This JavaScript file contains a bookmarklet function that prompts the user for a MOID (Markit On Demand) number and then opens a new browser tab to the corresponding Jira page for that MOID. + +## moids.js + +This JavaScript file contains a bookmarklet function that prompts the user for multiple MOID (Markit On Demand) numbers and then opens a new browser tab for each corresponding Jira page for those MOIDs. \ No newline at end of file diff --git a/src/data/completeissuetypelist.txt b/src/data/completeissuetypelist.txt new file mode 100644 index 0000000..d8c2b2a --- /dev/null +++ b/src/data/completeissuetypelist.txt @@ -0,0 +1,38 @@ +ADR +ALN +CL +CF +CS +CLRT +CSRT +CPRT +VB +CP +DEB +DR +DRRT +ETF +ETMF +ETN +ETV +ETC +FRC +FRG +FX +FU +BD +GB +IN +IDR +MMF +MF +OF +OP +PS +PR +PRRT +RT +SRN +UT +UTRT +WT diff --git a/src/data/excelissuetypes.txt b/src/data/excelissuetypes.txt new file mode 100644 index 0000000..a45e20e --- /dev/null +++ b/src/data/excelissuetypes.txt @@ -0,0 +1,27 @@ +CF +CL +CLRT +CP +CPRT +CS +CSRT +DEB +DR +DRRT +ETF +ETN +FU +FX +GB +IN +MF +MMF +OF +PR +PRRT +PS +RT +SRN +UT +UTRT +WT \ No newline at end of file diff --git a/src/helpers/dag.js b/src/helpers/dag.js new file mode 100644 index 0000000..f1d83af --- /dev/null +++ b/src/helpers/dag.js @@ -0,0 +1,18 @@ +/** + * Opens the DAG Task details page(s) based on user input. + * If user provides a comma-separated list of DAG Task numbers, it opens each task's details page in a new tab. + * If user does not provide any input, it opens the default DAG Tasks page in a new tab. + */ +javascript:(function() { + let answers = prompt("Enter the DAG Task #s, separated by commas"); + const splitAnswers = answers ? answers.split(",") : false; + let url = "https://dag.tools.mdgapp.net/Tasks/Tasks.asp"; + if (splitAnswers) { + splitAnswers.forEach(answer => { + let moidUrl = "https://dag.tools.mdgapp.net/Tasks/TaskDetail.asp?Cmd=Details&TaskID=" + answer.trim(); + window.open(moidUrl, '_blank'); + }); + } else { + window.open(url, '_blank').focus(); + } +})(); \ No newline at end of file diff --git a/src/helpers/hashid.js b/src/helpers/hashid.js new file mode 100644 index 0000000..69383b7 --- /dev/null +++ b/src/helpers/hashid.js @@ -0,0 +1,21 @@ +/** + * This JavaScript function takes a string, decodes it using decodeURIComponent, + * alerts the decoded string, and copies the result to the clipboard. + * + * The function works as follows: + * 1. Takes a string as input. + * 2. Decodes the string using decodeURIComponent. + * 3. Alerts the decoded string. + * 4. Copies the decoded string to the clipboard. + * + * Note: This function uses the Clipboard API which might not be fully supported in all browsers. + */ +javascript:(function() { + let answer = prompt("Enter the HashID"); + let decodedStr = decodeURIComponent(answer); + alert(decodedStr); + + navigator.clipboard.writeText(decodedStr) + .then(() => console.log('Decoded string copied to clipboard')) + .catch(err => console.error('Error in copying decoded string to clipboard: ', err)); +})(); \ No newline at end of file diff --git a/src/helpers/jira.js b/src/helpers/jira.js new file mode 100644 index 0000000..b698361 --- /dev/null +++ b/src/helpers/jira.js @@ -0,0 +1,26 @@ +/** + * This JavaScript function is a bookmarklet that prompts the user for a JIRA ticket number + * and then opens a new browser tab with the corresponding JIRA page for that ticket. + * + * The function works as follows: + * 1. Prompts the user to enter a JIRA ticket number. The entered value is stored in the `answer` variable. + * 2. Sets a default URL to the JIRA dashboard. + * 3. Checks if the user entered a value in the prompt. + * 4. If the user entered a value, changes the URL to point to the specific JIRA page for the entered ticket number. + * 5. Opens the URL in a new browser tab and brings focus to it. + * + * Note: This function is wrapped in a self-invoking function `(function() {...})();` which means it will automatically execute as soon as it is defined. + */ +javascript:(function() { + let answers = prompt("Enter the JIRA Tickets, separated by commas"); + const splitAnswers = answers ? answers.split(",") : false; + let url = "https://fincentric.atlassian.net/jira/software/c/projects/DIP/boards/513"; + if (splitAnswers) { + splitAnswers.forEach(answer => { + let moidUrl = "https://fincentric.atlassian.net/browse/" + answer.trim(); + window.open(moidUrl, '_blank'); + }); + } else { + window.open(url, '_blank').focus(); + } +})(); \ No newline at end of file diff --git a/src/helpers/moids.js b/src/helpers/moids.js new file mode 100644 index 0000000..20d8a6d --- /dev/null +++ b/src/helpers/moids.js @@ -0,0 +1,26 @@ +/** + * This JavaScript function is a bookmarklet that prompts the user for multiple MOID (Markit On Demand) numbers + * and then opens a new browser tab for each corresponding Jira page for those MOIDs. + * + * The function works as follows: + * 1. Prompts the user to enter MOID numbers separated by commas. The entered values are stored in the `answers` array. + * 2. Sets a default URL to the Jira dashboard. + * 3. Checks if the user entered any values in the prompt. + * 4. If the user entered values, changes the URL to point to the specific Jira page for each entered MOID number. + * 5. Opens each URL in a new browser tab and brings focus to the last opened tab. + * + * Note: This function is wrapped in a self-invoking function `(function() {...})();` which means it will automatically execute as soon as it is defined. + */ +javascript:(function() { + let answers = prompt("Enter the MOID #s, separated by commas"); + const splitAnswers = answers ? answers.split(",") : false; + let url = "https://jira.ihsmarkit.com/secure/Dashboard.jspa?selectPageId=63222"; + if (splitAnswers) { + splitAnswers.forEach(answer => { + let moidUrl = "https://jira.ihsmarkit.com/browse/MOID-" + answer.trim(); + window.open(moidUrl, '_blank'); + }); + } else { + window.open(url, '_blank').focus(); + } +})(); \ No newline at end of file diff --git a/src/helpers/rbc-di-featureflags.js b/src/helpers/rbc-di-featureflags.js new file mode 100644 index 0000000..7f2b9d3 --- /dev/null +++ b/src/helpers/rbc-di-featureflags.js @@ -0,0 +1,96 @@ +/** + * This function creates a modal dialog that allows the user to toggle feature flags. + * It retrieves the feature flags from the session storage, creates checkboxes for each flag, + * and saves the updated flags back to the session storage when the user clicks the save button. + * The modal dialog is appended to the document body and can be closed by clicking the save button. + */ +javascript:(function() { + let data = sessionStorage.getItem('rbc_di_session'); + let parsedData = JSON.parse(data); + let features = parsedData.features || {}; + + let modal = document.createElement('div'); + modal.style.position = 'fixed'; + modal.style.top = '50%'; + modal.style.left = '50%'; + modal.style.transform = 'translate(-50%, -50%)'; + modal.style.backgroundColor = 'white'; + modal.style.padding = '20px'; + modal.style.border = '1px solid black'; + modal.style.zIndex = '999'; + modal.style.display = 'flex'; + modal.style.flexWrap = 'wrap'; + + for (let key in features) { + if (features.hasOwnProperty(key) && typeof features[key] === 'boolean') { + let checkboxContainer = document.createElement('div'); + checkboxContainer.style.width = '50%'; + + let checkbox = document.createElement('input'); + checkbox.type = 'checkbox'; + checkbox.id = key; + checkbox.checked = features[key]; + + let label = document.createElement('label'); + label.htmlFor = key; + label.innerText = key; + + checkboxContainer.appendChild(checkbox); + checkboxContainer.appendChild(label); + modal.appendChild(checkboxContainer); + } + } + + let saveButton = document.createElement('button'); + saveButton.innerText = 'Save'; + saveButton.addEventListener('click', function() { + const checkboxes = modal.querySelectorAll('input[type="checkbox"]'); + checkboxes.forEach(function(checkbox) { + features[checkbox.id] = checkbox.checked; + }); + parsedData.features = features; + sessionStorage.setItem('rbc_di_session', JSON.stringify(parsedData)); + location.reload(); + }); + + let closeButton = document.createElement('button'); + closeButton.innerText = 'X'; + closeButton.style.position = 'absolute'; + closeButton.style.right = '10px'; + closeButton.style.top = '10px'; + closeButton.addEventListener('click', function() { + document.body.removeChild(modal); + document.body.removeChild(overlay); + }); + + let cancelButton = document.createElement('button'); + cancelButton.innerText = 'Cancel'; + cancelButton.addEventListener('click', function() { + document.body.removeChild(modal); + document.body.removeChild(overlay); + }); + + let buttonContainer = document.createElement('div'); + buttonContainer.style.width = '100%'; + buttonContainer.style.display = 'flex'; + buttonContainer.style.justifyContent = 'center'; + buttonContainer.style.marginTop = '20px'; + + buttonContainer.appendChild(saveButton); + buttonContainer.appendChild(cancelButton); + + modal.appendChild(closeButton); + modal.appendChild(buttonContainer); + + let overlay = document.createElement('div'); + overlay.style.position = 'fixed'; + overlay.style.top = '0'; + overlay.style.left = '0'; + overlay.style.width = '100%'; + overlay.style.height = '100%'; + overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; + overlay.style.zIndex = '998'; + + document.body.appendChild(overlay); + document.body.appendChild(modal); +})(); \ No newline at end of file diff --git a/src/helpers/workspace.js b/src/helpers/workspace.js new file mode 100644 index 0000000..63e571b --- /dev/null +++ b/src/helpers/workspace.js @@ -0,0 +1,91 @@ +javascript:(function() { + const urls = { + JIRAMetricsDashboard: "https://fincentric.atlassian.net/jira/dashboards/14019/", + JIRABoard: "https://fincentric.atlassian.net/jira/software/c/projects/DIP/boards/513", + MOIDDashboard: "https://jira.ihsmarkit.com/secure/Dashboard.jspa?selectPageId=63222", + DIUserLoginsConfluencePage: "https://confluence.ihsmarkit.com/pages/viewpage.action?spaceKey=MOD&title=DI+User+Logins#direct-investing--686175318", + WEUserAdmin: "https://intranet.tools.mdgapp.net/P/PTC1/UserAdmin" + }; + + let modal = document.createElement('div'); + modal.style.position = 'fixed'; + modal.style.top = '50%'; + modal.style.left = '50%'; + modal.style.transform = 'translate(-50%, -50%)'; + modal.style.backgroundColor = 'white'; + modal.style.padding = '20px'; + modal.style.border = '1px solid black'; + modal.style.zIndex = '999'; + modal.style.display = 'flex'; + modal.style.flexWrap = 'wrap'; + + Object.keys(urls).forEach(key => { + let checkboxContainer = document.createElement('div'); + checkboxContainer.style.width = '50%'; + + const checkbox = document.createElement('input'); + checkbox.type = 'checkbox'; + checkbox.id = key; + checkbox.name = key; + checkbox.value = urls[key]; + + const label = document.createElement('label'); + label.htmlFor = key; + label.innerText = key.split(/(?=[A-Z][a-z])/).join(' '); + + checkboxContainer.appendChild(checkbox); + checkboxContainer.appendChild(label); + modal.appendChild(checkboxContainer); + }); + + const startButton = document.createElement('button'); + startButton.innerText = 'Start'; + startButton.addEventListener('click', () => { + const selectedUrls = Array.from(modal.querySelectorAll('input[type="checkbox"]:checked')).map(checkbox => checkbox.value); + selectedUrls.forEach(url => window.open(url, '_blank')); + document.body.removeChild(modal); + document.body.removeChild(overlay); + }); + + let closeButton = document.createElement('button'); + closeButton.innerText = 'X'; + closeButton.style.position = 'absolute'; + closeButton.style.right = '10px'; + closeButton.style.top = '10px'; + closeButton.addEventListener('click', function() { + document.body.removeChild(modal); + document.body.removeChild(overlay); + }); + + let cancelButton = document.createElement('button'); + cancelButton.innerText = 'Cancel'; + cancelButton.addEventListener('click', function() { + document.body.removeChild(modal); + document.body.removeChild(overlay); + }); + + let buttonContainer = document.createElement('div'); + buttonContainer.style.width = '100%'; + buttonContainer.style.display = 'flex'; + buttonContainer.style.justifyContent = 'center'; + buttonContainer.style.marginTop = '20px'; + + buttonContainer.appendChild(startButton); + buttonContainer.appendChild(cancelButton); + + modal.appendChild(closeButton); + modal.appendChild(buttonContainer); + + let overlay = document.createElement('div'); + overlay.style.position = 'fixed'; + overlay.style.top = '0'; + overlay.style.left = '0'; + overlay.style.width = '100%'; + overlay.style.height = '100%'; + overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; + overlay.style.zIndex = '998'; + + document.body.appendChild(overlay); + document.body.appendChild(modal); +})(); + diff --git a/src/ideas/network-checker.js b/src/ideas/network-checker.js new file mode 100644 index 0000000..77c8830 --- /dev/null +++ b/src/ideas/network-checker.js @@ -0,0 +1,36 @@ +javascript:(function() { + checkNetworkRequests(prompt("Enter the keyword to search for in network requests")); + function checkNetworkRequests(keyword) { + var requests = []; + + (function() { + var originalFetch = window.fetch; + window.fetch = function() { + var url = arguments[0]; + var options = arguments[1]; + + if (url.includes(keyword)) { + requests.push({ url: url, options: options }); + } + + return originalFetch.apply(this, arguments); + }; + })(); + + (function() { + var originalOpen = window.XMLHttpRequest.prototype.open; + window.XMLHttpRequest.prototype.open = function() { + var method = arguments[0]; + var url = arguments[1]; + + if (url.includes(keyword)) { + requests.push({ method: method, url: url }); + } + + return originalOpen.apply(this, arguments); + }; + })(); + alert(JSON.stringify(requests, null, 2)); +} +})(); + diff --git a/src/ideas/newideashere.txt b/src/ideas/newideashere.txt new file mode 100644 index 0000000..8e51317 --- /dev/null +++ b/src/ideas/newideashere.txt @@ -0,0 +1 @@ +- Checking network tab for certain calls and showing their data diff --git a/src/ideas/released/featureflagging.txt b/src/ideas/released/featureflagging.txt new file mode 100644 index 0000000..047ea5c --- /dev/null +++ b/src/ideas/released/featureflagging.txt @@ -0,0 +1,9 @@ +updating feature flags in a DI sessions +reads localstorage and then updates its based on alert input? + +###snippet used currently +sessionStorage.setItem('rbc_di_session',JSON.stringify({ + "features": { + "dqqh": true,"dqso": true + } +})); \ No newline at end of file diff --git a/src/scratchpad/listChecker.js b/src/scratchpad/listChecker.js new file mode 100644 index 0000000..046056d --- /dev/null +++ b/src/scratchpad/listChecker.js @@ -0,0 +1,14 @@ +// List of issue types in completeissuetypelist.txt +let completeIssueTypes = [ + "ADR", "ALN", "CL", "CF", "CS", "CLRT", "CSRT", "CPRT", "VB", "CP", "DEB", "DR", "DRRT", "ETF", "ETMF", "ETN", "ETV", "ETC", "FRC", "FRG", "FX", "FU", "BD", "GB", "IN", "IDR", "MMF", "MF", "OF", "OP", "PS", "PR", "PRRT", "RT", "SRN", "UT", "UTRT", "WT" +]; + +// List of issue types in excelissuetypes.txt +let excelIssueTypes = [ + "CF", "CL", "CLRT", "CP", "CPRT", "CS", "CSRT", "DEB", "DR", "DRRT", "ETF", "ETN", "FU", "FX", "GB", "IN", "MF", "MMF", "OF", "PR", "PRRT", "PS", "RT", "SRN", "UT", "UTRT", "WT" +]; + +// Find the issue types that are in completeIssueTypes but not in excelIssueTypes +let missingIssueTypes = completeIssueTypes.filter(issueType => !excelIssueTypes.includes(issueType)); + +console.log(missingIssueTypes); \ No newline at end of file