Skip to content

Commit

Permalink
Fix type errors after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Nov 20, 2020
1 parent f5cd973 commit 0dd05fa
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { useUrlParams } from '../../../../hooks/useUrlParams';
import { SparkPlotWithValueLabel } from '../../../shared/charts/spark_plot/spark_plot_with_value_label';

export function ServiceListMetric({
Expand All @@ -16,14 +15,8 @@ export function ServiceListMetric({
series?: Array<{ x: number; y: number | null }>;
valueLabel: React.ReactNode;
}) {
const {
urlParams: { start, end },
} = useUrlParams();

return (
<SparkPlotWithValueLabel
start={new Date(start!).getTime()}
end={new Date(end!).getTime()}
valueLabel={valueLabel}
series={series}
color={color}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ export function ServiceOverviewErrorsTable({ serviceName }: Props) {
},
}
)}
start={new Date(start!).getTime()}
end={new Date(end!).getTime()}
/>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ export function ServiceOverviewTransactionsTable(props: Props) {
compact
series={latency.timeseries ?? undefined}
valueLabel={asDuration(latency.value)}
start={new Date(start!).getTime()}
end={new Date(end!).getTime()}
/>
);
},
Expand All @@ -208,8 +206,6 @@ export function ServiceOverviewTransactionsTable(props: Props) {
compact
series={throughput.timeseries ?? undefined}
valueLabel={asTransactionRate(throughput.value)}
start={new Date(start!).getTime()}
end={new Date(end!).getTime()}
/>
);
},
Expand All @@ -230,8 +226,6 @@ export function ServiceOverviewTransactionsTable(props: Props) {
compact
series={errorRate.timeseries ?? undefined}
valueLabel={asPercent(errorRate.value, 1)}
start={new Date(start!).getTime()}
end={new Date(end!).getTime()}
/>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n';

interface Props {
color: string;
series: Array<{ x: number; y: number | null }>;
series?: Array<{ x: number; y: number | null }>;
width: string;
}

export function SparkPlot(props: Props) {
const { series, color, width } = props;
const chartTheme = useChartTheme();

const isEmpty = series.every((point) => point.y === null);

if (isEmpty) {
if (!series || series.every((point) => point.y === null)) {
return (
<EuiFlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { EuiFlexGroup } from '@elastic/eui';
import React from 'react';
import { px, unit } from '../../../../../style/variables';
import { useTheme } from '../../../../../hooks/useTheme';
import { getEmptySeries } from '../../CustomPlot/getEmptySeries';
import { SparkPlot } from '../';

type Color =
Expand All @@ -26,15 +25,11 @@ type Color =
| 'euiColorVis9';

export function SparkPlotWithValueLabel({
start,
end,
color,
series,
valueLabel,
compact,
}: {
start: number;
end: number;
color: Color;
series?: Array<{ x: number; y: number | null }>;
valueLabel: React.ReactNode;
Expand All @@ -48,7 +43,7 @@ export function SparkPlotWithValueLabel({
<EuiFlexGroup gutterSize="m">
<EuiFlexItem grow={false}>
<SparkPlot
series={series ?? getEmptySeries(start, end)[0].data}
series={series}
width={compact ? px(unit * 3) : px(unit * 4)}
color={colorValue}
/>
Expand Down

0 comments on commit 0dd05fa

Please sign in to comment.