From 782a3316f6cab4c6e5d47da186e067a91aadfb63 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Thu, 27 Oct 2022 09:59:14 +0200 Subject: [PATCH] feat: Disable chart field select element when hierarchy is being fetched --- app/configurator/components/field.tsx | 31 ++++++++++++++++++-- app/configurator/config-form.tsx | 41 +++++++++++++++++++-------- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/app/configurator/components/field.tsx b/app/configurator/components/field.tsx index 51c7839c4..968dc0aa6 100644 --- a/app/configurator/components/field.tsx +++ b/app/configurator/components/field.tsx @@ -1,4 +1,6 @@ import { t } from "@lingui/macro"; +import { CircularProgress, Theme } from "@mui/material"; +import { makeStyles } from "@mui/styles"; import { extent, timeFormat, TimeLocaleObject, timeParse } from "d3"; import get from "lodash/get"; import { ChangeEvent, ReactNode, useCallback, useMemo, useState } from "react"; @@ -53,6 +55,15 @@ import { IconName } from "@/icons"; import { useLocale } from "@/locales/use-locale"; import { getPalette } from "@/palettes"; +const useStyles = makeStyles((theme) => ({ + loadingIndicator: { + color: theme.palette.grey[700], + display: "inline-block", + marginTop: theme.spacing(1), + marginLeft: theme.spacing(2), + }, +})); + export const ControlTabField = ({ component, value, @@ -625,7 +636,8 @@ export const ChartFieldField = ({ optional?: boolean; disabled?: boolean; }) => { - const fieldProps = useChartFieldField({ field }); + const classes = useStyles(); + const { fetching, ...fieldProps } = useChartFieldField({ field }); const noneLabel = t({ id: "controls.dimension.none", @@ -641,8 +653,21 @@ export const ChartFieldField = ({