From 6eb04b1c4f5cc4a0ea8d9e72f7272d30a12392d9 Mon Sep 17 00:00:00 2001 From: Simcha Shats Date: Tue, 13 Apr 2021 16:04:01 +0300 Subject: [PATCH 1/2] fix:fix get permission function --- .../src/dashboard/util/getPermissions.ts | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/superset-frontend/src/dashboard/util/getPermissions.ts b/superset-frontend/src/dashboard/util/getPermissions.ts index 3e7cb19765ddf..0208fd68fd65f 100644 --- a/superset-frontend/src/dashboard/util/getPermissions.ts +++ b/superset-frontend/src/dashboard/util/getPermissions.ts @@ -18,25 +18,22 @@ */ import memoizeOne from 'memoize-one'; -export default function getPermissions( - perm: string, - view: string, - roles: object, -) { - return memoizeOne(() => { - const roleList = Object.entries(roles); - if (roleList.length === 0) return false; - let bool; +const findPermissions = (perm: string, view: string, roles: object) => { + const roleList = Object.entries(roles); + if (roleList.length === 0) return false; + let bool; - roleList.forEach(([role, permissions]) => { - bool = Boolean( - permissions.find( - (permission: Array) => - permission[0] === perm && permission[1] === view, - ), - ); - }); - console.log('bool', bool); - return bool; + roleList.forEach(([role, permissions]) => { + bool = Boolean( + permissions.find( + (permission: Array) => + permission[0] === perm && permission[1] === view, + ), + ); }); -} + return bool; +}; + +const getPermissions = memoizeOne(findPermissions); + +export default getPermissions; From dd94926491da5bef6e02c24c221722f8cf9024d5 Mon Sep 17 00:00:00 2001 From: Simcha Shats Date: Sun, 5 Sep 2021 09:13:46 +0300 Subject: [PATCH 2/2] feat: add cross filter chart in charts gallery under FF --- superset-frontend/src/filters/components/GroupBy/index.ts | 1 + superset-frontend/src/filters/components/Range/index.ts | 1 + superset-frontend/src/filters/components/Select/index.ts | 1 + superset-frontend/src/filters/components/Time/index.ts | 1 + superset-frontend/src/filters/components/TimeColumn/index.ts | 1 + superset-frontend/src/filters/components/TimeGrain/index.ts | 1 + 6 files changed, 6 insertions(+) diff --git a/superset-frontend/src/filters/components/GroupBy/index.ts b/superset-frontend/src/filters/components/GroupBy/index.ts index 44055fa6f2de6..30e3ac05c4df0 100644 --- a/superset-frontend/src/filters/components/GroupBy/index.ts +++ b/superset-frontend/src/filters/components/GroupBy/index.ts @@ -28,6 +28,7 @@ export default class FilterGroupByPlugin extends ChartPlugin { name: t('Group By'), description: t('Group By filter plugin'), behaviors: [Behavior.INTERACTIVE_CHART, Behavior.NATIVE_FILTER], + tags: [t('Experimental')], thumbnail, }); diff --git a/superset-frontend/src/filters/components/Range/index.ts b/superset-frontend/src/filters/components/Range/index.ts index 5762810daaf2d..6c44b6e7ce3db 100644 --- a/superset-frontend/src/filters/components/Range/index.ts +++ b/superset-frontend/src/filters/components/Range/index.ts @@ -28,6 +28,7 @@ export default class RangeFilterPlugin extends ChartPlugin { name: t('Range filter'), description: t('Range filter plugin using AntD'), behaviors: [Behavior.INTERACTIVE_CHART, Behavior.NATIVE_FILTER], + tags: [t('Experimental')], thumbnail, }); diff --git a/superset-frontend/src/filters/components/Select/index.ts b/superset-frontend/src/filters/components/Select/index.ts index 3e9dcf8d37fee..7ded0c3635746 100644 --- a/superset-frontend/src/filters/components/Select/index.ts +++ b/superset-frontend/src/filters/components/Select/index.ts @@ -29,6 +29,7 @@ export default class FilterSelectPlugin extends ChartPlugin { description: t('Select filter plugin using AntD'), behaviors: [Behavior.INTERACTIVE_CHART, Behavior.NATIVE_FILTER], enableNoResults: false, + tags: [t('Experimental')], thumbnail, }); diff --git a/superset-frontend/src/filters/components/Time/index.ts b/superset-frontend/src/filters/components/Time/index.ts index 4b72113ac8d37..8a46949a545d6 100644 --- a/superset-frontend/src/filters/components/Time/index.ts +++ b/superset-frontend/src/filters/components/Time/index.ts @@ -28,6 +28,7 @@ export default class TimeFilterPlugin extends ChartPlugin { description: t('Custom time filter plugin'), behaviors: [Behavior.INTERACTIVE_CHART, Behavior.NATIVE_FILTER], thumbnail, + tags: [t('Experimental')], datasourceCount: 0, }); diff --git a/superset-frontend/src/filters/components/TimeColumn/index.ts b/superset-frontend/src/filters/components/TimeColumn/index.ts index 492f48f05e7c7..ada18644b98ff 100644 --- a/superset-frontend/src/filters/components/TimeColumn/index.ts +++ b/superset-frontend/src/filters/components/TimeColumn/index.ts @@ -28,6 +28,7 @@ export default class FilterTimeColumnPlugin extends ChartPlugin { name: t('Time column'), description: t('Time column filter plugin'), behaviors: [Behavior.INTERACTIVE_CHART, Behavior.NATIVE_FILTER], + tags: [t('Experimental')], thumbnail, }); diff --git a/superset-frontend/src/filters/components/TimeGrain/index.ts b/superset-frontend/src/filters/components/TimeGrain/index.ts index 8ce943ffbc9bb..d44ec4ed65a2e 100644 --- a/superset-frontend/src/filters/components/TimeGrain/index.ts +++ b/superset-frontend/src/filters/components/TimeGrain/index.ts @@ -28,6 +28,7 @@ export default class FilterTimeGrainPlugin extends ChartPlugin { name: t('Time grain'), description: t('Time grain filter plugin'), behaviors: [Behavior.INTERACTIVE_CHART, Behavior.NATIVE_FILTER], + tags: [t('Experimental')], thumbnail, });