Skip to content

Commit

Permalink
Resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
estherk15 committed Aug 6, 2024
2 parents fd85647 + 6774a9a commit 433dda8
Show file tree
Hide file tree
Showing 780 changed files with 60,381 additions and 15,817 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-22 20:06:16.598259",
"spec_repo_commit": "cd020fa6"
"regenerated": "2024-08-06 15:06:58.588036",
"spec_repo_commit": "0e8a9cfa"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-22 20:06:24.226691",
"spec_repo_commit": "cd020fa6"
"regenerated": "2024-08-06 15:07:06.620239",
"spec_repo_commit": "0e8a9cfa"
}
}
}
1 change: 1 addition & 0 deletions .github/workflows/bump_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
'datadog-api-client-python',
'datadog-api-client-ruby',
'datadog-api-client-typescript',
'datadog-api-client-rust',
'integrations-core'
]
const versions = await Promise.all(clients.map(async (repo) => {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ content/en/api/**/*.java
content/en/api/**/*.pybeta
content/en/api/**/*.rbbeta
content/en/api/**/*.ts
content/en/api/**/*.rs
content/en/api/tsconfig.json

# Ignoring all automated content
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include $(CONFIG_FILE)
# API Code Examples
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
EXAMPLES_DIR = $(shell pwd)/examples/content/en/api
EXAMPLES_REPOS := datadog-api-client-go datadog-api-client-java datadog-api-client-python datadog-api-client-ruby datadog-api-client-typescript
EXAMPLES_REPOS := datadog-api-client-go datadog-api-client-java datadog-api-client-python datadog-api-client-ruby datadog-api-client-typescript datadog-api-client-rust

# Set defaults when no makefile.config or missing entries
# Use DATADOG_API_KEY if set, otherwise try DD_API_KEY and lastly fall back to false
Expand Down Expand Up @@ -181,6 +181,7 @@ examples/$(patsubst datadog-api-client-%,clean-%-examples,$(1)):
examples/$(patsubst datadog-api-client-%,%,$(1)): examples/$(1) examples/$(patsubst datadog-api-client-%,clean-%-examples,$(1))
-find examples/$(1)/examples -iname \*.py -exec mv {} {}beta \;
-find examples/$(1)/examples -iname \*.rb -exec mv {} {}beta \;
-find examples/$(1)/examples -maxdepth 1 -iname \*.rs -exec sh -c 'mkdir -p `echo {} | sed "s/\_/\//2" | sed "s/\_/\//1" | xargs dirname` && mv {} `echo {} | sed "s/\_/\//2" | sed "s/\_/\//1"`' \;
-cp -Rn examples/$(1)/examples/v* ./content/en/api
endef

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ For more information on contributing, see the [contribution guidelines][18].
### Datadog Staff

- Always branch off of master; never commit directly to master.
- Name your branch `<SLACK_HANDLE>/<FEATURE_NAME>`. If you don’t use this convention, the Gitlab pipeline wont run and you wont get a branch preview. Getting a branch preview makes it easier for us to check for any issues with your PR, such as broken links.
- Name your branch `slack_username/branch_name`. If you don't include the forward slash (`/`), the Gitlab pipeline won't run and you won't get a branch preview. Getting a branch preview makes it easier for us to check for any issues with your PR, such as broken links. Using a Slack username ensures you get build notifications in Slack.
- Consult our [contributing guidelines][8].
- When you're ready to commit, create a new pull request to master from your branch.
- Use GitHub's [draft pull request][15] feature and appropriate labels such as "Do Not Merge" or "Work in Progress" until your PR is ready to be merged and live on production.
- If you've named your branch correctly, a GitHub bot posts a link to the docs preview website for your PR. After the preview build completes, you can use the link to preview your changes.
- To run the build locally, see [Docs Build][20]. This is an optional step and requires setup.
- Running the build locally is optional. If you followed the branch naming conventions above, your pull request should generate a preview. For information on local builds, see the [Build setup guide][20].

### Outside Contributors

Expand Down Expand Up @@ -66,4 +66,4 @@ Within 10 minutes of merging to master, it deploys automatically.
[17]: https://docs.datadoghq.com
[18]: /CONTRIBUTING.md
[19]: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
[20]: https://datadoghq.atlassian.net/wiki/spaces/docs4docs/pages/2231206099/Docs+Build#Local-builds
[20]: https://datadoghq.atlassian.net/wiki/spaces/docs4docs/pages/3960766866/Build+setup+guide
31 changes: 27 additions & 4 deletions assets/scripts/components/async-loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ function loadPage(newUrl) {
behavior: "instant"
});

const pathName = new URL(newUrl).pathname;
const commitRef = document.documentElement.dataset.commitRef
const commitRefLen = commitRef.length ? (commitRef.length + 1) : 0

let mainContent = document.getElementById('mainContent');

// temp workaround for integrations page https://datadoghq.atlassian.net/browse/WEB-5018
let isIntegrations = document.querySelector('.integrations')

if (mainContent && !isIntegrations) {
const currentTOC = document.querySelector('.js-toc-container');

Expand Down Expand Up @@ -215,11 +219,23 @@ function loadPage(newUrl) {
sidebar.classList.remove('d-none');
}
}

// Clean window pathname in order to update language dropdown items href
const nonEnPage = document.documentElement.lang !== 'en-US' // check if page is not in english

const noCommitRefPathName = pathName.slice(commitRefLen) // adjust pathname to remove commit ref if in preview env
const noCommitRefNoLangPathName = nonEnPage ? noCommitRefPathName.slice(3) : noCommitRefPathName // adjust pathname to remove language if not in english e.g. /ja/agent -> /agent

document.querySelectorAll('.language-select-container .dropdown-menu > a.dropdown-item').forEach((ddItem) => {
// Updates langauge dropdown item hrefs on asynchronous page loads
const noFtBranchddItemPathName = ddItem.pathname.slice(commitRefLen) // adjust dd item pathname to remove commit ref if in preview env
const noFtBranchNoLangddItemPathName = ddItem.dataset.lang ? noFtBranchddItemPathName.slice(3) : noFtBranchddItemPathName // adjust dd item pathname to remove language if not in english e.g. /ja/agent -> /agent

const pathName = new URL(newUrl).pathname;
const updatedURL = ddItem.href.replace(noFtBranchNoLangddItemPathName, noCommitRefNoLangPathName)
ddItem.setAttribute('href', updatedURL)
})

// sets query params if code tabs are present

initCodeTabs();

const regionSelector = document.querySelector('.js-region-select');
Expand Down Expand Up @@ -253,8 +269,15 @@ function loadPage(newUrl) {
httpRequest.open('GET', newUrl);
httpRequest.send();
} else {
window.location.href = newUrl;
// Integrations Pages

if(pathName.slice(commitRefLen) !== document.documentElement.dataset.relpermalink) {
// if switching between integrations pages, reload page. adjusts the pathName to remove commit ref if in preview env.
window.location.href = newUrl;
}
}
}

export {loadPage};


22 changes: 20 additions & 2 deletions assets/scripts/components/codetabs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getQueryParameterByName } from '../helpers/browser';
import { getCookieByName } from '../helpers/helpers';
import { getCookieByName, chromeHashFix } from '../helpers/helpers';
import regionConfig from '../config/regions.config';

const initCodeTabs = () => {
Expand Down Expand Up @@ -80,20 +80,38 @@ const initCodeTabs = () => {
updateUrl(activeLang)
}

const scrollToAnchor = (tab, anchorname) => {
const anchor = document.querySelectorAll(`[data-lang='${tab}'] ${anchorname}`)[0];
console.log('tab: ', tab);
console.log('scrolling to anchor: ', anchor);
if (anchor) {
anchor.scrollIntoView();
} else {
document.querySelector(anchorname).scrollIntoView();
}
}

const activateTabsOnLoad = () => {
const firstTab = document.querySelectorAll('.code-tabs .nav-tabs a').item(0)
if (tabQueryParameter) {
const selectedLanguageTab = document.querySelector(`a[data-lang="${tabQueryParameter}"]`);

if (selectedLanguageTab) {
activateCodeTab(selectedLanguageTab)
if (window.location.hash) {
setTimeout(function () {
scrollToAnchor(tabQueryParameter, window.location.hash);
}, 300);
}
}else{
activateCodeTab(firstTab)
chromeHashFix();
}
} else {
if (codeTabsList.length > 0) {
activateCodeTab(firstTab)
}
chromeHashFix();
}
}

Expand Down Expand Up @@ -214,4 +232,4 @@ const initCodeTabs = () => {
init()
}

export default initCodeTabs;
export default initCodeTabs
12 changes: 1 addition & 11 deletions assets/scripts/components/table-of-contents.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { scrollTop } from '../helpers/scrollTop';
import { bodyClassContains } from '../helpers/helpers';
import { DOMReady } from '../helpers/documentReady';
import { getQueryParameterByName } from '../helpers/browser';

let sidenavMapping = [];
let tocContainer = document.querySelector('.js-toc-container');
Expand Down Expand Up @@ -241,14 +242,3 @@ window.addEventListener('scroll', () => {

DOMReady(handleAPIPage);

// Fixes Chrome issue where pages with hash params are not scrolling to anchor
window.addEventListener('load', () => {
const isChrome = /Chrome/.test(navigator.userAgent);
if (window.location.hash && isChrome) {
setTimeout(function () {
const hash = window.location.hash;
window.location.hash = '';
window.location.hash = hash;
}, 300);
}
});
4 changes: 3 additions & 1 deletion assets/scripts/datadog-docs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import configDocs from './config/config-docs';
import { updateMainContentAnchors, gtag } from './helpers/helpers';
import { updateMainContentAnchors, gtag, chromeHashFix } from './helpers/helpers';
import { bodyClassContains } from './helpers/helpers';
import { DOMReady } from './helpers/documentReady';
import { initializeIntegrations } from './components/integrations';
Expand Down Expand Up @@ -122,6 +122,8 @@ const doOnLoad = () => {

if (document.querySelector('.code-tabs')) {
initCodeTabs();
} else {
chromeHashFix();
}
};

Expand Down
13 changes: 12 additions & 1 deletion assets/scripts/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ const getCookieByName = (name) => {
return value;
};

const chromeHashFix = () => {
const isChrome = /Chrome/.test(navigator.userAgent);
if (window.location.hash && isChrome) {
setTimeout(function () {
const hash = window.location.hash;
window.location.hash = '';
window.location.hash = hash;
}, 300);
}
}

const bodyClassContains = (string) => document.body.classList.contains(string);

export { updateMainContentAnchors, reloadWistiaVidScripts, gtag, getCookieByName, bodyClassContains };
export { updateMainContentAnchors, reloadWistiaVidScripts, gtag, getCookieByName, bodyClassContains, chromeHashFix };
16 changes: 14 additions & 2 deletions assets/scripts/helpers/string.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
const stringToTitleCase = (string) => {
if(string.length <= 0) return string;

const allCapWords = ['CSM', 'SIEM']
let openParens = false;

return string.split(' ')
.map(word => word[0].toUpperCase() + word.substr(1).toLowerCase())
.join(' ');
.map(word => {
if(word.startsWith('(')) openParens = true
if(allCapWords.some(cap => word.toLowerCase().includes(cap.toLowerCase()))) return word.toUpperCase();
if(word.endsWith(')')){
openParens = false
return word.toLowerCase()
}
if (openParens) return word.toLowerCase()
return word[0].toUpperCase() + word.substr(1).toLowerCase()
}).join(' ');
}

const truncateString = (string, characterMax, addEllipsis) => {
Expand Down
12 changes: 6 additions & 6 deletions assets/styles/pages/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ details {
position: relative;
padding-right: 0 !important;
pre {
padding: 30px 10px;
padding: 10px;
}
code {
white-space: pre;
Expand All @@ -260,14 +260,14 @@ details {
opacity: 0;
right: 0;
top: 0;
padding: 1rem 1rem 0 0;
padding: .5rem .5rem 0 0;
transition: opacity 0.2s ease-in-out;
z-index: 1;
button {
background-color: $white;
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.25);
border-radius: 4px;
padding: 8px 25px;
padding: 2px 12px 3px 12px;
transition: box-shadow 0.2s ease-in-out;
&:hover {
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.45);
Expand All @@ -285,7 +285,7 @@ details {
position: relative;
padding-right: 0 !important;
pre {
padding: 30px 10px;
padding: 10px;
}
code {
white-space: pre;
Expand All @@ -304,14 +304,14 @@ details {
opacity: 0;
right: 0;
top: 0;
padding: 1rem 1rem 0 0;
padding: .5rem .5rem 0 0;
transition: opacity 0.2s ease-in-out;
z-index: 1;
button {
background-color: $white;
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.25);
border-radius: 4px;
padding: 8px 25px;
padding: 2px 12px 3px 12px;
transition: box-shadow 0.2s ease-in-out;
&:hover {
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.45);
Expand Down
Loading

0 comments on commit 433dda8

Please sign in to comment.