Initial Commit

This commit is contained in:
Greg Jacobs
2024-06-01 12:33:51 -04:00
commit 52ba1e18b0
14 changed files with 448 additions and 0 deletions

22
CHANGELOG.md Normal file
View File

@@ -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)

23
README.MD Normal file
View File

@@ -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.

View File

@@ -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

View File

@@ -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

18
src/helpers/dag.js Normal file
View File

@@ -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();
}
})();

21
src/helpers/hashid.js Normal file
View File

@@ -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));
})();

26
src/helpers/jira.js Normal file
View File

@@ -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();
}
})();

26
src/helpers/moids.js Normal file
View File

@@ -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();
}
})();

View File

@@ -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);
})();

91
src/helpers/workspace.js Normal file
View File

@@ -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);
})();

View File

@@ -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));
}
})();

View File

@@ -0,0 +1 @@
- Checking network tab for certain calls and showing their data

View File

@@ -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
}
}));

View File

@@ -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);