fix: Pie chart not displayed in viz (#13987)

This commit is contained in:
Yongjie Zhao 2021-04-07 17:08:24 +08:00 committed by GitHub
parent a82d72fef6
commit 56dc74e09f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 10 deletions

View File

@ -107,6 +107,11 @@ function VizSupportValidation({ vizType }) {
);
}
const nativeFilterGate = behaviors =>
!behaviors.includes(Behavior.NATIVE_FILTER) ||
(isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
behaviors.includes(Behavior.CROSS_FILTER));
const VizTypeControl = props => {
const [showModal, setShowModal] = useState(false);
const [filter, setFilter] = useState('');
@ -168,11 +173,7 @@ const VizTypeControl = props => {
const filteredTypes = DEFAULT_ORDER.filter(type => registry.has(type))
.filter(type => {
const behaviors = registry.get(type)?.behaviors || [];
return (
(isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
behaviors.includes(Behavior.CROSS_FILTER)) ||
!behaviors.length
);
return nativeFilterGate(behaviors);
})
.map(type => ({
key: type,
@ -183,11 +184,7 @@ const VizTypeControl = props => {
.entries()
.filter(entry => {
const behaviors = entry.value?.behaviors || [];
return (
(isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
behaviors.includes(Behavior.CROSS_FILTER)) ||
!behaviors.length
);
return nativeFilterGate(behaviors);
})
.filter(({ key }) => !typesWithDefaultOrder.has(key)),
)