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

fix: multiple issues with FilterPopover #11412

Merged
merged 4 commits into from
Oct 27, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Tab, Tabs } from 'react-bootstrap';
import Button from 'src/components/Button';
import { t } from '@superset-ui/core';

import columnType from '../propTypes/columnType';
import adhocMetricType from '../propTypes/adhocMetricType';
Expand Down Expand Up @@ -178,21 +179,22 @@ export default class AdhocFilterEditPopover extends React.Component {
</Tab>
</Tabs>
<div>
<Button buttonSize="small" onClick={this.props.onClose} cta>
Copy link
Member Author

Choose a reason for hiding this comment

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

i18n, flip button (Save to the right and primary)

{t('Close')}
</Button>
<Button
data-test="adhoc-filter-edit-popover-save-button"
disabled={!stateIsValid}
buttonStyle={
hasUnsavedChanges && stateIsValid ? 'primary' : 'default'
}
buttonSize="small"
buttonStyle="primary"
className="m-r-5"
onClick={this.onSave}
cta
>
Save
</Button>
<Button buttonSize="small" onClick={this.props.onClose} cta>
Close
{t('Save')}
</Button>
<i
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AdhocFilterOption extends React.PureComponent {
this.onOverlayEntered = this.onOverlayEntered.bind(this);
this.onOverlayExited = this.onOverlayExited.bind(this);
this.handleVisibleChange = this.handleVisibleChange.bind(this);
this.state = { overlayShown: false };
this.state = { overlayShown: props.adhocFilter.isNew };
}

onPopoverResize() {
Expand All @@ -60,7 +60,6 @@ class AdhocFilterOption extends React.PureComponent {
// isNew is used to indicate whether to automatically open the overlay
// once the overlay has been opened, the metric/filter will never be
// considered new again.
this.props.adhocFilter.isNew = false;
mistercrunch marked this conversation as resolved.
Show resolved Hide resolved
this.setState({ overlayShown: true });
}

Expand Down Expand Up @@ -111,7 +110,6 @@ class AdhocFilterOption extends React.PureComponent {
trigger="click"
disabled
content={content}
defaultVisible={adhocFilter.isNew}
visible={this.state.overlayShown}
onVisibleChange={this.handleVisibleChange}
>
Expand Down