Skip to content

Commit

Permalink
Merge branch 'pexdax/db-connection-ui' of ssh://github.com/apache/sup…
Browse files Browse the repository at this point in the history
…erset into ch18653_errorMapping
  • Loading branch information
AAfghahi committed Jul 1, 2021
2 parents 91abee1 + 46621fc commit f921b12
Show file tree
Hide file tree
Showing 205 changed files with 747 additions and 441 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bashlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ cypress-run-all() {
say "::endgroup::"

# Rerun SQL Lab tests with backend persist enabled
export SUPERSET_CONFIG=tests.superset_test_config_sqllab_backend_persist
export SUPERSET_CONFIG=tests.integration_tests.superset_test_config_sqllab_backend_persist

# Restart Flask with new configs
kill $flaskProcessId
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/superset-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
env:
FLASK_ENV: development
ENABLE_REACT_CRUD_VIEWS: true
SUPERSET_CONFIG: tests.superset_test_config
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:superset@127.0.0.1:15432/superset
PYTHONPATH: ${{ github.workspace }}
REDIS_PORT: 16379
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/superset-python-presto-hive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
python-version: [3.8]
env:
PYTHONPATH: ${{ github.workspace }}
SUPERSET_CONFIG: tests.superset_test_config
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
REDIS_PORT: 16379
SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:superset@127.0.0.1:15432/superset
SUPERSET__SQLALCHEMY_EXAMPLES_URI: presto://localhost:15433/memory/default
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
python-version: [3.8]
env:
PYTHONPATH: ${{ github.workspace }}
SUPERSET_CONFIG: tests.superset_test_config
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
REDIS_PORT: 16379
SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:superset@127.0.0.1:15432/superset
SUPERSET__SQLALCHEMY_EXAMPLES_URI: hive://localhost:10000/default
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/superset-python-unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
python-version: [3.7]
env:
PYTHONPATH: ${{ github.workspace }}
SUPERSET_CONFIG: tests.superset_test_config
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
REDIS_PORT: 16379
SUPERSET__SQLALCHEMY_DATABASE_URI: |
mysql+mysqldb://superset:superset@127.0.0.1:13306/superset?charset=utf8mb4&binary_prefix=true
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
python-version: [3.7, 3.8]
env:
PYTHONPATH: ${{ github.workspace }}
SUPERSET_CONFIG: tests.superset_test_config
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
REDIS_PORT: 16379
SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:superset@127.0.0.1:15432/superset
services:
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
python-version: [3.7]
env:
PYTHONPATH: ${{ github.workspace }}
SUPERSET_CONFIG: tests.superset_test_config
SUPERSET_CONFIG: tests.integration_tests.superset_test_config
REDIS_PORT: 16379
SUPERSET__SQLALCHEMY_DATABASE_URI: |
sqlite:///${{ github.workspace }}/.temp/unittest.db
Expand Down
18 changes: 11 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ little bit helps, and credit will always be given.
- [Python Testing](#python-testing)
- [Frontend Testing](#frontend-testing)
- [Integration Testing](#integration-testing)
- [Debugging Server App](#debugging-server-app)
- [Debugging Server App in Kubernetes Environment](#debugging-server-app-in-kubernetes-environment)
- [Storybook](#storybook)
- [Translating](#translating)
- [Enabling language selection](#enabling-language-selection)
Expand Down Expand Up @@ -418,22 +420,23 @@ For example, the image referenced above actually lives in `superset-frontend/ima

#### OS Dependencies

Make sure your machine meets the [OS dependencies](https://superset.apache.org/docs/installation/installing-superset-from-scratch#os-dependencies) before following these steps.
Make sure your machine meets the [OS dependencies](https://superset.apache.org/docs/installation/installing-superset-from-scratch#os-dependencies) before following these steps.
You also need to install MySQL or [MariaDB](https://mariadb.com/downloads).

Ensure Python versions >3.7, Then proceed with:
Ensure that you are using Python version 3.7 or 3.8, then proceed with:

````bash
# Create a virtual environment and activate it (recommended)
python3 -m venv venv # setup a python3 virtualenv
source venv/bin/activate

# Install external dependencies
pip install -r requirements/local.txt
pip install -r requirements/testing.txt

# Install Superset in editable (development) mode
pip install -e .

# Create an admin user in your metadata database
# Create an admin user in your metadata database (use `admin` as username to be able to load the examples)
superset fab create-admin

# Initialize the database
Expand All @@ -442,11 +445,12 @@ superset db upgrade
# Create default roles and permissions
superset init

# Load some data to play with (you must create an Admin user with the username `admin` for this command to work)
# Load some data to play with.
# Note: you MUST have previously created an admin user with the username `admin` for this command to work.
superset load-examples

# Start the Flask dev web server from inside your virtualenv.
# Note that your page may not have css at this point.
# Note that your page may not have CSS at this point.
# See instructions below how to build the front-end assets.
FLASK_ENV=development superset run -p 8088 --with-threads --reload --debugger

Expand Down Expand Up @@ -767,7 +771,7 @@ npm run test -- path/to/file.js
We use [Cypress](https://www.cypress.io/) for integration tests. Tests can be run by `tox -e cypress`. To open Cypress and explore tests first setup and run test server:
```bash
export SUPERSET_CONFIG=tests.superset_test_config
export SUPERSET_CONFIG=tests.integration_tests.superset_test_config
export SUPERSET_TESTENV=true
export ENABLE_REACT_CRUD_VIEWS=true
export CYPRESS_BASE_URL="http://localhost:8081"
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set -eo pipefail
REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt"
# If Cypress run – overwrite the password for admin and export env variables
if [ "$CYPRESS_CONFIG" == "true" ]; then
export SUPERSET_CONFIG=tests.superset_test_config
export SUPERSET_CONFIG=tests.integration_tests.superset_test_config
export SUPERSET_TESTENV=true
export ENABLE_REACT_CRUD_VIEWS=true
export SUPERSET__SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://superset:superset@db:5432/superset
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/Miscellaneous/issue_codes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,4 @@ The query was not started by an asynchronous worker. Please reach out to your ad
The database was deleted.
```

The operation failed because the database referenced no longer exists. Please reach out to your administrator for further assistance.
The operation failed because the database referenced no longer exists. Please reach out to your administrator for further assistance.
2 changes: 1 addition & 1 deletion helm/superset/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ maintainers:
- name: craig-rueda
email: craig@craigrueda.com
url: https://github.com/craig-rueda
version: 0.3.1
version: 0.3.2
dependencies:
- name: postgresql
version: 10.2.0
Expand Down
11 changes: 7 additions & 4 deletions helm/superset/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ if .Values.ingress.enabled -}}
{{- $fullName := include "superset.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
Expand Down Expand Up @@ -46,9 +46,12 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
- path: {{ .Values.ingress.path }}
pathType: {{ .Values.ingress.pathType }}
backend:
serviceName: {{ $fullName }}
servicePort: http
service:
name: {{ $fullName }}
port:
name: http
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions helm/superset/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ ingress:
# nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
# nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
path: /
pathType: ImplementationSpecific
hosts:
- chart-example.local
tls: []
Expand Down
2 changes: 1 addition & 1 deletion scripts/python_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
set -e

export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.superset_test_config}
export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.integration_tests.superset_test_config}
export SUPERSET_TESTENV=true
echo "Superset config module: $SUPERSET_CONFIG"

Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ DB_NAME="test"
DB_USER="superset"
DB_PASSWORD="superset"
export SUPERSET__SQLALCHEMY_DATABASE_URI=${SUPERSET__SQLALCHEMY_DATABASE_URI:-postgresql+psycopg2://"${DB_USER}":"${DB_PASSWORD}"@localhost/"${DB_NAME}"}
export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.superset_test_config}
export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.integration_tests.superset_test_config}
RUN_INIT=1
RUN_RESET_DB=1
RUN_TESTS=1
Expand Down
3 changes: 0 additions & 3 deletions superset-frontend/spec/fixtures/mockNativeFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const nativeFilters: NativeFiltersState = {
rootPath: ['ROOT_ID'],
excluded: [],
},
isInstant: true,
controlValues: {
multiSelect: false,
enableEmptyFilter: false,
Expand Down Expand Up @@ -79,7 +78,6 @@ export const nativeFilters: NativeFiltersState = {
enableEmptyFilter: false,
inverseSelection: false,
},
isInstant: true,
},
},
};
Expand Down Expand Up @@ -136,7 +134,6 @@ export const singleNativeFiltersState = {
cascadeParentIds: [],
scope: { rootPath: ['ROOT_ID'], excluded: [227, 229] },
inverseSelection: false,
isInstant: true,
allowsMultipleValues: false,
isRequired: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const nativeFiltersInfo: NativeFiltersState = {
rootPath: [],
excluded: [],
},
isInstant: true,
controlValues: {
allowsMultipleValues: true,
isRequired: false,
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/components/InfoTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';
import { styled } from '@superset-ui/core';
import { Tooltip } from 'src/components/Tooltip';
import Icon from 'src/components/Icon';
import { Icon } from 'src/common/components';

export interface InfoTooltipProps {
className?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,38 @@ const DashboardContainer: FC<DashboardContainerProps> = ({ topLevelTabs }) => {
}, [getLeafComponentIdFromPath(directPathToChild)]);

// recalculate charts and tabs in scopes of native filters only when a scope or dashboard layout changes
const nativeFiltersValues = Object.values(nativeFilters);
const scopes = nativeFiltersValues.map(filter => filter.scope);
const filterScopes = Object.values(nativeFilters).map(filter => ({
id: filter.id,
scope: filter.scope,
}));
useEffect(() => {
if (
!isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) ||
nativeFiltersValues.length === 0
filterScopes.length === 0
) {
return;
}
const filterScopes = nativeFiltersValues.map(filter => {
const filterScope = filter.scope;
const scopes = filterScopes.map(filterScope => {
const { scope } = filterScope;
const chartsInScope: number[] = getChartIdsInFilterScope({
filterScope: {
scope: filterScope.rootPath,
scope: scope.rootPath,
// @ts-ignore
immune: filterScope.excluded,
immune: scope.excluded,
},
});
const tabsInScope = findTabsWithChartsInScope(
dashboardLayout,
chartsInScope,
);
return {
filterId: filter.id,
filterId: filterScope.id,
tabsInScope: Array.from(tabsInScope),
chartsInScope,
};
});
dispatch(setInScopeStatusOfFilters(filterScopes));
}, [JSON.stringify(scopes), JSON.stringify(dashboardLayout)]);
dispatch(setInScopeStatusOfFilters(scopes));
}, [JSON.stringify(filterScopes), dashboardLayout, dispatch]);

const childIds: string[] = topLevelTabs
? topLevelTabs.children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const FilterFocusHighlight = React.forwardRef(

if (focusedNativeFilterId) {
if (
nativeFilters.filters[focusedNativeFilterId].chartsInScope.includes(
nativeFilters.filters[focusedNativeFilterId].chartsInScope?.includes(
chartId,
)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MainPreset extends Preset {
}
}

fetchMock.get(`glob:*/api/v1/dataset/1`, {
fetchMock.get('glob:*/api/v1/dataset/7', {
description_columns: {},
id: 1,
label_columns: {
Expand Down Expand Up @@ -156,8 +156,7 @@ describe('FilterBar', () => {
"defaultDataMask":{"filterState":{"value":null}},
"controlValues":{},
"cascadeParentIds":[],
"scope":{"rootPath":["ROOT_ID"],"excluded":[]},
"isInstant":false
"scope":{"rootPath":["ROOT_ID"],"excluded":[]}
}],
"filter_sets_configuration":[{
"name":"${FILTER_SET_NAME}",
Expand All @@ -168,17 +167,16 @@ describe('FilterBar', () => {
"name":"${FILTER_NAME}",
"filterType":"filter_time",
"targets":[{}],
"defaultDataMask":{"filterState":{"value":"Last week"},"extraFormData":{"time_range":"Last week"}},
"defaultDataMask":{"filterState":{},"extraFormData":{}},
"controlValues":{},
"cascadeParentIds":[],
"scope":{"rootPath":["ROOT_ID"],"excluded":[]},
"isInstant":false
"scope":{"rootPath":["ROOT_ID"],"excluded":[]}
}
},
"dataMask":{
"${filterId}":{
"extraFormData":{"time_range":"Last week"},
"filterState":{"value":"Last week"},
"extraFormData":{},
"filterState":{},
"ownState":{},
"id":"${filterId}"
}
Expand All @@ -192,7 +190,14 @@ describe('FilterBar', () => {
beforeEach(() => {
jest.clearAllMocks();
fetchMock.get(
'http://localhost/api/v1/time_range/?q=%27Last%20day%27',
'glob:*/api/v1/time_range/?q=%27No%20filter%27',
{
result: { since: '', until: '', timeRange: 'No filter' },
},
{ overwriteRoutes: true },
);
fetchMock.get(
'glob:*/api/v1/time_range/?q=%27Last%20day%27',
{
result: {
since: '2021-04-13T00:00:00',
Expand All @@ -203,7 +208,7 @@ describe('FilterBar', () => {
{ overwriteRoutes: true },
);
fetchMock.get(
'http://localhost/api/v1/time_range/?q=%27Last%20week%27',
'glob:*/api/v1/time_range/?q=%27Last%20week%27',
{
result: {
since: '2021-04-07T00:00:00',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,10 @@ const FilterBar: React.FC<FiltersBarProps> = ({
}
// force instant updating on initialization for filters with `requiredFirst` is true or instant filters
else if (
(dataMaskSelected[filter.id] && filter.isInstant) ||
// filterState.value === undefined - means that value not initialized
(dataMask.filterState?.value !== undefined &&
dataMaskSelected[filter.id]?.filterState?.value === undefined &&
filter.requiredFirst)
dataMask.filterState?.value !== undefined &&
dataMaskSelected[filter.id]?.filterState?.value === undefined &&
filter.requiredFirst
) {
dispatch(updateDataMask(filter.id, dataMask));
}
Expand Down
Loading

0 comments on commit f921b12

Please sign in to comment.