[App Search] Fix bash API code example (#106015)
* Fix bash/curl API code example not correctly having `\`s at the end of non-body lines - Doing this requires removing the `dedent()` fn which is messing up backslashes - Removing dedent requires setting the template literal indentation to 0 and changing the indent level on DOCUMENTS_API_JSON_EXAMPLE * I unindented DOCUMENTS_API_JSON_EXAMPLE too hard - the { is no longer lined up with the [ I think??? what am I even doing with my life
This commit is contained in:
parent
5b68c54568
commit
da7c43c1db
|
@ -36,34 +36,34 @@ export const DOCUMENT_CREATION_WARNINGS = {
|
||||||
// This is indented the way it is to work with ApiCodeExample.
|
// This is indented the way it is to work with ApiCodeExample.
|
||||||
// Use dedent() when calling this alone
|
// Use dedent() when calling this alone
|
||||||
export const DOCUMENTS_API_JSON_EXAMPLE = `[
|
export const DOCUMENTS_API_JSON_EXAMPLE = `[
|
||||||
{
|
{
|
||||||
"id": "park_rocky-mountain",
|
"id": "park_rocky-mountain",
|
||||||
"title": "Rocky Mountain",
|
"title": "Rocky Mountain",
|
||||||
"description": "Bisected north to south by the Continental Divide, this portion of the Rockies has ecosystems varying from over 150 riparian lakes to montane and subalpine forests to treeless alpine tundra. Wildlife including mule deer, bighorn sheep, black bears, and cougars inhabit its igneous mountains and glacial valleys. Longs Peak, a classic Colorado fourteener, and the scenic Bear Lake are popular destinations, as well as the historic Trail Ridge Road, which reaches an elevation of more than 12,000 feet (3,700 m).",
|
"description": "Bisected north to south by the Continental Divide, this portion of the Rockies has ecosystems varying from over 150 riparian lakes to montane and subalpine forests to treeless alpine tundra. Wildlife including mule deer, bighorn sheep, black bears, and cougars inhabit its igneous mountains and glacial valleys. Longs Peak, a classic Colorado fourteener, and the scenic Bear Lake are popular destinations, as well as the historic Trail Ridge Road, which reaches an elevation of more than 12,000 feet (3,700 m).",
|
||||||
"nps_link": "https://www.nps.gov/romo/index.htm",
|
"nps_link": "https://www.nps.gov/romo/index.htm",
|
||||||
"states": [
|
"states": [
|
||||||
"Colorado"
|
"Colorado"
|
||||||
],
|
],
|
||||||
"visitors": 4517585,
|
"visitors": 4517585,
|
||||||
"world_heritage_site": false,
|
"world_heritage_site": false,
|
||||||
"location": "40.4,-105.58",
|
"location": "40.4,-105.58",
|
||||||
"acres": 265795.2,
|
"acres": 265795.2,
|
||||||
"square_km": 1075.6,
|
"square_km": 1075.6,
|
||||||
"date_established": "1915-01-26T06:00:00Z"
|
"date_established": "1915-01-26T06:00:00Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "park_saguaro",
|
"id": "park_saguaro",
|
||||||
"title": "Saguaro",
|
"title": "Saguaro",
|
||||||
"description": "Split into the separate Rincon Mountain and Tucson Mountain districts, this park is evidence that the dry Sonoran Desert is still home to a great variety of life spanning six biotic communities. Beyond the namesake giant saguaro cacti, there are barrel cacti, chollas, and prickly pears, as well as lesser long-nosed bats, spotted owls, and javelinas.",
|
"description": "Split into the separate Rincon Mountain and Tucson Mountain districts, this park is evidence that the dry Sonoran Desert is still home to a great variety of life spanning six biotic communities. Beyond the namesake giant saguaro cacti, there are barrel cacti, chollas, and prickly pears, as well as lesser long-nosed bats, spotted owls, and javelinas.",
|
||||||
"nps_link": "https://www.nps.gov/sagu/index.htm",
|
"nps_link": "https://www.nps.gov/sagu/index.htm",
|
||||||
"states": [
|
"states": [
|
||||||
"Arizona"
|
"Arizona"
|
||||||
],
|
],
|
||||||
"visitors": 820426,
|
"visitors": 820426,
|
||||||
"world_heritage_site": false,
|
"world_heritage_site": false,
|
||||||
"location": "32.25,-110.5",
|
"location": "32.25,-110.5",
|
||||||
"acres": 91715.72,
|
"acres": 91715.72,
|
||||||
"square_km": 371.2,
|
"square_km": 371.2,
|
||||||
"date_established": "1994-10-14T05:00:00Z"
|
"date_established": "1994-10-14T05:00:00Z"
|
||||||
}
|
}
|
||||||
]`;
|
]`;
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import dedent from 'dedent';
|
|
||||||
|
|
||||||
import { useValues, useActions } from 'kea';
|
import { useValues, useActions } from 'kea';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -107,23 +105,22 @@ export const FlyoutBody: React.FC = () => {
|
||||||
</EuiFlexGroup>
|
</EuiFlexGroup>
|
||||||
</EuiPanel>
|
</EuiPanel>
|
||||||
<EuiCodeBlock language="bash" fontSize="m" isCopyable>
|
<EuiCodeBlock language="bash" fontSize="m" isCopyable>
|
||||||
{dedent(`
|
{`\
|
||||||
curl -X POST '${documentsApiUrl}'
|
curl -X POST '${documentsApiUrl}' \\
|
||||||
-H 'Content-Type: application/json'
|
-H 'Content-Type: application/json' \\
|
||||||
-H 'Authorization: Bearer ${apiKey}'
|
-H 'Authorization: Bearer ${apiKey}' \\
|
||||||
-d '${DOCUMENTS_API_JSON_EXAMPLE}'
|
-d '${DOCUMENTS_API_JSON_EXAMPLE}'
|
||||||
# Returns
|
# Returns
|
||||||
# [
|
# [
|
||||||
# {
|
# {
|
||||||
# "id": "park_rocky-mountain",
|
# "id": "park_rocky-mountain",
|
||||||
# "errors": []
|
# "errors": []
|
||||||
# },
|
# },
|
||||||
# {
|
# {
|
||||||
# "id": "park_saguaro",
|
# "id": "park_saguaro",
|
||||||
# "errors": []
|
# "errors": []
|
||||||
# }
|
# }
|
||||||
# ]
|
# ]`}
|
||||||
`)}
|
|
||||||
</EuiCodeBlock>
|
</EuiCodeBlock>
|
||||||
</EuiFlyoutBody>
|
</EuiFlyoutBody>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue