Skip to content

Commit

Permalink
docs(clients): add onboarding for new influxdb3-go, `influxdb3-csha…
Browse files Browse the repository at this point in the history
…rp`, `influxdb3-java`
  • Loading branch information
bednar authored Jun 30, 2023
1 parent 5e4133e commit 701351d
Show file tree
Hide file tree
Showing 31 changed files with 2,859 additions and 186 deletions.
175 changes: 175 additions & 0 deletions src/homepageExperience/components/HomepageIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,181 @@ export const GoIcon = (
</svg>
)

export const CSharpIcon = (
<svg
version="1.1"
id="Layer_1"
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width="65"
height="65"
viewBox="0 0 79 88"
>
<g>
<path
id="XMLID_10_"
fill="#9A4993"
d="M78.9,25.9c0-1.5-0.3-2.8-1-3.9c-0.6-1.1-1.6-2-2.8-2.7c-10.5-6-21-12-31.6-18.1
c-2.8-1.6-5.6-1.6-8.4,0.1C31,3.7,10,15.6,3.7,19.2C1.2,20.7,0,23,0,25.9c0,12,0,24.2,0,36.2c0,1.4,0.3,2.7,0.9,3.8
C1.5,67,2.5,68,3.8,68.7c6.3,3.6,27.2,15.4,31.4,18c2.8,1.6,5.6,1.7,8.4,0.1c10.5-6,21-12,31.6-18.1c1.3-0.7,2.2-1.7,2.9-2.8
c0.6-1.1,0.9-2.4,0.9-3.8C78.9,62.2,78.9,38,78.9,25.9"
/>
<path
id="XMLID_8_"
fill="#6A1577"
d="M39.6,43.9L0.9,66c0.6,1.1,1.6,2.1,2.9,2.8c6.3,3.6,27.2,15.4,31.4,18c2.8,1.6,5.6,1.7,8.4,0.1
c10.5-6,21-12,31.6-18.1c1.3-0.7,2.2-1.7,2.9-2.8L39.6,43.9"
/>
<path
id="XMLID_7_"
fill="#6A1577"
d="M28.1,50.4c2.2,3.9,6.5,6.5,11.3,6.5s9.1-2.7,11.3-6.6l-11.2-6.4L28.1,50.4"
/>
<path
id="XMLID_2_"
fill="#813084"
d="M78.9,25.9c0-1.5-0.3-2.8-1-3.9l-38.3,22L78,66c0.6-1.1,0.9-2.4,0.9-3.8
C78.9,62.2,78.9,38,78.9,25.9"
/>
<path
id="XMLID_9_"
fill="#FFFFFF"
d="M50.8,50.3c-2.2,3.9-6.5,6.6-11.3,6.6c-4.9,0-9.1-2.6-11.3-6.5c-1.1-1.9-1.7-4.1-1.7-6.4
c0-7.1,5.9-12.9,13-12.9c4.9,0,9,2.6,11.3,6.4L62.1,31C57.6,23.3,49.2,18,39.4,18C25,18,13.3,29.7,13.3,44c0,4.7,1.2,9.1,3.4,12.9
c4.6,7.8,13,13,22.8,13s18.2-5.3,22.8-13.1L50.8,50.3"
/>
<g id="XMLID_32_">
<rect
id="XMLID_1_"
x="62.6"
y="37.9"
fill="#FFFFFF"
width="2.6"
height="12.4"
/>
<rect
id="XMLID_30_"
x="68.4"
y="37.9"
fill="#FFFFFF"
width="2.6"
height="12.4"
/>
<rect
id="XMLID_31_"
x="60.6"
y="40"
fill="#FFFFFF"
width="12.5"
height="2.6"
/>
<rect
id="XMLID_23_"
x="60.6"
y="45.7"
fill="#FFFFFF"
width="12.5"
height="2.6"
/>
</g>
</g>
</svg>
)

export const JavaIcon = (
<svg
version="1.1"
id="Layer_1"
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width="65"
height="65"
viewBox="0 0 64 119"
>
<g>
<path
id="XMLID_16_"
fill="#0074BD"
d="M21.2,63c0,0-3.1,1.8,2.2,2.4c6.5,0.7,9.8,0.6,16.9-0.7c0,0,1.9,1.2,4.5,2.2
C28.8,73.8,8.6,66.5,21.2,63L21.2,63z"
/>
<path
id="XMLID_15_"
fill="#0074BD"
d="M19.2,54.2c0,0-3.5,2.6,1.8,3.1c6.9,0.7,12.4,0.8,21.8-1c0,0,1.3,1.3,3.4,2
C26.9,63.9,5.4,58.8,19.2,54.2L19.2,54.2z"
/>
<path
id="XMLID_14_"
fill="#EA2D2E"
d="M35.8,39c3.9,4.5-1,8.6-1,8.6s10-5.2,5.4-11.6c-4.3-6-7.6-9,10.2-19.3
C50.4,16.7,22.3,23.6,35.8,39L35.8,39z"
/>
<path
id="XMLID_13_"
fill="#0074BD"
d="M56.9,69.6c0,0,2.3,1.9-2.5,3.4c-9.2,2.8-38.5,3.6-46.6,0.1c-2.9-1.3,2.6-3,4.3-3.4
c1.8-0.4,2.8-0.3,2.8-0.3c-3.2-2.3-20.9,4.5-9,6.4C38.5,81.1,65.4,73.4,56.9,69.6L56.9,69.6z"
/>
<path
id="XMLID_12_"
fill="#0074BD"
d="M22.7,44.9c0,0-14.8,3.5-5.3,4.8c4,0.5,12.1,0.4,19.6-0.2c6.1-0.5,12.3-1.6,12.3-1.6
s-2.2,0.9-3.7,2C30.5,53.9,1.4,52,9.8,48C16.9,44.5,22.7,44.9,22.7,44.9L22.7,44.9z"
/>
<path
id="XMLID_11_"
fill="#0074BD"
d="M49.4,59.7c15.3-8,8.2-15.6,3.3-14.6c-1.2,0.3-1.8,0.5-1.8,0.5s0.5-0.7,1.3-1
C62,41.3,69.5,54.8,49,60.1C49.1,60.1,49.3,59.9,49.4,59.7L49.4,59.7z"
/>
<path
id="XMLID_10_"
fill="#EA2D2E"
d="M40.1,0c0,0,8.5,8.5-8,21.5c-13.3,10.5-3,16.4,0,23.3c-7.7-7-13.4-13.1-9.6-18.8
C28,17.5,43.6,13.5,40.1,0L40.1,0z"
/>
<path
id="XMLID_9_"
fill="#0074BD"
d="M24.2,81.3c14.7,0.9,37.4-0.5,37.9-7.5c0,0-1,2.6-12.2,4.7c-12.5,2.4-28,2.1-37.3,0.6
C12.6,79.1,14.5,80.7,24.2,81.3L24.2,81.3z"
/>
<path
fill="#EA2D2E"
d="M61.4,93.8H61v-0.3h1.2v0.3h-0.4v1.3h-0.3L61.4,93.8L61.4,93.8L61.4,93.8z M63.8,93.8L63.8,93.8L63.3,95h-0.2
l-0.4-1.2l0,0V95h-0.3v-1.5h0.4l0.4,1.1l0.4-1.1H64V95h-0.3L63.8,93.8L63.8,93.8z"
/>
<path
fill="#EA2D2E"
d="M21.8,107.9c-1.4,1.2-2.9,1.9-4.2,1.9c-1.9,0-2.9-1.1-2.9-2.9c0-2,1.1-3.4,5.4-3.4h1.6v4.4H21.8L21.8,107.9z
M25.6,112.2V98.8c0-3.4-1.9-5.7-6.6-5.7c-2.7,0-5.1,0.7-7.1,1.5l0.6,2.4c1.5-0.6,3.5-1.1,5.5-1.1c2.7,0,3.9,1.1,3.9,3.3v1.7h-1.4
c-6.6,0-9.5,2.5-9.5,6.4c0,3.3,2,5.2,5.6,5.2c2.4,0,4.1-1,5.8-2.4l0.3,2L25.6,112.2L25.6,112.2z"
/>
<path
id="XMLID_4_"
fill="#EA2D2E"
d="M38.5,112.2h-4.8l-5.7-18.7h4.1l3.6,11.5l0.8,3.5c1.8-5,3.1-10.1,3.7-14.9h4.1
C43.1,99.6,41.2,106.4,38.5,112.2L38.5,112.2z"
/>
<path
fill="#EA2D2E"
d="M56.8,107.9c-1.4,1.2-2.9,1.9-4.2,1.9c-1.9,0-2.9-1.1-2.9-2.9c0-2,1.1-3.4,5.4-3.4h1.6L56.8,107.9L56.8,107.9
L56.8,107.9z M60.6,112.2V98.8c0-3.4-2-5.7-6.6-5.7c-2.7,0-5.1,0.7-7.1,1.5l0.6,2.4c1.5-0.6,3.5-1.1,5.5-1.1c2.7,0,3.9,1.1,3.9,3.3
v1.7h-1.4c-6.6,0-9.5,2.5-9.5,6.4c0,3.3,2,5.2,5.6,5.2c2.4,0,4.1-1,5.8-2.4l0.3,2L60.6,112.2L60.6,112.2z"
/>
<path
id="XMLID_1_"
fill="#EA2D2E"
d="M6.7,115.4c-1.1,1.6-2.9,2.9-4.8,3.6L0,116.8c1.5-0.8,2.7-2,3.3-3.1c0.5-1,0.7-2.3,0.7-5.4V87
h4.1v21.1C8.1,112,7.8,113.7,6.7,115.4L6.7,115.4z"
/>
</g>
</svg>
)

export const BookIcon = (
<svg
width="18"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export const AddDataAccordion: FC = () => {

const languageList = {
Arduino: 'new-user-setup/arduino',
'C#': 'load-data/client-libraries/csharp',
'C#': 'new-user-setup/csharp',
Dart: 'load-data/client-libraries/dart',
Go: 'new-user-setup/golang',
Java: 'load-data/client-libraries/java',
Java: 'new-user-setup/java',
Kotlin: 'load-data/client-libraries/kotlin',
'Node.js': 'new-user-setup/nodejs',
PHP: 'load-data/client-libraries/php',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
.cf-accordion--body-alignment-right {
padding-right: $cf-space-s;
}

.cf-accordion--body-container--expanded {
position: relative;
z-index: 1;
}
}

.option-accordion-header--icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export const QueryDataAccordion: FC = () => {
}

const languageList = {
'C#': 'new-user-setup/csharp',
Go: 'new-user-setup/golang',
Java: 'new-user-setup/java',
Python: 'new-user-setup/python',
}

Expand Down Expand Up @@ -78,7 +80,7 @@ export const QueryDataAccordion: FC = () => {
/>
<OptionAccordionElement
elementTitle="Application Code"
elementDescription="Write data into your database directly with your application code."
elementDescription="Query your data directly with your application code."
cta={() => {
return (
<FlexBox
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React from 'react'
import CodeSnippet from 'src/shared/components/CodeSnippet'

import {SafeBlankLink} from 'src/utils/SafeBlankLink'
import {event} from 'src/cloud/utils/reporting'

type OwnProps = {
bucket: string
}

export const ExecuteAggregateQuery = (props: OwnProps) => {
const {bucket} = props

const logCopyCodeSnippet = () => {
event('firstMile.csharpWizard.executeAggregateQuery.code.copied')
}

const logDocsOpened = () => {
event('firstMile.csharpWizard.executeAggregateQuery.docs.opened')
}

const fromBucketSnippet = `from(bucket: "${bucket}")
|> range(start: -10m) # find data points in last 10 minutes
|> mean()`

const query = `const string queryAggregate = @"from(bucket: ""${bucket}"")
|> range(start: -10m)
|> mean()";
foreach (var table in await queryApi.QueryAsync(query: queryAggregate, org: org))
{
foreach (var record in table.Records)
{
var field = record.GetField();
var value = record.GetValue();
Console.WriteLine("| {0,-5} | {1,-20} |", field, value);
}
}`

return (
<>
<h1>Execute an Aggregate Query</h1>
<p>
<SafeBlankLink
href="https://docs.influxdata.com/flux/v0.x/function-types/#aggregates"
onClick={logDocsOpened}
>
Aggregate functions
</SafeBlankLink>{' '}
take the values of all rows in a table and use them to perform an
aggregate operation. The result is output as a new value in a single-row
table.
</p>
<CodeSnippet
text={fromBucketSnippet}
showCopyControl={false}
onCopy={logCopyCodeSnippet}
language="properties"
/>
<p>
In this example, we use the{' '}
<code className="homepage-wizard--code-highlight">mean()</code> function
to calculate the average value of data points in the last 10 minutes.
<br />
<br />
Add the following to your <code>WriteQueryExample</code> class:
</p>
<CodeSnippet text={query} onCopy={logCopyCodeSnippet} language="csharp" />
<p style={{marginTop: '20px'}}>
This will return the mean for the "bees" and "ants" values.
</p>
</>
)
}
68 changes: 68 additions & 0 deletions src/homepageExperience/components/steps/csharp/ExecuteQuery.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React from 'react'

import CodeSnippet from 'src/shared/components/CodeSnippet'
import {event} from 'src/cloud/utils/reporting'

type OwnProps = {
bucket: string
}

export const ExecuteQuery = (props: OwnProps) => {
const {bucket} = props

const logCopyCodeSnippet = () => {
event('firstMile.csharpWizard.executeQuery.code.copied')
}

const fromBucketSnippet = `from(bucket: "${bucket}")
|> range(start: -10m)`

const query = `Console.WriteLine("Complete. Return to the InfluxDB UI.");
var queryApi = client.GetQueryApi();
const string query = @"from(bucket: ""${bucket}"") |> range(start: -10m)";
foreach (var table in await queryApi.QueryAsync(query: query, org: org))
{
foreach (var record in table.Records)
{
var field = record.GetField();
var value = record.GetValue();
var time = record.GetTime();
Console.WriteLine("| {0,-5} | {1,-5} | {2,-30} |", field, value, time);
}
}`

return (
<>
<h1>Execute a Flux Query</h1>
<p>
Now let’s query the numbers we wrote into the database. We use the Flux
scripting language to query data. Flux is designed for querying,
analyzing, and acting on data.
<br />
<br />
Here is what a simple Flux query looks like on its own:
</p>
<CodeSnippet
text={fromBucketSnippet}
showCopyControl={false}
onCopy={logCopyCodeSnippet}
language="properties"
/>
<p>
In this query, we are looking for data points within the last 10 minutes
with a measurement of "census".
<br />
<br />
Let’s use that Flux query in our C# code!
<br />
<br />
Add the following to your <code>WriteQueryExample</code> class:
</p>
<CodeSnippet text={query} onCopy={logCopyCodeSnippet} language="csharp" />
</>
)
}
Loading

0 comments on commit 701351d

Please sign in to comment.