You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2021/07/30 07:45:40 UTC
[superset] branch master updated: fix(dashboard): Add required
message in the tooltip for the time range filter (#15941)
This is an automated email from the ASF dual-hosted git repository.
diegopucci pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new c2e4290 fix(dashboard): Add required message in the tooltip for the time range filter (#15941)
c2e4290 is described below
commit c2e429039234cd74ce80e931a6df8400558fd4be
Author: Geido <60...@users.noreply.github.com>
AuthorDate: Fri Jul 30 09:44:33 2021 +0200
fix(dashboard): Add required message in the tooltip for the time range filter (#15941)
* Add required msg in tooltip
* Fix lint
* Keep red border on hover
---
.../components/controls/DateFilterControl/DateFilterLabel.tsx | 11 ++++++++---
.../src/filters/components/Time/TimeFilterPlugin.tsx | 4 +++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
index daa3be9..71f84a8 100644
--- a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
+++ b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
@@ -36,7 +36,7 @@ import {
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import Button from 'src/components/Button';
import ControlHeader from 'src/explore/components/ControlHeader';
-import Label from 'src/components/Label';
+import Label, { Type } from 'src/components/Label';
import Popover from 'src/components/Popover';
import { Divider } from 'src/common/components';
import Icons from 'src/components/Icons';
@@ -172,6 +172,7 @@ interface DateFilterControlProps {
onChange: (timeRange: string) => void;
value?: string;
endpoints?: TimeRangeEndpoints;
+ type?: Type;
}
export const DATE_FILTER_CONTROL_TEST_ID = 'date-filter-control';
@@ -180,7 +181,7 @@ export const getDateFilterControlTestId = testWithId(
);
export default function DateFilterLabel(props: DateFilterControlProps) {
- const { value = DEFAULT_TIME_RANGE, endpoints, onChange } = props;
+ const { value = DEFAULT_TIME_RANGE, endpoints, onChange, type } = props;
const [actualTimeRange, setActualTimeRange] = useState<string>(value);
const [show, setShow] = useState<boolean>(false);
@@ -216,7 +217,11 @@ export default function DateFilterLabel(props: DateFilterControlProps) {
guessedFrame === 'No filter'
) {
setActualTimeRange(value);
- setTooltipTitle(actualRange || '');
+ setTooltipTitle(
+ type === ('error' as Type)
+ ? t('Default value is required')
+ : actualRange || '',
+ );
} else {
setActualTimeRange(actualRange || '');
setTooltipTitle(value || '');
diff --git a/superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx b/superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx
index be5d2d1..2ec290c 100644
--- a/superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx
+++ b/superset-frontend/src/filters/components/Time/TimeFilterPlugin.tsx
@@ -31,7 +31,8 @@ const ControlContainer = styled.div<{
validateStatus?: 'error' | 'warning' | 'info';
}>`
padding: 2px;
- & > span {
+ & > span,
+ & > span:hover {
border: 2px solid transparent;
display: inline-block;
border: ${({ theme, validateStatus }) =>
@@ -99,6 +100,7 @@ export default function TimeFilterPlugin(props: PluginFilterTimeProps) {
value={filterState.value || NO_TIME_RANGE}
name="time_range"
onChange={handleTimeRangeChange}
+ type={filterState.validateStatus}
/>
</ControlContainer>
</TimeFilterStyles>