-
Notifications
You must be signed in to change notification settings - Fork 406
Add RedisTimeseries plugin #312
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
Conversation
import Chart from './components/Chart/Chart' | ||
import ChartResultView from './components/Chart/ChartResultView' | ||
|
||
import { TimeSeries, YAxisConfig, ChartConfig, AxisScale, GraphMode } from './components/Chart/interfaces' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, move interface after imports.
/* eslint-disable react/jsx-filename-extension */ | ||
import React, {useState} from 'react' | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, remove one empty line
const App = (props: Props) => { | ||
const { command = '', result: [{ response = '', status = '' } = {}] = [] } = props | ||
|
||
const data= response1.result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add space after data
* chartConfig={chartConfig} | ||
* data={data as any} | ||
* /> | ||
* ) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, remove comment blocks
* } | ||
|
||
* return <TableResult query={command} result={result} /> */ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same.
Also will be good to handle fail
status
import ChartConfigForm from './ChartConfigForm' | ||
import { TimeSeries, YAxisConfig, ChartConfig, AxisScale, GraphMode } from './interfaces' | ||
import Chart from './Chart' | ||
import { EuiSpacer } from '@elastic/eui' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, sort imports
</div> | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please refactor this component to function component
export const TIMESERIES_HISTORY_CONTAINER_NAME = 'REDIS_TIMESERIES' | ||
|
||
export const AUTO_UPDATE_TIMER_DEFAULT_VALUE = 5000 // time in milliseconds | ||
export const AUTO_UPDATE_NUM_SAMPLES_DEFAULT_VALUE = 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import these constants from './constants'
check: EuiIconCheck, | ||
}) | ||
|
||
import { EuiProvider } from '@elastic/eui'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, sort imports
import { icon as EuiIconArrowRight } from '@elastic/eui/es/components/icon/assets/arrow_right'; | ||
import { icon as EuiIconArrowDown } from '@elastic/eui/es/components/icon/assets/arrow_down'; | ||
import { icon as EuiIconCross } from '@elastic/eui/es/components/icon/assets/cross'; | ||
import { icon as EuiIconCheck } from '@elastic/eui/es/components/icon/assets/check'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, remove semicolons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could you please, check the plugin for responsive design?
* add redistimeseries plugin to app * update plugin dir path
- Remove semicolons, dead code and more
merge main
import React, { useRef, useEffect } from 'react' | ||
import Plotly, { Layout } from 'plotly.js-dist-min' | ||
import { Legend, LayoutAxis, PlotData } from 'plotly.js' | ||
import moment from 'moment' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moment.js is depricated
Could you replace it to date-fns?
|
||
const isDarkTheme = document.body.classList.contains('theme_DARK') | ||
|
||
export default function Chart(props: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add an interface for props
?
{ displayModeBar: false, autosizable: true, responsive: true, setBackground: () => 'transparent', }, | ||
) | ||
chartContainer.current.on('plotly_hover', function (eventdata) { | ||
var points = eventdata.points[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change var
to const
and at the line below
})), | ||
Object.keys((chartContainer.current)._fullLayout._plots)) | ||
}) | ||
chartContainer.current.on('plotly_relayout', function (eventdata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add an interface for eventdata
?
And for others chartContainer.current handlers
})), | ||
Object.keys((chartContainer.current)._fullLayout._plots)) | ||
}) | ||
chartContainer.current.on('plotly_relayout', function (eventdata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move 'plotly_relayout', 'plotly_hover' and 'plotly_doubleclick' to enum
chartState: LAYOUT_STATE | ||
} | ||
|
||
export default class ChartResultView extends React.Component<ChartResultViewProps, ChartResultViewState> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rewrite React.Component to Functional Component
@@ -0,0 +1,264 @@ | |||
export const WATERMARK_OPTIONS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move all constants from this file to constants.ts file
} | ||
|
||
function getMimeTypeOfDataURI(uri: DataURI) { | ||
return uri.split(/[:;,]/g)[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move RegExp to constants?
and please add Optional chaining operator before [1]
, this is not safety
uri.split(...).?[1]
} | ||
} | ||
|
||
export function hexToRGBA(hex: string, opacity: number): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rewrite this function. It's hard to read
const { command = '', data: result = [] } = props | ||
render( | ||
<App command={command} result={result} />, | ||
document.getElementById('app')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move second round bracket to the next line
Also could you add Unit tests for utils? |
@GnaneshKunal |
# Conflicts: # scripts/build-statics.cmd # scripts/build-statics.sh
No description provided.