diff --git a/RELEASING/README.md b/RELEASING/README.md
index 5c4786692711c..eac5e7fd5cbed 100644
--- a/RELEASING/README.md
+++ b/RELEASING/README.md
@@ -118,6 +118,8 @@ git push upstream $SUPERSET_GITHUB_BRANCH
Next, update the `CHANGELOG.md` with all the changes that are included in the release.
Make sure the branch has been pushed to `upstream` to ensure the changelog generator
can pick up changes since the previous release.
+Change log script requires a github token and will try to use your env var GITHUB_TOKEN.
+you can also pass the token using the parameter `--access_token`.
Example:
```bash
diff --git a/RELEASING/changelog.py b/RELEASING/changelog.py
index 07daacba8cb16..1d83aad7d3624 100644
--- a/RELEASING/changelog.py
+++ b/RELEASING/changelog.py
@@ -17,18 +17,22 @@
# pylint: disable=no-value-for-parameter
import csv as lib_csv
-import json
import os
import re
import sys
from dataclasses import dataclass
-from time import sleep
from typing import Any, Dict, Iterator, List, Optional, Union
-from urllib import request
-from urllib.error import HTTPError
import click
+try:
+ from github import BadCredentialsException, Github, PullRequest
+except ModuleNotFoundError:
+ print("PyGithub is a required package for this script")
+ exit(1)
+
+SUPERSET_REPO = "apache/superset"
+
@dataclass
class GitLog:
@@ -60,47 +64,31 @@ class GitChangeLog:
We want to map a git author to a github login, for that we call github's API
"""
- def __init__(self, version: str, logs: List[GitLog]) -> None:
+ def __init__(
+ self, version: str, logs: List[GitLog], access_token: Optional[str] = None
+ ) -> None:
self._version = version
self._logs = logs
self._github_login_cache: Dict[str, Optional[str]] = {}
self._wait = 10
+ github_token = access_token or os.environ.get("GITHUB_TOKEN")
+ self._github = Github(github_token)
+ self._superset_repo = ""
- def _wait_github_rate_limit(self) -> None:
- """
- Waits for available rate limit slots on the github API
- """
- while True:
- rate_limit_payload = self._fetch_github_rate_limit()
- if rate_limit_payload["rate"]["remaining"] > 1:
- break
- print(".", end="", flush=True)
- sleep(self._wait)
- print()
-
- @staticmethod
- def _fetch_github_rate_limit() -> Dict[str, Any]:
- """
- Fetches current github rate limit info
- """
- with request.urlopen("https://api.github.com/rate_limit") as response:
- payload = json.loads(response.read())
- return payload
-
- def _fetch_github_pr(self, pr_number: int) -> Dict[str, Any]:
+ def _fetch_github_pr(self, pr_number: int) -> PullRequest:
"""
Fetches a github PR info
"""
- payload = {}
try:
- self._wait_github_rate_limit()
- with request.urlopen(
- "https://api.github.com/repos/apache/superset/pulls/" f"{pr_number}"
- ) as response:
- payload = json.loads(response.read())
- except HTTPError as ex:
- print(f"{ex}", flush=True)
- return payload
+ github_repo = self._github.get_repo(SUPERSET_REPO)
+ except BadCredentialsException as ex:
+ print(
+ f"Bad credentials to github provided"
+ f" use access_token parameter or set GITHUB_TOKEN"
+ )
+ sys.exit(1)
+
+ return github_repo.get_pull(pr_number)
def _get_github_login(self, git_log: GitLog) -> Optional[str]:
"""
@@ -113,7 +101,7 @@ def _get_github_login(self, git_log: GitLog) -> Optional[str]:
if git_log.pr_number:
pr_info = self._fetch_github_pr(git_log.pr_number)
if pr_info:
- github_login = pr_info["user"]["login"]
+ github_login = pr_info.user.login
else:
github_login = author_name
# set cache
@@ -131,7 +119,7 @@ def __repr__(self) -> str:
github_login = log.author
result = result + (
f"- [#{log.pr_number}]"
- f"(https://github.com/apache/superset/pull/{log.pr_number}) "
+ f"(https://github.com/{SUPERSET_REPO}/pull/{log.pr_number}) "
f"{log.message} (@{github_login})\n"
)
print(f"\r {i}/{len(self._logs)}", end="", flush=True)
@@ -141,7 +129,7 @@ def __iter__(self) -> Iterator[Dict[str, Any]]:
for log in self._logs:
yield {
"pr_number": log.pr_number,
- "pr_link": f"https://github.com/apache/superset/pull/"
+ "pr_link": f"https://github.com/{SUPERSET_REPO}/pull/"
f"{log.pr_number}",
"message": log.message,
"time": log.time,
@@ -276,13 +264,20 @@ def compare(base_parameters: BaseParameters) -> None:
@click.option(
"--csv", help="The csv filename to export the changelog to",
)
+@click.option(
+ "--access_token",
+ help="The github access token,"
+ " if not provided will try to fetch from GITHUB_TOKEN env var",
+)
@click.pass_obj
-def change_log(base_parameters: BaseParameters, csv: str) -> None:
+def change_log(base_parameters: BaseParameters, csv: str, access_token: str) -> None:
""" Outputs a changelog (by PR) """
previous_logs = base_parameters.previous_logs
current_logs = base_parameters.current_logs
previous_diff_logs = previous_logs.diff(current_logs)
- logs = GitChangeLog(current_logs.git_ref, previous_diff_logs[::-1])
+ logs = GitChangeLog(
+ current_logs.git_ref, previous_diff_logs[::-1], access_token=access_token
+ )
if csv:
with open(csv, "w") as csv_file:
log_items = list(logs)
diff --git a/helm/superset/templates/configmap-superset.yaml b/helm/superset/templates/configmap-superset.yaml
new file mode 100644
index 0000000000000..104bc353b1be6
--- /dev/null
+++ b/helm/superset/templates/configmap-superset.yaml
@@ -0,0 +1,32 @@
+#
+# 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.
+#
+{{- if .Values.extraConfigs }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ template "superset.fullname" . }}-extra-config
+ labels:
+ app: {{ template "superset.name" . }}
+ chart: {{ template "superset.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+data:
+{{- range $path, $config := .Values.extraConfigs }}
+ {{ $path }}: |
+{{ tpl $config . | indent 4 -}}
+{{- end -}}
+{{- end -}}
\ No newline at end of file
diff --git a/helm/superset/templates/init-job.yaml b/helm/superset/templates/init-job.yaml
index 099b2ef450213..4645fcc64be15 100644
--- a/helm/superset/templates/init-job.yaml
+++ b/helm/superset/templates/init-job.yaml
@@ -51,10 +51,20 @@ spec:
- name: superset-config
mountPath: {{ .Values.configMountPath | quote }}
readOnly: true
+ {{ if .Values.extraConfigs }}
+ - name: superset-extra-config
+ mountPath: {{ .Values.extraConfigMountPath | quote }}
+ readOnly: true
+ {{- end }}
command: {{ tpl (toJson .Values.init.command) . }}
volumes:
- name: superset-config
secret:
secretName: {{ tpl .Values.configFromSecret . }}
+ {{- if .Values.extraConfigs }}
+ - name: superset-extra-config
+ configMap:
+ name: {{ template "superset.fullname" . }}-extra-config
+ {{- end }}
restartPolicy: Never
{{- end }}
diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml
index 366f7a39b3baa..dee9808d7fcbe 100644
--- a/helm/superset/values.yaml
+++ b/helm/superset/values.yaml
@@ -41,8 +41,23 @@ envFromSecret: '{{ template "superset.fullname" . }}-env'
##
extraEnv: {}
+extraConfigs: {}
+ # datasources-init.yaml: |
+ # databases:
+ # - allow_csv_upload: true
+ # allow_ctas: true
+ # allow_cvas: true
+ # database_name: example-db
+ # extra: "{\r\n \"metadata_params\": {},\r\n \"engine_params\": {},\r\n \"\
+ # metadata_cache_timeout\": {},\r\n \"schemas_allowed_for_csv_upload\": []\r\n\
+ # }"
+ # sqlalchemy_uri: example://example-db.local
+ # tables: []
+
configMountPath: "/app/pythonpath"
+extraConfigMountPath: "/app/configs"
+
image:
repository: apache/superset
tag: latest
@@ -256,4 +271,4 @@ nodeSelector: {}
tolerations: []
-affinity: {}
+affinity: {}
\ No newline at end of file
diff --git a/requirements/base.txt b/requirements/base.txt
index 64ae5d1f25074..8b41983563243 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -77,7 +77,7 @@ prison==0.1.3 # via flask-appbuilder
py==1.9.0 # via retry
pyarrow==1.0.1 # via apache-superset
pycparser==2.20 # via cffi
-pyjwt==1.7.1 # via flask-appbuilder, flask-jwt-extended
+pyjwt==1.7.1 # via apache-superset, flask-appbuilder, flask-jwt-extended
pymeeus==0.3.7 # via convertdate
pyparsing==2.4.7 # via apache-superset, packaging
pyrsistent==0.16.1 # via -r requirements/base.in, jsonschema
@@ -92,12 +92,12 @@ redis==3.5.3 # via apache-superset
retry==0.9.2 # via apache-superset
selenium==3.141.0 # via apache-superset
simplejson==3.17.2 # via apache-superset
-six==1.15.0 # via bleach, cryptography, flask-jwt-extended, flask-talisman, holidays, isodate, jsonschema, pathlib2, polyline, prison, pyrsistent, python-dateutil, sqlalchemy-utils, wtforms-json
+six==1.15.0 # via bleach, cryptography, flask-jwt-extended, flask-talisman, holidays, isodate, jsonschema, packaging, pathlib2, polyline, prison, pyrsistent, python-dateutil, sqlalchemy-utils, wtforms-json
slackclient==2.5.0 # via apache-superset
sqlalchemy-utils==0.36.8 # via apache-superset, flask-appbuilder
sqlalchemy==1.3.20 # via alembic, apache-superset, flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils
sqlparse==0.3.0 # via apache-superset
-typing-extensions==3.7.4.3 # via aiohttp, yarl
+typing-extensions==3.7.4.3 # via aiohttp, apache-superset, yarl
urllib3==1.25.11 # via selenium
vine==1.3.0 # via amqp, celery
webencodings==0.5.1 # via bleach
diff --git a/requirements/development.in b/requirements/development.in
index eae28663d0d62..5ac06dc543399 100644
--- a/requirements/development.in
+++ b/requirements/development.in
@@ -24,3 +24,4 @@ pyhive[hive]>=0.6.1
psycopg2-binary==2.8.5
tableschema
thrift>=0.11.0,<1.0.0
+pygithub>=1.54.1,<2.0.0
diff --git a/requirements/development.txt b/requirements/development.txt
index af94def47c643..f0eb4938a3889 100644
--- a/requirements/development.txt
+++ b/requirements/development.txt
@@ -1,4 +1,4 @@
-# SHA1:ae0364cae066a5cb8fb543c4f568bfcdacb6c1b7
+# SHA1:b7181d683bed10ffe4892d2f07bc94a503f46b44
#
# This file is autogenerated by pip-compile-multi
# To update, run:
@@ -11,6 +11,7 @@ boto3==1.16.10 # via tabulator
botocore==1.19.10 # via boto3, s3transfer
cached-property==1.5.2 # via tableschema
certifi==2020.6.20 # via requests
+deprecated==1.2.11 # via pygithub
et-xmlfile==1.0.1 # via openpyxl
flask-cors==3.0.9 # via -r requirements/development.in
future==0.18.2 # via pyhive
@@ -24,8 +25,9 @@ openpyxl==3.0.5 # via tabulator
pillow==7.2.0 # via -r requirements/development.in
psycopg2-binary==2.8.5 # via -r requirements/development.in
pydruid==0.6.1 # via -r requirements/development.in
+pygithub==1.54.1 # via -r requirements/development.in
pyhive[hive]==0.6.3 # via -r requirements/development.in
-requests==2.24.0 # via pydruid, tableschema, tabulator
+requests==2.24.0 # via pydruid, pygithub, tableschema, tabulator
rfc3986==1.4.0 # via tableschema
s3transfer==0.3.3 # via boto3
sasl==0.2.1 # via pyhive, thrift-sasl
@@ -34,6 +36,7 @@ tabulator==1.52.5 # via tableschema
thrift-sasl==0.4.2 # via pyhive
thrift==0.13.0 # via -r requirements/development.in, pyhive, thrift-sasl
unicodecsv==0.14.1 # via tableschema, tabulator
+wrapt==1.12.1 # via deprecated
xlrd==1.2.0 # via tabulator
# The following packages are considered to be unsafe in a requirements file:
diff --git a/requirements/testing.txt b/requirements/testing.txt
index 2c97c83247ae3..8ea641b1dfa48 100644
--- a/requirements/testing.txt
+++ b/requirements/testing.txt
@@ -40,7 +40,6 @@ traitlets==5.0.5 # via ipython
typed-ast==1.4.1 # via astroid
wcwidth==0.2.5 # via prompt-toolkit
websocket-client==0.57.0 # via docker
-wrapt==1.12.1 # via astroid
# The following packages are considered to be unsafe in a requirements file:
# pip
diff --git a/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts
index 70b01351eaa9f..c65b5dfb59252 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts
@@ -104,7 +104,7 @@ describe('VizType control', () => {
numScripts = nodes.length;
});
- cy.get('.Control .label').contains('Table').click();
+ cy.get('[data-test="visualization-type"]').contains('Table').click();
cy.get('[role="button"]').contains('Line Chart').click();
diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts
index 868d2fe27f18f..0af7dce36fa82 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts
@@ -161,7 +161,7 @@ describe('Visualization > Table', () => {
cy.verifySliceContainer('table');
expect(response?.body.result[0].data.length).to.eq(limit);
});
- cy.get('span.label-danger').contains('10 rows');
+ cy.get('[data-test="row-count-label"]').contains('10 rows');
});
it('Test table with columns and row limit', () => {
diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json
index afbfa1ca58f84..820adf3c6c4dc 100644
--- a/superset-frontend/package-lock.json
+++ b/superset-frontend/package-lock.json
@@ -18552,9 +18552,9 @@
}
},
"@superset-ui/chart-controls": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/chart-controls/-/chart-controls-0.17.1.tgz",
- "integrity": "sha512-dfJRoVH0WbG5FQ8smszVtiYLI3NvvLAQxW6HRgOqTLegiKocIIB8hjpMpGrOPxx2G0mBigAubeQowC1VOlpAZQ==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/chart-controls/-/chart-controls-0.17.2.tgz",
+ "integrity": "sha512-Rqk68T0sJlB77E1mO9If64NAymi4POy6STsdODtGQ7UlRx9DnbKMUxUqfPgGhLqiDRpYmsoQpG/CPHEvCdE5Pg==",
"requires": {
"@superset-ui/core": "0.17.1",
"lodash": "^4.17.15",
@@ -18647,11 +18647,11 @@
}
},
"@superset-ui/legacy-plugin-chart-calendar": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-calendar/-/legacy-plugin-chart-calendar-0.17.1.tgz",
- "integrity": "sha512-v9Hh2hNdxsu3vSRtx1KjqsDhDYlCStbEQekp2+BKRH55RKitbJzbw+6GgXxA09s/6VgIxji8oEaZVYAWylzJtQ==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-calendar/-/legacy-plugin-chart-calendar-0.17.2.tgz",
+ "integrity": "sha512-syc/v+lCp9Xfx76171YZ5PD0ZxdxneKQViUY0L4I6KtvIHPtUQqj3kQJRELPSWh933pKdqO1HtWTMG8jyNsmEw==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3-array": "^2.0.3",
"d3-selection": "^1.4.0",
@@ -18670,11 +18670,11 @@
}
},
"@superset-ui/legacy-plugin-chart-chord": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-chord/-/legacy-plugin-chart-chord-0.17.1.tgz",
- "integrity": "sha512-xJbr9oyHBOBRp1IWQn1HuLsrArJtADVk2FE6r4QZTVYCKzJoKrQTqQEfkA2roHOHfOZtlcHcD1rlOMt8KpdmDw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-chord/-/legacy-plugin-chart-chord-0.17.2.tgz",
+ "integrity": "sha512-ya0f6IBwc3JumcM4510glquY7OAV04fimgFpoH+9XEpTx2ikKnUwS02gGVzpWw4/0VfrSJNQqTy3vG+wmGvkSQ==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"prop-types": "^15.6.2",
@@ -18682,11 +18682,11 @@
}
},
"@superset-ui/legacy-plugin-chart-country-map": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-country-map/-/legacy-plugin-chart-country-map-0.17.1.tgz",
- "integrity": "sha512-CCJPFGp0P1lEX4W0JqcSC0Lq43gx8BSUNeE//xz+ZKc9JoERttVCKjwEyFCov6Y++iFM/EfDpg1bRS0XpJxD4A==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-country-map/-/legacy-plugin-chart-country-map-0.17.2.tgz",
+ "integrity": "sha512-+5SnkN/KzPkWDUNMVJ7E9hljG2ldsrAqpCget+x7oIfE1Nb0sbMm7q2ewQeAmUXs9ftSlrKVvb0560G9uLRqMQ==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"d3-array": "^2.0.3",
@@ -18704,33 +18704,33 @@
}
},
"@superset-ui/legacy-plugin-chart-event-flow": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-event-flow/-/legacy-plugin-chart-event-flow-0.17.1.tgz",
- "integrity": "sha512-pGuo5cVjLRJILKbE2oc7mFoWUTrOIf2ChNLHpULZZeNtpG8H3gXGA97qK+5KgXtslfv2BVi1sbR97VV9IH3gTw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-event-flow/-/legacy-plugin-chart-event-flow-0.17.2.tgz",
+ "integrity": "sha512-9sIO2ilA1iJ4MhYqdO8oj+byjyLvSdtsx/wmhGf6U4QqjLDSVpXgf3g2hQt6x34foMQodL8WcC9vAHa11ILpfw==",
"requires": {
"@data-ui/event-flow": "^0.0.84",
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-force-directed": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-force-directed/-/legacy-plugin-chart-force-directed-0.17.1.tgz",
- "integrity": "sha512-F8aV/iGBeHOh+9ewE8rfpWN2J/avAvlWl1zIM/PZTMlwimVwBXj8voTWk32LVL+Cb+9DwntB5KA093r8yWHK5Q==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-force-directed/-/legacy-plugin-chart-force-directed-0.17.2.tgz",
+ "integrity": "sha512-0S/iF17heD+UNetgQvE7jO4bvym2py54hGersDhtLuZm9Ch5Vhk+1q6X9j8QOTR5lcupIxkMvFIV/rCf3tjR+A==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"prop-types": "^15.7.2"
}
},
"@superset-ui/legacy-plugin-chart-heatmap": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-heatmap/-/legacy-plugin-chart-heatmap-0.17.1.tgz",
- "integrity": "sha512-IlItjyVT9Y3aE3qYml+CEbGpwVrPJu68MYb5UNOp+ms5DEETRH0Z61kKvX/egCVouYznyVrxjdc8SvL8tHqQYg==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-heatmap/-/legacy-plugin-chart-heatmap-0.17.2.tgz",
+ "integrity": "sha512-15XO5xoFn118TVgdp+GBnHd1cSM+/ieb1N5fZmulgSy88v0kLG/hl4NdG+lMSMWXoDkaWMlzJnz9EsP3hb+Vmw==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"d3-svg-legend": "^1.x",
@@ -18739,13 +18739,13 @@
}
},
"@superset-ui/legacy-plugin-chart-histogram": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-histogram/-/legacy-plugin-chart-histogram-0.17.1.tgz",
- "integrity": "sha512-awZCVmpXH5LCOOCktZdaj5PrPUBeAWdK/60A6n/oKufZ2x4eoXVLgBpsj3JCS73XcKu3FwhWRHLujE0pZthKhA==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-histogram/-/legacy-plugin-chart-histogram-0.17.2.tgz",
+ "integrity": "sha512-VbQ+5qGEg+XF3ovPPXDDfBYXwZyqkbqnA4R+yPG1y/rJldsvQ1/3TINT90Hz4rve9agvJihc0ERkoMUaFBgXtg==",
"requires": {
"@data-ui/histogram": "^0.0.84",
"@data-ui/theme": "^0.0.84",
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"@vx/legend": "^0.0.198",
"@vx/responsive": "^0.0.199",
@@ -18814,11 +18814,11 @@
}
},
"@superset-ui/legacy-plugin-chart-horizon": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-horizon/-/legacy-plugin-chart-horizon-0.17.1.tgz",
- "integrity": "sha512-1omJPgUSktLCqBXqDMMqb9dFfflxWGmEdl6lxVPMqqCrlRILdNCd1rdsQFsu1cN90FmZav7AMVj7SLvIHWvNnQ==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-horizon/-/legacy-plugin-chart-horizon-0.17.2.tgz",
+ "integrity": "sha512-JaEeIkWP0D2iAxNA7cOqJnjnaYWcG74DFYOWNzNdnzHwz4830yglHwzBH1gK9+5QxW7BiQ2MvLRA9T8Qzql5Hg==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3-array": "^2.0.3",
"d3-scale": "^3.0.1",
@@ -18848,11 +18848,11 @@
}
},
"@superset-ui/legacy-plugin-chart-map-box": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-map-box/-/legacy-plugin-chart-map-box-0.17.1.tgz",
- "integrity": "sha512-RHI9k3ulGodGjKgX2kBF3muMyTZKCQGPXV6BbNRzV8DJCc6eGrcE1eznC0ipHiy4yBYeKHfMwcWX3jh9dCI/kg==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-map-box/-/legacy-plugin-chart-map-box-0.17.2.tgz",
+ "integrity": "sha512-lg8jLk62T/QRVutyArUvw+rac/ee00IRG8EL6QIRxiHSayrST6GRcTQ6EZ6wxQ9444O3oDYBkFAwiCEXe9NHEA==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"immutable": "^3.8.2",
"mapbox-gl": "^0.53.0",
@@ -18870,11 +18870,11 @@
}
},
"@superset-ui/legacy-plugin-chart-paired-t-test": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-paired-t-test/-/legacy-plugin-chart-paired-t-test-0.17.1.tgz",
- "integrity": "sha512-WExiHSMvByu8+weNJoKll82cPrhF4zNRnMGzdiYMewJ6TZLN4Ws3ZLR+b2c26BnWQFyA8qXPpsCcQzX9c9WODw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-paired-t-test/-/legacy-plugin-chart-paired-t-test-0.17.2.tgz",
+ "integrity": "sha512-BEdZxUXx8SiK0QXmdcXF0uPL/ctF3oiHofQvx6Doi1WWb9QBJMV+jgG5vtEuQvQGMI9DNm/71g9iqt50onMjTQ==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"distributions": "^1.0.0",
"prop-types": "^15.6.2",
@@ -18882,22 +18882,22 @@
}
},
"@superset-ui/legacy-plugin-chart-parallel-coordinates": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-parallel-coordinates/-/legacy-plugin-chart-parallel-coordinates-0.17.1.tgz",
- "integrity": "sha512-v6HPEyQRKEOhVpydKzVo+HWUDNaYJhgWL/mrr/kDhT+htUPOUqtTqQZ2BsvgpTQiX4qXHUMnAOXAN7eBa4Xf3w==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-parallel-coordinates/-/legacy-plugin-chart-parallel-coordinates-0.17.2.tgz",
+ "integrity": "sha512-/jeQtKEQvxQFllcgD3I45176GgCnxsvbgdM3ztUgCflsLhrHQMD685PMDXacbhNE3WKnLszDZ/9Ayw+3PXu3vw==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"prop-types": "^15.7.2"
}
},
"@superset-ui/legacy-plugin-chart-partition": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-partition/-/legacy-plugin-chart-partition-0.17.1.tgz",
- "integrity": "sha512-Zx7lEjgz0N/MQBmXFrhAsjryIl7QzZc5Gi5bXEi9GYiXcDUaZJmLW0cUnJT5Maqgwt3HCtKgCDZEh/SRj+XBsQ==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-partition/-/legacy-plugin-chart-partition-0.17.2.tgz",
+ "integrity": "sha512-F0R8+JW6xrdVufjzoKx+/iyswWR+9I0lf2kODArcwyEYa4OkhqVjBJIWF1x8VpA6YFWreRmq1Tn0c3QcZrhh4w==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"d3-hierarchy": "^1.1.8",
@@ -18905,11 +18905,11 @@
}
},
"@superset-ui/legacy-plugin-chart-pivot-table": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-pivot-table/-/legacy-plugin-chart-pivot-table-0.17.1.tgz",
- "integrity": "sha512-qlXdtaKNQsMibpyJIeQUqaJTLE4Uce9Kn47t9mgB6lCLQc5c+egM9hVwB57P8tUxMBCJePQcjiRIJRnyLKjOTA==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-pivot-table/-/legacy-plugin-chart-pivot-table-0.17.2.tgz",
+ "integrity": "sha512-7eILPkjFvJuE6vbOAHHumfjEvJAT2j7pgOe9oS/4WYJrc/LCmOKRhZy/Fqn3yEMQX18TDfusu+hWsG8fD9T0Bw==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"datatables.net-bs": "^1.10.15",
@@ -18917,11 +18917,11 @@
}
},
"@superset-ui/legacy-plugin-chart-rose": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-rose/-/legacy-plugin-chart-rose-0.17.1.tgz",
- "integrity": "sha512-dQykgdgrtOTAq4ck/uZ98R8Vhv4UtercXUlNDMTsiJo5nz3/Ka/4Oz3zBf3Pey+3JrsIOQtJP1vKRKt/j37Zkg==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-rose/-/legacy-plugin-chart-rose-0.17.2.tgz",
+ "integrity": "sha512-c/Ka3mKmL5SisrkDVJ6TaRg0eAIZVDWcJdtOzXRsU7cUExtSDhkxc4aQ1LAOKc8cldxvQatI21HF3hAzk13NSw==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"nvd3": "1.8.6",
@@ -18929,11 +18929,11 @@
}
},
"@superset-ui/legacy-plugin-chart-sankey": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sankey/-/legacy-plugin-chart-sankey-0.17.1.tgz",
- "integrity": "sha512-gy5COpeeEHllYFuenXwdZr5OZ8bL1g+C16bGbjACG9/kIaF9ShoTN+Ad5cNTepb78Cox+WhmPHKIzbgPybN3Bw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sankey/-/legacy-plugin-chart-sankey-0.17.2.tgz",
+ "integrity": "sha512-DpKWknNlxGuwQhVCa/gwRTzTGnTMBHjnwC0M0kq1AtcoaYRgOnRN8XurNvXVIByxS9m4Y3YqhpYmQ65NIT7xAA==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"d3-sankey": "^0.4.2",
@@ -18941,11 +18941,11 @@
}
},
"@superset-ui/legacy-plugin-chart-sankey-loop": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sankey-loop/-/legacy-plugin-chart-sankey-loop-0.17.1.tgz",
- "integrity": "sha512-r46LqceZi1hv6DDiZMinuU/hR+jyAgURcBvXy/5GvEAF+0eVHUzqbQ8SWivmFCNRwVTAEBMYkUa3IKZ6LBeUbw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sankey-loop/-/legacy-plugin-chart-sankey-loop-0.17.2.tgz",
+ "integrity": "sha512-6iP5lSUvb4WaUikoeVGpmRZ9dzg7uS+1hTrOTxl+e0WgmOfbopH6I/Iv/oNLs+hAklrrLvWT14nKFRvmOayZ1g==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3-sankey-diagram": "^0.7.3",
"d3-selection": "^1.4.0",
@@ -18953,22 +18953,22 @@
}
},
"@superset-ui/legacy-plugin-chart-sunburst": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sunburst/-/legacy-plugin-chart-sunburst-0.17.1.tgz",
- "integrity": "sha512-hyP36lNaLBWCKfRXTMTG/uvJZa1bMjyX0jYDRAY/tNVxPBAjhTrB76SW1eShfpugg6baaqys9XrbVkxiKRcFnA==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sunburst/-/legacy-plugin-chart-sunburst-0.17.2.tgz",
+ "integrity": "sha512-bPiw75rEwt+Q2EPNbeM4CAb0g697F7P1WaVOnyo623o1jwZR61y4Gs1n5DvSijQvD3flHOuzK1oGnVSWEwG4sw==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-treemap": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-treemap/-/legacy-plugin-chart-treemap-0.17.1.tgz",
- "integrity": "sha512-z6dQo1ZDb2/drZUJ3nYScBbDXHiIYchtpscYNszyB/jGxJ90ridUniLQicyLxMkjdK4mpuBW9MgidSg0y0I0sw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-treemap/-/legacy-plugin-chart-treemap-0.17.2.tgz",
+ "integrity": "sha512-9rLBpx6DvCNndMmlenardcn5P350xyKyHWZtJrdAhmWK5IZ/G2VbPiynciApXZpBIK+cAiPM5VENp7G80sxLWw==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3-hierarchy": "^1.1.8",
"d3-selection": "^1.4.0",
@@ -18976,11 +18976,11 @@
}
},
"@superset-ui/legacy-plugin-chart-world-map": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-world-map/-/legacy-plugin-chart-world-map-0.17.1.tgz",
- "integrity": "sha512-S9XuCVUIbgfCH4sG0PWGMdEc14fzunZIiUZOC2hh2JtLV/vU452XO4a9viTzWFvAY75zHNetgkTtuoCsrQdLOw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-world-map/-/legacy-plugin-chart-world-map-0.17.2.tgz",
+ "integrity": "sha512-gOmugDzjLWK39ab2WYA+lEYaqv39bipH2aal6Dz2MtfODzZbF7JfDzeyquUhdMEr89fWHmEjiB2FU+DeXZN9yQ==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"d3-array": "^2.4.0",
@@ -19005,12 +19005,12 @@
}
},
"@superset-ui/legacy-preset-chart-big-number": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-big-number/-/legacy-preset-chart-big-number-0.17.1.tgz",
- "integrity": "sha512-961i+DqTNcPNlvH3GAB2ofViEk4CcZFdcjZ/rMdCzlEichmLLrNzKUPfouvhMpMokb4ysEADOkQvE7POlKjDWw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-big-number/-/legacy-preset-chart-big-number-0.17.2.tgz",
+ "integrity": "sha512-zgPTBuHxdSgCT2B3H0YF5zvlCLp+iLluSIUfFHMpfE7deMKPOnR+dObgozXJfDus3kVXWp6qr8uWFlMN3crtyw==",
"requires": {
"@data-ui/xy-chart": "^0.0.84",
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"@types/d3-color": "^1.2.2",
"@types/shortid": "^0.0.29",
@@ -19044,13 +19044,13 @@
}
},
"@superset-ui/legacy-preset-chart-nvd3": {
- "version": "0.16.10",
- "resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-nvd3/-/legacy-preset-chart-nvd3-0.16.10.tgz",
- "integrity": "sha512-zQPybEGYfthiUpwSOV4E1YUWnSqWY6S4nGXR8rVh2FIUFzyYyr4f5ZzOr6DKmytPlQbL1oXg0m35A8boshOh0g==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-nvd3/-/legacy-preset-chart-nvd3-0.17.2.tgz",
+ "integrity": "sha512-hoxc93lYYHoh02hxEogMREe5pHPjU/f69Jv1r0IOiApzeCJ9EG6rOVf1f1sfCaESZWG63Y1QpaHaQxb5koLyaw==",
"requires": {
"@data-ui/xy-chart": "^0.0.84",
- "@superset-ui/chart-controls": "0.16.9",
- "@superset-ui/core": "0.16.7",
+ "@superset-ui/chart-controls": "0.17.2",
+ "@superset-ui/core": "0.17.1",
"d3": "^3.5.17",
"d3-tip": "^0.9.1",
"dompurify": "^2.0.6",
@@ -19061,109 +19061,14 @@
"nvd3-fork": "^2.0.5",
"prop-types": "^15.6.2",
"urijs": "^1.18.10"
- },
- "dependencies": {
- "@superset-ui/chart-controls": {
- "version": "0.16.9",
- "resolved": "https://registry.npmjs.org/@superset-ui/chart-controls/-/chart-controls-0.16.9.tgz",
- "integrity": "sha512-GTwnJx5AhiYqwed3F3FCz+8Yuc56jlLM/g872zoHYQUejnAXGs/Iomeznga6+281DKfsbCO6ptH6qiOZYDH8PA==",
- "requires": {
- "@superset-ui/core": "0.16.7",
- "lodash": "^4.17.15",
- "prop-types": "^15.7.2"
- }
- },
- "@superset-ui/core": {
- "version": "0.16.7",
- "resolved": "https://registry.npmjs.org/@superset-ui/core/-/core-0.16.7.tgz",
- "integrity": "sha512-9i/o9ZC+dJibhoWZnoKGvxMMFcz65LjHuYk+hRspuRWA4qwobcdu64piQpfwuFVhw1yh3cbdxq+OSsNmNX9A9g==",
- "requires": {
- "@babel/runtime": "^7.1.2",
- "@emotion/core": "^10.0.28",
- "@emotion/styled": "^10.0.27",
- "@types/d3-format": "^1.3.0",
- "@types/d3-interpolate": "^1.3.1",
- "@types/d3-scale": "^2.1.1",
- "@types/d3-time": "^1.0.9",
- "@types/d3-time-format": "^2.1.0",
- "@types/lodash": "^4.14.149",
- "@types/rison": "0.0.6",
- "@types/seedrandom": "^2.4.28",
- "@vx/responsive": "^0.0.197",
- "csstype": "^2.6.4",
- "d3-format": "^1.3.2",
- "d3-interpolate": "^1.4.0",
- "d3-scale": "^3.0.0",
- "d3-time": "^1.0.10",
- "d3-time-format": "^2.2.0",
- "emotion-theming": "^10.0.27",
- "fetch-retry": "^4.0.1",
- "jed": "^1.1.1",
- "lodash": "^4.17.11",
- "pretty-ms": "^7.0.0",
- "react-error-boundary": "^1.2.5",
- "reselect": "^4.0.0",
- "rison": "^0.1.1",
- "seedrandom": "^3.0.5",
- "whatwg-fetch": "^3.0.0"
- }
- },
- "@vx/responsive": {
- "version": "0.0.197",
- "resolved": "https://registry.npmjs.org/@vx/responsive/-/responsive-0.0.197.tgz",
- "integrity": "sha512-Qv15PJ/Hy79LjyfJ/9E8z+zacKAnD43O2Jg9wvB6PFSNs73xPEDy/mHTYxH+FZv94ruAE3scBO0330W29sQpyg==",
- "requires": {
- "@types/lodash": "^4.14.146",
- "@types/react": "*",
- "lodash": "^4.17.10",
- "prop-types": "^15.6.1",
- "resize-observer-polyfill": "1.5.1"
- }
- },
- "d3-array": {
- "version": "2.11.0",
- "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.11.0.tgz",
- "integrity": "sha512-26clcwmHQEdsLv34oNKq5Ia9tQ26Y/4HqS3dQzF42QBUqymZJ+9PORcN1G52bt37NsL2ABoX4lvyYZc+A9Y0zw==",
- "requires": {
- "internmap": "^1.0.0"
- }
- },
- "d3-interpolate": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.4.0.tgz",
- "integrity": "sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==",
- "requires": {
- "d3-color": "1"
- }
- },
- "d3-scale": {
- "version": "3.2.3",
- "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.3.tgz",
- "integrity": "sha512-8E37oWEmEzj57bHcnjPVOBS3n4jqakOeuv1EDdQSiSrYnMCBdMd3nc4HtKk7uia8DUHcY/CGuJ42xxgtEYrX0g==",
- "requires": {
- "d3-array": "^2.3.0",
- "d3-format": "1 - 2",
- "d3-interpolate": "1.2.0 - 2",
- "d3-time": "1 - 2",
- "d3-time-format": "2 - 3"
- }
- },
- "d3-time-format": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.3.0.tgz",
- "integrity": "sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==",
- "requires": {
- "d3-time": "1"
- }
- }
}
},
"@superset-ui/plugin-chart-echarts": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-echarts/-/plugin-chart-echarts-0.17.1.tgz",
- "integrity": "sha512-+PzvoEbeTfrZ+SkM/bldwGljTjy+VBSz/AoPsDEgKmaJ8UZSG7rXQM01X0so7XkD9WRvAMI5q6+uFjL2zfDJlw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-echarts/-/plugin-chart-echarts-0.17.2.tgz",
+ "integrity": "sha512-wvxCUFvC4q7bBB2aZsylC6P3+qJp1vuAFpOCt4Bmk0QXn5IRchzpxwv+xv6f9G/XEKAS0O2BHgbbeepyF0z6FA==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"@types/echarts": "^4.9.3",
"@types/mathjs": "^6.0.7",
@@ -19172,12 +19077,12 @@
}
},
"@superset-ui/plugin-chart-table": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-table/-/plugin-chart-table-0.17.1.tgz",
- "integrity": "sha512-Jkf4nAU2usJUQthRMO5dSdeatlUvI+3QYCWujneTXCbR4MMBXhnlePlD0LO5dTteLNBql56rg2SbD10NDIZGZA==",
+ "version": "0.17.3",
+ "resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-table/-/plugin-chart-table-0.17.3.tgz",
+ "integrity": "sha512-mfVrm/P0vdiwDvsSwjc/h9KaYaOtV/Kr+IgQZ8FDrcovuKokkyXSvnkPBB/FFogBGuhXn1EEymrqgF7yQZqiMA==",
"requires": {
"@emotion/core": "^10.0.28",
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"@types/d3-array": "^2.0.0",
"@types/react-table": "^7.0.19",
@@ -19201,11 +19106,11 @@
}
},
"@superset-ui/plugin-chart-word-cloud": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-word-cloud/-/plugin-chart-word-cloud-0.17.1.tgz",
- "integrity": "sha512-jPz/22L3IwIoQqsHEFqwQTGyYdatednazPB3zGUv1KMzkj4AyU/sd5AsnCCDDC7EL10ylhy9NB8EYk12x5Z7vw==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-word-cloud/-/plugin-chart-word-cloud-0.17.2.tgz",
+ "integrity": "sha512-mfBPE+xZ2mjND2jqkHZAIWY2v+sMZ2n+rBfHJbK8EQhttqXrD7fJ5tmzDjWQqrYWpkGYwgdxLXZeZVgOedgg0w==",
"requires": {
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"@types/d3-cloud": "^1.2.1",
"@types/d3-scale": "^2.0.2",
@@ -19238,13 +19143,13 @@
}
},
"@superset-ui/preset-chart-xy": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/@superset-ui/preset-chart-xy/-/preset-chart-xy-0.17.1.tgz",
- "integrity": "sha512-N1mSF8OE04n+xM8Fh6ZsNLD1ARGnVlh3zzld1YmhasS7rRP8UZ3STGEjLm4IV8mTYeVc+i7+Xg/VI5Fl42Uhow==",
+ "version": "0.17.2",
+ "resolved": "https://registry.npmjs.org/@superset-ui/preset-chart-xy/-/preset-chart-xy-0.17.2.tgz",
+ "integrity": "sha512-OaZgtt+e5Jncum18lOvpYWJ3cbVMElTL+YO6MEpk3CvFvcROjH8R6MleK1Vm4iM8CTL3865Ycu8KeHwdpoSetg==",
"requires": {
"@data-ui/theme": "^0.0.84",
"@data-ui/xy-chart": "^0.0.84",
- "@superset-ui/chart-controls": "0.17.1",
+ "@superset-ui/chart-controls": "0.17.2",
"@superset-ui/core": "0.17.1",
"@vx/axis": "^0.0.198",
"@vx/legend": "^0.0.198",
@@ -20995,7 +20900,6 @@
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
"integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==",
- "dev": true,
"requires": {
"@types/react": "*",
"hoist-non-react-statics": "^3.3.0"
@@ -31359,7 +31263,7 @@
"dependencies": {
"core-js": {
"version": "1.2.7",
- "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
+ "resolved": "http://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
"integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY="
}
}
diff --git a/superset-frontend/package.json b/superset-frontend/package.json
index 6ebad9d3f268b..51f2ddfb9e710 100644
--- a/superset-frontend/package.json
+++ b/superset-frontend/package.json
@@ -65,34 +65,34 @@
"@babel/runtime-corejs3": "^7.12.5",
"@data-ui/sparkline": "^0.0.84",
"@emotion/core": "^10.0.35",
- "@superset-ui/chart-controls": "^0.17.1",
+ "@superset-ui/chart-controls": "^0.17.2",
"@superset-ui/core": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-calendar": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-chord": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-country-map": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-event-flow": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-force-directed": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-heatmap": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-histogram": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-horizon": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-map-box": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-paired-t-test": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-partition": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-pivot-table": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-rose": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-sankey": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-sankey-loop": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-sunburst": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-treemap": "^0.17.1",
- "@superset-ui/legacy-plugin-chart-world-map": "^0.17.1",
- "@superset-ui/legacy-preset-chart-big-number": "^0.17.1",
+ "@superset-ui/legacy-plugin-chart-calendar": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-chord": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-country-map": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-event-flow": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-force-directed": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-heatmap": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-histogram": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-horizon": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-map-box": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-paired-t-test": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-partition": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-pivot-table": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-rose": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-sankey": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-sankey-loop": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-sunburst": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-treemap": "^0.17.2",
+ "@superset-ui/legacy-plugin-chart-world-map": "^0.17.2",
+ "@superset-ui/legacy-preset-chart-big-number": "^0.17.2",
"@superset-ui/legacy-preset-chart-deckgl": "^0.4.1",
- "@superset-ui/legacy-preset-chart-nvd3": "^0.16.10",
- "@superset-ui/plugin-chart-echarts": "^0.17.1",
- "@superset-ui/plugin-chart-table": "^0.17.1",
- "@superset-ui/plugin-chart-word-cloud": "^0.17.1",
- "@superset-ui/preset-chart-xy": "^0.17.1",
+ "@superset-ui/legacy-preset-chart-nvd3": "^0.17.2",
+ "@superset-ui/plugin-chart-echarts": "^0.17.2",
+ "@superset-ui/plugin-chart-table": "^0.17.3",
+ "@superset-ui/plugin-chart-word-cloud": "^0.17.2",
+ "@superset-ui/preset-chart-xy": "^0.17.2",
"@vx/responsive": "^0.0.195",
"abortcontroller-polyfill": "^1.1.9",
"antd": "^4.9.4",
diff --git a/superset-frontend/spec/fixtures/mockNativeFilters.ts b/superset-frontend/spec/fixtures/mockNativeFilters.ts
index 9aa6e1010d067..24872d8a67a6c 100644
--- a/superset-frontend/spec/fixtures/mockNativeFilters.ts
+++ b/superset-frontend/spec/fixtures/mockNativeFilters.ts
@@ -16,14 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { NativeFiltersState } from 'src/dashboard/components/nativeFilters/types';
+import {
+ FilterType,
+ NativeFiltersState,
+} from 'src/dashboard/components/nativeFilters/types';
export const nativeFilters: NativeFiltersState = {
filters: {
'NATIVE_FILTER-e7Q8zKixx': {
id: 'NATIVE_FILTER-e7Q8zKixx',
name: 'region',
- type: 'text',
+ filterType: FilterType.filter_select,
targets: [
{
datasetId: 2,
@@ -46,7 +49,7 @@ export const nativeFilters: NativeFiltersState = {
'NATIVE_FILTER-x9QPw0so1': {
id: 'NATIVE_FILTER-x9QPw0so1',
name: 'country_code',
- type: 'text',
+ filterType: FilterType.filter_select,
targets: [
{
datasetId: 2,
diff --git a/superset-frontend/spec/javascripts/addSlice/AddSliceContainer_spec.tsx b/superset-frontend/spec/javascripts/addSlice/AddSliceContainer_spec.tsx
index 4af7fec71e80d..c3b8bac8a4b9c 100644
--- a/superset-frontend/spec/javascripts/addSlice/AddSliceContainer_spec.tsx
+++ b/superset-frontend/spec/javascripts/addSlice/AddSliceContainer_spec.tsx
@@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
-import { shallow, ShallowWrapper } from 'enzyme';
+import { ReactWrapper } from 'enzyme';
import Button from 'src/components/Button';
import Select from 'src/components/Select';
import AddSliceContainer, {
@@ -25,6 +25,7 @@ import AddSliceContainer, {
AddSliceContainerState,
} from 'src/addSlice/AddSliceContainer';
import VizTypeControl from 'src/explore/components/controls/VizTypeControl';
+import { styledMount as mount } from 'spec/helpers/theming';
const defaultProps = {
datasources: [
@@ -34,14 +35,18 @@ const defaultProps = {
};
describe('AddSliceContainer', () => {
- let wrapper: ShallowWrapper<
+ let wrapper: ReactWrapper<
AddSliceContainerProps,
AddSliceContainerState,
AddSliceContainer
>;
beforeEach(() => {
- wrapper = shallow();
+ wrapper = mount() as ReactWrapper<
+ AddSliceContainerProps,
+ AddSliceContainerState,
+ AddSliceContainer
+ >;
});
it('uses table as default visType', () => {
@@ -58,9 +63,9 @@ describe('AddSliceContainer', () => {
});
it('renders a disabled button if no datasource is selected', () => {
- expect(wrapper.find(Button).dive().find({ disabled: true })).toHaveLength(
- 1,
- );
+ expect(
+ wrapper.find(Button).find({ disabled: true }).hostNodes(),
+ ).toHaveLength(1);
});
it('renders an enabled button if datasource is selected', () => {
@@ -70,9 +75,9 @@ describe('AddSliceContainer', () => {
datasourceId: datasourceValue.split('__')[0],
datasourceType: datasourceValue.split('__')[1],
});
- expect(wrapper.find(Button).dive().find({ disabled: true })).toHaveLength(
- 0,
- );
+ expect(
+ wrapper.find(Button).find({ disabled: true }).hostNodes(),
+ ).toHaveLength(0);
});
it('formats explore url', () => {
diff --git a/superset-frontend/spec/javascripts/components/Timer_spec.tsx b/superset-frontend/spec/javascripts/components/Timer_spec.tsx
index 4af7ae7087ca1..f37004af838f8 100644
--- a/superset-frontend/spec/javascripts/components/Timer_spec.tsx
+++ b/superset-frontend/spec/javascripts/components/Timer_spec.tsx
@@ -21,7 +21,7 @@
*/
import React from 'react';
import { render, sleep, waitFor } from 'spec/helpers/testing-library';
-import Timer from 'src/components/Timer';
+import Timer, { TimerProps } from 'src/components/Timer';
import { now } from 'src/modules/dates';
function parseTime(text?: string | null) {
@@ -29,7 +29,7 @@ function parseTime(text?: string | null) {
}
describe('Timer', () => {
- const mockProps = {
+ const mockProps: TimerProps = {
startTime: now(),
endTime: undefined,
isRunning: true,
@@ -41,7 +41,6 @@ describe('Timer', () => {
const node = screen.getByRole('timer');
let text = node.textContent || '';
expect(node).toBeInTheDocument();
- expect(node).toHaveClass('label-warning');
expect(node).toHaveTextContent('00:00:00.00');
// should start running
await waitFor(() => {
diff --git a/superset-frontend/spec/javascripts/dashboard/components/nativeFilters/FilterBar_spec.tsx b/superset-frontend/spec/javascripts/dashboard/components/nativeFilters/FilterBar_spec.tsx
index bdd6dd92d4791..7e6e9b04a540f 100644
--- a/superset-frontend/spec/javascripts/dashboard/components/nativeFilters/FilterBar_spec.tsx
+++ b/superset-frontend/spec/javascripts/dashboard/components/nativeFilters/FilterBar_spec.tsx
@@ -20,6 +20,7 @@ import React from 'react';
import { styledMount as mount } from 'spec/helpers/theming';
import { Provider } from 'react-redux';
import FilterBar from 'src/dashboard/components/nativeFilters/FilterBar';
+import Button from 'src/components/Button';
import { mockStore } from 'spec/fixtures/mockStore';
describe('FilterBar', () => {
@@ -42,7 +43,8 @@ describe('FilterBar', () => {
expect(wrapper.find({ name: 'collapse' })).toExist();
});
it('has apply and reset all buttons', () => {
- expect(wrapper.find('.btn-primary')).toExist();
- expect(wrapper.find('.btn-secondary')).toExist();
+ expect(wrapper.find(Button).length).toBe(2);
+ expect(wrapper.find(Button).at(0)).toHaveProp('buttonStyle', 'secondary');
+ expect(wrapper.find(Button).at(1)).toHaveProp('buttonStyle', 'primary');
});
});
diff --git a/superset-frontend/spec/javascripts/explore/components/QueryAndSaveBtns_spec.jsx b/superset-frontend/spec/javascripts/explore/components/QueryAndSaveBtns_spec.jsx
index 6bca5fb55de4b..12e1a95e8ef75 100644
--- a/superset-frontend/spec/javascripts/explore/components/QueryAndSaveBtns_spec.jsx
+++ b/superset-frontend/spec/javascripts/explore/components/QueryAndSaveBtns_spec.jsx
@@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
-import { shallow } from 'enzyme';
+import { styledMount as mount } from 'spec/helpers/theming';
import sinon from 'sinon';
import QueryAndSaveButtons from 'src/explore/components/QueryAndSaveBtns';
@@ -38,23 +38,21 @@ describe('QueryAndSaveButtons', () => {
// Test the output
describe('output', () => {
- let wrapper;
-
- beforeEach(() => {
- wrapper = shallow();
- });
+ const wrapper = mount();
it('renders 2 buttons', () => {
expect(wrapper.find(Button)).toHaveLength(2);
});
it('renders buttons with correct text', () => {
- expect(wrapper.find(Button).contains('Run')).toBe(true);
- expect(wrapper.find(Button).contains('Save')).toBe(true);
+ expect(wrapper.find(Button).at(0).text().trim()).toBe('Run');
+ expect(wrapper.find(Button).at(1).text().trim()).toBe('Save');
});
it('calls onQuery when query button is clicked', () => {
- const queryButton = wrapper.find('[data-test="run-query-button"]');
+ const queryButton = wrapper
+ .find('[data-test="run-query-button"]')
+ .hostNodes();
queryButton.simulate('click');
expect(defaultProps.onQuery.called).toBe(true);
});
diff --git a/superset-frontend/spec/javascripts/explore/components/RowCountLabel_spec.jsx b/superset-frontend/spec/javascripts/explore/components/RowCountLabel_spec.jsx
index 7776788cb19da..13de226e70927 100644
--- a/superset-frontend/spec/javascripts/explore/components/RowCountLabel_spec.jsx
+++ b/superset-frontend/spec/javascripts/explore/components/RowCountLabel_spec.jsx
@@ -45,6 +45,6 @@ describe('RowCountLabel', () => {
limit: 100,
};
const wrapper = shallow();
- expect(wrapper.find(Label).first().props().bsStyle).toBe('danger');
+ expect(wrapper.find(Label).first().props().type).toBe('danger');
});
});
diff --git a/superset-frontend/spec/javascripts/profile/Security_spec.tsx b/superset-frontend/spec/javascripts/profile/Security_spec.tsx
index 6732e7b2a8177..31eda0aae7652 100644
--- a/superset-frontend/spec/javascripts/profile/Security_spec.tsx
+++ b/superset-frontend/spec/javascripts/profile/Security_spec.tsx
@@ -19,7 +19,7 @@
import React from 'react';
import { styledMount as mount } from 'spec/helpers/theming';
import Security from 'src/profile/components/Security';
-
+import Label from 'src/components/Label';
import { user, userNoPerms } from './fixtures';
describe('Security', () => {
@@ -31,19 +31,19 @@ describe('Security', () => {
});
it('renders 2 role labels', () => {
const wrapper = mount();
- expect(wrapper.find('.roles').find('.label')).toHaveLength(2);
+ expect(wrapper.find('.roles').find(Label)).toHaveLength(2);
});
it('renders 2 datasource labels', () => {
const wrapper = mount();
- expect(wrapper.find('.datasources').find('.label')).toHaveLength(2);
+ expect(wrapper.find('.datasources').find(Label)).toHaveLength(2);
});
it('renders 3 database labels', () => {
const wrapper = mount();
- expect(wrapper.find('.databases').find('.label')).toHaveLength(3);
+ expect(wrapper.find('.databases').find(Label)).toHaveLength(3);
});
it('renders no permission label when empty', () => {
const wrapper = mount();
- expect(wrapper.find('.datasources').find('.label')).not.toExist();
- expect(wrapper.find('.databases').find('.label')).not.toExist();
+ expect(wrapper.find('.datasources').find(Label)).not.toExist();
+ expect(wrapper.find('.databases').find(Label)).not.toExist();
});
});
diff --git a/superset-frontend/src/CRUD/CollectionTable.tsx b/superset-frontend/src/CRUD/CollectionTable.tsx
index 8166034d4f47f..ea46856df7b88 100644
--- a/superset-frontend/src/CRUD/CollectionTable.tsx
+++ b/superset-frontend/src/CRUD/CollectionTable.tsx
@@ -308,7 +308,7 @@ export default class CRUDCollection extends React.PureComponent<
{this.props.allowAddItem && (
- ))}
- >
-);
-
-export const InteractiveButton = args => {
- const { label, ...btnArgs } = args;
- return {label};
-};
-
-InteractiveButton.args = {
- buttonStyle: STYLES.defaultValue,
- buttonSize: SIZES.defaultValue,
- type: TYPES.defaultValue,
- target: TARGETS.defaultValue,
- href: HREFS.defaultValue,
- label: 'Button!',
-};
-InteractiveButton.argTypes = {
- buttonStyle: {
- name: STYLES.label,
- control: { type: 'select', options: Object.values(STYLES.options) },
- },
- size: {
- name: SIZES.label,
- control: { type: 'select', options: Object.values(SIZES.options) },
- },
- type: {
- name: TYPES.label,
- control: { type: 'select', options: Object.values(TYPES.options) },
- },
- target: {
- name: TARGETS.label,
- control: { type: 'select', options: Object.values(TARGETS.options) },
- },
- href: {
- name: HREFS.label,
- control: { type: 'select', options: Object.values(HREFS.options) },
- },
- onClick: { action: 'clicked' },
- label: { name: 'Label', control: { type: 'text' } },
-};
-
-ButtonGallery.argTypes = { onClick: { action: 'clicked' } };
diff --git a/superset-frontend/src/components/Button/Button.stories.tsx b/superset-frontend/src/components/Button/Button.stories.tsx
new file mode 100644
index 0000000000000..b5a683b36fa24
--- /dev/null
+++ b/superset-frontend/src/components/Button/Button.stories.tsx
@@ -0,0 +1,141 @@
+/**
+ * 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 Button, { ButtonProps } from './index';
+
+type ButtonStyle = Pick;
+type ButtonStyleValue = ButtonStyle[keyof ButtonStyle];
+type ButtonSize = Pick;
+type ButtonSizeValue = ButtonSize[keyof ButtonSize];
+
+export default {
+ title: 'Button',
+ component: Button,
+ includeStories: ['ButtonGallery', 'InteractiveButton'],
+};
+
+const buttonStyles: ButtonStyleValue[] = [
+ 'primary',
+ 'secondary',
+ 'tertiary',
+ 'dashed',
+ 'danger',
+ 'warning',
+ 'success',
+ 'link',
+ 'default',
+];
+
+const buttonSizes: ButtonSizeValue[] = ['xsmall', 'small', 'default'];
+
+export const STYLES = {
+ label: 'styles',
+ options: buttonStyles,
+ defaultValue: undefined,
+};
+
+export const SIZES = {
+ label: 'sizes',
+ options: buttonSizes,
+ defaultValue: undefined,
+};
+
+const TARGETS = {
+ label: 'target',
+ options: {
+ blank: '_blank',
+ none: null,
+ },
+ defaultValue: null,
+};
+
+const HREFS = {
+ label: 'href',
+ options: {
+ superset: 'https://superset.apache.org/',
+ none: null,
+ },
+ defaultValue: null,
+};
+
+export const ButtonGallery = () => (
+ <>
+ {SIZES.options.map(size => (
+
+
{size}
+ {Object.values(STYLES.options).map(style => (
+ true}
+ key={`${style}_${size}`}
+ style={{ marginRight: 20, marginBottom: 10 }}
+ >
+ {style}
+
+ ))}
+
+ ))}
+ >
+);
+
+ButtonGallery.story = {
+ parameters: {
+ actions: {
+ disabled: true,
+ },
+ controls: {
+ disabled: true,
+ },
+ knobs: {
+ disabled: true,
+ },
+ },
+};
+
+export const InteractiveButton = (args: ButtonProps & { label: string }) => {
+ const { label, ...btnArgs } = args;
+ return {label};
+};
+
+InteractiveButton.story = {
+ parameters: {
+ knobs: {
+ disabled: true,
+ },
+ },
+};
+
+InteractiveButton.args = {
+ buttonStyle: 'default',
+ buttonSize: 'default',
+ label: 'Button!',
+};
+
+InteractiveButton.argTypes = {
+ target: {
+ name: TARGETS.label,
+ control: { type: 'select', options: Object.values(TARGETS.options) },
+ },
+ href: {
+ name: HREFS.label,
+ control: { type: 'select', options: Object.values(HREFS.options) },
+ },
+ onClick: { action: 'clicked' },
+};
diff --git a/superset-frontend/src/components/Button/Button.test.tsx b/superset-frontend/src/components/Button/Button.test.tsx
index ab0f368fd99e5..3c2f895480369 100644
--- a/superset-frontend/src/components/Button/Button.test.tsx
+++ b/superset-frontend/src/components/Button/Button.test.tsx
@@ -59,10 +59,4 @@ describe('Button', () => {
expect(wrapper.find(Button).length).toEqual(permutationCount);
});
-
- // test things NOT in the storybook!
- it('renders custom button styles without melting', () => {
- wrapper = mount();
- expect(wrapper.find('Button.btn-foobar')).toHaveLength(1);
- });
});
diff --git a/superset-frontend/src/components/Button/index.tsx b/superset-frontend/src/components/Button/index.tsx
index 54ebe78245715..cfbf6418f8117 100644
--- a/superset-frontend/src/components/Button/index.tsx
+++ b/superset-frontend/src/components/Button/index.tsx
@@ -20,18 +20,11 @@ import React, { CSSProperties } from 'react';
import { kebabCase } from 'lodash';
import { mix } from 'polished';
import cx from 'classnames';
-import { Button as BootstrapButton } from 'react-bootstrap';
-import { styled } from '@superset-ui/core';
+import { Button as AntdButton } from 'src/common/components';
+import { useTheme } from '@superset-ui/core';
import { Tooltip } from 'src/common/components/Tooltip';
-import { Menu } from 'src/common/components';
-export type OnClickHandler = React.MouseEventHandler;
-
-export interface DropdownItemProps {
- label: string;
- url: string;
- icon?: string;
-}
+export type OnClickHandler = React.MouseEventHandler;
export interface ButtonProps {
id?: string;
@@ -52,264 +45,164 @@ export interface ButtonProps {
| 'rightBottom';
onClick?: OnClickHandler;
disabled?: boolean;
- buttonStyle?: string;
- btnStyles?: string;
- buttonSize?: BootstrapButton.ButtonProps['bsSize'];
- style?: BootstrapButton.ButtonProps['style'];
+ buttonStyle?:
+ | 'primary'
+ | 'secondary'
+ | 'tertiary'
+ | 'success'
+ | 'warning'
+ | 'danger'
+ | 'default'
+ | 'link'
+ | 'dashed';
+ buttonSize?: 'default' | 'small' | 'xsmall';
+ style?: CSSProperties;
children?: React.ReactNode;
- dropdownItems?: DropdownItemProps[];
- href?: string; // React-Bootstrap creates a link when this is passed in.
- target?: string; // React-Bootstrap creates a link when this is passed in.
- type?: string; // React-Bootstrap supports this when rendering an HTML button element
+ href?: string;
+ htmlType?: 'button' | 'submit' | 'reset';
cta?: boolean;
}
-const BUTTON_WRAPPER_STYLE = { display: 'inline-block', cursor: 'not-allowed' };
+export default function Button(props: ButtonProps) {
+ const {
+ tooltip,
+ placement,
+ disabled = false,
+ buttonSize,
+ buttonStyle,
+ className,
+ cta,
+ children,
+ href,
+ ...restProps
+ } = props;
-const SupersetButton = styled(BootstrapButton)`
- &:focus,
- &:active,
- &:focus:active {
- outline: none;
- box-shadow: none;
- }
- transition: all ${({ theme }) => theme.transitionTiming}s;
- border-radius: ${({ theme }) => theme.borderRadius}px;
- border: none;
- font-size: ${({ theme }) => theme.typography.sizes.s}px;
- font-weight: ${({ theme }) => theme.typography.weights.bold};
- margin-left: ${({ theme }) => theme.gridUnit * 4}px;
- &:first-of-type {
- margin-left: 0;
- }
+ const theme = useTheme();
+ const { colors, transitionTiming, borderRadius, typography } = theme;
+ const { primary, grayscale, success, warning, error } = colors;
- i {
- padding: 0 ${({ theme }) => theme.gridUnit * 2}px 0 0;
+ let height = 32;
+ let padding = 18;
+ if (buttonSize === 'xsmall') {
+ height = 22;
+ padding = 5;
+ } else if (buttonSize === 'small') {
+ height = 30;
+ padding = 10;
}
- /* SIP 34 colors! */
- &.btn {
- border: 1px solid transparent; /* this just makes sure the height is the same as tertiary/dashed buttons */
- &:hover,
- &:active {
- border: 1px solid transparent;
- }
- &-default,
- &-secondary {
- background-color: ${({ theme }) => theme.colors.primary.light4};
- color: ${({ theme }) => theme.colors.primary.dark1};
- &:hover {
- background-color: ${({ theme }) =>
- mix(0.1, theme.colors.grayscale.light5, theme.colors.primary.light4)};
- color: ${({ theme }) => theme.colors.primary.dark1};
- }
- &:active {
- background-color: ${({ theme }) =>
- mix(0.25, theme.colors.primary.base, theme.colors.primary.light4)};
- color: ${({ theme }) => theme.colors.primary.dark1};
- }
- }
- &-tertiary,
- &-dashed {
- border-width: 1px;
- border-style: solid;
- background-color: ${({ theme }) => theme.colors.grayscale.light5};
- color: ${({ theme }) => theme.colors.primary.dark1};
- border-color: ${({ theme }) => theme.colors.primary.dark1};
- &:hover {
- background-color: ${({ theme }) => theme.colors.grayscale.light5};
- color: ${({ theme }) => theme.colors.primary.dark1};
- border-color: ${({ theme }) => theme.colors.primary.light1};
- }
- &:active {
- background-color: ${({ theme }) => theme.colors.grayscale.light5};
- color: ${({ theme }) => theme.colors.primary.dark1};
- border-color: ${({ theme }) => theme.colors.primary.dark1};
- }
- &[disabled],
- &[disabled]:hover {
- background-color: ${({ theme }) => theme.colors.grayscale.light5};
- color: ${({ theme }) => theme.colors.grayscale.base};
- border-color: ${({ theme }) => theme.colors.grayscale.light2};
- }
- }
- &-dashed {
- border-style: dashed;
- &:hover,
- &:active {
- border-style: dashed;
- }
- }
- &-link {
- background: none;
- text-decoration: none;
- color: ${({ theme }) => theme.colors.primary.dark1};
- &:hover {
- background: none;
- color: ${({ theme }) => theme.colors.primary.base};
- }
- &:active {
- background: none;
- color: ${({ theme }) => theme.colors.primary.dark1};
- }
- &[disabled],
- &[disabled]:hover {
- background: none;
- color: ${({ theme }) => theme.colors.grayscale.base};
- }
- }
- &-primary {
- background-color: ${({ theme }) => theme.colors.primary.dark1};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- &:hover {
- background-color: ${({ theme }) =>
- mix(0.1, theme.colors.grayscale.light5, theme.colors.primary.dark1)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- &:active {
- background-color: ${({ theme }) =>
- mix(0.2, theme.colors.grayscale.dark2, theme.colors.primary.dark1)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- }
- &-danger {
- background-color: ${({ theme }) => theme.colors.error.base};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- &:hover {
- background-color: ${({ theme }) =>
- mix(0.1, theme.colors.grayscale.light5, theme.colors.error.base)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- &:active {
- background-color: ${({ theme }) =>
- mix(0.2, theme.colors.grayscale.dark2, theme.colors.error.base)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- }
- &-success {
- background-color: ${({ theme }) => theme.colors.success.base};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- &:hover {
- background-color: ${({ theme }) =>
- mix(0.1, theme.colors.grayscale.light5, theme.colors.success.base)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- &:active {
- background-color: ${({ theme }) =>
- mix(0.2, theme.colors.grayscale.dark2, theme.colors.success.base)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- }
- &-warning {
- background-color: ${({ theme }) => theme.colors.warning.base};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- &:hover {
- background-color: ${({ theme }) =>
- mix(0.1, theme.colors.grayscale.light5, theme.colors.warning.base)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- &:active {
- background-color: ${({ theme }) =>
- mix(0.2, theme.colors.grayscale.dark2, theme.colors.warning.base)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- }
- &-info {
- background-color: ${({ theme }) => theme.colors.info.dark1};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- &:hover {
- background-color: ${({ theme }) =>
- mix(0.1, theme.colors.grayscale.light5, theme.colors.info.dark1)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- &:active {
- background-color: ${({ theme }) =>
- mix(0.2, theme.colors.grayscale.dark2, theme.colors.info.dark1)};
- color: ${({ theme }) => theme.colors.grayscale.light5};
- }
- }
- &[disabled],
- &[disabled]:hover {
- background-color: ${({ theme }) => theme.colors.grayscale.light2};
- color: ${({ theme }) => theme.colors.grayscale.base};
- }
- }
+ let backgroundColor = primary.light4;
+ let backgroundColorHover = mix(0.1, primary.base, primary.light4);
+ let backgroundColorActive = mix(0.25, primary.base, primary.light4);
+ let backgroundColorDisabled = grayscale.light2;
+ let color = primary.dark1;
+ let colorHover = color;
+ let borderWidth = 0;
+ let borderStyle = 'none';
+ let borderColor = 'transparent';
+ let borderColorHover = 'transparent';
+ let borderColorDisabled = 'transparent';
- /* big Call to Action buttons */
- &.cta {
- min-width: ${({ theme }) => theme.gridUnit * 36}px;
- min-height: ${({ theme }) => theme.gridUnit * 8}px;
- text-transform: uppercase;
+ if (buttonStyle === 'primary') {
+ backgroundColor = primary.dark1;
+ backgroundColorHover = mix(0.1, grayscale.light5, primary.dark1);
+ backgroundColorActive = mix(0.2, grayscale.dark2, primary.dark1);
+ color = grayscale.light5;
+ colorHover = color;
+ } else if (buttonStyle === 'tertiary' || buttonStyle === 'dashed') {
+ backgroundColor = grayscale.light5;
+ backgroundColorHover = grayscale.light5;
+ backgroundColorActive = grayscale.light5;
+ backgroundColorDisabled = grayscale.light5;
+ borderWidth = 1;
+ borderStyle = buttonStyle === 'dashed' ? 'dashed' : 'solid';
+ borderColor = primary.dark1;
+ borderColorHover = primary.light1;
+ borderColorDisabled = grayscale.light2;
+ } else if (buttonStyle === 'danger') {
+ backgroundColor = error.base;
+ backgroundColorHover = mix(0.1, grayscale.light5, error.base);
+ backgroundColorActive = mix(0.2, grayscale.dark2, error.base);
+ color = grayscale.light5;
+ colorHover = color;
+ } else if (buttonStyle === 'warning') {
+ backgroundColor = warning.base;
+ backgroundColorHover = mix(0.1, grayscale.dark2, warning.base);
+ backgroundColorActive = mix(0.2, grayscale.dark2, warning.base);
+ color = grayscale.light5;
+ colorHover = color;
+ } else if (buttonStyle === 'success') {
+ backgroundColor = success.base;
+ backgroundColorHover = mix(0.1, grayscale.light5, success.base);
+ backgroundColorActive = mix(0.2, grayscale.dark2, success.base);
+ color = grayscale.light5;
+ colorHover = color;
+ } else if (buttonStyle === 'link') {
+ backgroundColor = 'transparent';
+ backgroundColorHover = 'transparent';
+ backgroundColorActive = 'transparent';
+ colorHover = primary.base;
}
-`;
-
-export default function Button({
- tooltip,
- placement,
- dropdownItems,
- disabled = false,
- buttonSize: bsSize,
- buttonStyle: bsStyle,
- className,
- style: style_,
- cta,
- children,
- ...restProps
-}: ButtonProps) {
- // Working around the fact that tooltips don't get triggered when buttons are disabled
- // https://github.com/react-bootstrap/react-bootstrap/issues/1588
- const style: CSSProperties | undefined =
- tooltip && disabled ? { ...style_, pointerEvents: 'none' } : style_;
- const officialBootstrapStyles = [
- 'success',
- 'warning',
- 'danger',
- 'info',
- 'default',
- 'primary',
- ];
-
- const transformedProps = {
- ...restProps,
- disabled,
- bsSize,
- bsStyle: officialBootstrapStyles.includes(bsStyle || '')
- ? bsStyle
- : 'default',
- className: cx(className, {
- cta: !!cta,
- [`btn-${bsStyle}`]: !officialBootstrapStyles.includes(bsStyle || ''),
- }),
- style,
- };
-
- let button = (
- {children}
+ const button = (
+
+ {children}
+
);
- if (dropdownItems) {
- button = (
-
- );
- }
-
if (tooltip) {
return (
(
+ <>
+
+ Button 1
+
+
+ Button 1
+ Button 2
+
+
+ Button 1
+ Button 2
+ Button 3
+
+ >
+);
+InteractiveButtonGroup.args = {
+ buttonStyle: 'tertiary',
+ buttonSize: 'default',
+};
+
+InteractiveButtonGroup.argTypes = {
+ buttonStyle: {
+ name: STYLES.label,
+ control: { type: 'select', options: STYLES.options },
+ },
+ buttonSize: {
+ name: SIZES.label,
+ control: { type: 'select', options: SIZES.options },
+ },
+};
+
+InteractiveButtonGroup.story = {
+ parameters: {
+ actions: {
+ disabled: true,
+ },
+ knobs: {
+ disabled: true,
+ },
+ },
+};
diff --git a/superset-frontend/src/components/ButtonGroup/ButtonGroup.test.tsx b/superset-frontend/src/components/ButtonGroup/ButtonGroup.test.tsx
new file mode 100644
index 0000000000000..e305eba122128
--- /dev/null
+++ b/superset-frontend/src/components/ButtonGroup/ButtonGroup.test.tsx
@@ -0,0 +1,50 @@
+/**
+ * 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 { ReactWrapper } from 'enzyme';
+import { styledMount as mount } from 'spec/helpers/theming';
+import Button from 'src/components/Button';
+import ButtonGroup from '.';
+
+describe('ButtonGroup', () => {
+ let wrapper: ReactWrapper;
+
+ it('renders 1 button', () => {
+ expect(
+ React.isValidElement(
+
+ Button
+ ,
+ ),
+ ).toBe(true);
+ });
+
+ it('renders 3 buttons', () => {
+ wrapper = mount(
+
+ Button
+ Button
+ Button
+ ,
+ );
+
+ expect(wrapper.find(Button).length).toEqual(3);
+ });
+});
diff --git a/superset-frontend/src/components/ButtonGroup/index.tsx b/superset-frontend/src/components/ButtonGroup/index.tsx
new file mode 100644
index 0000000000000..a812207d02d63
--- /dev/null
+++ b/superset-frontend/src/components/ButtonGroup/index.tsx
@@ -0,0 +1,53 @@
+/**
+ * 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';
+
+export interface ButtonGroupProps {
+ className?: string;
+ children?: React.ReactNode;
+}
+
+export default function ButtonGroup(props: ButtonGroupProps) {
+ const { className, children } = props;
+ return (
+
+ {children}
+
+ );
+}
diff --git a/superset-frontend/src/components/CachedLabel.jsx b/superset-frontend/src/components/CachedLabel.jsx
index db4bd2e46dbaf..a7bc72089e0c1 100644
--- a/superset-frontend/src/components/CachedLabel.jsx
+++ b/superset-frontend/src/components/CachedLabel.jsx
@@ -67,12 +67,12 @@ class CacheLabel extends React.PureComponent {
}
render() {
- const labelStyle = this.state.hovered ? 'primary' : 'default';
+ const labelType = this.state.hovered ? 'primary' : 'default';
return (
+
+ {db.backend} {db.database_name}
+
);
}
diff --git a/superset-frontend/src/components/ImportModal/ImportModal.test.tsx b/superset-frontend/src/components/ImportModal/ImportModal.test.tsx
index a7a1cf5e2fdc7..8594005937252 100644
--- a/superset-frontend/src/components/ImportModal/ImportModal.test.tsx
+++ b/superset-frontend/src/components/ImportModal/ImportModal.test.tsx
@@ -21,7 +21,7 @@ import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import { styledMount as mount } from 'spec/helpers/theming';
import { ReactWrapper } from 'enzyme';
-
+import Button from 'src/components/Button';
import { ImportResourceName } from 'src/views/CRUD/types';
import ImportModelsModal from 'src/components/ImportModal';
import Modal from 'src/common/components/Modal';
@@ -82,18 +82,13 @@ describe('ImportModelsModal', () => {
});
it('should render the import button initially disabled', () => {
- expect(wrapper.find('button[children="Import"]').prop('disabled')).toBe(
- true,
- );
+ expect(wrapper.find(Button).at(1).prop('disabled')).toBe(true);
});
it('should render the import button enabled when a file is selected', () => {
const file = new File([new ArrayBuffer(1)], 'model_export.zip');
wrapper.find('input').simulate('change', { target: { files: [file] } });
-
- expect(wrapper.find('button[children="Import"]').prop('disabled')).toBe(
- false,
- );
+ expect(wrapper.find(Button).at(1).prop('disabled')).toBe(false);
});
it('should render password fields when needed for import', () => {
diff --git a/superset-frontend/src/components/Label/Label.stories.tsx b/superset-frontend/src/components/Label/Label.stories.tsx
index fe5dfdb99eb0c..07fc7c09fa744 100644
--- a/superset-frontend/src/components/Label/Label.stories.tsx
+++ b/superset-frontend/src/components/Label/Label.stories.tsx
@@ -18,59 +18,52 @@
*/
import React from 'react';
import { action } from '@storybook/addon-actions';
-import { withKnobs, select, boolean, text } from '@storybook/addon-knobs';
-import Label from './index';
+import Label, { Type } from './index';
export default {
title: 'Label',
component: Label,
- decorators: [withKnobs],
- excludeStories: /.*Knob$/,
+ excludeStories: 'options',
};
-export const bsStyleKnob = {
- label: 'Types',
- options: {
- default: 'default',
- info: 'info',
- success: 'success',
- warning: 'warning',
- danger: 'danger',
- secondary: 'secondary',
- primary: 'primary',
- },
- defaultValue: 'default',
-};
+export const options = [
+ 'default',
+ 'info',
+ 'success',
+ 'warning',
+ 'danger',
+ 'primary',
+ 'secondary',
+];
export const LabelGallery = () => (
<>
Non-interactive
- {Object.values(bsStyleKnob.options).map(opt => (
-
+ {Object.values(options).map((opt: Type) => (
+
{`style: "${opt}"`}
))}
Interactive
- {Object.values(bsStyleKnob.options).map(opt => (
-
+ {Object.values(options).map((opt: Type) => (
+
{`style: "${opt}"`}
))}
>
);
-export const InteractiveLabel = () => (
-
- {text('Label', 'Label!')}
-
-);
+export const InteractiveLabel = (args: any) => {
+ const { hasOnClick, label, ...rest } = args;
+ return (
+
+ {label}
+
+ );
+};
+
+InteractiveLabel.args = {
+ hasOnClick: true,
+ label: 'Example',
+};
diff --git a/superset-frontend/src/components/Label/Label.test.tsx b/superset-frontend/src/components/Label/Label.test.tsx
index 1535d4c997761..d1879d0636cda 100644
--- a/superset-frontend/src/components/Label/Label.test.tsx
+++ b/superset-frontend/src/components/Label/Label.test.tsx
@@ -21,7 +21,7 @@ import React from 'react';
import { ReactWrapper } from 'enzyme';
import { styledMount as mount } from 'spec/helpers/theming';
import Label from '.';
-import { LabelGallery, bsStyleKnob } from './Label.stories';
+import { LabelGallery, options } from './Label.stories';
describe('Label', () => {
let wrapper: ReactWrapper;
@@ -34,23 +34,13 @@ describe('Label', () => {
it('works with an onClick handler', () => {
const mockAction = jest.fn();
wrapper = mount();
- wrapper.find('.label').simulate('click');
+ wrapper.find(Label).simulate('click');
expect(mockAction).toHaveBeenCalled();
});
// test stories from the storybook!
- it('renders all the sorybook gallery variants', () => {
+ it('renders all the storybook gallery variants', () => {
wrapper = mount();
- Object.values(bsStyleKnob.options).forEach(opt => {
- expect(wrapper.find(`.label-${opt}`).at(0).text()).toEqual(
- `style: "${opt}"`,
- );
- });
- });
-
- // test things NOT in the storybook!
- it('renders custom label styles without melting', () => {
- wrapper = mount();
- expect(wrapper.find('Label.label-foobar')).toHaveLength(1);
+ expect(wrapper.find(Label).length).toEqual(options.length * 2);
});
});
diff --git a/superset-frontend/src/components/Label/index.tsx b/superset-frontend/src/components/Label/index.tsx
index 18bd1d267cc6b..781e15f6a05d2 100644
--- a/superset-frontend/src/components/Label/index.tsx
+++ b/superset-frontend/src/components/Label/index.tsx
@@ -17,149 +17,98 @@
* under the License.
*/
import React, { CSSProperties } from 'react';
-import { Label as BootstrapLabel } from 'react-bootstrap';
-import { styled } from '@superset-ui/core';
-import cx from 'classnames';
+import { Tag } from 'src/common/components';
+import { useTheme } from '@superset-ui/core';
-export type OnClickHandler = React.MouseEventHandler;
+export type OnClickHandler = React.MouseEventHandler;
+
+export type Type =
+ | 'success'
+ | 'warning'
+ | 'danger'
+ | 'info'
+ | 'default'
+ | 'primary'
+ | 'secondary';
export interface LabelProps {
key?: string;
className?: string;
- id?: string;
- tooltip?: string;
- placement?: string;
onClick?: OnClickHandler;
- bsStyle?: string;
+ type?: Type;
style?: CSSProperties;
children?: React.ReactNode;
role?: string;
}
-const SupersetLabel = styled(BootstrapLabel)`
- /* un-bunch them! */
- margin-right: ${({ theme }) => theme.gridUnit}px;
- max-width: 100%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- vertical-align: middle;
+export default function Label(props: LabelProps) {
+ const theme = useTheme();
+ const { colors, transitionTiming } = theme;
+ const { type, onClick, children, ...rest } = props;
+ const {
+ primary,
+ secondary,
+ grayscale,
+ success,
+ warning,
+ error,
+ info,
+ } = colors;
- &:first-of-type {
- margin-left: 0;
- }
- &:last-of-type {
- margin-right: 0;
- }
- display: inline-block;
- border-width: 1px;
- border-style: solid;
- cursor: ${({ onClick }) => (onClick ? 'pointer' : 'default')};
- transition: background-color ${({ theme }) => theme.transitionTiming}s;
- &.label-warning {
- background-color: ${({ theme }) => theme.colors.warning.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.warning.dark1 : 'transparent'};
- &:hover {
- background-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.warning.dark1 : theme.colors.warning.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.warning.dark2 : 'transparent'};
- }
- }
- &.label-danger {
- background-color: ${({ theme }) => theme.colors.error.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.error.dark1 : 'transparent'};
- &:hover {
- background-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.error.dark1 : theme.colors.error.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.error.dark2 : 'transparent'};
- }
- }
- &.label-success {
- background-color: ${({ theme }) => theme.colors.success.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.success.dark1 : 'transparent'};
- &:hover {
- background-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.success.dark1 : theme.colors.success.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.success.dark2 : 'transparent'};
- }
- }
- &.label-default {
- background-color: ${({ theme }) => theme.colors.grayscale.light3};
- color: ${({ theme }) => theme.colors.grayscale.dark1};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.grayscale.light2 : 'transparent'};
- &:hover {
- background-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.primary.light2 : theme.colors.grayscale.light3};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.primary.light1 : 'transparent'};
- }
- }
- &.label-info {
- background-color: ${({ theme }) => theme.colors.info};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.info.dark1 : 'transparent'};
- &:hover {
- background-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.info.dark1 : theme.colors.info.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.info.dark2 : 'transparent'};
- }
- }
- &.label-primary {
- background-color: ${({ theme }) => theme.colors.primary.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.primary.dark1 : 'transparent'};
- &:hover {
- background-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.primary.dark2 : theme.colors.primary.base};
- border-color: ${({ theme, onClick }) =>
- onClick
- ? theme.colors.primary.dark2
- : 'transparent'}; /* would be nice if we had a darker color, but that's the floor! */
- }
- }
- /* note this is NOT a supported bootstrap label Style... this overrides default */
- &.label-secondary {
- background-color: ${({ theme }) => theme.colors.secondary.base};
- color: ${({ theme }) => theme.colors.grayscale.light4};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.secondary.dark1 : 'transparent'};
- &:hover {
- background-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.secondary.dark1 : theme.colors.secondary.base};
- border-color: ${({ theme, onClick }) =>
- onClick ? theme.colors.secondary.dark2 : 'transparent'};
+ let backgroundColor = grayscale.light3;
+ let backgroundColorHover = onClick ? primary.light2 : grayscale.light3;
+ let borderColor = onClick ? grayscale.light2 : 'transparent';
+ let borderColorHover = onClick ? primary.light1 : 'transparent';
+ let color = grayscale.dark1;
+
+ if (type && type !== 'default') {
+ color = grayscale.light4;
+
+ let baseColor;
+ if (type === 'success') {
+ baseColor = success;
+ } else if (type === 'warning') {
+ baseColor = warning;
+ } else if (type === 'danger') {
+ baseColor = error;
+ } else if (type === 'info') {
+ baseColor = info;
+ } else if (type === 'secondary') {
+ baseColor = secondary;
+ } else {
+ baseColor = primary;
}
+
+ backgroundColor = baseColor.base;
+ backgroundColorHover = onClick ? baseColor.dark1 : baseColor.base;
+ borderColor = onClick ? baseColor.dark1 : 'transparent';
+ borderColorHover = onClick ? baseColor.dark2 : 'transparent';
}
-`;
-export default function Label(props: LabelProps) {
- const officialBootstrapStyles = [
- 'success',
- 'warning',
- 'danger',
- 'info',
- 'default',
- 'primary',
- ];
- const labelProps = {
- ...props,
- placement: props.placement || 'top',
- bsStyle: officialBootstrapStyles.includes(props.bsStyle || '')
- ? props.bsStyle
- : 'default',
- className: cx(props.className, {
- [`label-${props.bsStyle}`]: !officialBootstrapStyles.includes(
- props.bsStyle || '',
- ),
- }),
- };
- return {props.children};
+ return (
+
+ {children}
+
+ );
}
diff --git a/superset-frontend/src/components/Menu/Menu.tsx b/superset-frontend/src/components/Menu/Menu.tsx
index 18ead3c164ab6..7ad599a1109e4 100644
--- a/superset-frontend/src/components/Menu/Menu.tsx
+++ b/superset-frontend/src/components/Menu/Menu.tsx
@@ -174,76 +174,69 @@ export function Menu({