mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
Some linting (#5790)
This commit is contained in:
committed by
GitHub
parent
71f014e9b6
commit
5b97fe5c0c
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -62,7 +62,6 @@ class Header extends React.PureComponent {
|
||||
this.state = {
|
||||
didNotifyMaxUndoHistoryToast: false,
|
||||
emphasizeUndo: false,
|
||||
hightlightRedo: false,
|
||||
};
|
||||
|
||||
this.handleChangeText = this.handleChangeText.bind(this);
|
||||
|
||||
@@ -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',
|
||||
@@ -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);
|
||||
@@ -307,9 +305,6 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
|
||||
this.setState({ errors }, callback);
|
||||
}
|
||||
hideAlert() {
|
||||
this.setState({ showAlert: false });
|
||||
}
|
||||
handleTabSelect(activeTabKey) {
|
||||
this.setState({ activeTabKey });
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -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>
|
||||
|
||||
@@ -37,7 +37,6 @@ class DatasourceControl extends React.PureComponent {
|
||||
super(props);
|
||||
this.state = {
|
||||
showEditDatasourceModal: false,
|
||||
filter: '',
|
||||
loading: true,
|
||||
showDatasource: false,
|
||||
};
|
||||
@@ -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);
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: 956a063c52b3
|
||||
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'
|
||||
|
||||
@@ -5,6 +5,10 @@ Revises: f231d82b9b26
|
||||
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
|
||||
|
||||
@@ -6,14 +6,18 @@ Revises: 430039611635
|
||||
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:
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: d2424a248d63
|
||||
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'
|
||||
|
||||
@@ -5,25 +5,29 @@ Revises: 3dda56f1c4c6
|
||||
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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: 2929af7925ed
|
||||
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
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: a6c18f869a4e
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: 3c3ffe173e4f
|
||||
Create Date: 2016-08-31 10:26:37.969107
|
||||
|
||||
"""
|
||||
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
|
||||
|
||||
|
||||
@@ -6,13 +6,18 @@ Revises: d827694c7555
|
||||
Create Date: 2016-02-10 08:47:28.950891
|
||||
|
||||
"""
|
||||
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 = '430039611635'
|
||||
down_revision = 'd827694c7555'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
def upgrade():
|
||||
op.add_column('logs', sa.Column('dashboard_id', sa.Integer(), nullable=True))
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: b4456560d4f3
|
||||
Create Date: 2016-04-15 17:58:33.842012
|
||||
|
||||
"""
|
||||
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 = '4fa88fe24e94'
|
||||
|
||||
@@ -5,6 +5,10 @@ Revises: ('130915240929', 'c9495751e314')
|
||||
Create Date: 2018-04-12 16:00:47.639218
|
||||
|
||||
"""
|
||||
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 = '5ccf602336a0'
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: ('525c854f0005', 'f1f2d4af5b90')
|
||||
Create Date: 2016-12-19 09:57:05.814013
|
||||
|
||||
"""
|
||||
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 = '6414e83d82b7'
|
||||
|
||||
@@ -5,6 +5,10 @@ Revises: ('4451805bbaa1', '1d9e835a84f9')
|
||||
Create Date: 2018-07-22 21:51:19.235558
|
||||
|
||||
"""
|
||||
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 = '705732c70154'
|
||||
|
||||
@@ -12,12 +12,7 @@ import re
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import (
|
||||
Table, Column,
|
||||
Integer, String, Text, ForeignKey,
|
||||
)
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from superset import db
|
||||
|
||||
@@ -31,7 +26,7 @@ class Dashboard(Base):
|
||||
"""Declarative class to do query in upgrade"""
|
||||
__tablename__ = 'dashboards'
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
dashboard_title = sa.Column(String(500))
|
||||
dashboard_title = sa.Column(sa.String(500))
|
||||
position_json = sa.Column(sa.Text)
|
||||
|
||||
|
||||
@@ -59,8 +54,8 @@ def upgrade():
|
||||
text = text.replace('_TYPE', '')
|
||||
|
||||
dashboard.position_json = text
|
||||
print('dash id:{} position_json size from {} to {}'
|
||||
.format(dashboard.id, len(original_text), len(text)))
|
||||
print('dash id:{} position_json size from {} to {}'.format(
|
||||
dashboard.id, len(original_text), len(text)))
|
||||
session.merge(dashboard)
|
||||
session.commit()
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: 18e88e1cc004
|
||||
Create Date: 2016-03-17 08:40:03.186534
|
||||
|
||||
"""
|
||||
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 = '836c0bf75904'
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: fee7b758c130
|
||||
Create Date: 2016-04-03 15:23:20.280841
|
||||
|
||||
"""
|
||||
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 = '867bf4f117f9'
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: 2591d77e9831
|
||||
Create Date: 2016-01-13 20:24:45.256437
|
||||
|
||||
"""
|
||||
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 = '8e80a26a31db'
|
||||
|
||||
@@ -6,14 +6,18 @@ Revises: f0fbf6129e13
|
||||
Create Date: 2016-05-11 17:28:32.407340
|
||||
|
||||
"""
|
||||
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 = '956a063c52b3'
|
||||
down_revision = 'f0fbf6129e13'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('clusters', schema=None) as batch_op:
|
||||
|
||||
@@ -6,6 +6,11 @@ Revises: 979c03af3341
|
||||
Create Date: 2017-03-28 11:28:41.387182
|
||||
|
||||
"""
|
||||
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
|
||||
|
||||
@@ -17,9 +22,12 @@ down_revision = '979c03af3341'
|
||||
def upgrade():
|
||||
op.add_column(
|
||||
'query',
|
||||
sa.Column('start_running_time',
|
||||
sa.Numeric(precision=20, scale=6),
|
||||
nullable=True))
|
||||
sa.Column(
|
||||
'start_running_time',
|
||||
sa.Numeric(precision=20, scale=6),
|
||||
nullable=True,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: ca69c70ec99b
|
||||
Create Date: 2017-08-31 17:35:58.230723
|
||||
|
||||
"""
|
||||
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 = 'a9c47e2c1547'
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: ('33d996bcc382', '65903709c321')
|
||||
Create Date: 2016-09-19 17:22:40.138601
|
||||
|
||||
"""
|
||||
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 = 'b347b202819b'
|
||||
|
||||
@@ -6,13 +6,16 @@ Revises: bb51420eaf83
|
||||
Create Date: 2016-04-15 08:31:26.249591
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'b4456560d4f3'
|
||||
down_revision = 'bb51420eaf83'
|
||||
|
||||
from alembic import op
|
||||
|
||||
|
||||
def upgrade():
|
||||
try:
|
||||
|
||||
@@ -8,16 +8,19 @@ Create Date: 2018-07-22 11:59:07.025119
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
import collections
|
||||
from functools import reduce
|
||||
import json
|
||||
import sys
|
||||
from functools import reduce
|
||||
import uuid
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import (
|
||||
Table, Column,
|
||||
Integer, String, Text, ForeignKey,
|
||||
Column,
|
||||
ForeignKey,
|
||||
Integer,
|
||||
String,
|
||||
Table,
|
||||
Text,
|
||||
)
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import relationship
|
||||
@@ -74,9 +77,9 @@ dashboard_slices = Table(
|
||||
class Dashboard(Base):
|
||||
"""Declarative class to do query in upgrade"""
|
||||
__tablename__ = 'dashboards'
|
||||
id = sa.Column(sa.Integer, primary_key=True)
|
||||
dashboard_title = sa.Column(String(500))
|
||||
position_json = sa.Column(sa.Text)
|
||||
id = Column(Integer, primary_key=True)
|
||||
dashboard_title = Column(String(500))
|
||||
position_json = Column(Text)
|
||||
slices = relationship(
|
||||
'Slice', secondary=dashboard_slices, backref='dashboards')
|
||||
|
||||
@@ -189,11 +192,11 @@ def get_chart_holder(position):
|
||||
|
||||
width = max(
|
||||
GRID_MIN_COLUMN_COUNT,
|
||||
int(round(size_x / GRID_RATIO))
|
||||
int(round(size_x / GRID_RATIO)),
|
||||
)
|
||||
height = max(
|
||||
GRID_MIN_ROW_UNITS,
|
||||
int(round(((size_y / GRID_RATIO) * 100) / ROW_HEIGHT))
|
||||
int(round(((size_y / GRID_RATIO) * 100) / ROW_HEIGHT)),
|
||||
)
|
||||
if code is not None:
|
||||
markdown_content = ' ' # white-space markdown
|
||||
@@ -210,7 +213,7 @@ def get_chart_holder(position):
|
||||
'width': width,
|
||||
'height': height,
|
||||
'code': markdown_content,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -233,7 +236,7 @@ def get_children_sum(children, attr, root):
|
||||
return reduce(
|
||||
(lambda sum, childId: sum + root[childId]['meta'][attr]),
|
||||
children,
|
||||
0
|
||||
0,
|
||||
)
|
||||
|
||||
|
||||
@@ -243,8 +246,8 @@ def get_wide_column_ids(children, root):
|
||||
return list(
|
||||
filter(
|
||||
lambda childId: can_reduce_column_width(root[childId], root),
|
||||
children
|
||||
)
|
||||
children,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -274,8 +277,8 @@ def reduce_row_width(row_component, root):
|
||||
wide_leaf_component_ids = list(
|
||||
filter(
|
||||
lambda childId: is_wide_leaf_component(root[childId]),
|
||||
row_component['children']
|
||||
)
|
||||
row_component['children'],
|
||||
),
|
||||
)
|
||||
|
||||
widest_chart_id = None
|
||||
@@ -480,7 +483,7 @@ def convert_to_layout(positions):
|
||||
for childId in root[current_column]['children']:
|
||||
if root[childId]['type'] == ROW_TYPE:
|
||||
root[childId]['meta']['width'] = reduce_row_width(
|
||||
root[childId], root
|
||||
root[childId], root,
|
||||
)
|
||||
else:
|
||||
root[childId]['meta']['width'] = \
|
||||
@@ -489,12 +492,12 @@ def convert_to_layout(positions):
|
||||
root[current_column]['meta']['width'] = get_children_max(
|
||||
root[current_column]['children'],
|
||||
'width',
|
||||
root
|
||||
root,
|
||||
)
|
||||
current_width = get_children_sum(
|
||||
item['children'],
|
||||
'width',
|
||||
root
|
||||
root,
|
||||
)
|
||||
idx += 1
|
||||
|
||||
@@ -574,7 +577,7 @@ def scan_dashboard_positions_data(positions):
|
||||
idx = sorted(
|
||||
available_columns_index,
|
||||
key=lambda x: next_row[x]['size_x'],
|
||||
reverse=True
|
||||
reverse=True,
|
||||
)[0]
|
||||
|
||||
next_position = next_row.pop(idx)
|
||||
@@ -646,10 +649,10 @@ def upgrade():
|
||||
positions.append(position)
|
||||
|
||||
v2_layout = convert_to_layout(positions)
|
||||
v2_layout[DASHBOARD_HEADER_ID] = get_header_component(dashboard.dashboard_title)
|
||||
v2_layout[DASHBOARD_HEADER_ID] = get_header_component(
|
||||
dashboard.dashboard_title)
|
||||
|
||||
sorted_by_key = collections.OrderedDict(sorted(v2_layout.items()))
|
||||
# print('converted position_json:\n {}'.format(json.dumps(sorted_by_key, indent=2)))
|
||||
dashboard.position_json = json.dumps(sorted_by_key, indent=2)
|
||||
session.merge(dashboard)
|
||||
session.commit()
|
||||
|
||||
@@ -5,14 +5,18 @@ Revises: f231d82b9b26
|
||||
Create Date: 2018-04-10 11:19:47.621878
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy import Column, Integer, String, Text
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from superset import db
|
||||
from superset.legacy import cast_form_data
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
@@ -10,9 +10,6 @@ Create Date: 2018-07-24 14:29:41.341098
|
||||
revision = 'c18bd4186f15'
|
||||
down_revision = ('46ba6aaaac97', 'ec1f88a35cc6')
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
|
||||
@@ -6,20 +6,26 @@ Revises: 4fa88fe24e94
|
||||
Create Date: 2016-04-25 08:54:04.303859
|
||||
|
||||
"""
|
||||
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 import Column, ForeignKey, Integer, String
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
from superset import db
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'c3a8f8611885'
|
||||
down_revision = '4fa88fe24e94'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from superset import db
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy import (
|
||||
Column, Integer, String, ForeignKey)
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
class Slice(Base):
|
||||
"""Declarative class to do query in upgrade"""
|
||||
__tablename__ = 'slices'
|
||||
@@ -29,6 +35,7 @@ class Slice(Base):
|
||||
table_id = Column(Integer, ForeignKey('tables.id'))
|
||||
perm = Column(String(2000))
|
||||
|
||||
|
||||
def upgrade():
|
||||
bind = op.get_bind()
|
||||
op.add_column('slices', sa.Column('perm', sa.String(length=2000), nullable=True))
|
||||
|
||||
@@ -5,6 +5,10 @@ Revises: ('30bb17c0dc76', 'bf706ae5eb46')
|
||||
Create Date: 2018-04-10 20:46:57.890773
|
||||
|
||||
"""
|
||||
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 = 'c9495751e314'
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: ('a99f2f7c195a', 'bcf3126872fc')
|
||||
Create Date: 2017-02-10 17:58:20.149960
|
||||
|
||||
"""
|
||||
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 = 'd6db5a5cdb5d'
|
||||
|
||||
@@ -6,6 +6,10 @@ Revises: c611f2b591b8
|
||||
Create Date: 2016-11-14 15:23:32.594898
|
||||
|
||||
"""
|
||||
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 = 'e46f2d27a08e'
|
||||
|
||||
@@ -10,9 +10,6 @@ Create Date: 2018-07-23 11:18:11.866106
|
||||
revision = 'ec1f88a35cc6'
|
||||
down_revision = ('bebcf3fed1fe', '705732c70154')
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
|
||||
@@ -6,14 +6,15 @@ Revises: ('3b626e2a6783', 'ab3d66c4246e')
|
||||
Create Date: 2016-10-02 10:35:38.825231
|
||||
|
||||
"""
|
||||
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 = 'ef8843b41dac'
|
||||
down_revision = ('3b626e2a6783', 'ab3d66c4246e')
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user