Skip to content

Commit

Permalink
Add npm package.json and setup webpack to transpile ES6/JSX and compi…
Browse files Browse the repository at this point in the history
…le JS files for frontend refactor. See readme.md in assets/ for npm setup instructions and visit the panoramix home page for a React sandbox.
  • Loading branch information
williaster committed Feb 19, 2016
1 parent 20bd4ca commit f40c024
Show file tree
Hide file tree
Showing 17 changed files with 7,585 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ dist
panoramix.egg-info/
app.db
*.bak

# Node.js, webpack artifacts
*.entry.js
*.js.map
node_modules
npm-debug.log
5 changes: 3 additions & 2 deletions panoramix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@


class MyIndexView(IndexView):
index_template = 'index.html'
index_template = 'refactor/index.html'

appbuilder = AppBuilder(
app, db.session, base_template='panoramix/base.html',
app, db.session,
base_template='refactor/base.html',
indexview=MyIndexView,
security_manager_class=app.config.get("CUSTOM_SECURITY_MANAGER"))

Expand Down
3 changes: 3 additions & 0 deletions panoramix/assets/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets" : ["es2015", "react"]
}
44 changes: 44 additions & 0 deletions panoramix/assets/html/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{% extends 'appbuilder/init.html' %}
{% import 'appbuilder/baselib.html' as baselib %}

{% block head_css %}
{{super()}}
<link rel="shortcut icon" href="/static/refactor/images/favicon.png" />
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/panoramix.css" />

<!-- Replace with custom theme css -->
<!-- <link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/themes/bootswatch.paper.min.css" /> -->
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/themes/panoramix-bootstrap-theme.css" />
{% endblock %}

{% block body %}

{% include 'appbuilder/general/confirm.html' %}
{% include 'appbuilder/general/alert.html' %}

{% block navbar %}
<header class="top" role="header">
{% include 'appbuilder/navbar.html' %}
</header>
{% endblock %}

{% block uncontained %}{% endblock %}

<div class="container">
<div class="row">
{% block messages %}
{% include 'appbuilder/flash.html' %}
{% endblock %}
{% block content %}{% endblock %}
</div>
</div>
<div class="container-fluid">
{% block content_fluid %}{% endblock %}
</div>

{% endblock %}

{% block tail_js %}
<script src="/static/refactor/javascripts/dist/base.entry.js"></script>
{{ super() }}
{% endblock %}
12 changes: 12 additions & 0 deletions panoramix/assets/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "refactor/base.html" %}

{% block content_fluid %}
<div id="app">
Oops! React.js is not working properly.
</div>
{% endblock %}

{% block tail_js %}
<script src="/static/refactor/javascripts/dist/index.entry.js"></script>
{{ super() }}
{% endblock %}
Binary file added panoramix/assets/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions panoramix/assets/javascripts/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Currently requires global app dependencies in one place. Css could go here too.
window.d3 = require('d3');
window.px = require('./modules/panoramix.js');
16 changes: 16 additions & 0 deletions panoramix/assets/javascripts/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { render } from 'react-dom';
import { Jumbotron } from 'react-bootstrap';

class App extends React.Component {
render () {
return (
<Jumbotron>
<h1>Panoramix</h1>
<p>Extensible visualization tool for exploring data from any database.</p>
</Jumbotron>
);
}
}

render(<App />, document.getElementById('app'));
Loading

0 comments on commit f40c024

Please sign in to comment.