suddjian commented on a change in pull request #9530: [charts] adds new filters
ui
URL:
https://github.com/apache/incubator-superset/pull/9530#discussion_r410387963
##########
File path: superset/charts/api.py
##########
@@ -493,3 +502,97 @@ def add_apispec_components(self, api_spec: APISpec) ->
None:
chart_type.__name__, schema=chart_type,
)
super().add_apispec_components(api_spec)
+
+ @expose("/viz_types", methods=["GET"])
+ @protect()
+ @safe
+ def viz_types(self) -> Response:
+ """Get unique viz_type values
+ ---
+ get:
+ responses:
+ 200:
+ description: charts unique viz_type data
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ count:
+ type: integer
+ result:
+ type: object
+ properties:
+ label:
+ type: string
+ value:
+ type: string
+ 400:
+ $ref: '#/components/responses/400'
+ 401:
+ $ref: '#/components/responses/401'
+ 404:
+ $ref: '#/components/responses/404'
+ 500:
+ $ref: '#/components/responses/500'
+ 422:
+ $ref: '#/components/responses/422'
+ 500:
+ $ref: '#/components/responses/500'
+ """
+ values = ChartDAO.fetch_unique_column_values("viz_type")
+ result = [{"label": val, "value": val} for val in values]
+ return self.response(200, count=len(result), result=result)
+
+ @expose("/datasources", methods=["GET"])
+ @protect()
+ @safe
+ def datasources(self) -> Response:
+ """Get unique viz_type values
Review comment:
```suggestion
"""Get unique datasource values
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]