Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Fix Flux CSV README examples #761

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jstirnaman
Copy link

  • Add required LayerConfig fill property.
  • Revise examples.

- Add required LayerConfig `fill` property.
- Revise examples.
@jstirnaman jstirnaman requested a review from a team June 3, 2022 20:25
Copy link
Contributor

@hoorayimhelping hoorayimhelping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating our docs! Have a couple of minor styling nitpicks to make the code behave more like the code in the codebase.

Please be sure to re-request a review from me, otherwise I may not get updated that changes have been made!

```ts
import { fromFlux, Plot, LayerTypes, Config, LayerConfig } from '@influxdata/giraffe'

export default function DevicePlot() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nitpick, but I don't think we should encourage export default in docs for some of the reasons outlined here: https://basarat.gitbook.io/typescript/main-1/defaultisbad.

It would look like this when removing the export default:

export const DevicePlot = () => {

table: dataFromFlux.table,
layers: [lineLayer],
}

// ...
return(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return(
return (


<pre>
import {Plot} from '@influxdata/giraffe'
export default function DevicePlot() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same bit here about export default

export const DevicePlot = () => {

<pre>
import {Plot, fromFlux} from '@influxdata/giraffe'
```ts
import { fromFlux, Plot, LayerTypes, Config, LayerConfig } from '@influxdata/giraffe'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's alphabetize these imports, and remove the spaces between the brackets, since that is our coding standard.

import {fromFlux, Config, LayerConfig, LayerTypes, Plot}


When using the comma separated values (CSV) from the Flux query as the `fluxResponse` property:
```ts
import { Plot, LayerTypes, Config, LayerConfig } from '@influxdata/giraffe'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here about alphabetizing and removing the spaces around the braces

import {Config, LayerConfig, LayerTypes, Plot}

Copy link
Contributor

@TCL735 TCL735 Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid TypeScript in the examples. I find TypeScript to be an advanced tool. Our examples should be approachable. Someone who wants to use just React does not need to import LayerTypes.

fluxResponse,
layers: [lineLayer],
}

// ...
return(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our standards have a space between return and ( or {

Suggested change
return(
return (


When using the comma separated values (CSV) from the Flux query as the `fluxResponse` property:
```ts
import { Plot, LayerTypes, Config, LayerConfig } from '@influxdata/giraffe'
Copy link
Contributor

@TCL735 TCL735 Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid TypeScript in the examples. I find TypeScript to be an advanced tool. Our examples should be approachable. Someone who wants to use just React does not need to import LayerTypes.

const lineLayer = {
type: "line",
const lineLayer: LayerConfig = {
type: LayerTypes.Line,
Copy link
Contributor

@TCL735 TCL735 Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid TypeScript in the examples. I find TypeScript to be an advanced tool. Our examples should be approachable. Someone who wants to use just React needs only the string "line"

}

const config = {
const config: Config = {
Copy link
Contributor

@TCL735 TCL735 Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid TypeScript in the examples. I find TypeScript to be an advanced tool. Our examples should be approachable. No need to confuse someone who just wants (and knows only how) to use React.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants