diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx index cf7d29ce7cf2..e2ee33d5cca6 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx +++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx @@ -390,6 +390,19 @@ function ChartList(props: ChartListProps) { ], ); + const favoritesFilter: Filter = { + Header: t('Favorite'), + id: 'id', + urlDisplay: 'favorite', + input: 'select', + operator: FilterOperator.chartIsFav, + unfilteredLabel: t('Any'), + selects: [ + { label: t('Yes'), value: true }, + { label: t('No'), value: false }, + ], + }; + const filters: Filters = [ { Header: t('Owner'), @@ -475,22 +488,7 @@ function ChartList(props: ChartListProps) { ), paginate: false, }, - ...(props.user.userId - ? [ - { - Header: t('Favorite'), - id: 'id', - urlDisplay: 'favorite', - input: 'select', - operator: FilterOperator.chartIsFav, - unfilteredLabel: t('Any'), - selects: [ - { label: t('Yes'), value: true }, - { label: t('No'), value: false }, - ], - } as Filter, - ] - : []), + ...(props.user.userId ? [favoritesFilter] : []), { Header: t('Search'), id: 'slice_name', diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx index 0a27ca39759d..9831c2640590 100644 --- a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx +++ b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx @@ -370,6 +370,19 @@ function DashboardList(props: DashboardListProps) { ], ); + const favoritesFilter: Filter = { + Header: t('Favorite'), + id: 'id', + urlDisplay: 'favorite', + input: 'select', + operator: FilterOperator.dashboardIsFav, + unfilteredLabel: t('Any'), + selects: [ + { label: t('Yes'), value: true }, + { label: t('No'), value: false }, + ], + }; + const filters: Filters = [ { Header: t('Owner'), @@ -424,22 +437,7 @@ function DashboardList(props: DashboardListProps) { { label: t('Draft'), value: false }, ], }, - ...(props.user.userId - ? [ - { - Header: t('Favorite'), - id: 'id', - urlDisplay: 'favorite', - input: 'select', - operator: FilterOperator.dashboardIsFav, - unfilteredLabel: t('Any'), - selects: [ - { label: t('Yes'), value: true }, - { label: t('No'), value: false }, - ], - } as Filter, - ] - : []), + ...(props.user.userId ? [favoritesFilter] : []), { Header: t('Search'), id: 'dashboard_title', diff --git a/superset/views/core.py b/superset/views/core.py index 4bdbdb5fc5cd..0cd26449b3c7 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1748,7 +1748,7 @@ def favstar( # pylint: disable=no-self-use ) -> FlaskResponse: """Toggle favorite stars on Slices and Dashboard""" if not g.user.get_id(): - return json_error_response(f"ERROR: Favstar toggling denied", status=403) + return json_error_response("ERROR: Favstar toggling denied", status=403) session = db.session() count = 0 favs = (