Skip to content

Commit

Permalink
[RUM Dashboard] Added loading state to visitor breakdown pie charts (#…
Browse files Browse the repository at this point in the history
…77201)

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
shahzad31 and elasticmachine authored Sep 14, 2020
1 parent 0fb4895 commit 6bef440
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ interface Props {
count: number;
name: string;
}>;
loading: boolean;
}

export function VisitorBreakdownChart({ options }: Props) {
export function VisitorBreakdownChart({ loading, options }: Props) {
const [darkMode] = useUiSetting$<boolean>('theme:darkMode');

const euiChartTheme = darkMode
? EUI_CHARTS_THEME_DARK
: EUI_CHARTS_THEME_LIGHT;

return (
<ChartWrapper loading={false} height="230px" maxWidth="430px">
<ChartWrapper loading={loading} height="230px" maxWidth="430px">
<StyleChart>
<Chart>
<Settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function VisitorBreakdown() {

const { start, end } = urlParams;

const { data } = useFetcher(
const { data, status } = useFetcher(
(callApmApi) => {
if (start && end) {
return callApmApi({
Expand Down Expand Up @@ -47,14 +47,20 @@ export function VisitorBreakdown() {
<h4>{I18LABELS.browser}</h4>
</EuiTitle>
<EuiSpacer size="s" />
<VisitorBreakdownChart options={data?.browsers} />
<VisitorBreakdownChart
options={data?.browsers}
loading={status !== 'success'}
/>
</EuiFlexItem>
<EuiFlexItem>
<EuiTitle size="xs">
<h4>{I18LABELS.operatingSystem}</h4>
</EuiTitle>
<EuiSpacer size="s" />
<VisitorBreakdownChart options={data?.os} />
<VisitorBreakdownChart
options={data?.os}
loading={status !== 'success'}
/>
</EuiFlexItem>
</EuiFlexGroup>
</>
Expand Down

0 comments on commit 6bef440

Please sign in to comment.