Skip to content

Commit 7784a79

Browse files
uid and euid url toggling
1 parent d657a35 commit 7784a79

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

webroot/adm/oncall/participant-summary.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ <h5>Site App Names</h5>
6464
<div class="row px-2">
6565
<div class="col section">
6666
<h5>Participant API Keys</h5>
67-
<a id="grafanaApiKeyUsage" target="_blank">API Key Usage Dashboard</a>
67+
<a id="grafanaApiKeyUsage" target="_blank">API Key Usage Dashboard</a>
6868
<pre class="errorDiv" id="participantKeysErrorOutput"></pre>
6969
<pre id="participantKeysStandardOutput"></pre>
7070
</div>

webroot/js/component/participantSummary.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,23 @@ document.addEventListener("DOMContentLoaded", () => {
352352
const sections = document.querySelectorAll(".section");
353353
sections.forEach((section) => (section.style.display = "block"));
354354

355-
const apiKeyUsageGrafanaUrl = `https://uid2.grafana.net/d/JaOQgV7Iz/api-key-usage?orgId=1&from=now-6h&to=now&timezone=browser&var-SiteId=${site.id}&var-Env=prod`;
356-
const apiKeyUsageElement = document.getElementById("grafanaApiKeyUsage");
357-
apiKeyUsageElement.href = apiKeyUsageGrafanaUrl;
355+
let currentEnv;
356+
if (window.location.origin.includes("prod")) {
357+
currentEnv = "prod";
358+
} else if (window.location.origin.includes("integ")) {
359+
currentEnv = "integ";
360+
} else {
361+
currentEnv = "test";
362+
}
363+
364+
let uidType = "uid2";
365+
if (window.location.origin.includes("UID2")) {
366+
uidType = "euid";
367+
}
368+
369+
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}`;
370+
const apiKeyUsageElement = document.getElementById("grafanaApiKeyUsage");
371+
apiKeyUsageElement.href = apiKeyUsageGrafanaUrl;
358372
});
359373
}
360374

@@ -387,8 +401,6 @@ document.addEventListener("DOMContentLoaded", () => {
387401
}
388402
});
389403
}
390-
391-
392404
});
393405

394406
export {};

0 commit comments

Comments
 (0)