Skip to content

Commit 33c68fa

Browse files
committed
Merge branch 'domalessi/docs-10584' of github.com:DataDog/documentation into domalessi/docs-10584
2 parents 906f8d2 + f71bc83 commit 33c68fa

File tree

699 files changed

+58474
-22086
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

699 files changed

+58474
-22086
lines changed

.apigentools-info

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-04-30 19:57:04.215900",
8-
"spec_repo_commit": "4f95b6c2"
7+
"regenerated": "2025-05-14 15:46:38.896407",
8+
"spec_repo_commit": "64f5e7ee"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-04-30 19:57:13.778933",
13-
"spec_repo_commit": "4f95b6c2"
12+
"regenerated": "2025-05-14 15:46:48.228708",
13+
"spec_repo_commit": "64f5e7ee"
1414
}
1515
}
1616
}

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ content/en/code_analysis/ @Datadog/static-analysis @Data
162162
content/en/quality_gates/ @Datadog/ci-app-backend @Datadog/documentation
163163

164164
# DDSQL Editor References
165-
content/en/ddsql_editor/reference/*.md @Datadog/xpq @Datadog/documentation
165+
content/en/ddsql_reference/*.md @Datadog/xpq @Datadog/documentation
166166

167167
# Data Streams Monitoring
168168
content/en/data_streams/*.md @Datadog/data-streams-monitoring @Datadog/documentation

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ node_modules: package.json yarn.lock
110110
@yarn install --immutable
111111

112112
source-dd-source:
113-
$(call source_repo,dd-source,https://github.com/DataDog/dd-source.git,main,true,domains/workflow/actionplatform/documentation/stable_bundles.json)
113+
$(call source_repo,dd-source,https://github.com/DataDog/dd-source.git,main,true,domains/workflow/actionplatform/documentation/stable_bundles.json domains/cloud_platform/aws/libs/mappings/content/)
114114

115115
# All the requirements for a full build
116116
dependencies: clean source-dd-source

assets/scripts/components/async-loading.js

+3
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@ function loadPage(newUrl) {
8585
hitsContainer.classList.add("hits-container", "d-none");
8686
const hits = document.createElement("div");
8787
hits.setAttribute("id", "hits");
88+
const hitsPartners = document.createElement("div");
89+
hitsPartners.setAttribute("id", "hits-partners");
8890

8991
searchBoxContainer.append(searchBox);
9092
searchBoxContainer.append(hitsContainer);
9193
hitsContainer.append(hits);
94+
hitsContainer.append(hitsPartners);
9295

9396
if(sidenavSearchbarMount) {
9497
sidenavSearchbarMount.append(searchBoxContainer);

assets/scripts/components/codetabs.js

+154-15
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,102 @@ const initCodeTabs = () => {
77
const { allowedRegions } = regionConfig;
88
const tabQueryParameter = getQueryParameterByName('tab') || getQueryParameterByName('tabs')
99
const codeTabParameters = allowedRegions.reduce((k,v) => ({...k, [v]: {}}), {});
10+
let resizeTimeout;
11+
let currentActiveTab = null; // Store the current active tab
12+
13+
const cleanupExistingTabs = () => {
14+
// Store current active tab before cleanup
15+
const activeTab = document.querySelector('.code-tabs .nav-tabs li.active a');
16+
if (activeTab) {
17+
currentActiveTab = activeTab.getAttribute('data-lang');
18+
}
19+
20+
// Remove all existing tab navigation elements
21+
document.querySelectorAll('.nav-tabs').forEach(navTabs => {
22+
// Only remove if it's a child of a code-tabs container
23+
if (navTabs.closest('.code-tabs')) {
24+
navTabs.innerHTML = '';
25+
}
26+
});
27+
}
28+
29+
const detectTabWrapping = () => {
30+
const tabContainers = document.querySelectorAll('.code-tabs');
31+
32+
tabContainers.forEach(container => {
33+
const tabsNav = container.querySelector('.nav-tabs');
34+
if (!tabsNav) return;
35+
36+
const tabs = tabsNav.querySelectorAll('li');
37+
if (tabs.length < 2) return; // Need at least two tabs to wrap
38+
39+
const firstTab = tabs[0];
40+
const lastTab = tabs[tabs.length - 1];
41+
42+
// Store original state
43+
const originalHasClass = container.classList.contains('tabs-wrap-layout');
44+
45+
// Ensure measurement happens in the unwrapped state
46+
container.classList.remove('tabs-wrap-layout');
47+
48+
// Force layout recalculation
49+
void tabsNav.offsetHeight;
50+
51+
const firstTop = firstTab.offsetTop;
52+
const lastTop = lastTab.offsetTop;
53+
const heightDifference = lastTop - firstTop;
54+
55+
// Determine if it *should* be wrapped based on measurement in unwrapped state
56+
// Use a small buffer (e.g., 2px) to account for rendering variations
57+
const shouldBeWrapped = heightDifference > 2;
58+
59+
// Apply the correct class if the state needs to change
60+
if (shouldBeWrapped !== originalHasClass) {
61+
if (shouldBeWrapped) {
62+
container.classList.add('tabs-wrap-layout');
63+
} else {
64+
container.classList.remove('tabs-wrap-layout');
65+
}
66+
} else {
67+
// If no change needed, ensure the class is restored if it was removed for measurement
68+
if (originalHasClass) {
69+
container.classList.add('tabs-wrap-layout');
70+
}
71+
}
72+
});
73+
};
74+
75+
const debouncedDetectTabWrapping = () => {
76+
clearTimeout(resizeTimeout);
77+
resizeTimeout = setTimeout(detectTabWrapping, 150); // Increased debounce time
78+
};
1079

1180
const init = () => {
81+
// Clean up existing tabs first
82+
cleanupExistingTabs();
83+
1284
renderCodeTabElements()
1385
addEventListeners()
1486
activateTabsOnLoad()
1587
getContentTabHeight()
1688
addObserversToCodeTabs()
89+
90+
// Initial detection with font loading check
91+
if (document.fonts && document.fonts.ready) {
92+
document.fonts.ready.then(() => {
93+
// Force reflow after fonts are loaded
94+
document.body.offsetHeight;
95+
detectTabWrapping();
96+
});
97+
} else {
98+
// Fallback for browsers without font loading API
99+
detectTabWrapping();
100+
}
101+
102+
// Remove any existing resize listeners
103+
window.removeEventListener('resize', debouncedDetectTabWrapping);
104+
// Add new resize listener
105+
window.addEventListener('resize', debouncedDetectTabWrapping);
17106
}
18107

19108
/**
@@ -25,16 +114,26 @@ const initCodeTabs = () => {
25114
const navTabsElement = codeTabsElement.querySelector('.nav-tabs')
26115
const tabContent = codeTabsElement.querySelector('.tab-content')
27116
const tabPaneNodeList = tabContent.querySelectorAll('.tab-pane')
117+
118+
// Create a map to track unique tab titles
119+
const uniqueTabs = new Map();
120+
28121
tabPaneNodeList.forEach(tabPane => {
29122
const title = tabPane.getAttribute('title')
30123
const lang = tabPane.getAttribute('data-lang')
31-
const li = document.createElement('li')
32-
const anchor = document.createElement('a')
33-
anchor.dataset.lang = lang
34-
anchor.href = '#'
35-
anchor.innerText = title
36-
li.appendChild(anchor)
37-
navTabsElement.appendChild(li)
124+
125+
// Only add the tab if we haven't seen this title before
126+
if (!uniqueTabs.has(title)) {
127+
uniqueTabs.set(title, true);
128+
129+
const li = document.createElement('li')
130+
const anchor = document.createElement('a')
131+
anchor.dataset.lang = lang
132+
anchor.href = '#'
133+
anchor.innerText = title
134+
li.appendChild(anchor)
135+
navTabsElement.appendChild(li)
136+
}
38137
})
39138
})
40139
}
@@ -56,12 +155,17 @@ const initCodeTabs = () => {
56155

57156
if (activeLangTab && activePane) {
58157
// Hide all tab content and remove 'active' class from all tab elements.
59-
tabsList.forEach(tab => tab.classList.remove('active'))
60-
tabPanesList.forEach(pane => pane.classList.remove('active', 'show'))
158+
// Also, remove any inline display style to let CSS classes control visibility.
159+
tabsList.forEach(tab => tab.classList.remove('active'));
160+
tabPanesList.forEach(pane => {
161+
pane.classList.remove('active', 'show');
162+
pane.style.removeProperty('display');
163+
});
61164

62165
// Show the active content and highlight active tab.
63-
activeLangTab.closest('li').classList.add('active')
64-
activePane.classList.add('active', 'show')
166+
activeLangTab.closest('li').classList.add('active');
167+
activePane.classList.add('active', 'show');
168+
activePane.style.removeProperty('display');
65169
}
66170

67171
const currentActiveTab = codeTabsElement.querySelector('.nav-tabs li.active')
@@ -75,14 +179,17 @@ const initCodeTabs = () => {
75179
firstTabPane.classList.add('active', 'show')
76180
}
77181
})
182+
183+
// Run tab wrapping detection after tab activation with slight delay
184+
setTimeout(detectTabWrapping, 10);
78185
}
79186

80187
updateUrl(activeLang)
81188
}
82189

83190
const scrollToAnchor = (tab, anchorname) => {
84191
const anchor = document.querySelectorAll(`[data-lang='${tab}'] ${anchorname}`)[0];
85-
192+
86193
if (anchor) {
87194
anchor.scrollIntoView();
88195
} else {
@@ -91,6 +198,16 @@ const initCodeTabs = () => {
91198
}
92199

93200
const activateTabsOnLoad = () => {
201+
// If we have a stored active tab from before reinitialization, use that
202+
if (currentActiveTab) {
203+
const selectedLanguageTab = document.querySelector(`a[data-lang="${currentActiveTab}"]`);
204+
if (selectedLanguageTab) {
205+
activateCodeTab(selectedLanguageTab);
206+
return;
207+
}
208+
}
209+
210+
// Otherwise use URL parameter or fall back to first tab
94211
const firstTab = document.querySelectorAll('.code-tabs .nav-tabs a').item(0)
95212
if (tabQueryParameter) {
96213
const selectedLanguageTab = document.querySelector(`a[data-lang="${tabQueryParameter}"]`);
@@ -102,7 +219,7 @@ const initCodeTabs = () => {
102219
scrollToAnchor(tabQueryParameter, window.location.hash);
103220
}, 300);
104221
}
105-
}else{
222+
} else {
106223
activateCodeTab(firstTab)
107224
}
108225
} else {
@@ -124,7 +241,7 @@ const initCodeTabs = () => {
124241

125242
activateCodeTab(link);
126243
getContentTabHeight();
127-
244+
128245
// ensures page doesnt jump when navigating tabs.
129246
// takes into account page shifting that occurs due to navigating tabbed content w/ height changes.
130247
// implementation of synced tabs from https://github.com/withastro/starlight/blob/main/packages/starlight/user-components/Tabs.astro
@@ -223,7 +340,29 @@ const initCodeTabs = () => {
223340
})
224341
}
225342

343+
/**
344+
* If Cdocs is running on this page,
345+
* tell it to refresh the tabs when content changes
346+
*/
347+
if (window.clientFiltersManager) {
348+
// Update the tabs after the page is initially rendered
349+
clientFiltersManager.registerHook('afterReveal', () => {
350+
// Reset stored tab on initial reveal
351+
currentActiveTab = null;
352+
init();
353+
});
354+
355+
// Update the tabs after the page is re-rendered
356+
clientFiltersManager.registerHook('afterRerender', init);
357+
}
358+
226359
init()
360+
361+
// Add window load event to handle final detection after everything is loaded
362+
window.addEventListener('load', () => {
363+
// Final check after page is fully loaded (all resources)
364+
setTimeout(detectTabWrapping, 50);
365+
});
227366
}
228367

229-
export default initCodeTabs
368+
export default initCodeTabs

assets/scripts/components/copy-code.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Tooltip from 'bootstrap/js/dist/tooltip';
44
// Script to add copy buttons to markdown fenced (```), and {{ highlight }} hugo function code blocks
55

66
function initCopyCode () {
7-
addCopyButton(['shell', 'json', 'yaml'])
7+
addCopyButton(['shell', 'json', 'yaml', 'sql'])
88

99
// Add Event Listener
1010
const copyButtons = document.querySelectorAll(['.js-copy-button', '#tryRuleModal .copy-icon']);
@@ -28,7 +28,7 @@ function addCopyButton (fencedLangs) {
2828
const dl = highlightEl.querySelector('[data-lang]');
2929
const codeLang = dl ? dl.dataset.lang : "";
3030
const isNestedInAppendableContainer = highlightEl.parentElement.classList.contains('append-copy-btn') //
31-
const isFencedCodeExample = [...fencedLangs].includes(codeLang) // markdown fenced code block
31+
const isFencedCodeExample = [...fencedLangs].includes(codeLang.toLowerCase()) // markdown fenced code block
3232

3333
const shouldAddCopyBtn = isFencedCodeExample || isNestedInAppendableContainer
3434
if(shouldAddCopyBtn){

0 commit comments

Comments
 (0)