mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 01:03:20 -05:00
* getredash/redash#4944 Query pages: keep selected filters when switching visualizations * Pass current filters to expanded widget modal
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
import React from "react";
|
|
import PropTypes from "prop-types";
|
|
import Button from "antd/lib/button";
|
|
import Modal from "antd/lib/modal";
|
|
import { wrap as wrapDialog, DialogPropType } from "@/components/DialogWrapper";
|
|
import { FiltersType } from "@/components/Filters";
|
|
import VisualizationRenderer from "@/components/visualizations/VisualizationRenderer";
|
|
import VisualizationName from "@/components/visualizations/VisualizationName";
|
|
|
|
function ExpandedWidgetDialog({ dialog, widget, filters }) {
|
|
return (
|
|
<Modal
|
|
{...dialog.props}
|
|
title={
|
|
<>
|
|
<VisualizationName visualization={widget.visualization} /> <span>{widget.getQuery().name}</span>
|
|
</>
|
|
}
|
|
width="95%"
|
|
footer={<Button onClick={dialog.dismiss}>Close</Button>}>
|
|
<VisualizationRenderer
|
|
visualization={widget.visualization}
|
|
queryResult={widget.getQueryResult()}
|
|
filters={filters}
|
|
context="widget"
|
|
/>
|
|
</Modal>
|
|
);
|
|
}
|
|
|
|
ExpandedWidgetDialog.propTypes = {
|
|
dialog: DialogPropType.isRequired,
|
|
widget: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
|
filters: FiltersType,
|
|
};
|
|
|
|
ExpandedWidgetDialog.defaultProps = {
|
|
filters: [],
|
|
};
|
|
|
|
export default wrapDialog(ExpandedWidgetDialog);
|