diff --git a/UPDATING.md b/UPDATING.md index 9cd0eae4e8798..2533c1ffd0d44 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -38,12 +38,14 @@ assists people when migrating to a new version. - [17539](https://github.com/apache/superset/pull/17539): all Superset CLI commands (init, load_examples and etc) require setting the FLASK_APP environment variable (which is set by default when .flaskenv is loaded) + ### Deprecations ### Other - [17589](https://github.com/apache/incubator-superset/pull/17589): It is now possible to limit access to users' recent activity data by setting the `ENABLE_BROAD_ACTIVITY_ACCESS` config flag to false, or customizing the `raise_for_user_activity_access` method in the security manager. - [16809](https://github.com/apache/incubator-superset/pull/16809): When building the superset frontend assets manually, you should now use Node 16 (previously Node 14 was required/recommended). Node 14 will most likely still work for at least some time, but is no longer actively tested for on CI. +- [17536](https://github.com/apache/superset/pull/17536): introduced a key-value endpoint to store dashboard filter state. This endpoint is backed by Flask-Caching and the default configuration assumes that the values will be stored in the file system. If you are already using another cache backend like Redis or Memchached, you'll probably want to change this setting in `superset_config.py`. The key is `FILTER_STATE_CACHE_CONFIG` and the available settings can be found in Flask-Caching [docs](https://flask-caching.readthedocs.io/en/latest/). ## 1.3.0 diff --git a/docs/gatsby-node.js b/docs/gatsby-node.js index 6c08f6d3c9b56..0ffff7fc36eac 100644 --- a/docs/gatsby-node.js +++ b/docs/gatsby-node.js @@ -314,6 +314,11 @@ exports.createPages = ({ actions }) => { toPath: '/docs/creating-charts-dashboards/exploring-data', isPermanent: true, }); + createRedirect({ + fromPath: '/usertutorial.html#native-filters', + toPath: '/docs/creating-charts-dashboards/exploring-data', + isPermanent: true, + }); createRedirect({ fromPath: '/usertutorial.html#publishing-your-dashboard', toPath: '/docs/creating-charts-dashboards/exploring-data', diff --git a/docs/src/pages/docs/Creating Charts and Dashboards/exploring-data.mdx b/docs/src/pages/docs/Creating Charts and Dashboards/exploring-data.mdx index 7ce2fcb5d6548..dd125da7fec3e 100644 --- a/docs/src/pages/docs/Creating Charts and Dashboards/exploring-data.mdx +++ b/docs/src/pages/docs/Creating Charts and Dashboards/exploring-data.mdx @@ -34,9 +34,11 @@ select the **Edit** button. -In the resulting modal window, switch to the **Extra** tab and -tick the checkbox for **Allow Data Upload**. End by clicking the **Save** button. +In the resulting modal window, switch to the **Advanced** tab and +expand the **Security** section. Tick the checkbox for **Allow Data Upload**. +End by clicking the **Save** button. + ### Loading CSV Data @@ -62,18 +64,7 @@ Leaving all the other options in their default settings, select **Save** at the You should now see _tutorial_flights_ as a dataset in the **Datasets** tab. Click on the entry to launch an Explore workflow using this dataset. -In this section, we'll create a table visualization -to show the number of flights and cost per travel class. - -By default, Apache Superset only shows the last week of data. In our example, we want to visualize all -of the data in the dataset. Click the **Time ‣ Time Range** section and change -the **Range Type** to **No Filter**. - - - -Click **Apply** to save. - -Now, we want to specify the rows in our table by using the **Group by** option. Since in this +First, we want to specify the rows in our table by using the **Group by** option. Since in this example, we want to understand different Travel Classes, we select **Travel Class** in this menu. Next, we can specify the metrics we would like to see in our table with the **Metrics** option. @@ -82,6 +73,7 @@ Next, we can specify the metrics we would like to see in our table with the **Me (in this case, quantity of flights in each Travel Class) - `SUM(Cost)`, which represents the total cost spent by each Travel Class + Finally, select **Run Query** to see the results of the table. @@ -112,40 +104,42 @@ dashboard** and then hover over the table. By selecting the bottom right hand co Finally, save your changes by selecting Save changes in the top right. -### Pivot Table +### Pivot Table v2 -In this section, we will extend our analysis using a more complex visualization, Pivot Table. By the +In this section, we will extend our analysis using a more complex visualization, Pivot Table v2. By the end of this section, you will have created a table that shows the monthly spend on flights for the first six months, by department, by travel class. Create a new chart by selecting **+ ‣ Chart** from the top right corner. Choose tutorial_flights again as a datasource, then click on the visualization type to get to the -visualization menu. Select the **Pivot Table** visualization (you can filter by entering text in the +visualization menu. Select the **Pivot Table v2** visualization (you can filter by entering text in the search box) and then **Create New Chart**. - + -In the **Time** section, keep the Time Column as Travel Date (this is selected automatically as we +In the **Time** section, keep the Time Column as Travel Date (this is selected automatically, as we only have one time column in our dataset). Then select Time Grain to be month as having daily data -would be too granular to see patterns from. Then select the time range to be the first six months of -2011 by click on Last week in the Time Range section, then in Custom selecting a Start / end of 1st -January 2011 and 30th June 2011 respectively by either entering directly the dates or using the -calendar widget (by selecting the month name and then the year, you can move more quickly to far -away dates). +would be too granular to see patterns from. Then select the Time Range to be the first six months of +2011 by clicking into the Time Range edit menu, selecting Custom from the Range Type dropdown, +and selecting a Start / end of 1st January 2011 and 30th June 2011 respectively by either entering +the dates directly or using the calendar widget (by selecting the month name and then the year, you +can move more quickly to far away dates). - + -Next, within the **Query** section, remove the default COUNT(\*) and add Cost, keeping the default -SUM aggregate. Note that Apache Superset will indicate the type of the metric by the symbol on the -left hand column of the list (ABC for string, # for number, a clock face for time, etc.). +Next, within the **Query** section, add a SUM(Cost) metric. Note that Apache Superset will indicate +the type of the metric by the symbol on the left hand column of the list (ABC for string, # for +number, a clock face for time, etc.). -In **Group by** select **Time**: this will automatically use the Time Column and Time Grain +In **Rows** select **Travel Date**: this will automatically use the Time Column and Time Grain selections we defined in the Time section. -Within **Columns**, select first Department and then Travel Class. All set – let’s **Run Query** to -see some data! +Within **Columns**, select first Department and then Travel Class. + +Under **Options**, tick the Show Rows Total and Show Columns Total checkboxes. All set – let’s +**Run Query** to see some data! - + You should see months in the rows and Department and Travel Class in the columns. Publish this chart to your existing Tutorial Dashboard you created earlier. @@ -183,7 +177,7 @@ Once you’re done, publish the chart in your Tutorial Dashboard. ### Markup -In this section, we will add some text to our dashboard. If you’re there already, you can navigate +In this section, we will add some text to our dashboard. If you’re not there already, you can navigate to the dashboard by selecting Dashboards on the top menu, then Tutorial dashboard from the list of dashboards. Got into edit mode by selecting **Edit dashboard**. @@ -229,6 +223,51 @@ Dashboard and then Save & go to dashboard. Once on the Dashboard, try using the those flights that departed from the United Kingdom – you will see the filter is applied to all of the other visualizations on the dashboard. +### Native Filters + +As Filter Box is set to be deprecated, this section will instruct you on how to use its replacement, +**Native Filters**. These are built into the dashboard view itself. Go to the Tutorial Dashboard and +select the filter icon in the top left corner: + + + +This will open the Native Filters panel, which is currently empty: + + + +Click on the pencil icon to open up the **Filters Configuration** modal. From here, you can create new filters or +manage existing ones. + + + +We're going to create a numerical range for ticket cost: + +- Select Numerical Range from the Filter Type dropdown +- Give the filter a name +- Select tutorial_flights from the Dataset dropdown if it's not been selected yet +- Select Cost from the Column dropdown + +Click the **Save** button. Your filter will load in the panel. + + + +You can adjust the slider to only include datapoints that fall within the selected range for Ticket +Cost! Set your range and click **Apply** to see how it affects your charts. + +We can also recreate the Origin Country filter from the Filter Box section. In the **Filters +Configuration** modal, click the Add button in the bottom left and select Filter. Set your filter up as +follows: + +- Select Value from Filter Type dropdown +- Select tutorial_flights from Dataset dropdown +- Select Origin Country from Column dropdown +- In Advanced, you can tick the Sort filter values checkbox to list country names alphabetically + +**Save** your filters! You can now select origin countries to include from the resulting dropdown. + + + + ### Publishing Your Dashboard If you have followed all of the steps outlined in the previous section, you should have a dashboard @@ -248,12 +287,12 @@ annotation to the Tutorial Line Chart we made in a previous section. Specificall dates when some flights were cancelled by the UK’s Civil Aviation Authority in response to the eruption of the Grímsvötn volcano in Iceland (23-25 May 2011). -First, add an annotation layer by navigating to Manage ‣ Annotation Layers. Add a new annotation -layer by selecting the green plus sign to add a new record. Enter the name Volcanic Eruptions and +First, add an annotation layer by navigating to Settings ‣ Manage ‣ Annotation Layers. Add a new annotation +layer by selecting the blue plus button to add a new record. Enter the name Volcanic Eruptions and save. We can use this layer to refer to a number of different annotations. -Next, add an annotation by navigating to Manage ‣ Annotations and then create a new annotation by -selecting the green plus sign. Then, select the Volcanic Eruptions layer, add a short description +Next, add an annotation by clicking into the newly created layer and then create a new annotation by +selecting the blue plus button. Then, select the Volcanic Eruptions layer, add a short description Grímsvötn and the eruption dates (23-25 May 2011) before finally saving. @@ -263,7 +302,7 @@ list. Next, go to the Annotations and Layers section and select Add Annotation L dialogue: - Name the layer as Volcanic Eruptions -- Change the Annotation Layer Type to Event +- Change the Annotation Layer Type to Interval - Set the Annotation Source as Superset annotation - Specify the Annotation Layer as Volcanic Eruptions @@ -302,7 +341,7 @@ Dashboard. There is quite a lot of variation in the data, which makes it difficult to identify any trend. One approach we can take is to show instead a rolling average of the time series. To do this, in the -**Moving Average** subsection of **Advanced Analytics**, select mean in the **Rolling** box and +**Rolling Window** subsection of **Advanced Analytics**, select mean in the **Rolling Function** box and enter 7 into both Periods and Min Periods. The period is the length of the rolling period expressed as a multiple of the Time Grain. In our example, the Time Grain is day, so the rolling period is 7 days, such that on the 7th October 2011 the value shown would correspond to the first seven days of diff --git a/docs/src/resources/openapi.json b/docs/src/resources/openapi.json index cdd51639054a4..7913a24f6a8b9 100644 --- a/docs/src/resources/openapi.json +++ b/docs/src/resources/openapi.json @@ -154,6 +154,10 @@ "description": "Should the layer be shown", "type": "boolean" }, + "showLabel": { + "description": "Should the label always be shown", + "type": "boolean" + }, "showMarkers": { "description": "Should markers be shown. Only applies to line annotations.", "type": "boolean" @@ -201,6 +205,7 @@ "required": [ "name", "show", + "showLabel", "showMarkers", "value" ], diff --git a/docs/static/images/add-data-upload.png b/docs/static/images/add-data-upload.png index d72ad68dcecfe..1efe998a91fc9 100644 Binary files a/docs/static/images/add-data-upload.png and b/docs/static/images/add-data-upload.png differ diff --git a/docs/static/images/count_column.png b/docs/static/images/count_column.png new file mode 100644 index 0000000000000..8d0c1c68cec70 Binary files /dev/null and b/docs/static/images/count_column.png differ diff --git a/docs/static/images/create_pivot.png b/docs/static/images/create_pivot.png deleted file mode 100644 index 2a24ee25153ce..0000000000000 Binary files a/docs/static/images/create_pivot.png and /dev/null differ diff --git a/docs/static/images/create_pivot_v2.png b/docs/static/images/create_pivot_v2.png new file mode 100644 index 0000000000000..78b49679785e9 Binary files /dev/null and b/docs/static/images/create_pivot_v2.png differ diff --git a/docs/static/images/db-modal-advanced.png b/docs/static/images/db-modal-advanced.png new file mode 100644 index 0000000000000..04e1f52c8a808 Binary files /dev/null and b/docs/static/images/db-modal-advanced.png differ diff --git a/docs/static/images/native_filters_empty_panel.png b/docs/static/images/native_filters_empty_panel.png new file mode 100644 index 0000000000000..999cc7038123b Binary files /dev/null and b/docs/static/images/native_filters_empty_panel.png differ diff --git a/docs/static/images/native_filters_menu_open.png b/docs/static/images/native_filters_menu_open.png new file mode 100644 index 0000000000000..82b539ed7fe54 Binary files /dev/null and b/docs/static/images/native_filters_menu_open.png differ diff --git a/docs/static/images/native_filters_modal.png b/docs/static/images/native_filters_modal.png new file mode 100644 index 0000000000000..c27e7c591a535 Binary files /dev/null and b/docs/static/images/native_filters_modal.png differ diff --git a/docs/static/images/native_filters_num_range.png b/docs/static/images/native_filters_num_range.png new file mode 100644 index 0000000000000..17d2534e9e28c Binary files /dev/null and b/docs/static/images/native_filters_num_range.png differ diff --git a/docs/static/images/native_filters_origin_country.png b/docs/static/images/native_filters_origin_country.png new file mode 100644 index 0000000000000..06096e909bbe6 Binary files /dev/null and b/docs/static/images/native_filters_origin_country.png differ diff --git a/docs/static/images/native_filters_origin_country_dropdown.png b/docs/static/images/native_filters_origin_country_dropdown.png new file mode 100644 index 0000000000000..296d4130b3840 Binary files /dev/null and b/docs/static/images/native_filters_origin_country_dropdown.png differ diff --git a/docs/static/images/no_filter_on_time_filter.png b/docs/static/images/no_filter_on_time_filter.png deleted file mode 100644 index 6d2cc3f78e903..0000000000000 Binary files a/docs/static/images/no_filter_on_time_filter.png and /dev/null differ diff --git a/docs/static/images/select_dates_pivot_table.png b/docs/static/images/select_dates_pivot_table.png deleted file mode 100644 index b7dd7fd862f74..0000000000000 Binary files a/docs/static/images/select_dates_pivot_table.png and /dev/null differ diff --git a/docs/static/images/select_dates_pivot_table_v2.png b/docs/static/images/select_dates_pivot_table_v2.png new file mode 100644 index 0000000000000..af2263d4097f4 Binary files /dev/null and b/docs/static/images/select_dates_pivot_table_v2.png differ diff --git a/docs/static/images/sum_cost_column.png b/docs/static/images/sum_cost_column.png index a9f37cf63c1bc..5239db13da442 100644 Binary files a/docs/static/images/sum_cost_column.png and b/docs/static/images/sum_cost_column.png differ diff --git a/docs/static/images/tutorial_pivot_table.png b/docs/static/images/tutorial_pivot_table.png deleted file mode 100644 index b80ea134a6ac9..0000000000000 Binary files a/docs/static/images/tutorial_pivot_table.png and /dev/null differ diff --git a/docs/static/images/tutorial_pivot_table_v2.png b/docs/static/images/tutorial_pivot_table_v2.png new file mode 100644 index 0000000000000..513db7fa86d3f Binary files /dev/null and b/docs/static/images/tutorial_pivot_table_v2.png differ diff --git a/superset-frontend/.storybook/main.js b/superset-frontend/.storybook/main.js index f55c29eac77c0..f5c4fc24fe47d 100644 --- a/superset-frontend/.storybook/main.js +++ b/superset-frontend/.storybook/main.js @@ -16,8 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -const path = require('path'); - // Superset's webpack.config.js const customConfig = require('../webpack.config.js'); diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/edit_properties.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/edit_properties.test.ts index 1cb84b3401aee..9e2fe49288625 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/edit_properties.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/edit_properties.test.ts @@ -103,7 +103,7 @@ describe('Dashboard edit action', () => { // save edit changes cy.get('.ant-modal-footer') - .contains('Apply') + .contains('Save') .click() .then(() => { // assert that modal edit window has closed diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts index 019bad7096ab5..63473a1b99cf8 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts @@ -227,6 +227,7 @@ describe('Visualization > Line', () => { value: 'y=140000', overrides: { time_range: null }, show: false, + showLabel: false, titleColumn: '', descriptionColumns: [], timeColumn: '', @@ -263,6 +264,7 @@ describe('Visualization > Line', () => { value, overrides: { time_range: null }, show: true, + showLabel: false, titleColumn: 'ds', descriptionColumns: ['ds'], timeColumn: 'ds', diff --git a/superset-frontend/cypress-base/package-lock.json b/superset-frontend/cypress-base/package-lock.json index 44096180abcd6..cd457f61eb224 100644 --- a/superset-frontend/cypress-base/package-lock.json +++ b/superset-frontend/cypress-base/package-lock.json @@ -1302,9 +1302,9 @@ } }, "node_modules/@superset-ui/core": { - "version": "0.18.13", - "resolved": "https://registry.npmjs.org/@superset-ui/core/-/core-0.18.13.tgz", - "integrity": "sha512-IGsCb6svbUaMGXpwjZTLRaxmVbNEi6acX9VRDDx+d7AcDIvzqMqocn70sDYseAi4NnbKiR96y8djcoUIV1JPBg==", + "version": "0.18.25", + "resolved": "https://registry.npmjs.org/@superset-ui/core/-/core-0.18.25.tgz", + "integrity": "sha512-b5ACrOuwriJ0SEQdsJuZYQfg+CjgfW2ZcVI3f0r8gK5HWmJnma5fBzc2VM/NGd0JIpCQSgfgoyXaVeFEXXD+dQ==", "dependencies": { "@babel/runtime": "^7.1.2", "@types/d3-format": "^1.3.0", @@ -2299,21 +2299,25 @@ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" }, "node_modules/browserslist": { - "version": "4.16.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.1.tgz", - "integrity": "sha512-UXhDrwqsNcpTYJBTZsbGATDxZbiVDsx6UjpmRUmtnP10pr8wAYr5LgFoEFw9ixriQH2mv/NX2SfGzE/o8GndLA==", + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.18.1.tgz", + "integrity": "sha512-8ScCzdpPwR2wQh8IT82CA2VgDwjHyqMovPBZSNH54+tm4Jk2pCuv90gmAdH6J84OCRWi0b4gMe6O6XPXuJnjgQ==", "dependencies": { - "caniuse-lite": "^1.0.30001173", - "colorette": "^1.2.1", - "electron-to-chromium": "^1.3.634", + "caniuse-lite": "^1.0.30001280", + "electron-to-chromium": "^1.3.896", "escalade": "^3.1.1", - "node-releases": "^1.1.69" + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" }, "bin": { "browserslist": "cli.js" }, "engines": { "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" } }, "node_modules/buffer": { @@ -2421,9 +2425,13 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001178", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001178.tgz", - "integrity": "sha512-VtdZLC0vsXykKni8Uztx45xynytOi71Ufx9T8kHptSw9AL4dpqailUJJHavttuzUe1KYuBYtChiWv+BAb7mPmQ==" + "version": "1.0.30001283", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001283.tgz", + "integrity": "sha512-9RoKo841j1GQFSJz/nCXOj0sD7tHBtlowjYlrqIUS812x9/emfBLBt6IyMz1zIaYc/eRL8Cs6HPUVi2Hzq4sIg==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } }, "node_modules/caseless": { "version": "0.12.0", @@ -3381,22 +3389,22 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.3.641", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.641.tgz", - "integrity": "sha512-b0DLhsHSHESC1I+Nx6n4w4Lr61chMd3m/av1rZQhS2IXTzaS5BMM5N+ldWdMIlni9CITMRM09m8He4+YV/92TA==" + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.5.tgz", + "integrity": "sha512-YKaB+t8ul5crdh6OeqT2qXdxJGI0fAYb6/X8pDIyye+c3a7ndOCk5gVeKX+ABwivCGNS56vOAif3TN0qJMpEHw==" }, "node_modules/elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "dependencies": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" } }, "node_modules/elliptic/node_modules/bn.js": { @@ -5403,9 +5411,9 @@ "peer": true }, "node_modules/json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -5492,17 +5500,17 @@ } }, "node_modules/jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "engines": [ - "node >=0.6.0" - ], + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" } }, "node_modules/kind-of": { @@ -6039,9 +6047,9 @@ } }, "node_modules/node-releases": { - "version": "1.1.69", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.69.tgz", - "integrity": "sha512-DGIjo79VDEyAnRlfSqYTsy+yoHd2IOjJiKUozD2MV2D85Vso6Bug56mb9tT/fY5Urt0iqk01H7x+llAruDR2zA==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -6443,9 +6451,9 @@ } }, "node_modules/path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-platform": { "version": "0.11.15", @@ -6488,6 +6496,11 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, "node_modules/picomatch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", @@ -9626,9 +9639,9 @@ } }, "@superset-ui/core": { - "version": "0.18.13", - "resolved": "https://registry.npmjs.org/@superset-ui/core/-/core-0.18.13.tgz", - "integrity": "sha512-IGsCb6svbUaMGXpwjZTLRaxmVbNEi6acX9VRDDx+d7AcDIvzqMqocn70sDYseAi4NnbKiR96y8djcoUIV1JPBg==", + "version": "0.18.25", + "resolved": "https://registry.npmjs.org/@superset-ui/core/-/core-0.18.25.tgz", + "integrity": "sha512-b5ACrOuwriJ0SEQdsJuZYQfg+CjgfW2ZcVI3f0r8gK5HWmJnma5fBzc2VM/NGd0JIpCQSgfgoyXaVeFEXXD+dQ==", "requires": { "@babel/runtime": "^7.1.2", "@types/d3-format": "^1.3.0", @@ -10505,15 +10518,15 @@ } }, "browserslist": { - "version": "4.16.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.1.tgz", - "integrity": "sha512-UXhDrwqsNcpTYJBTZsbGATDxZbiVDsx6UjpmRUmtnP10pr8wAYr5LgFoEFw9ixriQH2mv/NX2SfGzE/o8GndLA==", + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.18.1.tgz", + "integrity": "sha512-8ScCzdpPwR2wQh8IT82CA2VgDwjHyqMovPBZSNH54+tm4Jk2pCuv90gmAdH6J84OCRWi0b4gMe6O6XPXuJnjgQ==", "requires": { - "caniuse-lite": "^1.0.30001173", - "colorette": "^1.2.1", - "electron-to-chromium": "^1.3.634", + "caniuse-lite": "^1.0.30001280", + "electron-to-chromium": "^1.3.896", "escalade": "^3.1.1", - "node-releases": "^1.1.69" + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" } }, "buffer": { @@ -10603,9 +10616,9 @@ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, "caniuse-lite": { - "version": "1.0.30001178", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001178.tgz", - "integrity": "sha512-VtdZLC0vsXykKni8Uztx45xynytOi71Ufx9T8kHptSw9AL4dpqailUJJHavttuzUe1KYuBYtChiWv+BAb7mPmQ==" + "version": "1.0.30001283", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001283.tgz", + "integrity": "sha512-9RoKo841j1GQFSJz/nCXOj0sD7tHBtlowjYlrqIUS812x9/emfBLBt6IyMz1zIaYc/eRL8Cs6HPUVi2Hzq4sIg==" }, "caseless": { "version": "0.12.0", @@ -11385,22 +11398,22 @@ } }, "electron-to-chromium": { - "version": "1.3.641", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.641.tgz", - "integrity": "sha512-b0DLhsHSHESC1I+Nx6n4w4Lr61chMd3m/av1rZQhS2IXTzaS5BMM5N+ldWdMIlni9CITMRM09m8He4+YV/92TA==" + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.5.tgz", + "integrity": "sha512-YKaB+t8ul5crdh6OeqT2qXdxJGI0fAYb6/X8pDIyye+c3a7ndOCk5gVeKX+ABwivCGNS56vOAif3TN0qJMpEHw==" }, "elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" }, "dependencies": { "bn.js": { @@ -12971,9 +12984,9 @@ "peer": true }, "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" }, "json-schema-traverse": { "version": "0.4.1", @@ -13044,13 +13057,13 @@ } }, "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" } }, @@ -13491,9 +13504,9 @@ } }, "node-releases": { - "version": "1.1.69", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.69.tgz", - "integrity": "sha512-DGIjo79VDEyAnRlfSqYTsy+yoHd2IOjJiKUozD2MV2D85Vso6Bug56mb9tT/fY5Urt0iqk01H7x+llAruDR2zA==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==" }, "normalize-path": { "version": "3.0.0", @@ -13806,9 +13819,9 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "path-platform": { "version": "0.11.15", @@ -13842,6 +13855,11 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, "picomatch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", diff --git a/superset-frontend/jsconfig.json b/superset-frontend/jsconfig.json deleted file mode 100644 index af4aef66f1fd8..0000000000000 --- a/superset-frontend/jsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "src/*": ["./src/*"] - } - } -} diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index 63e22522cca59..8ed7dd63006c0 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -87,7 +87,7 @@ "mousetrap": "^1.6.1", "mustache": "^2.2.1", "omnibar": "^2.1.1", - "polished": "^3.6.5", + "polished": "^3.7.2", "prop-types": "^15.7.2", "query-string": "^6.13.7", "re-resizable": "^6.6.1", @@ -22032,9 +22032,9 @@ } }, "node_modules/@types/enzyme": { - "version": "3.10.5", - "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.5.tgz", - "integrity": "sha512-R+phe509UuUYy9Tk0YlSbipRpfVtIzb/9BHn5pTEtjJTF5LXvUjrIQcZvNyANNEyFrd2YGs196PniNT1fgvOQA==", + "version": "3.10.10", + "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.10.tgz", + "integrity": "sha512-/D4wFhiEjUDfPu+j5FVK0g/jf7rqeEIpNfAI+kyxzLpw5CKO0drnW3W5NC38alIjsWgnyQ8pbuPF5+UD+vhVyg==", "dev": true, "dependencies": { "@types/cheerio": "*", @@ -22196,9 +22196,9 @@ } }, "node_modules/@types/jquery": { - "version": "3.5.8", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.8.tgz", - "integrity": "sha512-cXk6NwqjDYg+UI9p2l3x0YmPa4m7RrXqmbK4IpVVpRJiYXU/QTo+UZrn54qfE1+9Gao4qpYqUnxm5ZCy2FTXAw==", + "version": "3.5.9", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.9.tgz", + "integrity": "sha512-B8pDk+sH/tSv/HKdx6EQER6BfUOb2GtKs0LOmozziS4h7cbe8u/eYySfUAeTwD+J09SqV3man7AMWIA5mgzCBA==", "dev": true, "dependencies": { "@types/sizzle": "*" @@ -24279,6 +24279,45 @@ "ajv": ">=5.0.0" } }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.8.2.tgz", + "integrity": "sha512-x9VuX+R/jcFj1DHo/fCp99esgGDWiHENrKxaCENuCxpoMCmAt/COCGVDwA7kleEpEzJjDnvh3yGoOuLu0Dtllw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -44694,12 +44733,12 @@ } }, "node_modules/mini-css-extract-plugin": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.3.0.tgz", - "integrity": "sha512-uzWaOwC+gJrnKbr23J1ZRWx/Wd9W9Ce1mKPlsBGBV/r8zG7/G7oKMxGmxbI65pVGbae2cR7CUx9Ulk0HQt8BfQ==", + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.4.5.tgz", + "integrity": "sha512-oEIhRucyn1JbT/1tU2BhnwO6ft1jjH1iCX9Gc59WFMg0n5773rQU0oyQ0zzeYFFuBfONaRbQJyGoPtuNseMxjA==", "dev": true, "dependencies": { - "schema-utils": "^3.1.0" + "schema-utils": "^4.0.0" }, "engines": { "node": ">= 12.13.0" @@ -44712,6 +44751,59 @@ "webpack": "^5.0.0" } }, + "node_modules/mini-css-extract-plugin/node_modules/ajv": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.8.2.tgz", + "integrity": "sha512-x9VuX+R/jcFj1DHo/fCp99esgGDWiHENrKxaCENuCxpoMCmAt/COCGVDwA7kleEpEzJjDnvh3yGoOuLu0Dtllw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/mini-css-extract-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/mini-store": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/mini-store/-/mini-store-3.0.6.tgz", @@ -47860,11 +47952,14 @@ } }, "node_modules/polished": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/polished/-/polished-3.6.5.tgz", - "integrity": "sha512-VwhC9MlhW7O5dg/z7k32dabcAFW1VI2+7fSe8cE/kXcfL7mVdoa5UxciYGW2sJU78ldDLT6+ROEKIZKFNTnUXQ==", + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/polished/-/polished-3.7.2.tgz", + "integrity": "sha512-pQKtpZGmsZrW8UUpQMAnR7s3ppHeMQVNyMDKtUyKwuvDmklzcEyM5Kllb3JyE/sE/x7arDmyd35i+4vp99H6sQ==", "dependencies": { - "@babel/runtime": "^7.9.2" + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=10" } }, "node_modules/portfinder": { @@ -79271,9 +79366,9 @@ } }, "@types/enzyme": { - "version": "3.10.5", - "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.5.tgz", - "integrity": "sha512-R+phe509UuUYy9Tk0YlSbipRpfVtIzb/9BHn5pTEtjJTF5LXvUjrIQcZvNyANNEyFrd2YGs196PniNT1fgvOQA==", + "version": "3.10.10", + "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.10.tgz", + "integrity": "sha512-/D4wFhiEjUDfPu+j5FVK0g/jf7rqeEIpNfAI+kyxzLpw5CKO0drnW3W5NC38alIjsWgnyQ8pbuPF5+UD+vhVyg==", "dev": true, "requires": { "@types/cheerio": "*", @@ -79435,9 +79530,9 @@ } }, "@types/jquery": { - "version": "3.5.8", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.8.tgz", - "integrity": "sha512-cXk6NwqjDYg+UI9p2l3x0YmPa4m7RrXqmbK4IpVVpRJiYXU/QTo+UZrn54qfE1+9Gao4qpYqUnxm5ZCy2FTXAw==", + "version": "3.5.9", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.9.tgz", + "integrity": "sha512-B8pDk+sH/tSv/HKdx6EQER6BfUOb2GtKs0LOmozziS4h7cbe8u/eYySfUAeTwD+J09SqV3man7AMWIA5mgzCBA==", "dev": true, "requires": { "@types/sizzle": "*" @@ -81149,6 +81244,35 @@ "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", "requires": {} }, + "ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "requires": { + "ajv": "^8.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.8.2.tgz", + "integrity": "sha512-x9VuX+R/jcFj1DHo/fCp99esgGDWiHENrKxaCENuCxpoMCmAt/COCGVDwA7kleEpEzJjDnvh3yGoOuLu0Dtllw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, "ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -96997,12 +97121,53 @@ } }, "mini-css-extract-plugin": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.3.0.tgz", - "integrity": "sha512-uzWaOwC+gJrnKbr23J1ZRWx/Wd9W9Ce1mKPlsBGBV/r8zG7/G7oKMxGmxbI65pVGbae2cR7CUx9Ulk0HQt8BfQ==", + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.4.5.tgz", + "integrity": "sha512-oEIhRucyn1JbT/1tU2BhnwO6ft1jjH1iCX9Gc59WFMg0n5773rQU0oyQ0zzeYFFuBfONaRbQJyGoPtuNseMxjA==", "dev": true, "requires": { - "schema-utils": "^3.1.0" + "schema-utils": "^4.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.8.2.tgz", + "integrity": "sha512-x9VuX+R/jcFj1DHo/fCp99esgGDWiHENrKxaCENuCxpoMCmAt/COCGVDwA7kleEpEzJjDnvh3yGoOuLu0Dtllw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + } + } } }, "mini-store": { @@ -99555,11 +99720,11 @@ } }, "polished": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/polished/-/polished-3.6.5.tgz", - "integrity": "sha512-VwhC9MlhW7O5dg/z7k32dabcAFW1VI2+7fSe8cE/kXcfL7mVdoa5UxciYGW2sJU78ldDLT6+ROEKIZKFNTnUXQ==", + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/polished/-/polished-3.7.2.tgz", + "integrity": "sha512-pQKtpZGmsZrW8UUpQMAnR7s3ppHeMQVNyMDKtUyKwuvDmklzcEyM5Kllb3JyE/sE/x7arDmyd35i+4vp99H6sQ==", "requires": { - "@babel/runtime": "^7.9.2" + "@babel/runtime": "^7.12.5" } }, "portfinder": { diff --git a/superset-frontend/package.json b/superset-frontend/package.json index e880ab4e0bd24..b72640d802459 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -72,23 +72,6 @@ "last 3 safari versions", "last 3 edge versions" ], - "stylelint": { - "rules": { - "block-opening-brace-space-before": "always", - "no-missing-end-of-source-newline": "never", - "rule-empty-line-before": [ - "always", - { - "except": [ - "first-nested" - ], - "ignore": [ - "after-comment" - ] - } - ] - } - }, "dependencies": { "@ant-design/icons": "^4.2.2", "@babel/runtime-corejs3": "^7.12.5", @@ -164,7 +147,7 @@ "mousetrap": "^1.6.1", "mustache": "^2.2.1", "omnibar": "^2.1.1", - "polished": "^3.6.5", + "polished": "^3.7.2", "prop-types": "^15.7.2", "query-string": "^6.13.7", "re-resizable": "^6.6.1", diff --git a/superset-frontend/packages/superset-ui-core/src/query/buildQueryContext.ts b/superset-frontend/packages/superset-ui-core/src/query/buildQueryContext.ts index fce53b4608d3a..070636f156f89 100644 --- a/superset-frontend/packages/superset-ui-core/src/query/buildQueryContext.ts +++ b/superset-frontend/packages/superset-ui-core/src/query/buildQueryContext.ts @@ -73,6 +73,7 @@ export default function buildQueryContext( ...hooks, }, }), + form_data: formData, result_format: formData.result_format || 'json', result_type: formData.result_type || 'full', }; diff --git a/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts b/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts index e51b568e03ae1..41708d9dc5c22 100644 --- a/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts +++ b/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts @@ -21,7 +21,12 @@ import { DatasourceType } from './Datasource'; import { BinaryOperator, SetOperator, UnaryOperator } from './Operator'; import { AppliedTimeExtras, TimeRange, TimeRangeEndpoints } from './Time'; import { AnnotationLayer } from './AnnotationLayer'; -import { QueryFields, QueryFormColumn, QueryFormMetric } from './QueryFormData'; +import { + QueryFields, + QueryFormColumn, + QueryFormData, + QueryFormMetric, +} from './QueryFormData'; import { Maybe } from '../../types'; import { PostProcessingRule } from './PostProcessing'; import { JsonObject } from '../../connection'; @@ -158,6 +163,7 @@ export interface QueryContext { /** Response format */ result_format: string; queries: QueryObject[]; + form_data?: QueryFormData; } export default {}; diff --git a/superset-frontend/packages/superset-ui-demo/.storybook/main.js b/superset-frontend/packages/superset-ui-demo/.storybook/main.js index 90ab868100c23..aadae106e328f 100644 --- a/superset-frontend/packages/superset-ui-demo/.storybook/main.js +++ b/superset-frontend/packages/superset-ui-demo/.storybook/main.js @@ -9,8 +9,6 @@ const packages = readdirSync(basePath).filter(name => { return stat.isSymbolicLink(); }); -const rootPath = path.resolve(__dirname, '../../../'); - const PLUGIN_PACKAGES_PATH_REGEXP = new RegExp( `${path.resolve( __dirname, @@ -64,16 +62,6 @@ module.exports = { ), }); - // todo: remove hard code after move storybook to superset repo. - config.resolve.alias['@emotion/styled'] = path.resolve( - rootPath, - './node_modules/@emotion/styled', - ); - config.resolve.alias['@emotion/core'] = path.resolve( - rootPath, - './node_modules/@emotion/core', - ); - config.devtool = 'eval-cheap-module-source-map'; config.devServer = { ...config.devServer, diff --git a/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-time-table/Stories.tsx b/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-time-table/Stories.tsx deleted file mode 100644 index 73b19eadf152f..0000000000000 --- a/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-time-table/Stories.tsx +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* eslint-disable no-magic-numbers */ -import React from 'react'; -import { SuperChart } from '@superset-ui/core'; -import TimeTableChartPlugin from '@superset-ui/legacy-plugin-chart-time-table'; -import data from './data'; - -new TimeTableChartPlugin().configure({ key: 'time-table' }).register(); - -export default { - title: 'Legacy Chart Plugins/legacy-plugin-chart-time-table', -}; - -export const basic = () => ( - -); diff --git a/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-time-table/data.ts b/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-time-table/data.ts deleted file mode 100644 index b9990d59255ce..0000000000000 --- a/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-time-table/data.ts +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -export default { - '1980-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 88, - 'Sub-Saharan Africa': 92, - }, - '1981-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 98, - 'Middle East & North Africa': 80, - 'Sub-Saharan Africa': 96, - }, - '1982-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 89, - 'Sub-Saharan Africa': 94, - }, - '1983-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 88, - 'Sub-Saharan Africa': 98, - }, - '1984-01-01 00:00:00': { - 'East Asia & Pacific': 97, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 91, - 'Sub-Saharan Africa': 98, - }, - '1985-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 94, - 'Sub-Saharan Africa': 97, - }, - '1986-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 98, - 'Sub-Saharan Africa': 99, - }, - '1987-01-01 00:00:00': { - 'East Asia & Pacific': 98, - 'Latin America & Caribbean': 98, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '1988-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 98, - 'Sub-Saharan Africa': 99, - }, - '1989-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 98, - 'Sub-Saharan Africa': 99, - }, - '1990-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '1991-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 98, - 'Sub-Saharan Africa': 99, - }, - '1992-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '1993-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '1994-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '1995-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '1996-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 98, - 'Sub-Saharan Africa': 99, - }, - '1997-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '1998-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '1999-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2000-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2001-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2002-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2003-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2004-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2005-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2006-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2007-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2008-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2009-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2010-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2011-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2012-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2013-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, - '2014-01-01 00:00:00': { - 'East Asia & Pacific': 99, - 'Latin America & Caribbean': 99, - 'Middle East & North Africa': 99, - 'Sub-Saharan Africa': 99, - }, -}; diff --git a/superset-frontend/packages/superset-ui-demo/tsconfig.json b/superset-frontend/packages/superset-ui-demo/tsconfig.json index 094d3c6ffab16..a7983cf472e56 100644 --- a/superset-frontend/packages/superset-ui-demo/tsconfig.json +++ b/superset-frontend/packages/superset-ui-demo/tsconfig.json @@ -6,28 +6,12 @@ "rootDir": "../../", "emitDeclarationOnly": false, "sourceMap": true, - "allowSyntheticDefaultImports": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": false, "noEmit": false, "baseUrl": "../../", - "paths": { - "@superset-ui/core": ["./packages/superset-ui-core/src"], - "@superset-ui/chart-controls": [ - "./packages/superset-ui-chart-controls/src" - ], - "@superset-ui/legacy-plugin-chart-*": [ - "./plugins/legacy-plugin-chart-*/src" - ], - "@superset-ui/legacy-preset-chart-*": [ - "./plugins/legacy-preset-chart-*/src" - ], - "@superset-ui/plugin-chart-*": ["./plugins/plugin-chart-*/src"], - "@superset-ui/preset-chart-*": ["./plugins/preset-chart-*/src"], - } }, - "exclude": ["node_modules"], "include": [ "storybook", "../**/src", diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/CHANGELOG.md b/superset-frontend/plugins/legacy-plugin-chart-time-table/CHANGELOG.md deleted file mode 100644 index 2cb283c0a4146..0000000000000 --- a/superset-frontend/plugins/legacy-plugin-chart-time-table/CHANGELOG.md +++ /dev/null @@ -1,43 +0,0 @@ - - -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [0.18.0](https://github.com/apache-superset/superset-ui/compare/v0.17.87...v0.18.0) (2021-08-30) - -**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-time-table - - - - - -## [0.17.63](https://github.com/apache-superset/superset-ui/compare/v0.17.62...v0.17.63) (2021-07-02) - -**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-time-table - - - - - -## [0.17.61](https://github.com/apache-superset/superset-ui/compare/v0.17.60...v0.17.61) (2021-07-02) - -**Note:** Version bump only for package @superset-ui/legacy-plugin-chart-time-table diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/README.md b/superset-frontend/plugins/legacy-plugin-chart-time-table/README.md deleted file mode 100644 index 5b3a95dd0a0ca..0000000000000 --- a/superset-frontend/plugins/legacy-plugin-chart-time-table/README.md +++ /dev/null @@ -1,52 +0,0 @@ - - -## @superset-ui/plugin-chart-time-table - -[![Version](https://img.shields.io/npm/v/@superset-ui/plugin-time-table.svg?style=flat-square)](https://www.npmjs.com/package/@superset-ui/plugin-chart-time-table) -[![David (path)](https://img.shields.io/david/apache-superset/superset-ui-plugins.svg?path=packages%2Fsuperset-ui-plugin-chart-time-table&style=flat-square)](https://david-dm.org/apache-superset/superset-ui-plugins?path=packages/superset-ui-plugin-chart-time-table) - -This plugin provides Time Table for Superset. - -### Usage - -Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to -lookup this chart throughout the app. - -```js -import TimeTableChartPlugin from '@superset-ui/legacy-plugin-chart-time-table'; - -new TimeTableChartPlugin().configure({ key: 'time-table' }).register(); -``` - -Then use it via `SuperChart`. See -[storybook](https://apache-superset.github.io/superset-ui-plugins/?selectedKind=plugin-chart-time-table) -for more details. - -```js - -``` diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/package.json b/superset-frontend/plugins/legacy-plugin-chart-time-table/package.json deleted file mode 100644 index 635f1b8865c64..0000000000000 --- a/superset-frontend/plugins/legacy-plugin-chart-time-table/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@superset-ui/legacy-plugin-chart-time-table", - "version": "0.18.25", - "description": "Superset Chart Plugin - Time Table", - "sideEffects": [ - "*.css" - ], - "main": "lib/index.js", - "module": "esm/index.js", - "files": [ - "esm", - "lib" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/apache-superset/superset-ui.git" - }, - "keywords": [ - "superset" - ], - "author": "Superset", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/apache-superset/superset-ui/issues" - }, - "homepage": "https://github.com/apache-superset/superset-ui#readme", - "publishConfig": { - "access": "public" - }, - "dependencies": { - "@data-ui/sparkline": "^0.0.84", - "@superset-ui/chart-controls": "0.18.25", - "@superset-ui/core": "0.18.25", - "@types/d3-scale": "^2.0.2", - "d3-scale": "^3.2.1", - "moment": "^2.26.0", - "mustache": "^4.0.1", - "prop-types": "^15.7.2", - "reactable-arc": "^0.15.0" - }, - "peerDependencies": { - "@types/react": "*", - "react": "^16.3.1" - } -} diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/TimeTable.tsx b/superset-frontend/plugins/legacy-plugin-chart-time-table/src/TimeTable.tsx deleted file mode 100644 index 20076e1268da5..0000000000000 --- a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/TimeTable.tsx +++ /dev/null @@ -1,330 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import React from 'react'; -import Mustache from 'mustache'; -import { scaleLinear } from 'd3-scale'; -import { Table, Thead, Th, Tr, Td } from 'reactable-arc'; -import { formatNumber, formatTime, styled } from '@superset-ui/core'; -import { - InfoTooltipWithTrigger, - MetricOption, -} from '@superset-ui/chart-controls'; -import moment from 'moment'; - -import FormattedNumber from './FormattedNumber'; -import SparklineCell from './SparklineCell'; - -const ACCESSIBLE_COLOR_BOUNDS = ['#ca0020', '#0571b0']; -interface ColorFromBoundProps { - value: number; - bounds: Array; - colorBounds: Array; -} -function colorFromBounds( - value: number, - bounds: number[], - colorBounds = ACCESSIBLE_COLOR_BOUNDS, -): ColorFromBoundProps | null { - if (bounds) { - const [min, max] = bounds; - const [minColor, maxColor] = colorBounds; - if (min !== null && max !== null) { - const colorScale = scaleLinear() - .domain([min, (max + min) / 2, max]) - // @ts-ignore - .range([minColor, 'grey', maxColor]); - - // @ts-ignore - return colorScale(value); - } - if (min !== null) { - // @ts-ignore - return value >= min ? maxColor : minColor; - } - if (max !== null) { - // @ts-ignore - return value < max ? maxColor : minColor; - } - } - return null; -} - -interface ColumnConfigProps { - colType: string; - comparisonType: string; - d3format: string; - key: string; - label: string; - timeLag: number; - tooltip: any; - bounds: number[]; - dateFormat: string; - width: string; - height: string; - yAxisBounds: number[]; - showYAxis: boolean; - timeRatio: number; -} - -interface RowData { - label: string; - // eslint-disable-next-line camelcase - metric_name: string; -} - -interface ChartProps { - className: string | undefined; - columnConfigs: Array; - data: object; - height: number; - rows: Array; - rowType: string; - url: string; - row: Array; -} -interface Entry { - [key: string]: number; -} - -class TimeTable extends React.PureComponent { - renderLeftCell(row: RowData) { - const { rowType, url } = this.props; - const context = { metric: row }; - const fullUrl = url ? Mustache.render(url, context) : null; - - if (rowType === 'column') { - const column = row; - if (fullUrl) { - return ( - - {column.label} - - ); - } - return column.label; - } - - return ( - - ); - } - - // eslint-disable-next-line class-methods-use-this - renderSparklineCell( - valueField: string, - column: ColumnConfigProps, - entries: Entry[], - ) { - let sparkData: number[]; - if (column.timeRatio) { - // Period ratio sparkline - sparkData = []; - for (let i = column.timeRatio; i < entries.length; i += 1) { - const prevData = entries[i - column.timeRatio][valueField]; - if (prevData && prevData !== 0) { - sparkData.push(entries[i][valueField] / prevData); - } else { - // @ts-ignore - sparkData.push(null); - } - } - } else { - sparkData = entries.map(d => d[valueField]); - } - - return ( - - ( -
- {formatNumber(column.d3format, sparkData[index])} -
- {formatTime( - column.dateFormat, - moment.utc(entries[index].time).toDate(), - )} -
-
- )} - /> - - ); - } - - // eslint-disable-next-line class-methods-use-this - renderValueCell( - valueField: string, - column: ColumnConfigProps, - reversedEntries: Entry[], - ) { - const recent = reversedEntries[0][valueField]; - let v = 0; - let errorMsg; - if (column.colType === 'time') { - // Time lag ratio - const timeLag = column.timeLag || 0; - const totalLag = Object.keys(reversedEntries).length; - if (timeLag >= totalLag) { - errorMsg = `The time lag set at ${timeLag} is too large for the length of data at ${reversedEntries.length}. No data available.`; - } else { - v = reversedEntries[timeLag][valueField]; - } - if (column.comparisonType === 'diff') { - v = recent - v; - } else if (column.comparisonType === 'perc') { - v = recent / v; - } else if (column.comparisonType === 'perc_change') { - v = recent / v - 1; - } - v = v || 0; - } else if (column.colType === 'contrib') { - // contribution to column total - v = - recent / - Object.keys(reversedEntries[0]) - .map(k => (k === 'time' ? 0 : reversedEntries[0][k])) - .reduce((a, b) => a + b); - } else if (column.colType === 'avg') { - // Average over the last {timeLag} - v = - reversedEntries - .map((k: Entry, i: number) => - i < column.timeLag ? k[valueField] : 0, - ) - .reduce((a: number, b: number) => a + b) / column.timeLag; - } - - const color = colorFromBounds(v, column.bounds); - - return ( - - {errorMsg ? ( -
{errorMsg}
- ) : ( - // @ts-ignore -
- -
- )} - - ); - } - - renderRow(row: RowData, entries: Entry[], reversedEntries: Entry[]) { - const { columnConfigs } = this.props; - const valueField: string = row.label || row.metric_name; - const leftCell = this.renderLeftCell(row); - return ( - - - {leftCell} - - {columnConfigs.map(c => - c.colType === 'spark' - ? this.renderSparklineCell(valueField, c, entries) - : this.renderValueCell(valueField, c, reversedEntries), - )} - - ); - } - - render() { - const { className, height, data, columnConfigs, rowType, rows } = - this.props; - const entries = Object.keys(data) - .sort() - // @ts-ignore - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - .map(time => ({ ...data[time], time })); - - const reversedEntries = entries.concat().reverse(); - - const defaultSort = - rowType === 'column' && columnConfigs.length > 0 - ? { - column: columnConfigs[0].key, - direction: 'desc', - } - : false; - - return ( -
- c.key)} - > - - - {columnConfigs.map((c, i) => ( - - ))} - - {rows.map(row => this.renderRow(row, entries, reversedEntries))} -
Metric - {c?.label}{' '} - {c?.tooltip && ( - - )} -
-
- ); - } -} - -export default styled(TimeTable)` - .time-table { - overflow: auto; - } -`; diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/TimeTableChartPlugin.ts b/superset-frontend/plugins/legacy-plugin-chart-time-table/src/TimeTableChartPlugin.ts deleted file mode 100644 index ef1933bfcda95..0000000000000 --- a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/TimeTableChartPlugin.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { t, ChartMetadata, ChartPlugin } from '@superset-ui/core'; -import transformProps from './transformProps'; -import thumbnail from './images/thumbnail.png'; - -const metadata = new ChartMetadata({ - name: t('Time-series Table'), - description: '', - thumbnail, - useLegacyApi: true, -}); - -export default class TimeTableChartPlugin extends ChartPlugin { - constructor() { - super({ - metadata, - // @ts-ignore - transformProps, - loadChart: () => import('./TimeTable'), - }); - } -} diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-time-table/src/controlPanel.ts deleted file mode 100644 index 941bd1fe0dcc1..0000000000000 --- a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/controlPanel.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { t, validateNonEmpty } from '@superset-ui/core'; -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; - -const config: ControlPanelConfig = { - controlPanelSections: [ - sections.legacyTimeseriesTime, - { - label: t('Query'), - expanded: true, - controlSetRows: [ - ['metrics'], - ['adhoc_filters'], - ['groupby'], - ['limit'], - [ - { - name: 'column_collection', - config: { - type: 'CollectionControl', - label: t('Time Series Columns'), - validators: [validateNonEmpty], - controlName: 'TimeSeriesColumnControl', - }, - }, - ], - [ - { - name: 'url', - config: { - type: 'TextControl', - label: t('URL'), - description: t( - "Templated link, it's possible to include {{ metric }} " + - 'or other values coming from the controls.', - ), - default: '', - }, - }, - ], - ], - }, - ], - controlOverrides: { - groupby: { - multiple: false, - }, - }, -}; - -export default config; diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/images/thumbnail.png b/superset-frontend/plugins/legacy-plugin-chart-time-table/src/images/thumbnail.png deleted file mode 100644 index 22c2ee2904390..0000000000000 Binary files a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/images/thumbnail.png and /dev/null differ diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/images/thumbnailLarge.png b/superset-frontend/plugins/legacy-plugin-chart-time-table/src/images/thumbnailLarge.png deleted file mode 100644 index 4dd4b925c7c1b..0000000000000 Binary files a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/images/thumbnailLarge.png and /dev/null differ diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/index.ts b/superset-frontend/plugins/legacy-plugin-chart-time-table/src/index.ts deleted file mode 100644 index 586524f506a99..0000000000000 --- a/superset-frontend/plugins/legacy-plugin-chart-time-table/src/index.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { t, ChartMetadata, ChartPlugin } from '@superset-ui/core'; -import transformProps from './transformProps'; -import thumbnail from './images/thumbnail.png'; -import controlPanel from './controlPanel'; - -const metadata = new ChartMetadata({ - category: t('Table'), - name: t('Time-series Table'), - description: t( - 'Compare multiple time series charts (as sparklines) and related metrics quickly. ', - ), - tags: [ - t('Multi-Variables'), - t('Comparison'), - t('Legacy'), - t('Percentages'), - t('Tabular'), - t('Description'), - t('Trend'), - ], - thumbnail, - useLegacyApi: true, -}); -export default class TimeTableChartPlugin extends ChartPlugin { - constructor() { - super({ - loadChart: () => import('./TimeTable'), - metadata, - // @ts-ignore - transformProps, - controlPanel, - }); - } -} diff --git a/superset-frontend/plugins/legacy-plugin-chart-time-table/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-time-table/tsconfig.json deleted file mode 100644 index b6bfaa2d98446..0000000000000 --- a/superset-frontend/plugins/legacy-plugin-chart-time-table/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "declarationDir": "lib", - "outDir": "lib", - "rootDir": "src" - }, - "exclude": [ - "lib", - "test" - ], - "extends": "../../tsconfig.json", - "include": [ - "src/**/*", - "types/**/*", - "../../types/**/*" - ], - "references": [ - { - "path": "../../packages/superset-ui-chart-controls" - }, - { - "path": "../../packages/superset-ui-core" - } - ] -} diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts index d0f83ddd91620..b1459ddea8a47 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts @@ -35,6 +35,7 @@ import { yAxisLabel, yAxisShowMinmax, yAxisBounds, + richTooltip, } from '../NVD3Controls'; const config: ControlPanelConfig = { @@ -81,6 +82,7 @@ const config: ControlPanelConfig = { ['color_scheme'], [showLegend], [showBarValue], + [richTooltip], [barStacked], [ { diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js index 66bf9328ae00e..7f3d4d08d4fef 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js @@ -673,9 +673,9 @@ function nvd3Vis(element, props) { chart.color(d => d.color || colorFn(cleanColorInput(d[colorKey]))); } - if (isVizTypes(['line', 'area']) && useRichTooltip) { + if (isVizTypes(['line', 'area', 'bar', 'dist_bar']) && useRichTooltip) { chart.useInteractiveGuideline(true); - if (vizType === 'line') { + if (vizType === 'line' || vizType === 'bar') { chart.interactiveLayer.tooltip.contentGenerator(d => generateRichLineTooltipContent( d, @@ -683,6 +683,10 @@ function nvd3Vis(element, props) { yAxisFormatter, ), ); + } else if (vizType === 'dist_bar') { + chart.interactiveLayer.tooltip.contentGenerator(d => + generateCompareTooltipContent(d, yAxisFormatter), + ); } else { // area chart chart.interactiveLayer.tooltip.contentGenerator(d => diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.ts b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx similarity index 90% rename from superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.ts rename to superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx index e8ff6266d57ac..c3a2ee579dc40 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.ts +++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import React from 'react'; import { QueryFormMetric, smartDateFormatter, @@ -225,7 +226,7 @@ const config: ControlPanelConfig = { name: 'rowOrder', config: { type: 'SelectControl', - label: t('Rows sort by'), + label: t('Sort rows by'), default: 'key_a_to_z', choices: [ // [value, label] @@ -235,7 +236,16 @@ const config: ControlPanelConfig = { ['value_z_to_a', t('value descending')], ], renderTrigger: true, - description: t('Order of rows'), + description: ( + +
{t('Change order of rows.')}
+
{t('Available sorting modes:')}
+
    +
  • {t('By key: use row names as sorting key')}
  • +
  • {t('By value: use metric values as sorting key')}
  • +
+
+ ), }, }, ], @@ -244,7 +254,7 @@ const config: ControlPanelConfig = { name: 'colOrder', config: { type: 'SelectControl', - label: t('Cols sort by'), + label: t('Sort columns by'), default: 'key_a_to_z', choices: [ // [value, label] @@ -254,7 +264,16 @@ const config: ControlPanelConfig = { ['value_z_to_a', t('value descending')], ], renderTrigger: true, - description: t('Order of columns'), + description: ( + +
{t('Change order of columns.')}
+
{t('Available sorting modes:')}
+
    +
  • {t('By key: use column names as sorting key')}
  • +
  • {t('By value: use metric values as sorting key')}
  • +
+
+ ), }, }, ], @@ -280,7 +299,7 @@ const config: ControlPanelConfig = { name: 'colSubtotalPosition', config: { type: 'SelectControl', - label: t('Cols subtotal position'), + label: t('Columns subtotal position'), default: false, choices: [ // [value, label] diff --git a/superset-frontend/scripts/check_license.sh b/superset-frontend/scripts/check_license.sh deleted file mode 100755 index 9d2026e523ff9..0000000000000 --- a/superset-frontend/scripts/check_license.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env bash -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -acquire_rat_jar () { - - URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar" - - JAR="$rat_jar" - - # Download rat launch jar if it hasn't been downloaded yet - if [ ! -f "$JAR" ]; then - # Download - printf "Attempting to fetch rat\n" - JAR_DL="${JAR}.part" - if [ $(command -v curl) ]; then - curl -L --silent "${URL}" > "$JAR_DL" && mv "$JAR_DL" "$JAR" - elif [ $(command -v wget) ]; then - wget --quiet ${URL} -O "$JAR_DL" && mv "$JAR_DL" "$JAR" - else - printf "You do not have curl or wget installed, please install rat manually.\n" - exit -1 - fi - fi - - unzip -tq "$JAR" &> /dev/null - if [ $? -ne 0 ]; then - # We failed to download - rm "$JAR" - printf "Our attempt to download rat locally to ${JAR} failed. Please install rat manually.\n" - exit -1 - fi - printf "Done downloading.\n" -} - -# Go to the project root directory -FWDIR="$(cd "`dirname "$0"`"/..; pwd)" -cd "$FWDIR" - -TMP_DIR=/tmp - -if test -x "$JAVA_HOME/bin/java"; then - declare java_cmd="$JAVA_HOME/bin/java" -else - declare java_cmd=java -fi - -export RAT_VERSION=0.13 -export rat_jar="${TMP_DIR}"/lib/apache-rat-${RAT_VERSION}.jar -mkdir -p ${TMP_DIR}/lib - - -[[ -f "$rat_jar" ]] || acquire_rat_jar || { - echo "Download failed. Obtain the rat jar manually and place it at $rat_jar" - exit 1 -} - -echo "Running license checks. This can take a while." -echo "$FWDIR"/.rat-excludes -$java_cmd -jar "$rat_jar" -E "$FWDIR"/.rat-excludes -d "$FWDIR" > rat-results.txt - -if [ $? -ne 0 ]; then - echo "RAT exited abnormally" - exit 1 -fi - -ERRORS="$(cat rat-results.txt | grep -e "??")" - -if test ! -z "$ERRORS"; then - echo >&2 "Could not find Apache license headers in the following files:" - echo >&2 "$ERRORS" - exit 1 -else - echo -e "RAT checks passed." -fi diff --git a/superset-frontend/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx b/superset-frontend/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx index 6598f3f0d4232..8e7db8490102b 100644 --- a/superset-frontend/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/ExploreActionButtons_spec.jsx @@ -82,4 +82,36 @@ describe('ExploreActionButtons', () => { spyExportChart.restore(); }); }); + + describe('Dropdown csv button when viz type is pivot table', () => { + let wrapper; + const defaultProps = { + actions: {}, + canDownloadCSV: false, + latestQueryFormData: { viz_type: 'pivot_table_v2' }, + queryEndpoint: 'localhost', + chartHeight: '30px', + }; + + beforeEach(() => { + wrapper = mount( + + + , + { + wrappingComponent: Provider, + wrappingComponentProps: { + store: mockStore, + }, + }, + ); + }); + + it('should render a dropdown button when viz type is pivot table', () => { + const csvTrigger = wrapper.find( + 'div[role="button"] span[aria-label="caret-down"]', + ); + expect(csvTrigger).toExist(); + }); + }); }); diff --git a/superset-frontend/src/CRUD/Field.test.tsx b/superset-frontend/src/CRUD/Field.test.tsx new file mode 100644 index 0000000000000..ab90033e5c5a9 --- /dev/null +++ b/superset-frontend/src/CRUD/Field.test.tsx @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { render, screen } from 'spec/helpers/testing-library'; +import { shallow } from 'enzyme'; +import TextAreaControl from 'src/explore/components/controls/TextAreaControl'; +import Field from './Field'; + +describe('Field', () => { + const defaultProps = { + fieldKey: 'mock', + value: '', + label: 'mock', + description: 'description', + control: , + onChange: jest.fn(), + compact: false, + inline: false, + }; + + it('should render', () => { + const { container } = render(); + expect(container).toBeInTheDocument(); + }); + + it('should call onChange', () => { + const wrapper = shallow(); + const textArea = wrapper.find(TextAreaControl); + textArea.simulate('change', { target: { value: 'x' } }); + expect(defaultProps.onChange).toHaveBeenCalled(); + }); + + it('should render compact', () => { + render(); + expect( + screen.queryByText(defaultProps.description), + ).not.toBeInTheDocument(); + }); +}); diff --git a/superset-frontend/src/CRUD/Field.tsx b/superset-frontend/src/CRUD/Field.tsx index 942b870f7d994..80388b6692f83 100644 --- a/superset-frontend/src/CRUD/Field.tsx +++ b/superset-frontend/src/CRUD/Field.tsx @@ -44,10 +44,10 @@ export default function Field({ fieldKey, value, label, - description, + description = null, control, - onChange, - compact, + onChange = () => {}, + compact = false, inline, }: FieldProps) { const onControlChange = useCallback( diff --git a/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.jsx b/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx similarity index 73% rename from superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.jsx rename to superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx index f9e6f79e804e8..797c7504282ea 100644 --- a/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.jsx +++ b/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx @@ -17,7 +17,6 @@ * under the License. */ import React, { useMemo } from 'react'; -import PropTypes from 'prop-types'; import Alert from 'src/components/Alert'; import { t } from '@superset-ui/core'; import TableView from 'src/components/TableView'; @@ -26,24 +25,28 @@ import Loading from 'src/components/Loading'; import ModalTrigger from 'src/components/ModalTrigger'; import { EmptyWrapperType } from 'src/components/TableView/TableView'; -const propTypes = { - dbId: PropTypes.number.isRequired, - schema: PropTypes.string.isRequired, - sql: PropTypes.string.isRequired, - getEstimate: PropTypes.func.isRequired, - queryCostEstimate: PropTypes.Object, - selectedText: PropTypes.string, - tooltip: PropTypes.string, - disabled: PropTypes.bool, -}; -const defaultProps = { - queryCostEstimate: [], - tooltip: '', - disabled: false, -}; +interface EstimateQueryCostButtonProps { + dbId: number; + schema: string; + sql: string; + getEstimate: Function; + queryCostEstimate: Record; + selectedText?: string; + tooltip?: string; + disabled?: boolean; +} -const EstimateQueryCostButton = props => { - const { cost } = props.queryCostEstimate; +const EstimateQueryCostButton = ({ + dbId, + schema, + sql, + getEstimate, + queryCostEstimate = {}, + selectedText, + tooltip = '', + disabled = false, +}: EstimateQueryCostButtonProps) => { + const { cost } = queryCostEstimate; const tableData = useMemo(() => (Array.isArray(cost) ? cost : []), [cost]); const columns = useMemo( () => @@ -53,21 +56,23 @@ const EstimateQueryCostButton = props => { [cost], ); - const onClick = () => { - props.getEstimate(); + // A call back method to pass an event handler function as a prop to the Button element. + // Refer: https://reactjs.org/docs/handling-events.html + const onClickHandler = () => { + getEstimate(); }; const renderModalBody = () => { - if (props.queryCostEstimate.error !== null) { + if (queryCostEstimate.error !== null) { return ( ); } - if (props.queryCostEstimate.completed) { + if (queryCostEstimate.completed) { return ( { return ; }; - const { disabled, selectedText, tooltip } = props; const btnText = selectedText ? t('Estimate selected query cost') : t('Estimate cost'); @@ -93,7 +97,7 @@ const EstimateQueryCostButton = props => { triggerNode={