File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
chronos_npm_package/server Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ interface EventChartProps {
19
19
*/
20
20
const GrafanaEventChart : React . FC < EventChartProps > = React . memo ( props => {
21
21
const { metricName } = props ;
22
+ const [ graphType , setGraphType ] = useState < string > ( "timeseries" ) ;
22
23
// const [solo, setSolo] = useState<SoloStyles | null>(null);
23
24
console . log ( "inside GrafanaEventChart" )
24
25
@@ -37,13 +38,17 @@ const GrafanaEventChart: React.FC<EventChartProps> = React.memo(props => {
37
38
console . log ( "uid: " , uid )
38
39
console . log ( "parsedName: " , parsedName )
39
40
41
+ const handleSelectionChange = ( event ) => {
42
+ setGraphType ( event . target . value ) ;
43
+ fetch ( 'http://localhost:1111/random' )
44
+ }
45
+
40
46
return (
41
47
< div className = "chart" data-testid = "Grafana Event Chart" >
42
- < br />
43
48
< h2 > { parsedName } </ h2 >
44
- { /* create chart using grafana */ }
49
+ { /* create chart using grafana iframe tag */ }
45
50
< iframe src = { `http://localhost:32000/d-solo/${ uid } /${ parsedName } ?orgId=1&refresh=10s&from=now-5m&to=now&panelId=1` } width = "650" height = "400" > </ iframe >
46
- < select name = "cars " id = "cars" >
51
+ < select name = "graphType " id = "graphType" value = { graphType } onChange = { handleSelectionChange } >
47
52
< option value = "timeseries" > Time Series</ option >
48
53
< option value = "barchart" > Bar Chart</ option >
49
54
< option value = "stat" > Stat</ option >
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ app.use(express.urlencoded());
13
13
14
14
app . get ( '/random' , ( req , res ) => {
15
15
console . log ( 'random endpoint hit' )
16
+ console . log ( 'number: ' , Math . floor ( Math . random ( ) * Math . floor ( 100 ) ) )
16
17
res . json ( {
17
18
number : Math . floor ( Math . random ( ) * Math . floor ( 100 ) )
18
19
} )
You can’t perform that action at this time.
0 commit comments