Skip to content

Commit

Permalink
Bumping the JS libs to fix the build (#2616)
Browse files Browse the repository at this point in the history
* bumping the js libs

* New linting rules

* More linting

* More

* Done linting

* npm >=4.5.0

* Bumping node

* Tweaking the build

* Fixing the damn build

* Fixing the apps
  • Loading branch information
mistercrunch committed Apr 13, 2017
1 parent a2b30f3 commit 366ecef
Show file tree
Hide file tree
Showing 132 changed files with 607 additions and 549 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Expand Up @@ -65,7 +65,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=standarderror-builtin,long-builtin,dict-view-method,intern-builtin,suppressed-message,no-absolute-import,unpacking-in-except,apply-builtin,delslice-method,indexing-exception,old-raise-syntax,print-statement,cmp-builtin,reduce-builtin,useless-suppression,coerce-method,input-builtin,cmp-method,raw_input-builtin,nonzero-method,backtick,basestring-builtin,setslice-method,reload-builtin,oct-method,map-builtin-not-iterating,execfile-builtin,old-octal-literal,zip-builtin-not-iterating,buffer-builtin,getslice-method,metaclass-assignment,xrange-builtin,long-suffix,round-builtin,range-builtin-not-iterating,next-method-called,dict-iter-method,parameter-unpacking,unicode-builtin,unichr-builtin,import-star-module-level,raising-string,filter-builtin-not-iterating,old-ne-operator,using-cmp-argument,coerce-builtin,file-builtin,old-division,hex-method
disable=standarderror-builtin,long-builtin,dict-view-method,intern-builtin,suppressed-message,no-absolute-import,unpacking-in-except,apply-builtin,delslice-method,indexing-exception,old-raise-syntax,print-statement,cmp-builtin,reduce-builtin,useless-suppression,coerce-method,input-builtin,cmp-method,raw_input-builtin,nonzero-method,backtick,basestring-builtin,setslice-method,reload-builtin,oct-method,map-builtin-not-iterating,execfile-builtin,old-octal-literal,zip-builtin-not-iterating,buffer-builtin,getslice-method,metaclass-assignment,xrange-builtin,long-suffix,round-builtin,range-builtin-not-iterating,next-method-called,dict-iter-method,parameter-unpacking,unicode-builtin,unichr-builtin,import-star-module-level,raising-string,filter-builtin-not-iterating,old-ne-operator,using-cmp-argument,coerce-builtin,file-builtin,old-division,hex-method,invalid-unary-operand-type


[REPORTS]
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -14,7 +14,7 @@ cache:
env:
global:
- TRAVIS_CACHE=$HOME/.travis_cache/
- TRAVIS_NODE_VERSION="5.11"
- TRAVIS_NODE_VERSION="6.10.2"
matrix:
- TOX_ENV=javascript
- TOX_ENV=pylint
Expand All @@ -23,7 +23,7 @@ env:
- TOX_ENV=py27-mysql
- TOX_ENV=py27-sqlite
before_install:
- npm install -g npm@'>=3.9.5'
- npm install -g npm@'>=4.5.0'
before_script:
- mysql -e 'drop database if exists superset; create database superset DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci' -u root
- mysql -u root -e "CREATE USER 'mysqluser'@'localhost' IDENTIFIED BY 'mysqluserpassword';"
Expand Down
21 changes: 21 additions & 0 deletions superset/assets/.eslintrc
Expand Up @@ -17,5 +17,26 @@
"func-names": 0,
"react/jsx-no-bind": 0,
"no-confusing-arrow": 0,

"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/anchor-has-content": 0,
"react/require-default-props": 0,
"no-plusplus": 0,
"no-mixed-operators": 0,
"no-continue": 0,
"no-bitwise": 0,
"no-undef": 0,
"no-multi-assign": 0,
"react/no-array-index-key": 0,
"no-restricted-properties": 0,
"no-prototype-builtins": 0,
"jsx-a11y/href-no-hash": 0,
"react/forbid-prop-types": 0,
"class-methods-use-this": 0,
"import/no-named-as-default": 0,
"import/prefer-default-export": 0,
"react/no-unescaped-entities": 0,
"react/no-unused-prop-types": 0,
"react/no-string-refs": 0,
}
}
5 changes: 3 additions & 2 deletions superset/assets/javascripts/SqlLab/actions.js
@@ -1,6 +1,7 @@
/* global notify */
import shortid from 'shortid';
import { now } from '../modules/dates';

const $ = require('jquery');

export const RESET_STATE = 'RESET_STATE';
Expand Down Expand Up @@ -262,7 +263,7 @@ export function addTable(query, tableName, schemaName) {
queryEditorId: query.id,
schema: schemaName,
expanded: true,
}), dataPreviewQuery)
}), dataPreviewQuery),
);
// Run query to get preview data for table
dispatch(runQuery(dataPreviewQuery));
Expand All @@ -272,7 +273,7 @@ export function addTable(query, tableName, schemaName) {
addAlert({
msg: 'Error occurred while fetching metadata',
bsStyle: 'danger',
})
}),
);
});

Expand Down
Expand Up @@ -59,15 +59,9 @@ class AceEditorWrapper extends React.PureComponent {
this.setState({ sql: nextProps.sql });
}
}
textChange(text) {
this.setState({ sql: text });
}
onBlur() {
this.props.onBlur(this.state.sql);
}
getCompletions(aceEditor, session, pos, prefix, callback) {
callback(null, this.state.words);
}
onEditorLoad(editor) {
editor.commands.addCommand({
name: 'runQuery',
Expand All @@ -87,10 +81,10 @@ class AceEditorWrapper extends React.PureComponent {
let words = [];
const columns = {};
const tables = props.tables || [];
tables.forEach(t => {
tables.forEach((t) => {
words.push({ name: t.name, value: t.name, score: 55, meta: 'table' });
const cols = t.columns || [];
cols.forEach(col => {
cols.forEach((col) => {
columns[col.name] = null; // using an object as a unique set
});
});
Expand All @@ -107,6 +101,12 @@ class AceEditorWrapper extends React.PureComponent {
}
});
}
getCompletions(aceEditor, session, pos, prefix, callback) {
callback(null, this.state.words);
}
textChange(text) {
this.setState({ sql: text });
}
render() {
return (
<AceEditor
Expand Down
14 changes: 7 additions & 7 deletions superset/assets/javascripts/SqlLab/components/App.jsx
@@ -1,14 +1,14 @@
const $ = window.$ = require('jquery');
import * as Actions from '../actions';
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';

import TabbedSqlEditors from './TabbedSqlEditors';
import QueryAutoRefresh from './QueryAutoRefresh';
import QuerySearch from './QuerySearch';
import AlertsWrapper from '../../components/AlertsWrapper';
import * as Actions from '../actions';

import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
const $ = window.$ = require('jquery');

class App extends React.PureComponent {
constructor(props) {
Expand All @@ -28,6 +28,9 @@ class App extends React.PureComponent {
window.removeEventListener('hashchange', this.onHashChanged.bind(this));
window.removeEventListener('resize', this.handleResize.bind(this));
}
onHashChanged() {
this.setState({ hash: window.location.hash });
}
getHeight() {
const navHeight = 90;
const headerHeight = $('.nav-tabs').outerHeight() ?
Expand All @@ -39,9 +42,6 @@ class App extends React.PureComponent {
handleResize() {
this.setState({ contentHeight: this.getHeight() });
}
onHashChanged() {
this.setState({ hash: window.location.hash });
}
render() {
let content;
if (this.state.hash) {
Expand Down
70 changes: 33 additions & 37 deletions superset/assets/javascripts/SqlLab/components/ColumnElement.jsx
Expand Up @@ -17,43 +17,39 @@ const tooltipTitleMap = {
index: 'Index',
};

class ColumnElement extends React.PureComponent {
render() {
const col = this.props.column;
let name = col.name;
let icons;
if (col.keys && col.keys.length > 0) {
name = <strong>{col.name}</strong>;
icons = col.keys.map((key, i) => (
<span key={i} className="ColumnElement">
<OverlayTrigger
placement="right"
overlay={
<Tooltip id="idx-json" bsSize="lg">
<strong>{tooltipTitleMap[key.type]}</strong>
<hr />
<pre className="text-small">
{JSON.stringify(key, null, ' ')}
</pre>
</Tooltip>
}
>
<i className={`fa text-muted m-l-2 ${iconMap[key.type]}`} />
</OverlayTrigger>
</span>
));
}
return (
<div className="clearfix table-column">
<div className="pull-left m-l-10 col-name">
{name}{icons}
</div>
<div className="pull-right text-muted">
<small> {col.type}</small>
</div>
</div>);
export default function ColumnElement(props) {
const col = props.column;
let name = col.name;
let icons;
if (col.keys && col.keys.length > 0) {
name = <strong>{col.name}</strong>;
icons = col.keys.map((key, i) => (
<span key={i} className="ColumnElement">
<OverlayTrigger
placement="right"
overlay={
<Tooltip id="idx-json" bsSize="lg">
<strong>{tooltipTitleMap[key.type]}</strong>
<hr />
<pre className="text-small">
{JSON.stringify(key, null, ' ')}
</pre>
</Tooltip>
}
>
<i className={`fa text-muted m-l-2 ${iconMap[key.type]}`} />
</OverlayTrigger>
</span>
));
}
return (
<div className="clearfix table-column">
<div className="pull-left m-l-10 col-name">
{name}{icons}
</div>
<div className="pull-right text-muted">
<small> {col.type}</small>
</div>
</div>);
}
ColumnElement.propTypes = propTypes;

export default ColumnElement;
@@ -1,9 +1,9 @@
import * as Actions from '../actions';
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Modal } from 'react-bootstrap';

import * as Actions from '../actions';
import ResultSet from './ResultSet';

const propTypes = {
Expand Down
19 changes: 8 additions & 11 deletions superset/assets/javascripts/SqlLab/components/HighlightedSql.jsx
Expand Up @@ -25,38 +25,35 @@ class HighlightedSql extends React.Component {
};
}
shrinkSql() {
const props = this.props;
const sql = props.sql || '';
const sql = this.props.sql || '';
let lines = sql.split('\n');
if (lines.length >= props.maxLines) {
lines = lines.slice(0, props.maxLines);
if (lines.length >= this.props.maxLines) {
lines = lines.slice(0, this.props.maxLines);
lines.push('{...}');
}
return lines.map((line) => {
if (line.length > props.maxWidth) {
return line.slice(0, props.maxWidth) + '{...}';
if (line.length > this.props.maxWidth) {
return line.slice(0, this.props.maxWidth) + '{...}';
}
return line;
})
.join('\n');
}
triggerNode() {
const props = this.props;
let shownSql = props.shrink ? this.shrinkSql(props.sql) : props.sql;
const shownSql = this.props.shrink ? this.shrinkSql(this.props.sql) : this.props.sql;
return (
<SyntaxHighlighter language="sql" style={github}>
{shownSql}
</SyntaxHighlighter>);
}
generateModal() {
const props = this.props;
let rawSql;
if (props.rawSql && props.rawSql !== this.props.sql) {
if (this.props.rawSql && this.props.rawSql !== this.props.sql) {
rawSql = (
<div>
<h4>Raw SQL</h4>
<SyntaxHighlighter language="sql" style={github}>
{props.rawSql}
{this.props.rawSql}
</SyntaxHighlighter>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions superset/assets/javascripts/SqlLab/components/Link.jsx
Expand Up @@ -22,7 +22,7 @@ const defaultProps = {

class Link extends React.PureComponent {
render() {
let tooltip = (
const tooltip = (
<Tooltip id="tooltip">
{this.props.tooltip}
</Tooltip>
Expand All @@ -34,7 +34,7 @@ class Link extends React.PureComponent {
style={this.props.style}
className={'Link ' + this.props.className}
>
{this.props.children}
{this.props.children}
</a>
);
if (this.props.tooltip) {
Expand Down
Expand Up @@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import * as Actions from '../actions';

const $ = require('jquery');

const QUERY_UPDATE_FREQ = 2000;
const QUERY_UPDATE_BUFFER_MS = 5000;

Expand Down
@@ -1,7 +1,7 @@
import React from 'react';
import { Alert } from 'react-bootstrap';

import QueryTable from './QueryTable';
import { Alert } from 'react-bootstrap';

const propTypes = {
queries: React.PropTypes.array.isRequired,
Expand Down

0 comments on commit 366ecef

Please sign in to comment.