Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
42ac46c
[bugfix] fix context confusion in Slice
mistercrunch Apr 26, 2016
c0fb9ee
[bugfix] big_number doesn't fadeout on hover
mistercrunch Apr 26, 2016
a2f2ad8
add navigation, zoom to treemap (#396)
andrewhn Apr 26, 2016
ab64a26
fix img loading overlay in explore view (#403)
mistercrunch Apr 26, 2016
b634d03
Show only Slices and Dashboards users have access to (#404)
mistercrunch Apr 26, 2016
89d1a77
[hotfix] filter_immune_slices fix
mistercrunch Apr 27, 2016
54860a8
Adding reference to another docker image in READMEM
mistercrunch Apr 28, 2016
337c9d5
v0.8.9
mistercrunch Apr 28, 2016
bd47a29
CHANGELOG update
mistercrunch Apr 28, 2016
2198fd4
Adding badge for python versions
mistercrunch Apr 29, 2016
77e4d4b
Fixgin README link
mistercrunch Apr 29, 2016
b78ec54
Merge pull request #414 from airbnb/chris/fix-sunburst-level-trunc
williaster Apr 29, 2016
7b5b602
Use batch_alter_table to drop column in the migration script (#406)
x4base Apr 30, 2016
d7ea473
enable timerotateloghandler (configurable) (#311)
sid88in May 1, 2016
0ca3f5e
Improving SQLA query generation (#421)
mistercrunch May 2, 2016
26d2736
Allowing for druid post aggregations (#418)
mistercrunch May 2, 2016
ec7dbed
Blank theme (#419)
mistercrunch May 2, 2016
88c9516
Getting started on translations (#423)
mistercrunch May 2, 2016
9a08c45
add additional postgres and redshift time grains (#429)
itajaja May 3, 2016
a8d0ae1
Fix name of test script in contributing guide (#428)
itajaja May 3, 2016
a3a9ec9
[hotfix] piechart goes black on refresh (#424)
mistercrunch May 3, 2016
1d0863a
Rename the dummy variable _ to avoid conflict with lazy_gettext (#427)
x4base May 4, 2016
0bedaed
Make sure anonymous user with proper permissions can access data (#415)
asydorchuk May 4, 2016
a3f549b
Some chinese translations as a Proof of Concept (#435)
mistercrunch May 5, 2016
6941f1d
add unicode data to tests (#432)
andrewhn May 5, 2016
bc71707
Recursively get the dependency fields of post aggregators (#437)
x4base May 5, 2016
82fa501
Update Chinese translation (#438)
liaojunshuo May 5, 2016
d304ee0
Bugfix in line chart where the series name is an empty string (#434)
mistercrunch May 5, 2016
2f64c42
blacklist druid datasources to be refreshed because it takes forever …
sid88in May 6, 2016
c5fcbc0
Support hyperUniqueCardinality type in post aggregation (#451)
x4base May 10, 2016
a75d6bc
add timestamp toggle in chart options (Table Viz) (#439)
sid88in May 10, 2016
77e9e6a
Fixing issue #444 color function chokes on non-string param (#447)
mistercrunch May 10, 2016
c4e3020
Conververting datetime based on database dialects (#446)
mistercrunch May 10, 2016
d79089c
Improving the parallel coordinate viz (#452)
mistercrunch May 10, 2016
673cce9
Attempting to fix #412 (#430)
mistercrunch May 10, 2016
6c333d5
Fixing the missing searchbox bug (#431)
mistercrunch May 10, 2016
aa6e6bd
Allowing for templated urls in iFrame (#460)
mistercrunch May 12, 2016
52bbb38
Don't limit parallel coordinates table size (#455)
mistercrunch May 12, 2016
f28c2b2
Cosmetric tweaks in the CRUD list view (#458)
mistercrunch May 12, 2016
a0099ad
v0.9.0
mistercrunch May 12, 2016
d846cb3
Updating changelog
mistercrunch May 12, 2016
5a870fe
Mysql key length (#459)
x4base May 12, 2016
83e0e58
[hotfix] Druid explore/table dropdown doesn't change anything
mistercrunch May 16, 2016
d305679
[fixing the build] a new version of eslint is more picky
mistercrunch May 16, 2016
607e1f9
Fixing the build 2 out of 2
mistercrunch May 17, 2016
5c0e30e
Added Calendar Heatmap (#475)
georgeke May 17, 2016
2620aec
Fixing the heatmap calendar color ranges in the Welcome page (#474)
mistercrunch May 17, 2016
8a406b1
Add PUBLIC_ROLE_LIKE_GAMMA config flag (#473)
asydorchuk May 17, 2016
1766f6e
[hotfix] making druid_time_origin stick
mistercrunch May 17, 2016
d1f0276
Introducing Horizon charts (#472)
mistercrunch May 17, 2016
4738b01
[hotfix] setting default value for druid_time_origin
mistercrunch May 17, 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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*.pyc
changelog.sh
babel
.DS_Store
.coverage
_build
Expand Down
1,044 changes: 882 additions & 162 deletions CHANGELOG.md

Large diffs are not rendered by default.

46 changes: 41 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ npm run dev

Tests can then be run with:

./run_unit_tests.sh
./run_tests.sh

Lint the project with:

Expand All @@ -159,12 +159,12 @@ Generate the documentation with:
cd docs && ./build.sh

## CSS Themes
As part of the npm build process, CSS for Caravel is compiled from ```Less```, a dynamic stylesheet language.
As part of the npm build process, CSS for Caravel is compiled from `Less`, a dynamic stylesheet language.

It's possible to customize or add your own theme to Caravel, either by overriding CSS rules or preferably
by modifying the Less variables or files in ```assets/stylesheets/less/```.
by modifying the Less variables or files in `assets/stylesheets/less/`.

The ```variables.less``` and ```bootswatch.less``` files that ship with Caravel are derived from
The `variables.less` and `bootswatch.less` files that ship with Caravel are derived from
[Bootswatch](https://bootswatch.com) and thus extend Bootstrap. Modify variables in these files directly, or
swap them out entirely with the equivalent files from other Bootswatch (themes)[https://github.com/thomaspark/bootswatch.git]

Expand All @@ -179,7 +179,43 @@ meets these guidelines:
as part of the same PR. Doc string are often sufficient, make
sure to follow the sphinx compatible standards.
3. The pull request should work for Python 2.6, 2.7, and ideally python 3.3.
`from __future__ import ` will be required in every `.py` file soon.
``from __future__ import`` will be required in every `.py` file soon.
4. Code will be reviewed by re running the unittests, flake8 and syntax
should be as rigorous as the core Python project.
5. Please rebase and resolve all conflicts before submitting.


## Tranlations

We use [Babel](http://babel.pocoo.org/en/latest/) to translate Caravel. The
key is to instrument the strings that need translation using
`from flask.ext.babelpkg import lazy_gettext as _`. Once this is imported in
a module, all you have to do is to `_("Wrap your strings")` using the
underscore `_` "function".

To enable changing language in your environment, you can simply add the
`LANGUAGES` parameter to your `caravel_config.py`. Having more than one
options here will add a language selection dropdown on the right side of the
navigation bar.

LANGUAGES = {
'en': {'flag': 'us', 'name': 'English'},
'fr': {'flag': 'fr', 'name': 'French'},
'zh': {'flag': 'cn', 'name': 'Chinese'},
}

As per the [Flask AppBuilder documentation] about translation, to create a
new language dictionary, run the following command:

pybabel init -i ./babel/messages.pot -d caravel/translations -l es

Then it's a matter of running the statement bellow to gather all stings that
need translation

fabmanager babel-extract --target caravel/translations/

You can then translate the strings gathered in files located under
`caravel/translation`, where there's one per language. For the translations
to take effect, they need to be compiled using this command:

fabmanager babel-compile --target caravel/translations/
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Caravel
[![PyPI version](https://badge.fury.io/py/caravel.svg)](https://badge.fury.io/py/caravel)
[![Coverage Status](https://coveralls.io/repos/airbnb/caravel/badge.svg?branch=master&service=github)](https://coveralls.io/github/airbnb/caravel?branch=master)
[![Code Health](https://landscape.io/github/airbnb/caravel/master/landscape.svg?style=flat)](https://landscape.io/github/airbnb/caravel/master)
[![PyPI](https://img.shields.io/pypi/pyversions/caravel.svg?maxAge=2592000)](https://pypi.python.org/pypi/caravel)
[![Requirements Status](https://requires.io/github/airbnb/caravel/requirements.svg?branch=master)](https://requires.io/github/airbnb/caravel/requirements/?branch=master)
[![Join the chat at https://gitter.im/airbnb/caravel](https://badges.gitter.im/airbnb/caravel.svg)](https://gitter.im/airbnb/caravel?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Documentation](https://img.shields.io/badge/docs-airbnb.io-blue.svg)](http://airbnb.io/caravel/)
Expand Down Expand Up @@ -89,7 +90,8 @@ Resources
-------------
* [Caravel Google Group](https://groups.google.com/forum/#!forum/airbnb_caravel)
* [Gitter (live chat) Channel](https://gitter.im/airbnb/caravel)
* [Docker image](https://hub.docker.com/r/kochalex/caravel/) (community contributed)
* [Docker image 1](https://hub.docker.com/r/kochalex/caravel/)
[Docker image 2](https://hub.docker.com/r/amancevice/caravel/) (community contributed)
* [Slides from Strata (March 2016)](https://drive.google.com/open?id=0B5PVE0gzO81oOVJkdF9aNkJMSmM)


Expand Down
5 changes: 0 additions & 5 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ List of TODO items for Caravel
* **Dashboard URL filters:** `{dash_url}#fltin__fieldname__value1,value2`
* **Default slice:** choose a default slice for the dataset instead of
default endpoint
* **refresh freq**: specifying the refresh frequency of a dashboard and
specific slices within it, some randomization would be nice
* **Widget sets / chart grids:** a way to have all charts support making
a series of charts and putting them in a grid. The same way that you
can groupby for series, you could chart by. The form field set would be
Expand All @@ -27,8 +25,6 @@ List of TODO items for Caravel
some visualizations as annotations. An example of a layer might be
"holidays" or "site outages", ...
* **Slack integration** - TBD
* **Sexy Viz Selector:** the visualization selector should be a nice large
modal with nice thumbnails for each one of the viz
* **Comments:** allow for people to comment on slices and dashes


Expand All @@ -37,7 +33,6 @@ List of TODO items for Caravel
* CREATE VIEW button from SQL editor
* Test button for when editing SQL expression
* Slider form element
* datasource in explore mode could be a dropdown
* [druid] Allow for post aggregations (ratios!)
* in/notin filters autocomplete (druid)

Expand Down
4 changes: 4 additions & 0 deletions babel/babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ignore: caravel/assets/node_modules/**]
[python: caravel/**.py]
[jinja2: caravel/**/templates/**.html]
encoding = utf-8
117 changes: 117 additions & 0 deletions babel/messages.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Translations template for Caravel.
# Copyright (C) 2016 ORGANIZATION
# This file is distributed under the same license as the Caravel project.
# Maxime Beauchemin <maximebeauchemin @ gmail.com>, 2016.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-05-02 00:21-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"

#: caravel/models.py:564
msgid ""
"Datetime column not provided as part table configuration and is required "
"by this type of chart"
msgstr ""

#: caravel/models.py:1153
msgid "No data was returned."
msgstr ""

#: caravel/views.py:116
msgid ""
"Whether to make this column available as a [Time Granularity] option, "
"column has to be DATETIME or DATETIME-like"
msgstr ""

#: caravel/views.py:215
msgid "Databases"
msgstr ""

#: caravel/views.py:217 caravel/views.py:261 caravel/views.py:284
msgid "Sources"
msgstr ""

#: caravel/views.py:260
msgid "Tables"
msgstr ""

#: caravel/views.py:282
msgid "Druid Clusters"
msgstr ""

#: caravel/views.py:313
msgid "Slices"
msgstr ""

#: caravel/views.py:341
msgid ""
"This json object describes the positioning of the widgets in the "
"dashboard. It is dynamically generated when adjusting the widgets size "
"and positions by using drag & drop in the dashboard view"
msgstr ""

#: caravel/views.py:346
msgid ""
"The css for individual dashboards can be altered here, or in the "
"dashboard view where changes are immediately visible"
msgstr ""

#: caravel/views.py:367
msgid "Dashboards"
msgstr ""

#: caravel/views.py:392
msgid "Action Log"
msgstr ""

#: caravel/views.py:393
msgid "Security"
msgstr ""

#: caravel/views.py:430
msgid "Druid Datasources"
msgstr ""

#: caravel/views.py:514
msgid "The datasource seems to have been deleted"
msgstr ""

#: caravel/views.py:522
msgid "You don't seem to have access to this datasource"
msgstr ""

#: caravel/views.py:843
msgid "This view requires the `all_datasource_access` permission"
msgstr ""

#: caravel/views.py:954
msgid "CSS Templates"
msgstr ""

#: caravel/templates/appbuilder/navbar_right.html:34
msgid "Profile"
msgstr ""

#: caravel/templates/appbuilder/navbar_right.html:35
msgid "Logout"
msgstr ""

#: caravel/templates/appbuilder/navbar_right.html:40
msgid "Login"
msgstr ""

#: caravel/templates/caravel/welcome.html:8
#: caravel/templates/caravel/welcome.html:13
msgid "Welcome!"
msgstr ""

17 changes: 13 additions & 4 deletions caravel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import logging
import os
from logging.handlers import TimedRotatingFileHandler

from flask import Flask, redirect
from flask.ext.appbuilder import SQLA, AppBuilder, IndexView
Expand All @@ -20,10 +21,6 @@
APP_DIR = os.path.dirname(__file__)
CONFIG_MODULE = os.environ.get('CARAVEL_CONFIG', 'caravel.config')

# Logging configuration
logging.basicConfig(format='%(asctime)s:%(levelname)s:%(name)s:%(message)s')
logging.getLogger().setLevel(logging.DEBUG)

app = Flask(__name__)
app.config.from_object(CONFIG_MODULE)
if not app.debug:
Expand All @@ -37,6 +34,18 @@

migrate = Migrate(app, db, directory=APP_DIR + "/migrations")

# Logging configuration
logging.basicConfig(format=app.config.get('LOG_FORMAT'))
logging.getLogger().setLevel(app.config.get('LOG_LEVEL'))

if app.config.get('ENABLE_TIME_ROTATE'):
logging.getLogger().setLevel(app.config.get('TIME_ROTATE_LOG_LEVEL'))
handler = TimedRotatingFileHandler(app.config.get('FILENAME'),
when=app.config.get('ROLLOVER'),
interval=app.config.get('INTERVAL'),
backupCount=app.config.get('BACKUP_COUNT'))
logging.getLogger().addHandler(handler)


class MyIndexView(IndexView):
@expose('/')
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added caravel/assets/images/viz_thumbnails/horizon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion caravel/assets/javascripts/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ require('./caravel-select2.js');
require('../node_modules/gridster/dist/jquery.gridster.min.css');
require('../node_modules/gridster/dist/jquery.gridster.min.js');

require('../stylesheets/dashboard.css');

var Dashboard = function (dashboardData) {
var dashboard = $.extend(dashboardData, {
filters: {},
Expand Down Expand Up @@ -92,7 +94,7 @@ var Dashboard = function (dashboardData) {
fetchAndRender();
},
refreshExcept: function (slice_id) {
var immune = this.metadata.filter_immune_slice || [];
var immune = this.metadata.filter_immune_slices || [];
this.slices.forEach(function (slice) {
if (slice.data.slice_id !== slice_id && immune.indexOf(slice.data.slice_id) === -1) {
slice.render();
Expand Down
1 change: 1 addition & 0 deletions caravel/assets/javascripts/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require('../node_modules/bootstrap-toggle/js/bootstrap-toggle.min.js');

// css
require('../vendor/pygments.css');
require('../stylesheets/explore.css');
require('../node_modules/bootstrap-toggle/css/bootstrap-toggle.min.css');

var slice;
Expand Down
18 changes: 15 additions & 3 deletions caravel/assets/javascripts/modules/caravel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var $ = require('jquery');
var jQuery = $;
var d3 = require('d3');
var Mustache = require('mustache');

// vis sources
var sourceMap = {
Expand All @@ -26,7 +27,9 @@ var sourceMap = {
table: 'table.js',
word_cloud: 'word_cloud.js',
world_map: 'world_map.js',
treemap: 'treemap.js'
treemap: 'treemap.js',
cal_heatmap: 'cal_heatmap.js',
horizon: 'horizon.js'
};

var color = function () {
Expand All @@ -48,6 +51,7 @@ var color = function () {
var seen = {};
return function (s) {
if (!s) { return; }
s = String(s);
// next line is for caravel series that should have the same color
s = s.replace('---', '');
if (seen[s] === undefined) {
Expand Down Expand Up @@ -214,6 +218,13 @@ var px = (function () {
getWidgetHeader: function () {
return this.container.parents("li.widget").find(".chart-header");
},
render_template: function (s) {
var context = {
width: this.width,
height: this.height
};
return Mustache.render(s, context);
},
jsonEndpoint: function () {
var parser = document.createElement('a');
parser.href = data.json_endpoint;
Expand Down Expand Up @@ -301,6 +312,7 @@ var px = (function () {
},
bindResizeToWindowResize: function () {
var resizeTimer;
var slice = this;
$(window).on('resize', function (e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
Expand All @@ -314,7 +326,7 @@ var px = (function () {
}
this.force = force;
token.find("img.loading").show();
container.css('height', slice.height());
container.css('height', this.height());
dttm = 0;
timer = setInterval(stopwatch, 10);
$('#timer').removeClass('btn-danger btn-success');
Expand All @@ -323,7 +335,7 @@ var px = (function () {
},
resize: function () {
token.find("img.loading").show();
container.css('height', slice.height());
container.css('height', this.height());
this.viz.render();
this.viz.resize();
},
Expand Down
Loading