Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(native-filters): Time native filter #12992

Merged
merged 22 commits into from
Feb 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix height
  • Loading branch information
villebro committed Feb 11, 2021
commit c52617c66b371327e2744e4a4c5e6d1f4efc0d2d
11 changes: 8 additions & 3 deletions superset-frontend/src/filters/components/Time/AntdTimeFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Styles = styled.div<AntdPluginFilterStylesProps>`
`;

export default function AntdTimeFilter(props: AntdPluginFilterTimeProps) {
const { formData, setExtraFormData, width, height } = props;
const { formData, setExtraFormData, width } = props;
const { defaultValue, currentValue } = formData;

const [value, setValue] = useState<string>(defaultValue ?? DEFAULT_VALUE);
Expand All @@ -58,8 +58,13 @@ export default function AntdTimeFilter(props: AntdPluginFilterTimeProps) {
}, [defaultValue]);

return (
<Styles width={width} height={height}>
<DateFilterControl value={value} name="" onChange={handleTimeRangeChange} />
// @ts-ignore
<Styles width={width}>
<DateFilterControl
value={value}
name=""
Copy link
Member

@zhaoyongjie zhaoyongjie Feb 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one nit:
could we set a default name for DateFilterControl ?

onChange={handleTimeRangeChange}
/>
</Styles>
);
}
4 changes: 2 additions & 2 deletions superset-frontend/src/filters/components/Time/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t, ChartMetadata, ChartPlugin } from '@superset-ui/core';
import { Behavior, ChartMetadata, ChartPlugin, t } from '@superset-ui/core';
import controlPanel from './controlPanel';
import transformProps from './transformProps';
import thumbnail from './images/thumbnail.png';
Expand All @@ -26,7 +26,7 @@ export default class TimeFilterPlugin extends ChartPlugin {
const metadata = new ChartMetadata({
name: t('Time range filter plugin'),
description: 'Custom time filter plugin',
isNativeFilter: true,
behaviors: [Behavior.NATIVE_FILTER],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be also CROSS_FILTER

thumbnail,
});

Expand Down