Skip to content

Commit

Permalink
Merge branch 'superset_official/master' into combine_metrics
Browse files Browse the repository at this point in the history
# Conflicts:
#	superset/assets/javascripts/explore/stores/visTypes.js
  • Loading branch information
roganw committed Jul 26, 2017
2 parents 675f575 + 6045063 commit e884578
Show file tree
Hide file tree
Showing 36 changed files with 404 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
repo_token: eESbYiv4An6KEvjpmguDs4L7YkubXbqn1
repo_token: 4P9MpvLrZfJKzHdGZsdV3MzO43OZJgYFn
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cache:
env:
global:
- TRAVIS_CACHE=$HOME/.travis_cache/
- TRAVIS_NODE_VERSION="6.10.2"
- TRAVIS_NODE_VERSION="7.10.0"
matrix:
- TOX_ENV=javascript
- TOX_ENV=pylint
Expand All @@ -19,7 +19,7 @@ env:
- TOX_ENV=py27-mysql
- TOX_ENV=py27-sqlite
before_install:
- npm install -g npm@'>=4.5.0'
- npm install -g npm@'>=5.0.3'
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
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,13 @@ To install third party libraries defined in `package.json`, run the
following within the `superset/assets/` directory which will install them in a
new `node_modules/` folder within `assets/`.

```
npm install
```bash
# from the root of the repository, move to where our JS package.json lives
cd superset/assets/
# install yarn, a replacement for `npm install` that is faster and more deterministic
npm install -g yarn
# run yarn to fetch all the dependencies
yarn
```

To parse and generate bundled files for superset, run either of the
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
Superset
=========

[![Build Status](https://travis-ci.org/airbnb/superset.svg?branch=master)](https://travis-ci.org/airbnb/superset)
[![Build Status](https://travis-ci.org/apache/incubator-superset.svg?branch=master)](https://travis-ci.org/apache/incubator-superset)
[![PyPI version](https://badge.fury.io/py/superset.svg)](https://badge.fury.io/py/superset)
[![Coverage Status](https://coveralls.io/repos/airbnb/superset/badge.svg?branch=master&service=github)](https://coveralls.io/github/airbnb/superset?branch=master)
[![JS Test Coverage](https://codeclimate.com/github/airbnb/superset/badges/coverage.svg)](https://codeclimate.com/github/airbnb/superset/coverage)
[![Code Health](https://landscape.io/github/airbnb/superset/master/landscape.svg?style=flat)](https://landscape.io/github/airbnb/superset/master)
[![Code Climate](https://codeclimate.com/github/airbnb/superset/badges/gpa.svg)](https://codeclimate.com/github/airbnb/superset)
[![Coverage Status](https://coveralls.io/repos/apache/incubator-superset/badge.svg?branch=master&service=github)](https://coveralls.io/github/apache/incubator-superset?branch=master)
[![PyPI](https://img.shields.io/pypi/pyversions/superset.svg?maxAge=2592000)](https://pypi.python.org/pypi/superset)
[![Requirements Status](https://requires.io/github/airbnb/superset/requirements.svg?branch=master)](https://requires.io/github/airbnb/superset/requirements/?branch=master)
[![Join the chat at https://gitter.im/airbnb/superset](https://badges.gitter.im/airbnb/superset.svg)](https://gitter.im/airbnb/superset?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Requirements Status](https://requires.io/github/apache/incubator-superset/requirements.svg?branch=master)](https://requires.io/github/apache/incubator-superset/requirements/?branch=master)
[![Join the chat at https://gitter.im/apache/incubator-superset](https://badges.gitter.im/apache/incubator-superset.svg)](https://gitter.im/apache/incubator-superset?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Documentation](https://img.shields.io/badge/docs-apache.org-blue.svg)](https://superset.incubator.apache.org)
[![dependencies Status](https://david-dm.org/airbnb/superset/status.svg?path=superset/assets)](https://david-dm.org/airbnb/superset?path=superset/assets)
[![dependencies Status](https://david-dm.org/apache/incubator-superset/status.svg?path=superset/assets)](https://david-dm.org/apache/incubator-superset?path=superset/assets)

<img
src="https://cloud.githubusercontent.com/assets/130878/20946612/49a8a25c-bbc0-11e6-8314-10bef902af51.png"
Expand Down Expand Up @@ -176,6 +173,7 @@ the world know they are using Superset. Join our growing community!
- [Brilliant.org](https://brilliant.org/)
- [Clark.de](http://clark.de/)
- [Digit Game Studios](https://www.digitgaming.com/)
- [Douban](https://www.douban.com/)
- [Endress+Hauser](http://www.endress.com/)
- [FBK - ICT center](http://ict.fbk.eu)
- [Faasos](http://faasos.com/)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions superset/assets/javascripts/components/EditableTitle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class EditableTitle extends React.PureComponent {
this.handleClick = this.handleClick.bind(this);
this.handleBlur = this.handleBlur.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleKeyPress = this.handleKeyPress.bind(this);
}
handleClick() {
if (!this.props.canEdit) {
Expand Down Expand Up @@ -58,6 +59,13 @@ class EditableTitle extends React.PureComponent {
title: ev.target.value,
});
}
handleKeyPress(ev) {
if (ev.key === 'Enter') {
ev.preventDefault();

this.handleBlur();
}
}
render() {
return (
<span className="editable-title">
Expand All @@ -72,6 +80,7 @@ class EditableTitle extends React.PureComponent {
onChange={this.handleChange}
onBlur={this.handleBlur}
onClick={this.handleClick}
onKeyPress={this.handleKeyPress}
/>
</TooltipWrapper>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class ChartContainer extends React.PureComponent {

<TooltipWrapper
label="edit-desc"
tooltip="Edit Description"
tooltip="Edit slice properties"
>
<a
className="edit-desc-icon"
Expand Down Expand Up @@ -341,7 +341,7 @@ function mapStateToProps(state) {
table_name: formData.datasource_name,
viz_type: formData.viz_type,
triggerRender: state.triggerRender,
datasourceType: state.datasource_type,
datasourceType: state.datasource.type,
datasourceId: state.datasource_id,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Alert } from 'react-bootstrap';
import { sectionsToRender } from '../stores/visTypes';
import { sectionsToRender, visTypes } from '../stores/visTypes';
import ControlPanelSection from './ControlPanelSection';
import ControlRow from './ControlRow';
import Control from './Control';
Expand All @@ -28,7 +28,15 @@ class ControlPanelsContainer extends React.Component {
this.getControlData = this.getControlData.bind(this);
}
getControlData(controlName) {
const mapF = controls[controlName].mapStateToProps;
// Identifying mapStateToProps function to apply (logic can't be in store)
let mapF = controls[controlName].mapStateToProps;

// Looking to find mapStateToProps override for this viz type
const controlOverrides = visTypes[this.props.controls.viz_type.value].controlOverrides || {};
if (controlOverrides[controlName] && controlOverrides[controlName].mapStateToProps) {
mapF = controlOverrides[controlName].mapStateToProps;
}
// Applying mapStateToProps if needed
if (mapF) {
return Object.assign({}, this.props.controls[controlName], mapF(this.props.exploreState));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function mapStateToProps(state) {
const form_data = getFormDataFromControls(state.controls);
return {
chartStatus: state.chartStatus,
datasource_type: state.datasource_type,
datasource_type: state.datasource.type,
controls: state.controls,
form_data,
standalone: state.standalone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export default class SelectControl extends React.PureComponent {
this.onChange = this.onChange.bind(this);
}
componentWillReceiveProps(nextProps) {
if (nextProps.choices !== this.props.choices) {
if (nextProps.choices !== this.props.choices ||
nextProps.options !== this.props.options) {
const options = this.getOptions(nextProps);
this.setState({ options });
}
Expand Down
31 changes: 29 additions & 2 deletions superset/assets/javascripts/explore/stores/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const controls = {
isLoading: true,
clearable: false,
default: null,
validators: [v.nonEmpty],
mapStateToProps: (state) => {
const datasources = state.datasources || [];
return {
Expand Down Expand Up @@ -217,6 +218,14 @@ export const controls = {
description: null,
},

pivot_margins: {
type: 'CheckboxControl',
label: 'Show totals',
renderTrigger: false,
default: true,
description: 'Display total row/column',
},

show_markers: {
type: 'CheckboxControl',
label: 'Show Markers',
Expand Down Expand Up @@ -333,7 +342,7 @@ export const controls = {
valueRenderer: c => <ColumnOption column={c} />,
valueKey: 'column_name',
mapStateToProps: state => ({
options: (state.datasource) ? state.datasource.columns : [],
options: (state.datasource) ? state.datasource.columns.filter(c => c.groupby) : [],
}),
},

Expand Down Expand Up @@ -666,7 +675,7 @@ export const controls = {
label: 'Entity',
default: null,
validators: [v.nonEmpty],
description: 'This define the element to be plotted on the chart',
description: 'This defines the element to be plotted on the chart',
mapStateToProps: state => ({
choices: (state.datasource) ? state.datasource.gb_cols : [],
}),
Expand Down Expand Up @@ -1280,5 +1289,23 @@ export const controls = {
hidden: true,
description: 'The number of seconds before expiring the cache',
},

order_by_entity: {
type: 'CheckboxControl',
label: 'Order by entity id',
description: 'Important! Select this if the table is not already sorted by entity id, ' +
'else there is no guarantee that all events for each entity are returned.',
default: true,
},

min_leaf_node_event_count: {
type: 'SelectControl',
freeForm: false,
label: 'Minimum leaf node event count',
default: 1,
choices: formatSelectOptionsForRange(1, 10),
description: 'Leaf nodes that represent fewer than this number of events will be initially ' +
'hidden in the visualization',
},
};
export default controls;
67 changes: 62 additions & 5 deletions superset/assets/javascripts/explore/stores/visTypes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { D3_TIME_FORMAT_OPTIONS } from './controls';

import * as v from '../validators';

export const sections = {
Expand Down Expand Up @@ -76,7 +75,7 @@ export const sections = {
],
};

const visTypes = {
export const visTypes = {
dist_bar: {
label: 'Distribution - Bar Chart',
controlPanelSections: [
Expand Down Expand Up @@ -338,7 +337,7 @@ const visTypes = {
controlSetRows: [
['groupby', 'columns'],
['metrics', 'pandas_aggfunc'],
['number_format', 'combine_metric'],
['number_format', 'combine_metric', 'pivot_margins'],
],
},
],
Expand Down Expand Up @@ -743,8 +742,13 @@ const visTypes = {
controlOverrides: {
groupby: {
label: 'Filter controls',
description: 'The controls you want to filter on',
default: [],
description: (
'The controls you want to filter on. Note that only columns ' +
'checked as "filterable" will show up on this list.'
),
mapStateToProps: state => ({
options: (state.datasource) ? state.datasource.columns.filter(c => c.filterable) : [],
}),
},
},
},
Expand Down Expand Up @@ -798,6 +802,14 @@ const visTypes = {
],
},
],
controlOverrides: {
all_columns_x: {
validators: [v.nonEmpty],
},
all_columns_y: {
validators: [v.nonEmpty],
},
},
},

horizon: {
Expand Down Expand Up @@ -882,6 +894,51 @@ const visTypes = {
},
},
},

event_flow: {
label: 'Event flow',
requiresTime: true,
controlPanelSections: [
{
label: 'Event definition',
controlSetRows: [
['entity'],
['all_columns_x'],
['row_limit'],
['order_by_entity'],
['min_leaf_node_event_count'],
],
},
{
label: 'Additional meta data',
controlSetRows: [
['all_columns'],
],
},
],
controlOverrides: {
entity: {
label: 'Column containing entity ids',
description: 'e.g., a "user id" column',
},
all_columns_x: {
label: 'Column containing event names',
validators: [v.nonEmpty],
default: control => (
control.choices && control.choices.length > 0 ?
control.choices[0][0] : null
),
},
row_limit: {
label: 'Event count limit',
description: 'The maximum number of events to return, equivalent to number of rows',
},
all_columns: {
label: 'Meta data',
description: 'Select any columns for meta data inspection',
},
},
},
};

export default visTypes;
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/javascripts/modules/superset.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { QUERY_TIMEOUT_THRESHOLD } from '../constants';

const utils = require('./utils');

/* eslint wrap-iife: 0*/
/* eslint wrap-iife: 0 */
const px = function () {
let slice;
function getParam(name) {
Expand Down
3 changes: 2 additions & 1 deletion superset/assets/js_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set -e
cd "$(dirname "$0")"
npm --version
node --version
npm install
npm install -g yarn
yarn
npm run sync-backend
npm run lint
npm run test
Expand Down
4 changes: 2 additions & 2 deletions superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
},
"homepage": "https://github.com/airbnb/superset#readme",
"dependencies": {
"@data-ui/event-flow": "0.0.4",
"babel-register": "^6.24.1",
"bootstrap": "^3.3.6",
"brace": "^0.10.0",
Expand All @@ -56,7 +57,6 @@
"jquery": "^3.2.1",
"jsdom": "9.12.0",
"lodash.throttle": "^4.1.1",
"mapbox-gl": "^0.26.0",
"moment": "^2.14.1",
"mustache": "^2.2.1",
"nvd3": "1.8.5",
Expand All @@ -71,7 +71,7 @@
"react-dom": "^15.5.1",
"react-gravatar": "^2.6.1",
"react-grid-layout": "^0.14.4",
"react-map-gl": "^1.7.0",
"react-map-gl": "^2.0.3",
"react-redux": "^5.0.2",
"react-resizable": "^1.3.3",
"react-select": "1.0.0-rc.3",
Expand Down
Loading

0 comments on commit e884578

Please sign in to comment.