Skip to content

Commit

Permalink
Merge branch 'master' into pexdax/db-connection-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh authored Jun 17, 2021
2 parents 9cecb8b + 965dacd commit 0b306a4
Show file tree
Hide file tree
Showing 47 changed files with 1,230 additions and 432 deletions.
2 changes: 1 addition & 1 deletion docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ else
--workers 1 \
--worker-class gthread \
--threads 20 \
--timeout 60 \
--timeout ${GUNICORN_TIMEOUT:-60} \
--limit-request-line 0 \
--limit-request-field_size 0 \
"${FLASK_APP}"
Expand Down
1 change: 1 addition & 0 deletions docker/docker-frontend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
set -e

cd /app/superset-frontend
npm install -g npm@7
npm install -f --no-optional --global webpack webpack-cli
npm install -f --no-optional

Expand Down
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: [email protected]
url: https://github.com/craig-rueda
version: 0.1.4
version: 0.1.5
dependencies:
- name: postgresql
version: 10.2.0
Expand Down
32 changes: 30 additions & 2 deletions helm/superset/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,20 @@ envFromSecret: '{{ template "superset.fullname" . }}-env'
## Extra environment variables that will be passed into pods
##
extraEnv: {}
# Extend timeout to allow long running queries.
# GUNICORN_TIMEOUT: 300


# OAUTH_HOME_DOMAIN: ..
# # If a whitelist is not set, any address that can use your OAuth2 endpoint will be able to login.
# # this includes any random Gmail address if your OAuth2 Web App is set to External.
# OAUTH_WHITELIST_REGEX: ...

## Extra environment variables to pass as secrets
##
extraSecretEnv: {}
# MAPBOX_API_KEY: ...
# # Google API Keys: https://console.cloud.google.com/apis/credentials
# GOOGLE_KEY: ...
# GOOGLE_SECRET: ...

Expand All @@ -76,13 +85,17 @@ extraSecrets: {}
# A dictionary of overrides to append at the end of superset_config.py - the name does not matter
# WARNING: the order is not guaranteed
configOverrides: {}
# extend_timeout: |
# # Extend timeout to allow long running queries.
# SUPERSET_WEBSERVER_TIMEOUT = ...
# enable_oauth: |
# from flask_appbuilder.security.manager import AUTH_DB
# from flask_appbuilder.security.manager import (AUTH_DB, AUTH_OAUTH)
# AUTH_TYPE = AUTH_OAUTH

# OAUTH_PROVIDERS = [
# {
# "name": "google",
# "whitelist": [ os.getenv("OAUTH_WHITELIST_REGEX", "") ],
# "icon": "fa-google",
# "token_key": "access_token",
# "remote_app": {
Expand All @@ -93,9 +106,17 @@ configOverrides: {}
# "request_token_url": None,
# "access_token_url": "https://accounts.google.com/o/oauth2/token",
# "authorize_url": "https://accounts.google.com/o/oauth2/auth",
# },
# "authorize_params": {"hd": os.getenv("OAUTH_HOME_DOMAIN", "")}
# }
# }
# ]
# # Map Authlib roles to superset roles
# AUTH_ROLE_ADMIN = 'Admin'
# AUTH_ROLE_PUBLIC = 'Public'
# # Will allow user self registration, allowing to create Flask users from Authorized User
# AUTH_USER_REGISTRATION = True
# # The default user self registration role
# AUTH_USER_REGISTRATION_ROLE = "Admin"

configMountPath: "/app/pythonpath"

Expand All @@ -121,6 +142,10 @@ ingress:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
## Extend timeout to allow long running queries.
# nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
# nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
# nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
path: /
hosts:
- chart-example.local
Expand Down Expand Up @@ -239,6 +264,7 @@ init:
- ". {{ .Values.configMountPath }}/superset_bootstrap.sh; . {{ .Values.configMountPath }}/superset_init.sh"
enabled: true
loadExamples: false
createAdmin: true
adminUser:
username: admin
firstname: Superset
Expand All @@ -259,6 +285,7 @@ init:
superset db upgrade
echo "Initializing roles..."
superset init
{{ if .Values.init.createAdmin }}
echo "Creating admin user..."
superset fab create-admin \
--username {{ .Values.init.adminUser.username }} \
Expand All @@ -267,6 +294,7 @@ init:
--email {{ .Values.init.adminUser.email }} \
--password {{ .Values.init.adminUser.password }} \
|| true
{{- end }}
{{ if .Values.init.loadExamples }}
echo "Loading examples..."
superset load_examples
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ prison==0.1.3
# via flask-appbuilder
py==1.9.0
# via retry
pyarrow==3.0.0
pyarrow==4.0.1
# via apache-superset
pycparser==2.20
# via cffi
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_git_sha():
"python-dateutil",
"python-dotenv",
"python-geohash",
"pyarrow>=3.0.0, <3.1",
"pyarrow>=4.0.1, <4.1",
"pyyaml>=5.4",
"PyJWT>=1.7.1, <2",
"redis",
Expand Down
37 changes: 37 additions & 0 deletions superset-frontend/spec/helpers/IntersectionObserver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* 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.
*/
class IntersectionObserver {
disconnect() {
return null;
}

observe() {
return null;
}

takeRecords() {
return null;
}

unobserve() {
return null;
}
}

export { IntersectionObserver };
2 changes: 2 additions & 0 deletions superset-frontend/spec/helpers/shim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { configure as configureTranslation } from '@superset-ui/core';
import { Worker } from './Worker';
import { IntersectionObserver } from './IntersectionObserver';
import setupSupersetClient from './setupSupersetClient';

configure({ adapter: new Adapter() });
Expand All @@ -46,6 +47,7 @@ g.window = g.window || {};
g.window.location = { href: 'about:blank' };
g.window.performance = { now: () => new Date().getTime() };
g.window.Worker = Worker;
g.window.IntersectionObserver = IntersectionObserver;
g.URL.createObjectURL = () => '';

Object.defineProperty(window, 'matchMedia', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import sinon from 'sinon';
import fetchMock from 'fetch-mock';
import { ParentSize } from '@vx/responsive';
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
import { Sticky, StickyContainer } from 'react-sticky';
import Tabs from 'src/components/Tabs';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
Expand Down Expand Up @@ -90,14 +89,14 @@ describe('DashboardBuilder', () => {

it('should render a StickyContainer with class "dashboard"', () => {
const wrapper = setup();
const stickyContainer = wrapper.find(StickyContainer);
const stickyContainer = wrapper.find('[data-test="dashboard-content"]');
expect(stickyContainer).toHaveLength(1);
expect(stickyContainer.prop('className')).toBe('dashboard');
});

it('should add the "dashboard--editing" class if editMode=true', () => {
const wrapper = setup({ dashboardState: { editMode: true } });
const stickyContainer = wrapper.find(StickyContainer).first();
const stickyContainer = wrapper.find('[data-test="dashboard-content"]');
expect(stickyContainer.prop('className')).toBe(
'dashboard dashboard--editing',
);
Expand All @@ -113,12 +112,12 @@ describe('DashboardBuilder', () => {
{ dashboardLayout: undoableDashboardLayoutWithTabs },
mockStoreWithTabs,
);
const sticky = wrapper.find(Sticky);

const sticky = wrapper.find('[data-test="top-level-tabs"]');
const dashboardComponent = sticky.find(DashboardComponent);

const tabChildren =
undoableDashboardLayoutWithTabs.present.TABS_ID.children;
expect(sticky).toHaveLength(1);
expect(dashboardComponent).toHaveLength(1 + tabChildren.length); // tab + tabs
expect(dashboardComponent.at(0).prop('id')).toBe('TABS_ID');
tabChildren.forEach((tabId, i) => {
Expand Down
10 changes: 5 additions & 5 deletions superset-frontend/spec/javascripts/sqllab/TableElement_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('TableElement', () => {
},
},
);
expect(wrapper.find(IconTooltip)).toHaveLength(5);
expect(wrapper.find(IconTooltip)).toHaveLength(4);
});
it('has 14 columns', () => {
const wrapper = shallow(<TableElement {...mockedProps} />);
Expand Down Expand Up @@ -112,20 +112,20 @@ describe('TableElement', () => {
},
);
expect(
wrapper.find(IconTooltip).at(2).hasClass('fa-sort-alpha-asc'),
wrapper.find(IconTooltip).at(1).hasClass('fa-sort-alpha-asc'),
).toEqual(true);
expect(
wrapper.find(IconTooltip).at(2).hasClass('fa-sort-numeric-asc'),
wrapper.find(IconTooltip).at(1).hasClass('fa-sort-numeric-asc'),
).toEqual(false);
wrapper.find('.header-container').hostNodes().simulate('click');
expect(wrapper.find(ColumnElement).first().props().column.name).toBe('id');
wrapper.find('.header-container').simulate('mouseEnter');
wrapper.find('.sort-cols').hostNodes().simulate('click');
expect(
wrapper.find(IconTooltip).at(2).hasClass('fa-sort-numeric-asc'),
wrapper.find(IconTooltip).at(1).hasClass('fa-sort-numeric-asc'),
).toEqual(true);
expect(
wrapper.find(IconTooltip).at(2).hasClass('fa-sort-alpha-asc'),
wrapper.find(IconTooltip).at(1).hasClass('fa-sort-alpha-asc'),
).toEqual(false);
expect(wrapper.find(ColumnElement).first().props().column.name).toBe(
'active',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ export default function SouthPane({
}
let results;
if (latestQuery) {
if (latestQuery?.extra?.errors) {
latestQuery.errors = latestQuery.extra.errors;
}
if (
isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE) &&
latestQuery.state === 'success' &&
Expand Down
13 changes: 7 additions & 6 deletions superset-frontend/src/SqlLab/components/SqlEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import PropTypes from 'prop-types';
import Split from 'react-split';
import { t, styled, supersetTheme } from '@superset-ui/core';
import { t, styled, supersetTheme, withTheme } from '@superset-ui/core';
import debounce from 'lodash/debounce';
import throttle from 'lodash/throttle';
import StyledModal from 'src/components/Modal';
Expand All @@ -38,7 +38,7 @@ import {
Switch,
Input,
} from 'src/common/components';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';
import { detectOS } from 'src/utils/common';
import {
addQueryEditor,
Expand Down Expand Up @@ -564,7 +564,7 @@ class SqlEditor extends React.PureComponent {
this.props.database || {};

const showMenu = allowCTAS || allowCVAS;

const { theme } = this.props;
const runMenuBtn = (
<Menu>
{allowCTAS && (
Expand Down Expand Up @@ -639,7 +639,7 @@ class SqlEditor extends React.PureComponent {
this.props.defaultQueryLimit,
)}
</span>
<Icon name="triangle-down" />
<Icons.TriangleDown iconColor={theme.colors.grayscale.base} />
</a>
</Dropdown>
</LimitSelectStyled>
Expand Down Expand Up @@ -667,7 +667,7 @@ class SqlEditor extends React.PureComponent {
<ShareSqlLabQuery queryEditor={qe} />
</span>
<Dropdown overlay={this.renderDropdown()} trigger="click">
<Icon name="more-horiz" />
<Icons.MoreHoriz iconColor={theme.colors.grayscale.base} />
</Dropdown>
</div>
</StyledToolbar>
Expand Down Expand Up @@ -783,4 +783,5 @@ function mapDispatchToProps(dispatch) {
);
}

export default connect(mapStateToProps, mapDispatchToProps)(SqlEditor);
const themedSqlEditor = withTheme(SqlEditor);
export default connect(mapStateToProps, mapDispatchToProps)(themedSqlEditor);
20 changes: 20 additions & 0 deletions superset-frontend/src/SqlLab/components/SqlEditorLeftBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import PropTypes from 'prop-types';
import Button from 'src/components/Button';
import { t, styled, css } from '@superset-ui/core';
import Collapse from 'src/components/Collapse';
import Icons from 'src/components/Icons';
import TableElement from './TableElement';
import TableSelector from '../../components/TableSelector';
import { IconTooltip } from '../../components/IconTooltip';

const propTypes = {
queryEditor: PropTypes.object.isRequired,
Expand Down Expand Up @@ -134,6 +136,23 @@ export default class SqlEditorLeftBar extends React.PureComponent {
this.props.actions.addTable(this.props.queryEditor, tableName, schemaName);
}

renderExpandIconWithTooltip = ({ isActive }) => (
<IconTooltip
css={css`
transform: rotate(90deg);
`}
aria-label="Collapse"
tooltip={t(`${isActive ? 'Collapse' : 'Expand'} table preview`)}
>
<Icons.RightOutlined
iconSize="s"
css={css`
transform: ${isActive ? 'rotateY(180deg)' : ''};
`}
/>
</IconTooltip>
);

render() {
const shouldShowReset = window.location.search === '?reset=1';
const tableMetaDataHeight = this.props.height - 130; // 130 is the height of the selects above
Expand Down Expand Up @@ -184,6 +203,7 @@ export default class SqlEditorLeftBar extends React.PureComponent {
expandIconPosition="right"
ghost
onChange={this.onToggleTable}
expandIcon={this.renderExpandIconWithTooltip}
>
{this.props.tables.map(table => (
<TableElement
Expand Down
Loading

0 comments on commit 0b306a4

Please sign in to comment.