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/11/21 16:57:46 UTC

[GitHub] [superset] dpgaspar commented on a diff in pull request #22178: chore: remove annotation layer FAB CRUD model view

dpgaspar commented on code in PR #22178:
URL: https://github.com/apache/superset/pull/22178#discussion_r1028304944


##########
superset/views/annotations.py:
##########
@@ -14,117 +14,27 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from typing import Any, Dict
-
-from flask_appbuilder import CompactCRUDMixin
+from flask_appbuilder import permission_name
 from flask_appbuilder.api import expose
-from flask_appbuilder.models.sqla.interface import SQLAInterface
 from flask_appbuilder.security.decorators import has_access
-from flask_babel import lazy_gettext as _
-from wtforms.validators import StopValidation
 
-from superset.constants import MODEL_VIEW_RW_METHOD_PERMISSION_MAP, RouteMethod
-from superset.models.annotations import Annotation, AnnotationLayer
 from superset.superset_typing import FlaskResponse
-from superset.views.base import SupersetModelView
-
-
-class StartEndDttmValidator:  # pylint: disable=too-few-public-methods
-    """
-    Validates dttm fields.
-    """
 
-    def __call__(self, form: Dict[str, Any], field: Any) -> None:
-        if not form["start_dttm"].data and not form["end_dttm"].data:
-            raise StopValidation(_("annotation start time or end time is required."))
-        if (
-            form["end_dttm"].data
-            and form["start_dttm"].data
-            and form["end_dttm"].data < form["start_dttm"].data
-        ):
-            raise StopValidation(
-                _("Annotation end time must be no earlier than start time.")
-            )

Review Comment:
   very nice catch! fixing



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