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

Chart improvements #989

Merged
merged 25 commits into from
Oct 2, 2018
Merged

Chart improvements #989

merged 25 commits into from
Oct 2, 2018

Conversation

bjoernricks
Copy link
Contributor

  • Allow to render different icons in overlay
  • Allow to toggle legend
  • Allow to toggle 2d/3d donut view
  • Allow to store chart specific data
  • Fix stuff 😁

Move react state methods up.
hasSvg can always be derived in render.
Add icon to toggle displaying the legend of charts.
Allow to override the icon prop of DataDisplay to render different icons
for a chart.
Allow to set and get state for charts in DataDisplay. Setting the state
will also re-render the children which wouldn't be possible if a chart
keeps the state internally in it's component. At a first step the
showLegend state is put into the chart state.

In future this chart state will be saved in the redux store too.
Chart modules should not depend on dashboard components. Charts
components are only for displaying some data and dashboards for
orchestrating different displays which might be charts.
Charts must be updates at least if data, width or height props have
changed.
Rename displayLegend of Bar chart to showLegend and add showLegend to
Donut chart.
If the legend is displayed the Bar chart must be rendered again after
the ref is set.

Also update chart to use new React.createRef API.
We have mostly all proptypes at the bottom of the js module. Therefore
it's demanding to search for the LineChart proptypes.
Use showLegend prop instead of displayLegend at LineChart.
Never crash if svg or download refs aren't set. This should not ever
happen but it is saver to check for this case.
When the svg ref is set in a child of DataDisplay the component will not
be re-rendered necessarily. Therefore the svg ref may be set but the
icon is still not displayed. Therefore add an external prop to
deactivate the svg download icon on demand.
When displaying a table it shouldn't be possible to download a svg.
Only re-calculate state from width if the width has changed actually. Th
LineChart did crash because the width has been re-calculated when
hovering over the LineChart to display the tooltips. This lead to an
infinite loop.

Also fix calculation of the width. It uses the same pattern as the donut
chart now.
A chart should be re-rendered if the showLegend prop has changed.
@codecov
Copy link

codecov bot commented Oct 2, 2018

Codecov Report

Merging #989 into master will increase coverage by <.01%.
The diff coverage is 3.9%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #989      +/-   ##
=========================================
+ Coverage    9.11%   9.11%   +<.01%     
=========================================
  Files         818     821       +3     
  Lines       26695   26744      +49     
  Branches     5737    5717      -20     
=========================================
+ Hits         2432    2437       +5     
- Misses      21908   21947      +39     
- Partials     2355    2360       +5
Impacted Files Coverage Δ
gsa/src/web/pages/tasks/dashboard/highresults.js 0% <ø> (ø) ⬆️
...a/src/web/pages/tasks/dashboard/mosthighresults.js 0% <ø> (ø) ⬆️
...ges/operatingsystems/dashboard/vulnscoredisplay.js 0% <ø> (ø) ⬆️
.../src/web/pages/hosts/dashboard/vulnscoredisplay.js 0% <ø> (ø) ⬆️
...b/components/dashboard/display/datatabledisplay.js 0% <ø> (ø) ⬆️
...a/src/web/pages/hosts/dashboard/modifieddisplay.js 0% <ø> (ø) ⬆️
.../web/pages/overrides/dashboard/wordclouddisplay.js 0% <ø> (ø) ⬆️
...onents/dashboard/display/created/createddisplay.js 0% <ø> (ø) ⬆️
...b/components/dashboard/display/cvss/cvssdisplay.js 0% <ø> (ø) ⬆️
.../src/web/pages/tasks/dashboard/schedulesdisplay.js 0% <ø> (ø) ⬆️
... and 36 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f470240...ed66c95. Read the comment docs.

Use initialState instead of initialChartState because the internal state
variable name isn't visible outside of DataDisplay component. For
children it's only the state.
@swaterkamp swaterkamp merged commit 09ad750 into greenbone:master Oct 2, 2018
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.

2 participants