Skip to content

Commit

Permalink
Merge branch 'master' into api-docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
arikfr authored Jan 26, 2017
2 parents 4e06a38 + a5d7351 commit 39c4e1c
Show file tree
Hide file tree
Showing 65 changed files with 777 additions and 304 deletions.
22 changes: 22 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
engines:
pep8:
enabled: true
eslint:
enabled: true
channel: "eslint-3"
config:
config: client/.eslintrc.js
checks:
import/no-unresolved:
enabled: false
ratings:
paths:
- "redash/**/*.py"
- "client/**/*.js"
exclude_paths:
- tests/**/*.py
- migrations/**/*.py
- old_migrations/**/*.py
- setup/**/*
- bin/**/*

4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
client/.tmp/
client/node_modules/
node_modules/
.tmp/
.git/
.vagrant/
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ venv

dump.rdb

# Docker related
docker-compose.yml

node_modules
.tmp
.sass-cache
Expand Down
2 changes: 0 additions & 2 deletions .landscape.yaml

This file was deleted.

55 changes: 7 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,10 @@
FROM ubuntu:trusty
FROM redash/base:latest

# Ubuntu packages
RUN apt-get update && \
apt-get install -y python-pip python-dev curl build-essential pwgen libffi-dev sudo git-core wget \
# Postgres client
libpq-dev \
# Additional packages required for data sources:
libssl-dev libmysqlclient-dev freetds-dev libsasl2-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# We first copy only the requirements file, to avoid rebuilding on every file
# change.
COPY requirements.txt requirements_dev.txt requirements_all_ds.txt ./
RUN pip install -r requirements.txt -r requirements_dev.txt -r requirements_all_ds.txt

# Users creation
RUN useradd --system --comment " " --create-home redash
COPY . ./

# Pip requirements for all data source types
RUN pip install -U setuptools==23.1.0 && \
pip install supervisor==3.1.2

COPY . /opt/redash/current
RUN chown -R redash /opt/redash/current

# Setting working directory
WORKDIR /opt/redash/current

# Install project specific dependencies
RUN pip install -r requirements_all_ds.txt && \
pip install -r requirements.txt

RUN curl https://deb.nodesource.com/setup_4.x | bash - && \
apt-get install -y nodejs && \
sudo -u redash -H make deps && \
rm -rf node_modules client/node_modules /home/redash/.npm /home/redash/.cache && \
apt-get purge -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Setup supervisord
RUN mkdir -p /opt/redash/supervisord && \
mkdir -p /opt/redash/logs && \
cp /opt/redash/current/setup/docker/supervisord/supervisord.conf /opt/redash/supervisord/supervisord.conf

# Fix permissions
RUN chown -R redash /opt/redash

# Expose ports
EXPOSE 5000
EXPOSE 9001

# Startup script
CMD ["supervisord", "-c", "/opt/redash/supervisord/supervisord.conf"]
ENTRYPOINT ["/app/bin/docker-entrypoint"]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ BASE_VERSION=$(shell python ./manage.py version | cut -d + -f 1)
FILENAME=$(CIRCLE_ARTIFACTS)/$(NAME).$(VERSION).tar.gz

deps:
if [ -d "./client/app" ]; then cd client && npm install; fi
if [ -d "./client/app" ]; then cd client && npm run build; fi
if [ -d "./client/app" ]; then npm install; fi
if [ -d "./client/app" ]; then npm run build; fi

pack:
sed -ri "s/^__version__ = '([0-9.]*)'/__version__ = '$(FULL_VERSION)'/" redash/__init__.py
tar -zcv -f $(FILENAME) --exclude="optipng*" --exclude=".git*" --exclude="*.pyc" --exclude="*.pyo" --exclude="venv" --exclude="client/node_modules" --exclude="client/app" *
tar -zcv -f $(FILENAME) --exclude="optipng*" --exclude=".git*" --exclude="*.pyc" --exclude="*.pyo" --exclude="venv" --exclude="node_modules" *

upload:
python bin/release_manager.py $(CIRCLE_SHA1) $(BASE_VERSION) $(FILENAME)
Expand Down
2 changes: 0 additions & 2 deletions Procfile.dev

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img title="Redash" src='http://redash.io/static/old_img/redash_logo.png' width="200px"/>
<img title="Redash" src='https://redash.io/assets/images/logo.png' width="200px"/>
</p>
<p align="center">
<img title="Build Status" src='https://circleci.com/gh/getredash/redash.png?circle-token=8a695aa5ec2cbfa89b48c275aea298318016f040'/>
Expand Down
15 changes: 0 additions & 15 deletions Vagrantfile

This file was deleted.

73 changes: 73 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash
set -e

worker() {
WORKERS_COUNT=${WORKERS_COUNT:-2}
QUEUES=${QUEUES:-queries,scheduled_queries,celery}

echo "Starting $WORKERS_COUNT workers for queues: $QUEUES..."
exec sudo -E -u redash /usr/local/bin/celery worker --app=redash.worker -c$WORKERS_COUNT -Q$QUEUES -linfo --maxtasksperchild=10 -Ofair
}

scheduler() {
WORKERS_COUNT=${WORKERS_COUNT:-1}
QUEUES=${QUEUES:-celery}

echo "Starting scheduler and $WORKERS_COUNT workers for queues: $QUEUES..."

exec sudo -E -u redash /usr/local/bin/celery worker --app=redash.worker --beat -c$WORKERS_COUNT -Q$QUEUES -linfo --maxtasksperchild=10 -Ofair
}

server() {
exec sudo -E -u redash /usr/local/bin/gunicorn -b 0.0.0.0:5000 --name redash -w4 redash.wsgi:app
}

help() {
echo "Redash Docker."
echo ""
echo "Usage:"
echo ""

echo "server -- start Redash server (with gunicorn)"
echo "worker -- start Celery worker"
echo "scheduler -- start Celery worker with a beat (scheduler) process"
echo ""
echo "shell -- open shell"
echo "dev_server -- start Flask development server with debugger and auto reload"
echo "create_db -- create database tables"
}

tests() {
export REDASH_DATABASE_URL="postgresql://postgres@postgres/tests"
exec sudo -E -u redash make test
}

case "$1" in
worker)
shift
worker
;;
server)
shift
server
;;
scheduler)
shift
scheduler
;;
dev_server)
exec sudo -E -u redash /app/manage.py runserver --debugger --reload -h 0.0.0.0
;;
shell)
exec sudo -E -u redash /app/manage.py shell
;;
create_db)
exec sudo -E -u redash /app/manage.py database create_tables
;;
tests)
tests
;;
*)
help
;;
esac
21 changes: 0 additions & 21 deletions bin/vagrant_ctl.sh

This file was deleted.

4 changes: 2 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
machine:
services:
- docker
- redis
node:
version:
6.9.1
Expand All @@ -12,10 +13,9 @@ dependencies:
- pip install --upgrade setuptools
- pip install -r requirements_dev.txt
- pip install -r requirements.txt
- pip install pymongo==3.2.1
- make deps
cache_directories:
- client/node_modules/
- node_modules/
test:
override:
- nosetests --with-xunit --xunit-file=$CIRCLE_TEST_REPORTS/junit.xml --with-coverage --cover-package=redash tests/
Expand Down
Empty file added client/app/assets/css/main.scss
Empty file.
2 changes: 1 addition & 1 deletion client/app/assets/css/redash.css
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ div.table-name:hover {

.collapsing,
.collapse.in {
background: #f4f4f4;
background: #222;
padding: 5px 10px;
transition: all 0.35s ease;
}
Expand Down
7 changes: 7 additions & 0 deletions client/app/components/app-header/app-header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.menu-search {
margin-top: 3px;
}

.menu-search input[type="text"] {
height: 30px;
}
14 changes: 8 additions & 6 deletions client/app/components/app-header/app-header.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<nav class="navbar navbar-inverse navbar-fixed-top app-header" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<button type="button" class="navbar-toggle" ng-click="isNavOpen = !isNavOpen">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><img ng-src="{{$ctrl.logoUrl}}"/></a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<div class="collapse navbar-collapse" uib-collapse="!isNavOpen">
<ul class="nav navbar-nav">
<li class="dropdown" ng-show="$ctrl.showDashboardsMenu" uib-dropdown>
<a href="#" class="dropdown-toggle" uib-dropdown-toggle title="Dashboards">
<span class="visible-md visible-lg">Dashboards <b class="caret"></b></span>
<span class="visible-xs visible-sm"><i class="zmdi zmdi-view-dashboard"></i> <b class="caret"></b></span>
<span class="visible-xs visible-md visible-lg">Dashboards <b class="caret"></b></span>
<span class="visible-sm"><i class="zmdi zmdi-view-dashboard"></i> <b class="caret"></b></span>
</a>
<ul class="dropdown-menu" uib-dropdown-menu>
<li><a ng-show="$ctrl.currentUser.hasPermission('create_dashboard')" ng-click="$ctrl.newDashboard()">New Dashboard</a></li>
Expand All @@ -37,10 +37,12 @@
</li>
</ul>
<form class="navbar-form navbar-left" role="search" ng-submit="$ctrl.searchQueries()">
<div class="form-group">
<div class="input-group menu-search">
<input type="text" ng-model="$ctrl.term" class="form-control" placeholder="Search queries...">
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="zmdi zmdi-search"></span></button>
</span>
</div>
<button type="submit" class="btn btn-default"><span class="zmdi zmdi-search"></span></button>
</form>
<ul class="nav navbar-nav navbar-right">
<li ng-show="$ctrl.currentUser.isAdmin">
Expand Down
1 change: 1 addition & 0 deletions client/app/components/app-header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import debug from 'debug';

import template from './app-header.html';
import logoUrl from '../../assets/images/redash_icon_small.png';
import './app-header.css';

const logger = debug('redash:appHeader');

Expand Down
4 changes: 4 additions & 0 deletions client/app/components/parameter-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ <h4 class="modal-title">{{$ctrl.parameter.name}}</h4>
<option value="datetime-with-seconds">Date and Time (with seconds)</option>
</select>
</div>
<div class="form-group">
<label>Global</label>
<input type="checkbox" class="form-inline" ng-model="$ctrl.parameter.global">
</div>
</div>
</div>
4 changes: 4 additions & 0 deletions client/app/components/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ function ParametersDirective($location, $uibModal) {
parameters: '=',
syncValues: '=?',
editable: '=?',
changed: '&onChange',
},
template,
link(scope) {
// is this the correct location for this logic?
if (scope.syncValues !== false) {
scope.$watch('parameters', () => {
if (scope.changed) {
scope.changed({});
}
scope.parameters.forEach((param) => {
if (param.value !== null || param.value !== '') {
$location.search(`p_${param.name}`, param.value);
Expand Down
1 change: 1 addition & 0 deletions client/app/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html ng-app="app">
<head lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<base href="/">
<title>Redash</title>
Expand Down
3 changes: 2 additions & 1 deletion client/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import './sortable';

import './assets/css/superflat_redash.css';
import './assets/css/redash.css';
import './assets/css/main.scss';

import * as pages from './pages';
import * as components from './components';
Expand Down Expand Up @@ -107,7 +108,7 @@ ngModule.config(($routeProvider, $locationProvider, $compileProvider,
});

// Update ui-select's template to use Font-Awesome instead of glyphicon.
ngModule.run(($templateCache) => {
ngModule.run(($templateCache, OfflineListener) => { // eslint-disable-line no-unused-vars
const templateName = 'bootstrap/match.tpl.html';
let template = $templateCache.get(templateName);
template = template.replace('glyphicon glyphicon-remove', 'fa fa-remove');
Expand Down
1 change: 1 addition & 0 deletions client/app/pages/dashboards/dashboard-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <h3 class='list-group-item m-0'>Tags</h3>
<td>
<a href="dashboard/{{ dashboard.slug }}">
<span class="label label-primary m-2" ng-bind="tag" ng-repeat="tag in dashboard.tags"></span> {{ dashboard.untagged_name }}
<span class="label label-warning" ng-if="dashboard.is_draft">Unpublished</span>
</a>
</td>
<td>{{ dashboard.created_at | dateTime }}</td>
Expand Down
Loading

0 comments on commit 39c4e1c

Please sign in to comment.