-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest.txt
78 lines (71 loc) · 2.76 KB
/
rest.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
};
const NO_COLOR = null;
const extractRole = (displayName) => {
return /(\w+)\/\w+/.exec(displayName)[1]
};
const getAccountInfo = (accountId) => {
const [alias, color] = accounts[accountId] || [accountId, NO_COLOR];
return { alias, color };
};
const accountId = document.querySelector(
'[data-testid="account-detail-menu"] > div:nth-child(1) > div:nth-child(1) > span:nth-child(2)'
).textContent.replace(/-/g, '');
console.debug({ accountId });
const { alias, color } = getAccountInfo(accountId);
const displayName = document.querySelector(
'[data-testid="awsc-nav-account-menu-button"] > span:nth-child(1)'
).textContent;
console.debug({ displayName });
const role = extractRole(displayName);
console.debug({ role });
const dropdownHeader = document.querySelector(
'[data-testid="awsc-nav-account-menu-button"] [title]'
);
switch (role) {
case "Operator":
dropdownHeader.innerHTML = `${alias}`;
dropdownHeader.style.backgroundColor = "red";
dropdownHeader.style.color = "white";
dropdownHeader.style.fontSize = "10pt";
switch (alias) {
case "Devops":
dropdownHeader.innerHTML = `${alias}`;
dropdownHeader.style.backgroundColor = "green";
dropdownHeader.style.color = "white";
dropdownHeader.style.fontSize = "10pt";
break;
case "Development":
dropdownHeader.innerHTML = `${alias}`;
dropdownHeader.style.backgroundColor = "green";
dropdownHeader.style.color = "white";
dropdownHeader.style.fontSize = "10pt";
break;
break;
default:
dropdownHeader.style.backgroundColor = color;
dropdownHeader.style.color = "white";
dropdownHeader.style.fontSize = "10pt";
}
break;
case "AdministratorAccess":
dropdownHeader.innerHTML = `${role}@${alias}`;
dropdownHeader.style.backgroundColor = "blue";
dropdownHeader.style.color = "white";
dropdownHeader.style.fontSize = "10pt";
break;
case "ViewOnlyAccess":
dropdownHeader.innerHTML = `${role}@${alias}`;
dropdownHeader.style.backgroundColor = "orange";
dropdownHeader.style.color = "white";
dropdownHeader.style.fontSize = "10pt";
break;
default:
dropdownHeader.style.backgroundColor = color;
dropdownHeader.style.color = "white";
dropdownHeader.style.fontSize = "10pt";
}
if (color !== NO_COLOR) {
dropdownHeader.style.backgroundColor = color;
dropdownHeader.style.color = "white";
dropdownHeader.style.fontSize = "10pt";
}