Skip to content

Commit 33484b3

Browse files
added uidtype and currentenv as params
1 parent 5d7b736 commit 33484b3

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

webroot/adm/oncall/participant-summary.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ <h5>Participant Encryption Keys</h5>
8686
<div class="col section">
8787
<h5>Participant Operator Keys</h5>
8888
<pre class="errorDiv" id="operatorKeysErrorOutput"></pre>
89-
<a id="operatorDashboard" target="_blank"></a>
89+
<a id="operatorDashboard" target="_blank" style="visibility: hidden;">Operator Dashboard</a>
9090
<pre id="operatorKeysStandardOutput"></pre>
9191
</div>
9292
</div>
9393
<div class="row px-2">
9494
<div class="col section">
9595
<h5>Participant Opt-out Webhook</h5>
9696
<pre class="errorDiv" id="webhooksErrorOutput"></pre>
97-
<a id="optOutDashboard" target="_blank"></a>
97+
<a id="optOutDashboard" target="_blank" style="visibility: hidden;">Opt Out Dashboard</a>
9898
<pre id="webhooksStandardOutput"></pre>
9999
</div>
100100
</div>

webroot/js/component/participantSummary.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function loadEncryptionKeysCallback(result, siteId) {
142142
if (element) element.innerHTML = highlightedText;
143143
};
144144

145-
function loadOperatorKeysCallback(result, siteId) {
145+
function loadOperatorKeysCallback(result, siteId, uidType, currentEnv) {
146146
const textToHighlight = '"disabled": true';
147147
const resultJson = JSON.parse(result);
148148
let filteredResults = resultJson.filter((item) => { return item.site_id === siteId });
@@ -158,13 +158,13 @@ function loadOperatorKeysCallback(result, siteId) {
158158

159159
if (filteredResults.length !== 0) {
160160
const el = document.getElementById("operatorDashboard");
161-
el.innerText = "Operator Dashboard";
161+
el.style.visibility = "visible";
162162
const operatorDashboardUrl = `https://${uidType}.grafana.net/d/nnz7mb9Mk/operator-dashboard?orgId=1&from=now-24h&to=now&timezone=browser&var-_APP=uid2-operator&var-CLUSTER=uid2-prod-opr-use2-auto&var-ENV=${currentEnv}&var-_STORE=$__all`;
163163
el.href = operatorDashboardUrl;
164164
}
165165
};
166166

167-
function loadOptoutWebhooksCallback(result, siteName) {
167+
function loadOptoutWebhooksCallback(result, siteName, uidType, currentEnv) {
168168
const resultJson = JSON.parse(result);
169169
const filteredResults = resultJson.filter((item) => { return item.name === siteName });
170170
const formatted = prettifyJson(JSON.stringify(filteredResults));
@@ -173,7 +173,7 @@ function loadOptoutWebhooksCallback(result, siteName) {
173173

174174
if (filteredResults.length !== 0) {
175175
const el = document.getElementById("optOutDashboard");
176-
el.innerText = "Opt Out Dashboard";
176+
el.style.visibility = "visible";
177177
const optOutDashboardUrl = `https://${uidType}.grafana.net/d/a3-KG_rGz/optout-dashboard?orgId=1&from=now-1h&to=now&timezone=browser&var-_APP=uid2-optout&var-CLUSTER=uid2-us-east-2&var-ENV=${currentEnv}&var-_STORE=operators`;
178178
el.href = optOutDashboardUrl;
179179
}
@@ -241,7 +241,21 @@ document.addEventListener('DOMContentLoaded', () => {
241241
return;
242242
}
243243

244-
let url = `/api/site/${site.id}`;
244+
let currentEnv;
245+
if (window.location.origin.includes("prod")) {
246+
currentEnv = "prod";
247+
} else if (window.location.origin.includes("integ")) {
248+
currentEnv = "integ";
249+
} else {
250+
currentEnv = "test";
251+
}
252+
253+
let uidType = "uid2";
254+
if (window.location.origin.includes("UID2")) {
255+
uidType = "euid";
256+
}
257+
258+
let url = `/api/site/${site.id}`;
245259
doApiCallWithCallback('GET', url, loadSiteCallback, (err) => { participantSummaryErrorHandler(err, '#siteErrorOutput') });
246260

247261
url = `/api/client/list/${site.id}`;
@@ -254,29 +268,15 @@ document.addEventListener('DOMContentLoaded', () => {
254268
doApiCallWithCallback('GET', url, (r) => { loadEncryptionKeysCallback(r, site.id) }, (err) => { participantSummaryErrorHandler(err, '#encryptionKeysErrorOutput') });
255269

256270
url = '/api/operator/list';
257-
doApiCallWithCallback('GET', url, (r) => { loadOperatorKeysCallback(r, site.id) }, (err) => { participantSummaryErrorHandler(err, '#operatorKeysErrorOutput') });
271+
doApiCallWithCallback('GET', url, (r) => { loadOperatorKeysCallback(r, site.id, uidType, currentEnv) }, (err) => { participantSummaryErrorHandler(err, '#operatorKeysErrorOutput') });
258272

259273
url = '/api/partner_config/get';
260-
doApiCallWithCallback('GET', url, (r) => { loadOptoutWebhooksCallback(r, site.name) }, (err) => { participantSummaryErrorHandler(err, '#webhooksErrorOutput') });
261-
262-
url = `/api/sharing/keysets/related?site_id=${site.id}`;
263-
doApiCallWithCallback('GET', url, (r) => { loadRelatedKeysetsCallback(r, site.id, site.clientTypes) }, (err) => { participantSummaryErrorHandler(err, '#relatedKeysetsErrorOutput') });
264-
const sections = document.querySelectorAll('.section');
265-
sections.forEach(section => section.style.display = 'block');
274+
doApiCallWithCallback('GET', url, (r) => { loadOptoutWebhooksCallback(r, site.name, uidType, currentEnv) }, (err) => { participantSummaryErrorHandler(err, '#webhooksErrorOutput') });
266275

267-
let currentEnv;
268-
if (window.location.origin.includes("prod")) {
269-
currentEnv = "prod";
270-
} else if (window.location.origin.includes("integ")) {
271-
currentEnv = "integ";
272-
} else {
273-
currentEnv = "test";
274-
}
275-
276-
let uidType = "uid2";
277-
if (window.location.origin.includes("UID2")) {
278-
uidType = "euid";
279-
}
276+
url = `/api/sharing/keysets/related?site_id=${site.id}`;
277+
doApiCallWithCallback('GET', url, (r) => { loadRelatedKeysetsCallback(r, site.id, site.clientTypes) }, (err) => { participantSummaryErrorHandler(err, '#relatedKeysetsErrorOutput') });
278+
const sections = document.querySelectorAll('.section');
279+
sections.forEach(section => section.style.display = 'block');
280280

281281
const apiKeyUsageGrafanaUrl = `https://${uidType}.grafana.net/d/JaOQgV7Iz/api-key-usage?orgId=1&from=now-6h&to=now&timezone=browser&var-SiteId=${site.id}&var-Env=${currentEnv}`;
282282
const apiKeyUsageElement = document.getElementById("grafanaApiKeyUsage");

0 commit comments

Comments
 (0)