Skip to content
Snippets Groups Projects
Unverified Commit 1041fe8a authored by Alexander Lesnenko's avatar Alexander Lesnenko Committed by GitHub
Browse files

hide back button on the relative date time picker when open from a table column header (#22874)

parent 8d9ff35c
No related branches found
No related tags found
No related merge requests found
......@@ -258,6 +258,7 @@ export default class FilterPopover extends Component<Props, State> {
onBack={onBack}
onCommit={this.handleCommit}
onFilterChange={this.handleFilterChange}
disableChangingDimension={!showFieldPicker}
>
{!isSidebar ? (
<Button
......
......@@ -234,6 +234,7 @@ type Props = {
hideTimeSelectors?: boolean;
hideEmptinessOperators?: boolean;
disableOperatorSelection?: boolean;
disableChangingDimension?: boolean;
primaryColor?: string;
minWidth?: number | null;
......@@ -251,6 +252,7 @@ const DatePicker: React.FC<Props> = props => {
onFilterChange,
isSidebar,
disableOperatorSelection,
disableChangingDimension,
primaryColor,
onCommit,
children,
......@@ -265,8 +267,9 @@ const DatePicker: React.FC<Props> = props => {
const Widget = operator && operator.widget;
const enableBackButton =
(!showShortcuts && !disableOperatorSelection) ||
(showShortcuts && props.onBack);
!disableChangingDimension &&
((!showShortcuts && !disableOperatorSelection) ||
(showShortcuts && props.onBack));
const onBack = () => {
if (!operator || showShortcuts) {
props.onBack?.();
......
......@@ -78,9 +78,15 @@ describe("scenarios > question > relative-datetime", () => {
openOrdersTable();
cy.findByTextEnsureVisible("Created At").click();
cy.findByText("Filter by this column").click();
cy.intercept("POST", "/api/dataset").as("dataset");
cy.findByText("Last 30 Days").click();
popover().within(() => {
cy.findByText("Filter by this column").click();
cy.icon("chevronleft").should("not.exist");
cy.findByText("Last 30 Days").click();
});
cy.wait("@dataset");
cy.findByText("Created At Previous 30 Days").click();
......@@ -104,10 +110,6 @@ describe("scenarios > question > relative-datetime", () => {
.first()
.click();
cy.findByText("Specific dates...").should("exist");
cy.icon("chevronleft").click();
cy.findByText("Specific dates...").should("not.exist");
cy.findByText("Created At").click();
cy.findByText("Specific dates...").should("exist");
cy.findByText("Between").should("not.exist");
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment