moving to status.io
This commit is contained in:
parent
7cd5138bf5
commit
a161c58766
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
// ==UserScript==
|
||||
// @name Status.io Selector
|
||||
// @name Status.io Selector 2
|
||||
// @namespace https://status.io
|
||||
// @description Effort to simplify configuration of incidents/maintenance windows
|
||||
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
|
||||
|
|
@ -8,61 +7,20 @@
|
|||
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
|
||||
// @grant GM_addStyle
|
||||
// @grant GM_setClipboard
|
||||
// @include /^https?://app\.status\.io/dashboard/.*$/
|
||||
// @include /^https?://app\.status\.io/dashboard/.*/?(maintenance|incident)/create$/
|
||||
// @include /^https?://app\.status\.io/dashboard/.*/?(maintenance|incident)/.*/?edit$/
|
||||
// @version 0.0.1
|
||||
// ==/UserScript==
|
||||
|
||||
const urlRegex = /^http?s:\/\/servicedesk(\.microsoft\.com)?\/\#\/customer\/commercial\?caseNumber=\d+$/
|
||||
if (urlRegex.test($("ul").context.URL)) {
|
||||
try {
|
||||
waitForKeyElements("#mc-case-section", storeAndPrint);
|
||||
|
||||
function storeAndPrint () {
|
||||
var region = "";
|
||||
var d = new Date();
|
||||
var endDate = d.toISOString().valueOf()
|
||||
d.setDate(d.getDate() - 1)
|
||||
var startDate = d.toISOString().valueOf()
|
||||
const caseText = $("#mc-case-section")[0].innerText;
|
||||
const caseID = $("#content")[0].innerText.split('\n')[1]
|
||||
const resourceURIRegex = /\/subscriptions\/[\d\w]{8}-[\d\w]{4}-[\d\w]{4}-[\d\w]{4}-[\d\w]{12}\/resourceGroups\/.*\/providers\/Microsoft\.ContainerService\/managedClusters\/.*/g;
|
||||
const resourceURI = caseText.match(resourceURIRegex)[0];
|
||||
const ascResourceURI = resourceURI.replace(/\//gi, "~2F");
|
||||
const subscription = resourceURI.split('/')[2];
|
||||
const resourceGroup = resourceURI.split('/')[4];
|
||||
const cluster = resourceURI.split('/')[8];
|
||||
var template = `
|
||||
farts
|
||||
|
||||
`;
|
||||
const regionRegex = /- Location:.*/g;
|
||||
const regionlower = caseText.match(regionRegex)[0].split(' ')[2];
|
||||
switch (regionlower) {
|
||||
case 'australiaeast':
|
||||
region = "AustraliaEast";
|
||||
break;
|
||||
case 'westus2':
|
||||
region = "WestUs2";
|
||||
break;
|
||||
default:
|
||||
console.log(`Sorry, looks like ${regionlower} isn't stored as a valid region. Please reach out to tybean@.`);
|
||||
}
|
||||
const tenantIDRegex = /- Tenant Id:.*/g;
|
||||
const tenantID = caseText.match(tenantIDRegex)[0].split(' ')[3];
|
||||
const objectIDRegex = /- Object Id:.*/g;
|
||||
const objectID = caseText.match(objectIDRegex)[0].split(' ')[3];
|
||||
const appLensURL = `https://applens.azurewebsites.net${resourceURI}/home/category?startTime=${startDate}&endTime=${endDate}`;
|
||||
const jarvisURL = `https://jarvis-west.dc.ad.msft.net/?page=actions&acisEndpoint=Public&selectedNodeType=3&extension=AzureContainerService%20AKS&group=Resource%20Operations&operationId=GetManagedCluster&operationName=Get%20Managed%20Cluster&inputMode=single¶ms={"wellknownsubscriptionid":"${subscription}","smeaksresourcegroup":"${resourceGroup}","smeaksresource":"${cluster}","smeaksapiversions":"2019-04-01"}&actionEndpoint=${region}`;
|
||||
const ascURL = `https://azuresupportcenter.msftcloudes.com/resourceExplorer/resource/${ascResourceURI}?srId=${caseID}`
|
||||
var zNode = document.createElement ('div');
|
||||
zNode.innerHTML = '<button id="appLensButton" type="button">'
|
||||
+ 'AppLens</button><button id = jarvisButton>Jarvis</button><button id=ascButton>ASC</button><button id = kustoButton>Kusto</button> <button id = oneClickButton>1 - Click</button>'
|
||||
var zNode = document.createElement ('div');
|
||||
zNode.innerHTML = '<button id="canadaCentralButton" type="button">'
|
||||
+ 'canadacentral</button><button id = jarvisButton>Jarvis</button><button id=ascButton>ASC</button><button id = kustoButton>Kusto</button> <button id = oneClickButton>1 - Click</button>'
|
||||
;
|
||||
zNode.setAttribute ('id', 'myContainer');
|
||||
document.body.appendChild (zNode);
|
||||
|
||||
//--- Activate the newly added button.
|
||||
document.getElementById ("appLensButton").addEventListener (
|
||||
document.getElementById ("canadaCentralButton").addEventListener (
|
||||
"click", appLensButtonClickAction, false
|
||||
);
|
||||
document.getElementById ("jarvisButton").addEventListener (
|
||||
|
|
@ -101,9 +59,9 @@ farts
|
|||
//--- Style our newly added elements using CSS.
|
||||
GM_addStyle ( multilineStr ( function () {/*!
|
||||
#myContainer {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
font-size: 14px;
|
||||
background: orange;
|
||||
border: 3px outset black;
|
||||
|
|
@ -123,16 +81,9 @@ farts
|
|||
|
||||
function multilineStr (dummyFunc) {
|
||||
var str = dummyFunc.toString ();
|
||||
str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
|
||||
.replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
|
||||
str = str.replace (/^[^\/]+\/\*!?/, '') // Strip function () { /*!
|
||||
.replace (/\s*\*\/\s*\}\s*$/, '') // Strip */ }
|
||||
.replace (/\/\/.+$/gm, '') // Double-slash comments wreck CSS. Strip them.
|
||||
;
|
||||
return str;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
// If an error was thrown, go ahead and present it as an alert to help
|
||||
// with debugging any problems
|
||||
alert(err.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue