You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/09/28 21:39:48 UTC

[GitHub] [incubator-superset] willbarrett commented on a change in pull request #11083: feat: custom favorite filter for dashboards, charts and saved queries

willbarrett commented on a change in pull request #11083:
URL: https://github.com/apache/incubator-superset/pull/11083#discussion_r496247499



##########
File path: superset/views/base_api.py
##########
@@ -84,6 +91,31 @@ def __init__(self, field_name: str, filter_class: Type[BaseFilter]):
         self.filter_class = filter_class
 
 
+class BaseFavoriteFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    """
+    Base Custom filter for the GET list that filters all dashboards, slices
+    that a user has favored or not
+    """
+
+    name = _("Is favorite")
+    arg_name = ""

Review comment:
       We could even leverage this default and leave it blank in the subclasses :) (re: `favorited`)

##########
File path: superset/charts/filters.py
##########
@@ -44,6 +45,17 @@ def apply(self, query: Query, value: Any) -> Query:
         )
 
 
+class ChartFavoriteFilter(BaseFavoriteFilter):  # pylint: disable=too-few-public-methods
+    """
+    Custom filter for the GET list that filters all charts that a user has favored
+    """
+
+    name = _("Is favorite")
+    arg_name = "chart_is_fav"

Review comment:
       Could we change this from `chart_is_fav`, `dashboard_is_fav` to `favorited` for all of them? More consistent, no abbreviation to remember, etc.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org