catch up
This commit is contained in:
parent
a572c95cb8
commit
9fc34e2704
|
|
@ -10,6 +10,29 @@
|
|||
// @version 0.0.1
|
||||
// ==/UserScript==
|
||||
|
||||
if (window.location.href.indexOf("5d49ec10226b9e13cb6a422e") > -1) {
|
||||
console.log("azure status page");
|
||||
var componentArray = ["api", "auth", "compute", "jobs", "odbc", "webapp", "sql"];
|
||||
var regionArray = ["canadacentral", "canadaeast", "centralindia", "southindia", "westindia", +
|
||||
"switzerlandnorth", "norwayeast", "westus2", "westus", "southcentralus", +
|
||||
"westeurope", "northeurope", "ukwest", "uksouth", "southafricanorth", +
|
||||
"uaenorth", "australiaeast", "australiacentral", "australiacentral2", +
|
||||
"australiasoutheast", "japaneast", "japanwest", "koreacentral", +
|
||||
"southeastasia", "eastasia", "brazilsouth", "eastus2", "eastus", +
|
||||
"centralus", "northcentralus", "francecentral", "chinanorth2", "chinaeast2", +
|
||||
"usgovvirginia", "usgovarizona"];
|
||||
var profilesHTML = '<center><button id="controlPlanesButton type="button">Controlplanes</button> <button id="stagesButton type="button">Stages</button> <button id="dataPlanesButton type="button">Dataplanes</button></center>'
|
||||
var dataplanesHTML = '<button id="canadaCentralButton" type="button">canadacentral</button><button id="canadaEastButton" type="button">canadaeast</button><button id="centralIndiaButton" type="button>centralindia</button><button id="southIndiaButton" type="button">southindia</button><button id="westIndiaButton" type="button">westindia</button><button id="switzerlandNorthButton" type="button">switzerlandnorth</button><button id="norwayEastButton" type="button">norwayeast</button>'
|
||||
var locationHTML = dataplanesHTML
|
||||
}
|
||||
|
||||
if (window.location.href.indexOf("5cf02dde58a00904bda41926") > -1) {
|
||||
console.log("aws status page");
|
||||
}
|
||||
|
||||
if (window.location.href.indexOf("60087ab5608daf0535dc8e23") > -1) {
|
||||
console.log("gcp status page");
|
||||
}
|
||||
// setup some variables
|
||||
var apiGroup = $("div.form-group").filter(":contains('API Service')");
|
||||
var authGroup = $("div.form-group").filter(":contains('Authentication')");
|
||||
|
|
@ -17,34 +40,45 @@ var computeGroup = $("div.form-group").filter(":contains('Compute Service')");
|
|||
var jobsGroup = $("div.form-group").filter(":contains('Jobs Service')");
|
||||
var odbcGroup = $("div.form-group").filter(":contains('ODBC/JDBC Service')");
|
||||
var webappGroup = $("div.form-group").filter(":contains('User Interface')");
|
||||
var sqlGroup = $("div.form-group").filter(":contains('Databricks SQL')");
|
||||
|
||||
|
||||
var componentArray = ["api", "auth", "compute", "jobs", "odbc", "webapp"];
|
||||
var selectedComponents = new Map();
|
||||
var i;
|
||||
var selectedRegions = new Map();
|
||||
for (i = 0; i < componentArray.length; i++) {
|
||||
selectedComponents.set(componentArray[i], 0);
|
||||
selectedComponents.set(componentArray[i], false);
|
||||
}
|
||||
|
||||
for (i = 0; i < componentArray.length; i++) {
|
||||
var component = componentArray[i];
|
||||
if (selectedComponents.get(component) == 0){
|
||||
var groupName = component + "Group";
|
||||
console.log(groupName);
|
||||
console.log(eval(groupName));
|
||||
for (i = 0; i < regionArray.length; i++) {
|
||||
selectedRegions.set(regionArray[i], false)
|
||||
}
|
||||
|
||||
function apply() {
|
||||
for (i = 0; i < componentArray.length; i++) {
|
||||
var component = componentArray[i];
|
||||
console.log(component)
|
||||
for (j = 0; j < regionArray.length; j++) {
|
||||
var region = regionArray[j];
|
||||
var groupName = component + "Group";
|
||||
var group = eval(groupName);
|
||||
var checkboxStr = `group.find('*').filter(\":contains('${region}')\").filter("div.clearfix.prettycheckbox.labelright.blue").children().filter("A")[0]`;
|
||||
var checkbox = eval(checkboxStr);
|
||||
if (checkRegion(region) == true && checkComponent(component) == true) {
|
||||
selectCheckbox(checkbox);
|
||||
} else {
|
||||
deselectCheckbox(checkbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// load actions
|
||||
var testObj = apiGroup.find('*').filter(":contains('canadacentral')").filter("div.clearfix.prettycheckbox.labelright.blue").children().filter("A")[0];
|
||||
console.log(Object.keys(testObj));
|
||||
console.log(testObj);
|
||||
|
||||
// draw frame
|
||||
var zNode = document.createElement('div');
|
||||
zNode.innerHTML = '<button id="allComponentsButton" type="button">AllComponents</button><button id="apiButton" type="button">API</button><button id="authButton">Auth</button>' +
|
||||
zNode.innerHTML = profilesHTML + '</br>' + locationHTML + '</br></br><button id="allComponentsButton" type="button">AllComponents</button> <button id="apiButton" type="button">API</button><button id="authButton">Auth</button>' +
|
||||
'<button id="computeButton" type="button">Compute</button><button id="jobsButton" type="button">Jobs</button><button id="odbcButton" type="button">ODBC/JDBC</button>' +
|
||||
'<button id="webappButton" type="button">Webapp</button></br></br><button id="canadaCentralButton" type="button">canadacentral</button>' +
|
||||
' <button id = printArrayButton>Print Array</button>';
|
||||
'<button id="webappButton" type="button">Webapp</button><button id="sqlButton" type="button">SQL</button></br></br>'+
|
||||
'<button id="applyButton" type="button">Apply Selection</button>';
|
||||
zNode.setAttribute('id', 'myContainer');
|
||||
document.body.appendChild(zNode);
|
||||
|
||||
|
|
@ -54,48 +88,56 @@ document.getElementById("apiButton").addEventListener(
|
|||
);
|
||||
|
||||
function apiButtonClickAction(zEvent) {
|
||||
toggleComponent("api", "apiButton");
|
||||
console.log(selectedComponents);
|
||||
toggleComponent("api");
|
||||
toggleButtonColor("apiButton");
|
||||
}
|
||||
document.getElementById("authButton").addEventListener(
|
||||
"click", authButtonClickAction, false
|
||||
);
|
||||
|
||||
function authButtonClickAction(zEvent) {
|
||||
toggleComponent("auth", "authButton");
|
||||
console.log(selectedComponents);
|
||||
toggleComponent("auth");
|
||||
toggleButtonColor("authButton");
|
||||
}
|
||||
document.getElementById("computeButton").addEventListener(
|
||||
"click", computeButtonClickAction, false
|
||||
);
|
||||
|
||||
function computeButtonClickAction(zEvent) {
|
||||
toggleComponent("compute", "computeButton");
|
||||
console.log(selectedComponents);
|
||||
toggleComponent("compute");
|
||||
toggleButtonColor("computeButton");
|
||||
}
|
||||
|
||||
document.getElementById("jobsButton").addEventListener(
|
||||
"click", jobsButtonClickAction, false
|
||||
);
|
||||
|
||||
function jobsButtonClickAction(zEvent) {
|
||||
toggleComponent("jobs", "jobsButton");
|
||||
console.log(selectedComponents);
|
||||
toggleComponent("jobs");
|
||||
toggleButtonColor("jobsButton");
|
||||
}
|
||||
document.getElementById("odbcButton").addEventListener(
|
||||
"click", odbcButtonClickAction, false
|
||||
);
|
||||
|
||||
function odbcButtonClickAction(zEvent) {
|
||||
toggleComponent("odbc", "odbcButton");
|
||||
console.log(selectedComponents);
|
||||
toggleComponent("odbc");
|
||||
toggleButtonColor("odbcButton");
|
||||
}
|
||||
document.getElementById("webappButton").addEventListener(
|
||||
"click", webappButtonClickAction, false
|
||||
);
|
||||
|
||||
function webappButtonClickAction(zEvent) {
|
||||
toggleComponent("webapp", "webappButton");
|
||||
console.log(selectedComponents);
|
||||
toggleComponent("webapp");
|
||||
toggleButtonColor("webappButton");
|
||||
}
|
||||
document.getElementById("sqlButton").addEventListener(
|
||||
"click", sqlButtonClickAction, false
|
||||
);
|
||||
|
||||
function sqlButtonClickAction(zEvent) {
|
||||
toggleComponent("sql");
|
||||
toggleButtonColor("sqlButton");
|
||||
}
|
||||
document.getElementById("allComponentsButton").addEventListener(
|
||||
"click", allComponentsButtonClickAction, false
|
||||
|
|
@ -105,49 +147,110 @@ function allComponentsButtonClickAction(zEvent) {
|
|||
for (i = 0; i < componentArray.length; i++) {
|
||||
var component = componentArray[i];
|
||||
var buttonName = component + "Button";
|
||||
toggleComponent(component, buttonName);
|
||||
console.log(buttonName);
|
||||
selectComponent(component);
|
||||
setButtonColor(buttonName);
|
||||
}
|
||||
}
|
||||
|
||||
// regional buttons
|
||||
function canadaCentralButtonClickAction(zEvent) {
|
||||
checkBoxToggle(testObj, "canadaCentralButton");
|
||||
toggleRegion("canadacentral");
|
||||
toggleButtonColor("canadaCentralButton")
|
||||
|
||||
}
|
||||
document.getElementById("canadaCentralButton").addEventListener(
|
||||
"click", canadaCentralButtonClickAction, false
|
||||
);
|
||||
|
||||
// aux buttons
|
||||
function printArrayClickAction(zEvent) {
|
||||
console.log(componentArray);
|
||||
function canadaEastButtonClickAction(zEvent) {
|
||||
toggleRegion("canadaeast");
|
||||
toggleButtonColor("canadaEastButton")
|
||||
}
|
||||
document.getElementById("printArrayButton").addEventListener(
|
||||
"click", printArrayClickAction, false
|
||||
document.getElementById("canadaEastButton").addEventListener(
|
||||
"click", canadaEastButtonClickAction, false
|
||||
);
|
||||
// aux buttons
|
||||
|
||||
function applyButtonClickAction(zEvent) {
|
||||
apply();
|
||||
}
|
||||
document.getElementById("applyButton").addEventListener(
|
||||
"click", applyButtonClickAction, false
|
||||
)
|
||||
// aux functions
|
||||
function toggleComponent(component, buttonName) {
|
||||
if (selectedComponents.get(component) == 0) {
|
||||
selectedComponents.set(component, 1);
|
||||
document.getElementById(buttonName).style.background = '#00FF00';
|
||||
function toggleComponent(component) {
|
||||
if (checkComponent(component) == false) {
|
||||
selectComponent(component);
|
||||
} else {
|
||||
selectedComponents.set(component, 0);
|
||||
document.getElementById(buttonName).style.background = '#FFFFFF';
|
||||
deselectComponent(component);
|
||||
}
|
||||
}
|
||||
function toggleButtonColor(buttonName) {
|
||||
var bg = document.getElementById(buttonName).style.background;
|
||||
if(bg != '') {
|
||||
clearButtonColor(buttonName);
|
||||
} else {
|
||||
setButtonColor(buttonName);
|
||||
}
|
||||
}
|
||||
function checkComponent(component) {
|
||||
var status = selectedComponents.get(component);
|
||||
return status;
|
||||
}
|
||||
function checkRegion(region) {
|
||||
var status = selectedRegions.get(region)
|
||||
return status;
|
||||
}
|
||||
|
||||
function checkBoxToggle(box, buttonName) {
|
||||
function selectComponent(component) {
|
||||
selectedComponents.set(component, true);
|
||||
console.log(selectedComponents);
|
||||
}
|
||||
|
||||
function deselectComponent(component) {
|
||||
selectedComponents.set(component, false);
|
||||
console.log(selectedComponents);
|
||||
}
|
||||
|
||||
function toggleRegion(region) {
|
||||
if (checkRegion(region) == false) {
|
||||
selectRegion(region);
|
||||
} else {
|
||||
deselectRegion(region);
|
||||
}
|
||||
}
|
||||
function selectRegion(region) {
|
||||
selectedRegions.set(region, true);
|
||||
console.log(selectedRegions);
|
||||
}
|
||||
function deselectRegion(region) {
|
||||
selectedRegions.set(region, false);
|
||||
console.log(selectedRegions);
|
||||
}
|
||||
function setButtonColor(buttonName) {
|
||||
document.getElementById(buttonName).style.background = '#00FF00';
|
||||
}
|
||||
|
||||
function clearButtonColor(buttonName) {
|
||||
document.getElementById(buttonName).style.background = '';
|
||||
}
|
||||
|
||||
function selectCheckbox(box) {
|
||||
box.setAttribute("class", "checked");
|
||||
}
|
||||
function deselectCheckbox(box) {
|
||||
box.setAttribute("class", "");
|
||||
}
|
||||
|
||||
function toggleCheckbox(box) {
|
||||
if (box.getAttribute("class") == "checked") {
|
||||
box.setAttribute("class", "");
|
||||
document.getElementById(buttonName).style.background = '#FFFFFF';
|
||||
} else {
|
||||
box.setAttribute("class", "checked");
|
||||
document.getElementById(buttonName).style.background = '#00FF00';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function multilineStr(dummyFunc) {
|
||||
var str = dummyFunc.toString();
|
||||
str = str.replace(/^[^\/]+\/\*!?/, '') // Strip function () { /*!
|
||||
|
|
@ -156,7 +259,6 @@ function multilineStr(dummyFunc) {
|
|||
;
|
||||
return str;
|
||||
}
|
||||
|
||||
// frame CSS style
|
||||
GM_addStyle(multilineStr(function() {
|
||||
/*!
|
||||
|
|
@ -181,3 +283,4 @@ GM_addStyle(multilineStr(function() {
|
|||
}
|
||||
*/
|
||||
}));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue