Skip to content

Commit

Permalink
fix: linter follow-up
Browse files Browse the repository at this point in the history
  • Loading branch information
trepmag committed May 12, 2021
1 parent 8dd7062 commit 07e6e6c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 33 deletions.
30 changes: 14 additions & 16 deletions superset-frontend/src/views/CRUD/chart/ChartList.tsx
Expand Up @@ -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'),
Expand Down Expand Up @@ -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',
Expand Down
30 changes: 14 additions & 16 deletions superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx
Expand Up @@ -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'),
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion superset/views/core.py
Expand Up @@ -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 = (
Expand Down

0 comments on commit 07e6e6c

Please sign in to comment.