Skip to content

Commit

Permalink
Some linting (#5790)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Sep 20, 2018
1 parent 71f014e commit 5b97fe5
Show file tree
Hide file tree
Showing 39 changed files with 264 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,6 @@ describe('ExploreResultsButton', () => {
expect(wrapper.find(Button)).to.have.length(1);
});

describe('getColumnFromProps', () => {
it('should require valid query parameter in props', () => {
const emptyQuery = {
database,
show: true,
query: {},
};
const wrapper = shallow(<ExploreResultsButton {...emptyQuery} />, {
context: { store },
}).dive();
expect(wrapper.state().hints).to.deep.equal([]);
});
});

describe('datasourceName', () => {
let wrapper;
let stub;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ const defaultProps = {
class ExploreResultsButton extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
hints: [],
};
this.visualize = this.visualize.bind(this);
this.onClick = this.onClick.bind(this);
this.getInvalidColumns = this.getInvalidColumns.bind(this);
Expand Down
1 change: 0 additions & 1 deletion superset/assets/src/dashboard/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class Header extends React.PureComponent {
this.state = {
didNotifyMaxUndoHistoryToast: false,
emphasizeUndo: false,
hightlightRedo: false,
};

this.handleChangeText = this.handleChangeText.bind(this);
Expand Down
5 changes: 0 additions & 5 deletions superset/assets/src/datasource/DatasourceEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ export class DatasourceEditor extends React.PureComponent {
super(props);
this.state = {
datasource: props.datasource,
showAlert: true,
errors: [],
isDruid: props.datasource.type === 'druid',
isSqla: props.datasource.type === 'table',
Expand All @@ -202,7 +201,6 @@ export class DatasourceEditor extends React.PureComponent {
this.onChange = this.onChange.bind(this);
this.onDatasourcePropChange = this.onDatasourcePropChange.bind(this);
this.onDatasourceChange = this.onDatasourceChange.bind(this);
this.hideAlert = this.hideAlert.bind(this);
this.syncMetadata = this.syncMetadata.bind(this);
this.setColumns = this.setColumns.bind(this);
this.validateAndChange = this.validateAndChange.bind(this);
Expand Down Expand Up @@ -307,9 +305,6 @@ export class DatasourceEditor extends React.PureComponent {

this.setState({ errors }, callback);
}
hideAlert() {
this.setState({ showAlert: false });
}
handleTabSelect(activeTabKey) {
this.setState({ activeTabKey });
}
Expand Down
7 changes: 0 additions & 7 deletions superset/assets/src/datasource/DatasourceModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ class DatasourceModal extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
showEditDatasource: false,
filter: '',
loading: true,
errors: [],
showDatasource: false,
datasource: props.datasource,
};
this.toggleShowDatasource = this.toggleShowDatasource.bind(this);
this.changeSearch = this.changeSearch.bind(this);
this.setSearchRef = this.setSearchRef.bind(this);
this.onDatasourceChange = this.onDatasourceChange.bind(this);
this.onClickSave = this.onClickSave.bind(this);
Expand Down Expand Up @@ -98,9 +94,6 @@ class DatasourceModal extends React.PureComponent {
toggleShowDatasource() {
this.setState({ showDatasource: !this.state.showDatasource });
}
changeSearch(event) {
this.setState({ filter: event.target.value });
}
renderSaveDialog() {
return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class DatasourceControl extends React.PureComponent {
super(props);
this.state = {
showEditDatasourceModal: false,
filter: '',
loading: true,
showDatasource: false,
};
Expand Down Expand Up @@ -95,9 +94,6 @@ class DatasourceControl extends React.PureComponent {
toggleModal() {
this.setState({ showModal: !this.state.showModal });
}
changeSearch(event) {
this.setState({ filter: event.target.value });
}
selectDatasource(datasourceId) {
this.setState({ showModal: false });
this.props.onChange(datasourceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Create Date: 2016-05-27 15:03:32.980343
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

# revision identifiers, used by Alembic.
revision = '1226819ee0e3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
Create Date: 2018-04-03 08:19:34.098789
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from alembic import op
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
Expand Down
153 changes: 88 additions & 65 deletions superset/migrations/versions/18e88e1cc004_making_audit_nullable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
Create Date: 2016-03-13 21:30:24.833107
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = '18e88e1cc004'
down_revision = '430039611635'

from alembic import op
import sqlalchemy as sa


def upgrade():
try:
Expand All @@ -30,69 +34,88 @@ def upgrade():
op.drop_column('columns', 'created_by_fk')
op.drop_column('columns', 'changed_on')
op.drop_column('columns', 'changed_by_fk')
op.alter_column('css_templates', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('css_templates', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('dashboards', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('dashboards', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'css_templates', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'css_templates', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'dashboards', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'dashboards', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.create_unique_constraint(None, 'dashboards', ['slug'])
op.alter_column('datasources', 'changed_by_fk',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column('datasources', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('datasources', 'created_by_fk',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column('datasources', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('dbs', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('dbs', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('slices', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('slices', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('sql_metrics', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('sql_metrics', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('table_columns', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('table_columns', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('tables', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('tables', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('url', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column('url', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
### end Alembic commands ###
except:
op.alter_column(
'datasources', 'changed_by_fk',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column(
'datasources', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'datasources', 'created_by_fk',
existing_type=sa.INTEGER(),
nullable=True)
op.alter_column(
'datasources', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'dbs', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'dbs', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'slices', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'slices', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'sql_metrics', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'sql_metrics', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'table_columns', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'table_columns', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'tables', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'tables', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'url', 'changed_on',
existing_type=sa.DATETIME(),
nullable=True)
op.alter_column(
'url', 'created_on',
existing_type=sa.DATETIME(),
nullable=True)
except Exception:
pass


Expand Down
4 changes: 4 additions & 0 deletions superset/migrations/versions/1d2ddd543133_log_dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Create Date: 2016-03-25 14:35:44.642576
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

# revision identifiers, used by Alembic.
revision = '1d2ddd543133'
Expand Down
26 changes: 15 additions & 11 deletions superset/migrations/versions/1d9e835a84f9_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
Create Date: 2018-07-16 18:04:07.764659
"""

# revision identifiers, used by Alembic.
revision = '1d9e835a84f9'
down_revision = '3dda56f1c4c6'
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import expression

# revision identifiers, used by Alembic.
revision = '1d9e835a84f9'
down_revision = '3dda56f1c4c6'


def upgrade():
op.add_column(
'dbs',
sa.Column(
'allow_csv_upload',
sa.Boolean(),
nullable=False,
server_default=expression.true()))
'dbs',
sa.Column(
'allow_csv_upload',
sa.Boolean(),
nullable=False,
server_default=expression.true()))


def downgrade():
op.drop_column('dbs', 'allow_csv_upload')

Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json

from alembic import op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Create Date: 2015-11-21 11:18:00.650587
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa
Expand Down
4 changes: 4 additions & 0 deletions superset/migrations/versions/2fcdcb35e487_saved_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Create Date: 2017-03-29 15:04:35.734190
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from alembic import op
import sqlalchemy as sa
from superset import db
Expand Down
Loading

0 comments on commit 5b97fe5

Please sign in to comment.