Skip to content

Commit

Permalink
Addresses comments
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina committed Feb 3, 2023
1 parent 95a958b commit 7ac2ac0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ export const ControlPanelsContainer = (props: ControlPanelsContainerProps) => {
filter.operator === Operators.TEMPORAL_RANGE;
if (isTemporalRange(valueToBeDeleted)) {
const count = values.filter(isTemporalRange).length;
if (count < 2) {
if (count === 1) {
return t(
`You cannot delete the last temporal filter as it's used for time range filters in dashboards.`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,10 @@ const DndFilterSelect = (props: DndFilterSelectProps) => {

const onClickClose = useCallback(
(index: number) => {
if (canDelete) {
const result = canDelete(values[index], values);
if (typeof result === 'string') {
warning({ title: t('Warning'), content: result });
return;
}
const result = canDelete?.(values[index], values);
if (typeof result === 'string') {
warning({ title: t('Warning'), content: result });
return;
}
removeValue(index);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,10 @@ class AdhocFilterControl extends React.Component {
onRemoveFilter(index) {
const { canDelete } = this.props;
const { values } = this.state;
if (canDelete) {
const result = canDelete(values[index], values);
if (typeof result === 'string') {
warning({ title: t('Warning'), content: result });
return;
}
const result = canDelete?.(values[index], values);
if (typeof result === 'string') {
warning({ title: t('Warning'), content: result });
return;
}
this.removeFilter(index);
}
Expand Down

0 comments on commit 7ac2ac0

Please sign in to comment.