Skip to content

Commit 6f9f14d

Browse files
committed
Rename selector label to 'Select Region' and migrate all docs
Two changes: 1. Rename the bar label from "Region" to "Select Region" in the selector UI. 2. Migrate every documentation page that mentions platform.robusta.dev or api.robusta.dev so the region selector is visible wherever the user encounters a Robusta endpoint. Concretely, replace .. code-block:: <lang> with .. robusta-code:: <lang> for any code block whose body contains a Robusta URL — 65 blocks across 36 files. Pages whose only mention is an inline external link (signup CTAs, prose references) are intentionally left as-is; the page-wide JS still rewrites those URLs to the selected region using the value persisted in localStorage from any page that does carry a selector. The JS also now collects URL targets from the whole content area rather than scoping them to each box, so a selector click on any component on the page rewrites every Robusta URL it can reach (prose, tables, code, anchor hrefs).
1 parent 123a216 commit 6f9f14d

37 files changed

Lines changed: 98 additions & 108 deletions

docs/_static/region-selector.js

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@
3434
});
3535
}
3636

37-
// Each box on the page has its own collection of URL targets so its
38-
// contents update in place when the region changes.
37+
// All URL occurrences across the page content (text nodes + relevant
38+
// attributes). Boxes are separate — each holds its selector buttons so
39+
// every box on the page stays visually in sync on region change.
40+
const targets = [];
3941
const boxes = [];
4042

4143
function collectTargets(root) {
42-
const targets = [];
4344
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
4445
acceptNode: function (node) {
4546
if (!node.nodeValue || !DETECT_PATTERN.test(node.nodeValue)) {
@@ -66,35 +67,32 @@
6667
}
6768
});
6869
});
69-
return targets;
7070
}
7171

72-
function applyToBox(box, regionKey) {
73-
for (let i = 0; i < box.targets.length; i++) {
74-
const t = box.targets[i];
72+
function applyRegion(regionKey) {
73+
for (let i = 0; i < targets.length; i++) {
74+
const t = targets[i];
7575
const next = rewrite(t.original, regionKey);
7676
if (t.kind === "text") {
7777
if (t.node.nodeValue !== next) t.node.nodeValue = next;
7878
} else {
7979
if (t.node.getAttribute(t.attr) !== next) t.node.setAttribute(t.attr, next);
8080
}
8181
}
82-
updateBoxButtons(box, regionKey);
83-
}
84-
85-
function updateBoxButtons(box, regionKey) {
86-
box.buttons.forEach(function (btn) {
87-
const isActive = btn.getAttribute("data-region") === regionKey;
88-
btn.classList.toggle("is-active", isActive);
89-
btn.setAttribute("aria-checked", String(isActive));
90-
});
82+
for (let j = 0; j < boxes.length; j++) {
83+
const buttons = boxes[j].buttons;
84+
for (let k = 0; k < buttons.length; k++) {
85+
const btn = buttons[k];
86+
const active = btn.getAttribute("data-region") === regionKey;
87+
btn.classList.toggle("is-active", active);
88+
btn.setAttribute("aria-checked", String(active));
89+
}
90+
}
9191
}
9292

9393
function syncAll(regionKey) {
9494
saveRegion(regionKey);
95-
boxes.forEach(function (box) {
96-
applyToBox(box, regionKey);
97-
});
95+
applyRegion(regionKey);
9896
}
9997

10098
function buildBar(currentRegion) {
@@ -103,7 +101,7 @@
103101

104102
const label = document.createElement("span");
105103
label.className = "robusta-region-box__bar-label";
106-
label.textContent = "Region";
104+
label.textContent = "Select Region";
107105
bar.appendChild(label);
108106

109107
const group = document.createElement("div");
@@ -133,28 +131,10 @@
133131
return { bar: bar, buttons: buttons };
134132
}
135133

136-
function initBox(el, currentRegion) {
137-
const existingBar = el.querySelector(":scope > ." + BAR_CLASS);
138-
if (existingBar) existingBar.remove();
139-
140-
const built = buildBar(currentRegion);
141-
el.insertBefore(built.bar, el.firstChild);
142-
143-
const targetRoot = el.querySelector(".robusta-region-box__body") || el;
144-
const targets = collectTargets(targetRoot);
145-
146-
const box = {
147-
el: el,
148-
bar: built.bar,
149-
buttons: built.buttons,
150-
targets: targets,
151-
};
152-
boxes.push(box);
153-
applyToBox(box, currentRegion);
154-
}
155-
156134
function init() {
135+
targets.length = 0;
157136
boxes.length = 0;
137+
158138
const content =
159139
document.querySelector(".md-content__inner") ||
160140
document.querySelector("article") ||
@@ -163,10 +143,20 @@
163143
if (!content) return;
164144

165145
const region = getRegion();
166-
const elements = content.querySelectorAll(".robusta-region-box");
167-
elements.forEach(function (el) {
168-
initBox(el, region);
146+
147+
content.querySelectorAll(".robusta-region-box").forEach(function (el) {
148+
const existingBar = el.querySelector(":scope > ." + BAR_CLASS);
149+
if (existingBar) existingBar.remove();
150+
const built = buildBar(region);
151+
el.insertBefore(built.bar, el.firstChild);
152+
boxes.push({ buttons: built.buttons });
169153
});
154+
155+
collectTargets(content);
156+
157+
if (targets.length === 0 && boxes.length === 0) return;
158+
159+
applyRegion(region);
170160
}
171161

172162
if (document.readyState === "loading") {

docs/configuration/alertmanager-integration/coralogix_managed_prometheus.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Common Configuration (for both webhooks)
2020
1. In the Coralogix site go to Data Flow, then Outbound Webhooks, and click ``Generic webhook``.
2121
2. In the url insert:
2222

23-
.. code-block::
23+
.. robusta-code::
2424

2525
https://api.robusta.dev/integrations/generic/alertmanager
2626

docs/configuration/alertmanager-integration/google-managed-alertmanager.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Configure the Alertmanager webhook
2222

2323
Apply the following Secret in the GMP namespace (default ``gmp-public``). Replace ``<ACCOUNT_ID>`` and ``<SIGNING_KEY>`` with your credentials.
2424

25-
.. code-block:: yaml
25+
.. robusta-code:: yaml
2626

2727
apiVersion: v1
2828
kind: Secret
@@ -103,7 +103,7 @@ Optional: verify credentials with curl
103103

104104
You can manually validate the webhook and credentials by posting a sample alert:
105105

106-
.. code-block:: bash
106+
.. robusta-code:: bash
107107

108108
curl -X POST 'https://api.robusta.dev/integrations/generic/alertmanager' \
109109
-H 'Authorization: Bearer <ACCOUNT_ID> <SIGNING_KEY>' \

docs/configuration/alertmanager-integration/grafana-self-hosted.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Generate and save your new ``API Key``
4444
Select ``Webhook`` from the Integration options.
4545
Add the following URL. Add your ``account_id`` to it:
4646

47-
.. code-block::
47+
.. robusta-code::
4848

4949
https://api.robusta.dev/integrations/alerts/grafana?account_id=YOUR_ACCOUNT_ID
5050

@@ -111,7 +111,7 @@ To configure it:
111111

112112
2. Insert the following URL:
113113

114-
.. code-block::
114+
.. robusta-code::
115115

116116
https://api.robusta.dev/integrations/generic/alertmanager
117117

docs/configuration/alertmanager-integration/nagios.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Requirements
1414
- Robusta must already be deployed and running in your environment.
1515
- The Nagios host must be able to send `curl` requests to the Robusta API endpoint:
1616

17-
.. code-block::
17+
.. robusta-code::
1818

1919
https://api.robusta.dev/integrations/generic/nagios
2020

@@ -80,7 +80,7 @@ Step 4: Create the Bash Command Script
8080

8181
Save this as `notify-robusta.sh`, ensure it's executable (`chmod +x notify-robusta.sh`), and Nagios can access it.
8282

83-
.. code-block:: bash
83+
.. robusta-code:: bash
8484

8585
#!/bin/sh
8686

docs/configuration/alertmanager-integration/outofcluster-prometheus.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This integration lets your central Prometheus send alerts to Robusta, as if they
2121

2222
.. admonition:: alertmanager.yaml
2323

24-
.. code-block:: yaml
24+
.. robusta-code:: yaml
2525

2626
receivers:
2727
- name: 'robusta'
@@ -72,7 +72,7 @@ If you are using a third-party AlertManager and want to give it separate credent
7272

7373
.. admonition:: alertmanager.yaml
7474

75-
.. code-block:: yaml
75+
.. robusta-code:: yaml
7676

7777
receivers:
7878
- name: 'robusta'

docs/configuration/alertmanager-integration/pagerduty-alerting.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Set the following values:
4747

4848
* **Webhook URL**:
4949

50-
.. code-block::
50+
.. robusta-code::
5151

5252
https://api.robusta.dev/integrations/generic/pagerduty/incidents
5353

@@ -88,7 +88,7 @@ Step 1: Create an Integration for Alertmanager
8888
1. In Event Orchestration, create a new **Integration** named ``Alertmanager``.
8989
2. Use the following webhook URL:
9090

91-
.. code-block::
91+
.. robusta-code::
9292

9393
https://api.robusta.dev/integrations/generic/pagerduty/alerts
9494

@@ -116,7 +116,7 @@ Step 3: Add a Webhook Action
116116

117117
* **URL**:
118118

119-
.. code-block::
119+
.. robusta-code::
120120

121121
https://api.robusta.dev/integrations/generic/pagerduty/alerts
122122

@@ -171,15 +171,15 @@ Optional: Cluster Name via Query Param
171171

172172
You can specify the target cluster using a query parameter in the webhook URL:
173173

174-
.. code-block::
174+
.. robusta-code::
175175

176176
https://api.robusta.dev/integrations/generic/pagerduty/incidents?cluster=your-cluster-name
177177

178178
This is useful for multi-cluster setups where Robusta should assign findings to a specific cluster.
179179

180180
For example:
181181

182-
.. code-block::
182+
.. robusta-code::
183183

184184
https://api.robusta.dev/integrations/generic/pagerduty/incidents?cluster=test-cluster
185185

docs/configuration/alertmanager-integration/solarwinds.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Step 3: Create a Webhook Configuration in SolarWinds
3737
- **Description**: Robusta Webhook
3838
- **Destination URL**:
3939

40-
.. code-block::
40+
.. robusta-code::
4141

4242
https://api.robusta.dev/integrations/generic/solarwinds?account_id=ACCOUNT_ID_HERE
4343

docs/configuration/exporting/alert-export-api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Example Request
4848

4949
The following ``curl`` command demonstrates how to export alert history data for the ``CrashLoopBackoff`` alert:
5050

51-
.. code-block:: bash
51+
.. robusta-code:: bash
5252

5353
curl --location 'https://api.robusta.dev/api/query/alerts?alert_name=CrashLoopBackoff&account_id=ACCOUNT_ID&start_ts=2024-09-02T04%3A02%3A05.032Z&end_ts=2024-09-17T05%3A02%3A05.032Z' \
5454
--header 'Authorization: Bearer API-KEY'

docs/configuration/exporting/alert-statistics-api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Example Request
4141

4242
The following `curl` command demonstrates how to query aggregated alert data for a specified time range:
4343

44-
.. code-block:: bash
44+
.. robusta-code:: bash
4545

4646
curl --location 'https://api.robusta.dev/api/query/report?account_id=XXXXXX-XXXX_XXXX_XXXXX7&start_ts=2024-10-27T04:02:05.032Z&end_ts=2024-11-27T05:02:05.032Z' \
4747
--header 'Authorization: Bearer API-KEY'

0 commit comments

Comments
 (0)