feat(cross-filters): add cross filters (#12662)

* feat: add cross filters

* refactor: fix CR notes

* lint: fix lint

* lint: fix lint

* chore: pre-commit

* refactor: under chage

* refactor: move to behaviors

* lint: fix lint

Co-authored-by: amitmiran137 <amit.miran@nielsen.com>
This commit is contained in:
simcha90
2021-02-12 09:58:19 +02:00
committed by GitHub
parent 85d02620b7
commit 956f276e70
9 changed files with 66 additions and 18 deletions

View File

@@ -24,9 +24,9 @@ import { useDynamicPluginContext } from 'src/components/DynamicPlugins';
import { Tooltip } from 'src/common/components/Tooltip';
import Modal from 'src/common/components/Modal';
import Label from 'src/components/Label';
import ControlHeader from '../ControlHeader';
import './VizTypeControl.less';
import { FeatureFlag, isFeatureEnabled } from '../../../featureFlags';
const propTypes = {
description: PropTypes.string,
@@ -168,7 +168,11 @@ const VizTypeControl = props => {
const filteredTypes = DEFAULT_ORDER.filter(type => registry.has(type))
.filter(type => {
const behaviors = registry.get(type)?.behaviors || [];
return behaviors.includes(Behavior.CROSS_FILTER) || !behaviors.length;
return (
(isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
behaviors.includes(Behavior.CROSS_FILTER)) ||
!behaviors.length
);
})
.map(type => ({
key: type,
@@ -179,7 +183,11 @@ const VizTypeControl = props => {
.entries()
.filter(entry => {
const behaviors = entry.value?.behaviors || [];
return behaviors.includes(Behavior.CROSS_FILTER) || !behaviors.length;
return (
(isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
behaviors.includes(Behavior.CROSS_FILTER)) ||
!behaviors.length
);
})
.filter(({ key }) => !typesWithDefaultOrder.has(key)),
)