Skip to content

Commit

Permalink
Fixes #29734 - Fix bar chart on config report page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondrej Prazak committed May 13, 2020
1 parent 8a80ef0 commit bfdbe33
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
Expand Up @@ -6,6 +6,8 @@ import ChartBox from '../ChartBox/ChartBox';
import { translate as __ } from '../../common/I18n';
import { STATUS } from '../../constants';

import './ConfigReports.scss';

const ConfigReports = props => {
const {
metricsChartData,
Expand All @@ -29,7 +31,7 @@ const ConfigReports = props => {

return (
<Row>
<Col md={4}>
<Col md={5}>
<ChartBox
{...chartBoxProps}
type="donut"
Expand All @@ -38,15 +40,15 @@ const ConfigReports = props => {
/>
</Col>

<Col md={4}>
<Col md={5} className="bar-chart-medium-width">
<ChartBox
{...chartBoxProps}
type="bar"
chart={{ data: statusChartData, id: 'report-status' }}
title={__('Report Status')}
/>
</Col>
<Col md={4}>
<Col md={2}>
<table className={classNames(tableClasses, 'report-chart')}>
<tbody>{tableData.map((metric, i) => createRow(metric, i))}</tbody>
<tfoot>
Expand Down
@@ -0,0 +1,3 @@
.bar-chart-medium-width {
min-width: 450px;
}
Expand Up @@ -8,7 +8,7 @@ exports[`ComponentWrapper should render config reports 1`] = `
<Col
bsClass="col"
componentClass="div"
md={4}
md={5}
>
<ChartBox
chart={
Expand All @@ -34,8 +34,9 @@ exports[`ComponentWrapper should render config reports 1`] = `
</Col>
<Col
bsClass="col"
className="bar-chart-medium-width"
componentClass="div"
md={4}
md={5}
>
<ChartBox
chart={
Expand All @@ -62,7 +63,7 @@ exports[`ComponentWrapper should render config reports 1`] = `
<Col
bsClass="col"
componentClass="div"
md={4}
md={2}
>
<table
className="report-chart"
Expand Down
Expand Up @@ -4,7 +4,7 @@ const enums = {
SIZE: {
LARGE: { height: 500 },
REGULAR: { width: 240, height: 240 },
MEDIUM: { width: 350, height: 350 },
MEDIUM: { width: 320, height: 320 },
},
WIDTH: {
SMALL: 15,
Expand All @@ -17,6 +17,7 @@ const barChartEnums = {
SIZE: {
LARGE: { height: 500 },
REGULAR: { width: 350, height: 350 },
MEDIUM: { width: 450, height: 320 },
SMALL: { height: 290 },
},
WIDTH: { ...enums.width },
Expand Down Expand Up @@ -83,6 +84,11 @@ export const barChartConfig = {
padding: null,
};

export const mediumBarChartConfig = {
...barChartConfig,
size: barChartEnums.SIZE.MEDIUM,
};

export const smallBarChartConfig = {
...barChartConfig,
size: barChartEnums.SIZE.SMALL,
Expand Down
2 changes: 2 additions & 0 deletions webpack/assets/javascripts/services/charts/ChartService.js
Expand Up @@ -5,6 +5,7 @@ import {
donutLargeChartConfig,
donutMediumChartConfig,
barChartConfig,
mediumBarChartConfig,
smallBarChartConfig,
lineChartConfig,
timeseriesLineChartConfig,
Expand All @@ -19,6 +20,7 @@ const chartsSizeConfig = {
bar: {
regular: barChartConfig,
small: smallBarChartConfig,
medium: mediumBarChartConfig,
},
line: {
regular: lineChartConfig,
Expand Down

0 comments on commit bfdbe33

Please sign in to comment.