Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0feb0ac
modify travis tests to create user with password for mysql and postgr…
dennisobrien Sep 12, 2016
0debcee
added set_sqlalchemy_uri which stores a password-masked version in th…
dennisobrien Sep 14, 2016
a2f2c66
broke the comment into two lines to make linting happy
dennisobrien Sep 14, 2016
1cf298d
fixed trailing whitespace
dennisobrien Sep 14, 2016
01d1c13
fixed a spelling mistake and removed a commented line.
dennisobrien Sep 15, 2016
c795eb9
Incorporate the tests from PR #694 which addresses #596
dennisobrien Sep 15, 2016
cdb621a
handle the case when a uri is passed but a database name is not
dennisobrien Sep 15, 2016
78588d5
remove the test using the hard-coded sqlalchemy uri.
dennisobrien Sep 15, 2016
8c91119
simplify the logic in testconn. thanks @xrmx
dennisobrien Sep 15, 2016
6ca1fd9
[sqllab] hide SqlEditor textarea to prevent flicker
mistercrunch Sep 12, 2016
b9d1abb
Single quote filter values with comma (#1084)
vera-liu Sep 12, 2016
5fcb6e9
[sql lab] specify schema name when generating vanila query (#1096)
mistercrunch Sep 13, 2016
47c7435
Time grain support for unix-timestamp columns (#1093)
yejianye Sep 13, 2016
55145f5
Clean up the druid sync api. (#1101)
bkyryliuk Sep 14, 2016
4f64ca0
[bugfix] filter_immune_slices doesn't work (#1110)
mistercrunch Sep 14, 2016
a0c3012
Animated GIFs on README (#1109)
mistercrunch Sep 14, 2016
aa81482
[bugfix] namespacing the mapbox css
mistercrunch Sep 15, 2016
8e661e8
When the label size is too short, the constant for calculating (#1120)
vera-liu Sep 15, 2016
c4458ee
Associate version to entry files (#1060)
vera-liu Sep 16, 2016
a38a927
[explore] clarifying force-refresh message
mistercrunch Sep 16, 2016
11af4ff
Fixing druid culster perms to mirror sqla databases (#1123)
mistercrunch Sep 16, 2016
190e0d5
[welcome] removing calendar heatmap from welcome page (#1119)
mistercrunch Sep 16, 2016
b492541
[hotfix] lint
mistercrunch Sep 16, 2016
e25f0c1
Apply stretchMargin only to distribution bar (#1124)
vera-liu Sep 16, 2016
7bfff03
[explore] giving more room to Slice title (#1118)
mistercrunch Sep 16, 2016
2542fc8
[security] prevent XSS on FAB list views (#1125)
mistercrunch Sep 16, 2016
1a1d387
Fix double escaping of dttm expressions (#744) (#1103)
xrmx Sep 17, 2016
98da9a0
Make sql test connection work with saved Database instance (#694)
xrmx Sep 17, 2016
48d8f83
added set_sqlalchemy_uri which stores a password-masked version in th…
dennisobrien Sep 14, 2016
f95fb0f
added a newline
dennisobrien Sep 19, 2016
4397328
added set_sqlalchemy_uri which stores a password-masked version in th…
dennisobrien Sep 14, 2016
b26a949
fixing this comment line again
dennisobrien Sep 19, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ before_install:
- npm install -g npm@'>=3.9.5'
before_script:
- mysql -e 'drop database if exists caravel; create database caravel DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci' -u root
- mysql -u root -e "CREATE USER 'mysqluser'@'localhost' IDENTIFIED BY 'mysqluserpassword';"
- mysql -u root -e "GRANT ALL ON caravel.* TO 'mysqluser'@'localhost';"
- psql -c 'create database caravel;' -U postgres
- psql -c "CREATE USER postgresuser WITH PASSWORD 'password';" -U postgres
- export PATH=${PATH}:/tmp/hive/bin
install:
- pip install --upgrade pip
Expand Down
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@ and interactive.
[this project used to be named **Panoramix**]


Video - Introduction to Caravel
---------------------------------
[![Caravel - ](http://img.youtube.com/vi/3Txm_nj_R7M/0.jpg)](http://www.youtube.com/watch?v=3Txm_nj_R7M)
Screenshots & Gifs
------------------
![img](http://g.recordit.co/xFXSvaGUts.gif)

Screenshots
------------
---
![img](http://g.recordit.co/uZggYOdR5g.gif)

---
![img](http://g.recordit.co/U70FWLpLvh.gif)

---
![img](http://i.imgur.com/x8t30YU.png)

---
![img](http://i.imgur.com/DRCnbq6.png)

Caravel
Expand Down Expand Up @@ -83,11 +90,23 @@ More screenshots
----------------

![img](http://i.imgur.com/SAhDJCI.png)

---
![img](http://i.imgur.com/iuLpv1c.png)

---
![img](http://i.imgur.com/V2FWeZx.png)

---
![img](http://i.imgur.com/BeUtCzF.png)

---
![img](http://i.imgur.com/phoY7jI.png)

---
![img](http://i.imgur.com/NvIDgdC.png)

---
![img](http://i.imgur.com/DzwYyns.png)


Expand Down
3 changes: 0 additions & 3 deletions caravel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
from flask_cache import Cache
from flask_migrate import Migrate

from caravel import version

VERSION = version.VERSION_STRING

APP_DIR = os.path.dirname(__file__)
CONFIG_MODULE = os.environ.get('CARAVEL_CONFIG', 'caravel.config')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class QueryAutoRefresh extends React.Component {
}
QueryAutoRefresh.propTypes = {
actions: React.PropTypes.object,
queriesLastUpdate: React.PropTypes.integer,
networkOn: React.PropTypes.boolean,
queriesLastUpdate: React.PropTypes.number,
networkOn: React.PropTypes.bool,
};
QueryAutoRefresh.defaultProps = {
// queries: null,
Expand Down
4 changes: 2 additions & 2 deletions caravel/assets/javascripts/SqlLab/components/ResultSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class ResultSet extends React.Component {
}
ResultSet.propTypes = {
query: React.PropTypes.object,
showControls: React.PropTypes.boolean,
search: React.PropTypes.boolean,
showControls: React.PropTypes.bool,
search: React.PropTypes.bool,
searchText: React.PropTypes.string,
};
ResultSet.defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ SqlEditorTopToolbar.propTypes = {
queryEditor: React.PropTypes.object,
tables: React.PropTypes.array,
actions: React.PropTypes.object,
networkOn: React.PropTypes.boolean,
networkOn: React.PropTypes.bool,
};

SqlEditorTopToolbar.defaultProps = {
Expand Down
4 changes: 2 additions & 2 deletions caravel/assets/javascripts/SqlLab/components/SqlShrink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ SqlShrink.defaultProps = {

SqlShrink.propTypes = {
sql: React.PropTypes.string,
maxWidth: React.PropTypes.integer,
maxLines: React.PropTypes.integer,
maxWidth: React.PropTypes.number,
maxLines: React.PropTypes.number,
};

export default SqlShrink;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ class TableElement extends React.Component {
cols += ', ';
}
});
return `SELECT ${cols}\nFROM ${this.props.table.name}`;
let tableName = this.props.table.name;
if (this.props.table.schema) {
tableName = this.props.table.schema + '.' + tableName;
}
return `SELECT ${cols}\nFROM ${tableName}`;
}

popSelectStar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class VisualizeModal extends React.Component {
columns: {},
hints: [],
};
}
componentDidMount() {
this.validate();
}
validate() {
Expand Down Expand Up @@ -135,8 +137,8 @@ class VisualizeModal extends React.Component {
/>
),
}));
const alerts = this.state.hints.map((hint) => (
<Alert bsStyle="warning">{hint}</Alert>
const alerts = this.state.hints.map((hint, i) => (
<Alert bsStyle="warning" key={i}>{hint}</Alert>
));
const modal = (
<div className="VisualizeModal">
Expand Down Expand Up @@ -191,11 +193,12 @@ class VisualizeModal extends React.Component {
}
VisualizeModal.propTypes = {
query: React.PropTypes.object,
show: React.PropTypes.boolean,
show: React.PropTypes.bool,
onHide: React.PropTypes.function,
};
VisualizeModal.defaultProps = {
show: false,
onHide: () => {},
};

function mapStateToProps() {
Expand Down
3 changes: 3 additions & 0 deletions caravel/assets/javascripts/SqlLab/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,6 @@ div.tablePopover:hover {
.SouthPane .tab-content {
padding-top: 10px;
}
.SqlEditor textarea {
display: none;
}
2 changes: 1 addition & 1 deletion caravel/assets/javascripts/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function dashboardContainer(dashboardData) {
refreshExcept(sliceId) {
const immune = this.metadata.filter_immune_slices || [];
this.slices.forEach(function (slice) {
if (slice.data.slice_id !== sliceId && immune.indexOf(slice.data.sliceId) === -1) {
if (slice.data.slice_id !== sliceId && immune.indexOf(slice.data.slice_id) === -1) {
slice.render();
}
});
Expand Down
5 changes: 3 additions & 2 deletions caravel/assets/javascripts/modules/caravel.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ const px = function () {
cachedSelector = $('#is_cached');
if (data !== undefined && data.is_cached) {
cachedSelector
.attr('title',
'Served from data cached at ' + data.cached_dttm + '. Click to force-refresh')
.attr(
'title',
`Served from data cached at ${data.cached_dttm}. Click [Query] to force-refresh`)
.show()
.tooltip('fixTitle');
} else {
Expand Down
29 changes: 0 additions & 29 deletions caravel/assets/javascripts/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ require('../stylesheets/welcome.css');
require('bootstrap');
require('datatables.net-bs');
require('../node_modules/datatables-bootstrap3-plugin/media/css/datatables-bootstrap3.css');
require('../node_modules/cal-heatmap/cal-heatmap.css');
const d3 = require('d3');
const CalHeatMap = require('cal-heatmap');
function modelViewTable(selector, modelView, orderCol, order) {
// Builds a dataTable from a flask appbuilder api endpoint
let url = '/' + modelView.toLowerCase() + '/api/read';
Expand Down Expand Up @@ -51,32 +49,5 @@ function modelViewTable(selector, modelView, orderCol, order) {
});
}
$(document).ready(function () {
d3.json('/caravel/activity_per_day', function (json) {
const ext = d3.extent(d3.values(json));
const cal = new CalHeatMap();
const range = 10;
const legendBounds = [];
const step = (ext[1] - ext[0]) / (range - 1);
for (let i = 0; i < range; i++) {
legendBounds.push(i * step + ext[0]);
}
cal.init({
start: new Date().setFullYear(new Date().getFullYear() - 1),
range: 13,
data: json,
legend: legendBounds,
legendColors: [
'#D6E685',
'#1E6823',
],
domain: 'month',
subDomain: 'day',
itemName: 'action',
tooltip: true,
cellSize: 10,
cellPadding: 2,
domainGutter: 22,
});
});
modelViewTable('#dash_table', 'DashboardModelViewAsync', 'changed_on', 'desc');
});
2 changes: 1 addition & 1 deletion caravel/assets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "caravel",
"version": "0.1.0",
"version": "0.10.0",
"description": "Caravel is a data exploration platform designed to be visual, intuitive, and interactive.",
"directories": {
"doc": "docs",
Expand Down
6 changes: 3 additions & 3 deletions caravel/assets/visualizations/mapbox.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
div.widget .slice_container {
.mapbox div.widget .slice_container {
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
overflow: hidden;
}

div.widget .slice_container:active {
.mapbox div.widget .slice_container:active {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}

.slice_container div {
.mapbox .slice_container div {
padding-top: 0px;
}
5 changes: 5 additions & 0 deletions caravel/assets/visualizations/nvd3_vis.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ text.nv-axislabel {

.dist_bar svg.nvd3-svg {
width: auto;
font-size: 14px;
}

.nv-x text{
font-size: 12px;
}

.bar .slice_container {
Expand Down
22 changes: 14 additions & 8 deletions caravel/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ function nvd3Vis(slice) {

// Calculates the longest label size for stretching bottom margin
function calculateStretchMargins(payloadData) {
const axisLabels = payloadData.data[0].values;
let stretchMargin = 0;
const pixelsPerCharX = 4.5; // approx, depends on font size
let maxLabelSize = 0;
for (let i = 0; i < axisLabels.length; i++) {
maxLabelSize = Math.max(axisLabels[i].x.length, maxLabelSize);
}
stretchMargin = Math.ceil(Math.max(stretchMargin, pixelsPerCharX * maxLabelSize));
let maxLabelSize = 10; // accomodate for shorter labels
payloadData.data.forEach((d) => {
const axisLabels = d.values;
for (let i = 0; i < axisLabels.length; i++) {
maxLabelSize = Math.max(axisLabels[i].x.length, maxLabelSize);
}
});
stretchMargin = Math.ceil(pixelsPerCharX * maxLabelSize);
return stretchMargin;
}

Expand Down Expand Up @@ -310,8 +312,12 @@ function nvd3Vis(slice) {
}

if (fd.bottom_margin === 'auto') {
const stretchMargin = calculateStretchMargins(payload);
chart.margin({ bottom: stretchMargin });
if (vizType === 'dist_bar') {
const stretchMargin = calculateStretchMargins(payload);
chart.margin({ bottom: stretchMargin });
} else {
chart.margin({ bottom: 50 });
}
} else {
chart.margin({ bottom: fd.bottom_margin });
}
Expand Down
5 changes: 4 additions & 1 deletion caravel/assets/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');

// input dir
const APP_DIR = path.resolve(__dirname, './');

// output dir
const BUILD_DIR = path.resolve(__dirname, './dist');

const VERSION_STRING = JSON.parse(fs.readFileSync('package.json')).version;

const config = {
entry: {
'css-theme': APP_DIR + '/javascripts/css-theme.js',
Expand All @@ -19,7 +22,7 @@ const config = {
},
output: {
path: BUILD_DIR,
filename: '[name].entry.js',
filename: `[name].${VERSION_STRING}.entry.js`,
},
resolve: {
extensions: [
Expand Down
2 changes: 1 addition & 1 deletion caravel/bin/caravel
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def version(verbose):
"-----------------------\n"
"Caravel {version}\n"
"-----------------------").format(
boat=ascii_art.boat, version=caravel.VERSION)
boat=ascii_art.boat, version=config.get('VERSION_STRING'))
print(s)
if verbose:
print("[DB] : " + "{}".format(db.engine))
Expand Down
7 changes: 7 additions & 0 deletions caravel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caravel import app

import json
import os

from dateutil import tz
Expand All @@ -22,6 +24,11 @@
# ---------------------------------------------------------
# Caravel specific config
# ---------------------------------------------------------
PACKAGE_DIR = os.path.join(BASE_DIR, 'static', 'assets')
PACKAGE_FILE = os.path.join(PACKAGE_DIR, 'package.json')
with open(PACKAGE_FILE) as package_file:
VERSION_STRING = json.load(package_file)['version']

ROW_LIMIT = 50000
CARAVEL_WORKERS = 16

Expand Down
Binary file modified caravel/data/energy.json.gz
Binary file not shown.
Loading