You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2021/07/23 11:43:15 UTC

[superset] branch hugh/update-put-query-context created (now c145800)

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

hugh pushed a change to branch hugh/update-put-query-context
in repository https://gitbox.apache.org/repos/asf/superset.git.


      at c145800  saving for now

This branch includes the following new commits:

     new 6ddfd66  Merge branch 'master' of https://github.com/apache/superset
     new c145800  saving for now

The 2 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] 02/02: saving for now

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

hugh pushed a commit to branch hugh/update-put-query-context
in repository https://gitbox.apache.org/repos/asf/superset.git

commit c145800710b221cce9ab6f032e0af932e1b7bef1
Author: hughhhh <hu...@gmail.com>
AuthorDate: Thu Jul 22 14:15:25 2021 -0400

    saving for now
---
 .../explore/components/PropertiesModal/index.tsx   | 25 +++++++++++++++++++++-
 .../src/explore/exploreUtils/index.js              |  2 ++
 superset/charts/api.py                             |  5 ++++-
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/superset-frontend/src/explore/components/PropertiesModal/index.tsx b/superset-frontend/src/explore/components/PropertiesModal/index.tsx
index 0c46f6b..490e989 100644
--- a/superset-frontend/src/explore/components/PropertiesModal/index.tsx
+++ b/superset-frontend/src/explore/components/PropertiesModal/index.tsx
@@ -23,10 +23,11 @@ import Button from 'src/components/Button';
 import { OptionsType } from 'react-select/src/types';
 import { AsyncSelect } from 'src/components/Select';
 import rison from 'rison';
-import { t, SupersetClient } from '@superset-ui/core';
+import { t, SupersetClient, QueryFormData } from '@superset-ui/core';
 import Chart, { Slice } from 'src/types/Chart';
 import { Form, FormItem } from 'src/components/Form';
 import { getClientErrorObject } from 'src/utils/getClientErrorObject';
+import { buildV1ChartDataPayload } from '../../exploreUtils';
 
 type PropertiesModalProps = {
   slice: Slice;
@@ -70,7 +71,9 @@ export default function PropertiesModal({
 
   const fetchChartData = useCallback(
     async function fetchChartData() {
+      console.log(slice);
       try {
+        console.log('fetching chart data!');
         const response = await SupersetClient.get({
           endpoint: `/api/v1/chart/${slice.slice_id}`,
         });
@@ -81,6 +84,26 @@ export default function PropertiesModal({
             label: `${owner.first_name} ${owner.last_name}`,
           })),
         );
+
+        if (chart.query_context === null) {
+          // Build query context
+          const queryContext = buildV1ChartDataPayload({
+            formData: slice.form_data as QueryFormData,
+            force: false,
+            resultFormat: 'json',
+            resultType: 'full',
+          });
+
+          console.log('queryContext', queryContext);
+
+          // Todo: Make PUT to update query context
+          // const response = await makeApi({
+          //   method: 'PUT',
+          //   endpoint: `/api/v1/chart/${}`,
+          // })(`q=${queryParams}`);
+        }
+
+        // set query_context if null
       } catch (response) {
         const clientError = await getClientErrorObject(response);
         showError(clientError);
diff --git a/superset-frontend/src/explore/exploreUtils/index.js b/superset-frontend/src/explore/exploreUtils/index.js
index ddcd95b..20fa4f2 100644
--- a/superset-frontend/src/explore/exploreUtils/index.js
+++ b/superset-frontend/src/explore/exploreUtils/index.js
@@ -303,6 +303,8 @@ export const exportChart = ({
       ownState,
     });
   }
+
+  console.log('making POST for getting data');
   postForm(url, payload);
 };
 
diff --git a/superset/charts/api.py b/superset/charts/api.py
index 0d394cd..2f7f4c7 100644
--- a/superset/charts/api.py
+++ b/superset/charts/api.py
@@ -129,6 +129,7 @@ class ChartRestApi(BaseSupersetModelRestApi):
         "params",
         "slice_name",
         "viz_type",
+        "query_context",
     ]
     show_select_columns = show_columns + ["table.id"]
     list_columns = [
@@ -337,6 +338,9 @@ class ChartRestApi(BaseSupersetModelRestApi):
             500:
               $ref: '#/components/responses/500'
         """
+        logger.info("*" * 20)
+        logger.info("hit put endpoint!!")
+        logger.info("*" * 20)
 
         if not request.is_json:
             return self.response_400(message="Request is not JSON")
@@ -345,7 +349,6 @@ class ChartRestApi(BaseSupersetModelRestApi):
         # This validates custom Schema with custom validations
         except ValidationError as error:
             return self.response_400(message=error.messages)
-
         try:
             changed_model = UpdateChartCommand(g.user, pk, item).run()
             response = self.response(200, id=changed_model.id, result=item)

[superset] 01/02: Merge branch 'master' of https://github.com/apache/superset

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

hugh pushed a commit to branch hugh/update-put-query-context
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6ddfd662752a9459748933af3ef2b20b300e55db
Merge: 6a2412f 5e1c469
Author: hughhhh <hu...@gmail.com>
AuthorDate: Thu Jul 22 12:37:11 2021 -0400

    Merge branch 'master' of https://github.com/apache/superset

 .pylintrc                                          |   50 +-
 RELEASING/changelog.py                             |   13 +-
 RELEASING/send_email.py                            |   49 +-
 RESOURCES/INTHEWILD.md                             |    1 +
 docker/pythonpath_dev/superset_config.py           |    7 +-
 requirements/base.txt                              |   11 -
 requirements/development.in                        |    1 +
 requirements/development.txt                       |    4 +-
 requirements/testing.txt                           |    2 +
 scripts/benchmark_migration.py                     |   38 +-
 scripts/cancel_github_workflows.py                 |   24 +-
 scripts/permissions_cleanup.py                     |    2 +-
 setup.cfg                                          |   16 +-
 setup.py                                           |   10 +-
 .../cypress/integration/dashboard/markdown.test.ts |    2 +-
 .../integration/dashboard_list/filter.test.ts      |    8 +-
 superset-frontend/package-lock.json                | 1782 ++++++++++++++++----
 superset-frontend/package.json                     |   56 +-
 .../explore/components/VizTypeControl_spec.jsx     |    8 +-
 .../src/components/Select/Select.stories.tsx       |   11 +-
 superset-frontend/src/components/Select/Select.tsx |   30 +-
 superset-frontend/src/components/Select/utils.ts   |   15 +-
 .../SupersetResourceSelect.test.tsx                |   64 -
 .../components/SupersetResourceSelect/index.tsx    |  121 --
 .../src/components/TableView/TableView.tsx         |   19 +-
 .../components/WarningIconWithTooltip/index.tsx    |    5 +-
 .../DashboardBuilder/DashboardBuilder.tsx          |    2 +-
 .../FiltersConfigForm/ColumnSelect.tsx             |    5 +-
 .../FiltersConfigForm/DatasetSelect.tsx            |  121 ++
 .../FiltersConfigForm/FiltersConfigForm.tsx        |  150 +-
 .../FiltersConfigForm/getControlItemsMap.tsx       |    1 -
 .../FiltersConfigModal/FiltersConfigForm/utils.ts  |   26 +
 .../FiltersConfigModal/FiltersConfigModal.test.tsx |   92 +-
 .../src/dashboard/util/resizableConfig.ts          |   10 +-
 .../src/explore/actions/saveModalActions.js        |   16 +-
 .../explore/components/DataTableControl/index.tsx  |    2 +-
 .../DataTableControl/useTableColumns.test.ts       |  145 +-
 .../explore/components/DataTablesPane/index.tsx    |    9 +-
 .../DndColumnSelectControl/DndMetricSelect.tsx     |   28 +-
 .../MetricControl/AdhocMetricPopoverTrigger.tsx    |   22 +
 .../controls/VizTypeControl/VizTypeGallery.tsx     |   70 +-
 .../components/GroupBy/GroupByFilterPlugin.tsx     |   38 +-
 .../filters/components/Range/RangeFilterPlugin.tsx |    6 +-
 .../components/Select/SelectFilterPlugin.tsx       |  107 +-
 .../filters/components/Time/TimeFilterPlugin.tsx   |    4 +-
 .../TimeColumn/TimeColumnFilterPlugin.tsx          |   40 +-
 .../components/TimeGrain/TimeGrainFilterPlugin.tsx |   35 +-
 superset-frontend/src/filters/components/common.ts |    7 +-
 superset/charts/api.py                             |  140 +-
 superset/charts/schemas.py                         |   14 +
 superset/cli.py                                    |    2 +-
 superset/commands/importers/v1/examples.py         |    4 +-
 superset/common/query_object.py                    |    4 +-
 superset/config.py                                 |    1 +
 superset/connectors/druid/models.py                |   22 +
 superset/connectors/sqla/models.py                 |   22 +-
 .../dashboards/commands/importers/v1/__init__.py   |    2 +-
 superset/databases/commands/validate.py            |    2 +-
 superset/datasets/dao.py                           |    2 +-
 superset/db_engine_specs/base.py                   |    2 +-
 superset/db_engine_specs/mysql.py                  |    2 +-
 superset/db_engine_specs/postgres.py               |    2 +-
 superset/db_engine_specs/presto.py                 |    2 +-
 superset/initialization/__init__.py                |    8 +-
 ...=> 030c840e3a1c_add_query_context_to_slices.py} |   20 +-
 ...411006_add_execution_id_to_report_execution_.py |    6 +-
 .../versions/49b5a32daba5_add_report_schedules.py  |   13 +-
 superset/models/slice.py                           |    4 +-
 superset/reports/commands/execute.py               |    6 +-
 superset/reports/notifications/slack.py            |    4 +-
 superset/reports/schemas.py                        |    2 +-
 superset/tasks/schedules.py                        |   15 +-
 superset/tasks/slack_util.py                       |    4 +-
 superset/utils/cache.py                            |    2 +-
 superset/utils/celery.py                           |    2 +-
 superset/utils/decorators.py                       |    2 +-
 superset/utils/mock_data.py                        |   18 +-
 .../retries.py}                                    |   43 +-
 superset/utils/webdriver.py                        |    4 +-
 superset/views/core.py                             |    4 +
 tests/integration_tests/charts/api_tests.py        |  122 +-
 tests/integration_tests/charts/commands_tests.py   |    8 +-
 .../dashboards/security/security_rbac_tests.py     |    4 +-
 .../integration_tests/importexport/__init__.py     |   11 -
 tests/integration_tests/query_context_tests.py     |   39 +
 tests/integration_tests/reports/commands_tests.py  |    2 +-
 .../security/migrate_roles_tests.py                |    2 +-
 tests/unit_tests/db_engine_specs/test_gsheets.py   |   49 +-
 88 files changed, 2712 insertions(+), 1190 deletions(-)