You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by su...@apache.org on 2021/02/03 04:25:51 UTC

[superset] branch dashboard-bootstrap created (now 3e41a9e)

This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a change to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git.


      at 3e41a9e  add get_charts to include_route_methods /)_-)

This branch includes the following new commits:

     new eecefc5  feat(dashboard): get endpoint for a dashboard's charts
     new 355e4e0  temporary debugging fetch on the frontend
     new 2ef5532  attempted fixes
     new 179513c  singular -> plural derp
     new a78f835  plural -> singular derp derp
     new fb36d11  docstring changes
     new bdcf224  change return, no id
     new f164585  move log above query
     new 3e41a9e  add get_charts to include_route_methods /)_-)

The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 05/09: plural -> singular derp derp

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a78f835fb31021119e20780e2d584bcf408b927c
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Feb 2 15:39:42 2021 -0800

    plural -> singular derp derp
---
 superset-frontend/src/dashboard/components/PropertiesModal.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset-frontend/src/dashboard/components/PropertiesModal.jsx b/superset-frontend/src/dashboard/components/PropertiesModal.jsx
index 66c24c1..ef9ebbe 100644
--- a/superset-frontend/src/dashboard/components/PropertiesModal.jsx
+++ b/superset-frontend/src/dashboard/components/PropertiesModal.jsx
@@ -205,7 +205,7 @@ class PropertiesModal extends React.PureComponent {
       this.onOwnersChange(initialSelectedOwners);
     }, handleErrorResponse);
     SupersetClient.get({
-      endpoint: `/api/v1/dashboards/${this.props.dashboardId}/charts`,
+      endpoint: `/api/v1/dashboard/${this.props.dashboardId}/charts`,
     });
   }
 


[superset] 01/09: feat(dashboard): get endpoint for a dashboard's charts

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit eecefc5a698704e3e1a5bf88da8ef06e3fef261c
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Jan 19 15:18:40 2021 -0800

    feat(dashboard): get endpoint for a dashboard's charts
---
 superset/dashboards/api.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 superset/dashboards/dao.py |  6 ++++++
 2 files changed, 52 insertions(+)

diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py
index 61b56b1..6366688 100644
--- a/superset/dashboards/api.py
+++ b/superset/dashboards/api.py
@@ -210,6 +210,52 @@ class DashboardRestApi(BaseSupersetModelRestApi):
             self.include_route_methods = self.include_route_methods | {"thumbnail"}
         super().__init__()
 
+    @expose("/<pk>/charts/", methods=["GET"])
+    @protect()
+    @safe
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.get_charts",
+        log_to_statsd=False,
+    )
+    def get_charts(self, pk: int) -> Response:
+        """Change this later
+        ---
+        post:
+          description: >-
+            Create a new Dashboard.
+          requestBody:
+            description: Dashboard schema
+            required: true
+            content:
+              application/json:
+                schema:
+                  $ref: '#/components/schemas/{{self.__class__.__name__}}.post'
+          responses:
+            201:
+              description: Dashboard added
+              content:
+                application/json:
+                  schema:
+                    type: object
+                    properties:
+                      id:
+                        type: number
+                      result:
+                        $ref: '#/components/schemas/{{self.__class__.__name__}}.post'
+            302:
+              description: Redirects to the current digest
+            400:
+              $ref: '#/components/responses/400'
+            401:
+              $ref: '#/components/responses/401'
+            404:
+              $ref: '#/components/responses/404'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        DashboardDAO.get_charts_for_dashboard(pk)
+
     @expose("/", methods=["POST"])
     @protect()
     @safe
diff --git a/superset/dashboards/dao.py b/superset/dashboards/dao.py
index 65bdc69..aae75c8 100644
--- a/superset/dashboards/dao.py
+++ b/superset/dashboards/dao.py
@@ -23,6 +23,7 @@ from sqlalchemy.exc import SQLAlchemyError
 from superset.dao.base import BaseDAO
 from superset.dashboards.filters import DashboardFilter
 from superset.extensions import db
+from superset.models.slice import Slice
 from superset.models.core import FavStar, FavStarClassName
 from superset.models.dashboard import Dashboard
 from superset.models.slice import Slice
@@ -36,6 +37,11 @@ class DashboardDAO(BaseDAO):
     base_filter = DashboardFilter
 
     @staticmethod
+    def get_charts_for_dashboard(dashboard_id: int) -> List[Slice]:
+        query = db.session.query(Dashboard).filter(Dashboard.id == dashboard_id)
+        logger.info(query.__dict__)
+
+    @staticmethod
     def validate_slug_uniqueness(slug: str) -> bool:
         if not slug:
             return True


[superset] 02/09: temporary debugging fetch on the frontend

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 355e4e0aed8b8a4d4e76c2fc4b7ec5bf4c35173f
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Feb 2 15:21:35 2021 -0800

    temporary debugging fetch on the frontend
---
 superset-frontend/src/dashboard/components/PropertiesModal.jsx | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/superset-frontend/src/dashboard/components/PropertiesModal.jsx b/superset-frontend/src/dashboard/components/PropertiesModal.jsx
index 1cc75b1..ef9ebbe 100644
--- a/superset-frontend/src/dashboard/components/PropertiesModal.jsx
+++ b/superset-frontend/src/dashboard/components/PropertiesModal.jsx
@@ -204,6 +204,9 @@ class PropertiesModal extends React.PureComponent {
       }));
       this.onOwnersChange(initialSelectedOwners);
     }, handleErrorResponse);
+    SupersetClient.get({
+      endpoint: `/api/v1/dashboard/${this.props.dashboardId}/charts`,
+    });
   }
 
   updateFormState(name, value) {


[superset] 08/09: move log above query

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit f164585f56350e0700a4fb13803399f1d69a1e55
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Feb 2 20:21:44 2021 -0800

    move log above query
---
 superset/dashboards/dao.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset/dashboards/dao.py b/superset/dashboards/dao.py
index 810cb94..2667e69 100644
--- a/superset/dashboards/dao.py
+++ b/superset/dashboards/dao.py
@@ -37,8 +37,8 @@ class DashboardDAO(BaseDAO):
 
     @staticmethod
     def get_charts_for_dashboard(dashboard_id: int) -> List[Slice]:
-        query = db.session.query(Dashboard).filter(Dashboard.id == dashboard_id)
         logger.info("GETTING CHARTS____")
+        query = db.session.query(Dashboard).filter(Dashboard.id == dashboard_id)
         logger.info(query.__dict__)
         return []
 


[superset] 03/09: attempted fixes

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 2ef5532949efc75465a0f32258d93147ad795997
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Feb 2 15:24:21 2021 -0800

    attempted fixes
---
 superset/dashboards/api.py | 5 +++--
 superset/dashboards/dao.py | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py
index 6366688..d6a9fa0 100644
--- a/superset/dashboards/api.py
+++ b/superset/dashboards/api.py
@@ -210,7 +210,7 @@ class DashboardRestApi(BaseSupersetModelRestApi):
             self.include_route_methods = self.include_route_methods | {"thumbnail"}
         super().__init__()
 
-    @expose("/<pk>/charts/", methods=["GET"])
+    @expose("/<pk>/charts", methods=["GET"])
     @protect()
     @safe
     @statsd_metrics
@@ -254,7 +254,8 @@ class DashboardRestApi(BaseSupersetModelRestApi):
             500:
               $ref: '#/components/responses/500'
         """
-        DashboardDAO.get_charts_for_dashboard(pk)
+        charts = DashboardDAO.get_charts_for_dashboard(pk)
+        return self.response(200, id=pk, response=charts)
 
     @expose("/", methods=["POST"])
     @protect()
diff --git a/superset/dashboards/dao.py b/superset/dashboards/dao.py
index aae75c8..810cb94 100644
--- a/superset/dashboards/dao.py
+++ b/superset/dashboards/dao.py
@@ -23,7 +23,6 @@ from sqlalchemy.exc import SQLAlchemyError
 from superset.dao.base import BaseDAO
 from superset.dashboards.filters import DashboardFilter
 from superset.extensions import db
-from superset.models.slice import Slice
 from superset.models.core import FavStar, FavStarClassName
 from superset.models.dashboard import Dashboard
 from superset.models.slice import Slice
@@ -39,7 +38,9 @@ class DashboardDAO(BaseDAO):
     @staticmethod
     def get_charts_for_dashboard(dashboard_id: int) -> List[Slice]:
         query = db.session.query(Dashboard).filter(Dashboard.id == dashboard_id)
+        logger.info("GETTING CHARTS____")
         logger.info(query.__dict__)
+        return []
 
     @staticmethod
     def validate_slug_uniqueness(slug: str) -> bool:


[superset] 04/09: singular -> plural derp

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 179513c7a0260682afe2eaa5a6a58ad32a4e634b
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Feb 2 15:36:08 2021 -0800

    singular -> plural derp
---
 superset-frontend/src/dashboard/components/PropertiesModal.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset-frontend/src/dashboard/components/PropertiesModal.jsx b/superset-frontend/src/dashboard/components/PropertiesModal.jsx
index ef9ebbe..66c24c1 100644
--- a/superset-frontend/src/dashboard/components/PropertiesModal.jsx
+++ b/superset-frontend/src/dashboard/components/PropertiesModal.jsx
@@ -205,7 +205,7 @@ class PropertiesModal extends React.PureComponent {
       this.onOwnersChange(initialSelectedOwners);
     }, handleErrorResponse);
     SupersetClient.get({
-      endpoint: `/api/v1/dashboard/${this.props.dashboardId}/charts`,
+      endpoint: `/api/v1/dashboards/${this.props.dashboardId}/charts`,
     });
   }
 


[superset] 09/09: add get_charts to include_route_methods /)_-)

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3e41a9ebdc680503f27b55d020e78efed01a9aa6
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Feb 2 20:24:29 2021 -0800

    add get_charts to include_route_methods /)_-)
---
 superset/dashboards/api.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py
index 3413069..76a7d62 100644
--- a/superset/dashboards/api.py
+++ b/superset/dashboards/api.py
@@ -89,6 +89,7 @@ class DashboardRestApi(BaseSupersetModelRestApi):
         RouteMethod.RELATED,
         "bulk_delete",  # not using RouteMethod since locally defined
         "favorite_status",
+        "get_charts",
     }
     resource_name = "dashboard"
     allow_browser_login = True


[superset] 07/09: change return, no id

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit bdcf2241e88c7dd21034bcc76168c4f21ece848b
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Feb 2 20:20:58 2021 -0800

    change return, no id
---
 superset/dashboards/api.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py
index 19b6cb7..3413069 100644
--- a/superset/dashboards/api.py
+++ b/superset/dashboards/api.py
@@ -244,7 +244,7 @@ class DashboardRestApi(BaseSupersetModelRestApi):
               $ref: '#/components/responses/404'
         """
         charts = DashboardDAO.get_charts_for_dashboard(pk)
-        return self.response(200, id=pk, response=charts)
+        return self.response(200, response=charts)
 
     @expose("/", methods=["POST"])
     @protect()


[superset] 06/09: docstring changes

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

suddjian pushed a commit to branch dashboard-bootstrap
in repository https://gitbox.apache.org/repos/asf/superset.git

commit fb36d11130bb827a91ee65fc4bc67eae60715606
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Tue Feb 2 20:19:58 2021 -0800

    docstring changes
---
 superset/dashboards/api.py | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py
index d6a9fa0..19b6cb7 100644
--- a/superset/dashboards/api.py
+++ b/superset/dashboards/api.py
@@ -219,30 +219,21 @@ class DashboardRestApi(BaseSupersetModelRestApi):
         log_to_statsd=False,
     )
     def get_charts(self, pk: int) -> Response:
-        """Change this later
+        """Gets the chart definitions for a given dashboard
         ---
-        post:
+        get:
           description: >-
             Create a new Dashboard.
-          requestBody:
-            description: Dashboard schema
-            required: true
-            content:
-              application/json:
-                schema:
-                  $ref: '#/components/schemas/{{self.__class__.__name__}}.post'
           responses:
-            201:
-              description: Dashboard added
+            200:
+              description: Dashboard chart definitions
               content:
                 application/json:
                   schema:
                     type: object
                     properties:
-                      id:
-                        type: number
                       result:
-                        $ref: '#/components/schemas/{{self.__class__.__name__}}.post'
+                        $ref: '#/components/schemas/ChartRestApi.post'
             302:
               description: Redirects to the current digest
             400:
@@ -251,8 +242,6 @@ class DashboardRestApi(BaseSupersetModelRestApi):
               $ref: '#/components/responses/401'
             404:
               $ref: '#/components/responses/404'
-            500:
-              $ref: '#/components/responses/500'
         """
         charts = DashboardDAO.get_charts_for_dashboard(pk)
         return self.response(200, id=pk, response=charts)