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 2022/01/07 18:39:18 UTC

[GitHub] [superset] graceguo-supercat commented on a change in pull request #17749: feat(alerts): Select tabs to send backend

graceguo-supercat commented on a change in pull request #17749:
URL: https://github.com/apache/superset/pull/17749#discussion_r780454780



##########
File path: superset/reports/commands/create.py
##########
@@ -113,3 +114,20 @@ def validate(self) -> None:
             exception = ReportScheduleInvalidError()
             exception.add_list(exceptions)
             raise exception
+
+    def _validate_report_extra(self, exceptions: List[ValidationError]) -> None:
+        extra = self._properties.get("extra")
+        dashboard = self._properties.get("dashboard")
+
+        if extra is None or dashboard is None:
+            return
+
+        dashboard_tab_ids = extra.get("dashboard_tab_ids")
+        if dashboard_tab_ids is None:
+            return
+        position_data = json.loads(dashboard.position_json)
+        invalid_tab_ids = [
+            tab_id for tab_id in dashboard_tab_ids if tab_id not in position_data
+        ]
+        if invalid_tab_ids:
+            exceptions.append(ValidationError("Invalid tab IDs selected", "extra"))

Review comment:
       i think let owners know error details is important. i added extra filed in error message.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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