Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4060 from kyoto/monitoring-dashboards-fix-tooltips
Monitoring Dashboards: Fix tooltips and improve graph styling
- Loading branch information
Showing
4 changed files
with
73 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 23 additions & 11 deletions
34
frontend/public/components/monitoring/dashboards/graph.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,43 @@ | ||
import * as _ from 'lodash-es'; | ||
import * as React from 'react'; | ||
import { connect } from 'react-redux'; | ||
|
||
import { FormatLegendLabel, QueryBrowser } from '../query-browser'; | ||
import * as UIActions from '../../../actions/ui'; | ||
import { FormatLegendLabel, PatchQuery, QueryBrowser } from '../query-browser'; | ||
|
||
// Set the queries in Redux so that other components like the graph tooltip can access them | ||
const patchAllQueries = (queries: string[], patchQuery: PatchQuery): void => { | ||
_.each(queries, (query, i) => patchQuery(i, { query })); | ||
}; | ||
|
||
const Graph: React.FC<Props> = ({ | ||
formatLegendLabel, | ||
isStack, | ||
patchQuery, | ||
pollInterval, | ||
queries, | ||
timespan, | ||
}) => ( | ||
<QueryBrowser | ||
defaultSamples={30} | ||
formatLegendLabel={formatLegendLabel} | ||
hideControls | ||
isStack={isStack} | ||
pollInterval={pollInterval} | ||
queries={queries} | ||
timespan={timespan} | ||
/> | ||
<div onMouseEnter={() => patchAllQueries(queries, patchQuery)}> | ||
<QueryBrowser | ||
defaultSamples={30} | ||
formatLegendLabel={formatLegendLabel} | ||
hideControls | ||
isStack={isStack} | ||
pollInterval={pollInterval} | ||
queries={queries} | ||
timespan={timespan} | ||
/> | ||
</div> | ||
); | ||
|
||
type Props = { | ||
formatLegendLabel?: FormatLegendLabel; | ||
isStack: boolean; | ||
patchQuery: PatchQuery; | ||
pollInterval: number; | ||
queries: string[]; | ||
timespan: number; | ||
}; | ||
|
||
export default Graph; | ||
export default connect(null, { patchQuery: UIActions.queryBrowserPatchQuery })(Graph); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters