Skip to content

Commit

Permalink
partial refactor of explore page, visualizations not managed with web…
Browse files Browse the repository at this point in the history
…pack yet.
  • Loading branch information
williaster committed Feb 19, 2016
1 parent 0eb3dcd commit af34549
Show file tree
Hide file tree
Showing 14 changed files with 505 additions and 50 deletions.
57 changes: 30 additions & 27 deletions panoramix/assets/html/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,46 @@
{% 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" />
{{super()}}
<link rel="shortcut icon" href="/static/refactor/images/favicon.png" />
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/vendor/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/refactor/stylesheets/panoramix.css" />

<!-- Replace with custom bootstrap theme -->
<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' %}
{% include 'appbuilder/general/confirm.html' %}
{% include 'appbuilder/general/alert.html' %}

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

{% block uncontained %}{% 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 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() }}
{{ super() }}
<!-- @TODO get this to shim correctly with a require('jquery-ui') -->
<script src="/static/refactor/javascripts/vendor/jquery-ui.min.js"></script>
<script src="/static/refactor/javascripts/dist/base.entry.js"></script>
{% endblock %}
218 changes: 218 additions & 0 deletions panoramix/assets/html/explore.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
{% extends "refactor/base.html" %}

{% block head_css %}
{{super()}}
<link rel="stylesheet" type="text/css" href="/static/lib/pygments.css" />
<link href="/static/lib/bootstrap-toggle.min.css" rel="stylesheet">
{% endblock %}

{% block content_fluid %}
{% set datasource = viz.datasource %}
{% set form = viz.form %}

{% macro panofield(fieldname)%}
<div>
{% set field = form.get_field(fieldname)%}
<div>
{{ viz.get_form_override(fieldname, 'label') or field.label }}
{% if field.description %}
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right"
title="{{ viz.get_form_override(fieldname, 'description') or field.description }}"></i>
{% endif %}
{{ field(class_=form.field_css_classes(field.name)) }}
</div>
</div>
{% endmacro %}

<div class="datasource">
<form id="query" method="GET" style="display: none;">
<div class="header">
<span class="btn btn-default notbtn">
<strong>{{ datasource.full_name }}</strong>
{% if datasource.description %}
<a data-toggle="modal" data-target="#sourceinfo_modal">
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="{{ datasource.description }}"></i>
</a>
{% endif %}
<a class="" href="/{{ datasource.baselink }}/edit/{{ datasource.id }}" data-toggle="tooltip" title="Edit datasource">
<i class="fa fa-edit"></i>
</a>
</span>
<span>{{ form.get_field("viz_type")(class_="select2") }}</span>
{% if slice %}
<span class="alert alert-info" title="Slice" data-toggle="tooltip">{{ slice.slice_name }}
<a class="" href="/slicemodelview/edit/{{ slice.id }}" data-toggle="tooltip" title="Edit Slice metadata">
{% if slice.description %}
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="{{ slice.description }}"></i>
{% endif %}
<i class="fa fa-edit"></i>
</a>
</span>
{% endif %}
<div class="btn-group results pull-right" role="group">
<a role="button" tabindex="0" class="btn btn-default" id="shortner" title="Short URL" data-toggle="popover" data-trigger="focus">
<i class="fa fa-link"></i>
</a>
<span class="btn btn-default" id="standalone" title="Standalone version, use to embed anywhere" data-toggle="tooltip">
<i class="fa fa-code"></i>
</span>
<span class="btn btn-default " id="json" title="Export to .json" data-toggle="tooltip">
<i class="fa fa-file-code-o"></i>
.json
</span>
<span class="btn btn-default " id="csv" title="Export to .csv format" data-toggle="tooltip">
<i class="fa fa-file-text-o"></i>.csv
</span>
<span class="btn btn-warning notbtn" id="timer">0 sec</span>
<span class="btn btn-info disabled query"
data-toggle="modal" data-target="#query_modal">query</span>
</div>
<hr/>
</div>
<div id="form_container" class="col-left-fixed">
<div class="row center-block">
<button type="button" class="btn btn-primary druidify">
<i class="fa fa-bolt"></i>
Query
</button>
{% if viz.form_data.slice_id %}
<button type="button" class="btn btn-default" id="btn_overwrite">
<i class="fa fa-save"></i>
Overwrite
</button>
{% endif %}
<button type="button" class="btn btn-default" id="btn_save">
<i class="fa fa-plus-circle"></i>
Save as
</button>
</div>
<br/>
{% for fieldset in form.fieldsets %}
<fieldset class="fs-style">
{% if fieldset.label %}
<legend class="legend-style">
<span class="legend_label">{{ fieldset.label }}</span>
{% if fieldset.description %}
<i class="fa fa-info-circle" data-toggle="tooltip"
data-placement="bottom"
title="{{ fieldset.description }}"></i>
{% endif %}
<span class="collapser"> [-]</span>
</legend>
{% endif %}
<div class="fieldset_content">
{% for fieldname in fieldset.fields %}
{% if not fieldname %}
<hr/>
{% elif not fieldname.__iter__ %}
{{ panofield(fieldname) }}
{% else %}
<div class="row">
<div class="form-group">
{% for name in fieldname %}
<div class="col-xs-{{ (12 / fieldname|length) | int }}">
{% if name %}
{{ panofield(name) }}
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endfor %}
</div>
</fieldset>
{% endfor %}
<fieldset class="fs-style">
<legend class="legend-style">
<span class="legend_label">Filters</span>
<i class="fa fa-info-circle" data-toggle="tooltip"
data-placement="bottom"
title="Filters are defined using comma delimited strings as in 'US,FR,Other'"></i>
<span class="collapser"> [-]</span>
</legend>
<div class="fieldset_content">
<div id="flt0" style="display: none;">
<span class="">{{ form.flt_col_0(class_="form-control inc") }}</span>
<div class="row">
<span class="col col-sm-4">{{ form.flt_op_0(class_="form-control inc") }}</span>
<span class="col col-sm-6">{{ form.flt_eq_0(class_="form-control inc") }}</span>
<button type="button" class="btn btn-default btn-sm remove" aria-label="Delete filter">
<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>

</button>
</div>
</div>
<div id="filters"></div>
<button type="button" id="plus" class="btn btn-default btn-sm" aria-label="Add a filter">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
<span>Add filter</span>
</button>
</div>
</fieldset>
{{ form.slice_id() }}
{{ form.slice_name() }}
{{ form.collapsed_fieldsets() }}
<input type="hidden" name="action" id="action" value="">
<input type="hidden" name="datasource_name" value="{{ datasource.name }}">
<input type="hidden" name="datasource_id" value="{{ datasource.id }}">
<input type="hidden" name="datasource_type" value="{{ datasource.type }}">
<input type="hidden" name="previous_viz_type" value="{{ viz.viz_type or "table" }}">
</div>

<div class="col-offset">
{% block messages %}{% endblock %}
{% include 'appbuilder/flash.html' %}
<div
id="{{ viz.token }}"
class="widget viz slice {{ viz.viz_type }}"
data-slice="{{ viz.json_data }}"
style="height: 700px;">
<img src="{{ url_for("static", filename="img/loading.gif") }}" class="loading" alt="loading">
<div id="{{ viz.token }}_con" class="slice_container" style="height: 100%; width: 100%"></div>
</div>
</div>
<div class="modal fade" id="query_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">Query</h4>
</div>
<div class="modal-body">
<pre id="query_container"></pre>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="sourceinfo_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">Datasource Description</h4>
</div>
<div class="modal-body">
{{ datasource.description_markeddown | safe }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</form>
</div>
{% endblock %}

{% block tail_js %}
{{ super() }}
<script src="/static/refactor/javascripts/dist/explore.entry.js"></script>
{% endblock %}
2 changes: 1 addition & 1 deletion panoramix/assets/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
{% endblock %}

{% block tail_js %}
<script src="/static/refactor/javascripts/dist/index.entry.js"></script>
{{ super() }}
<script src="/static/refactor/javascripts/dist/index.entry.js"></script>
{% endblock %}
27 changes: 27 additions & 0 deletions panoramix/assets/html/viz.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% if viz.form_data.get("json") == "true" %}
{{ viz.get_json() }}
{% else %}

{% if viz.request.args.get("standalone") == "true" %}
{% extends 'panoramix/standalone.html' %}
{% else %}
{% extends 'refactor/explore.html' %}
{% endif %}


{% block head_css %}
{{super()}}
{% for css in viz.css_files %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename=css) }}">
{% endfor %}
{% endblock %}


{% block tail %}
{{super()}}
{% for js in viz.js_files %}
<script src="{{ url_for('static', filename=js) }}"></script>
{% endfor %}
{% endblock %}

{% endif %}
21 changes: 21 additions & 0 deletions panoramix/assets/javascripts/explore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require('select2');
require('./vendor/bootstrap-toggle.min.js');
require('./vendor/select2.sortable.js');

$(document).ready(function() {
px.initExploreView();

var data = $('.slice').data('slice');
var slice = px.Slice(data);

$('.slice').data('slice', slice);

px.renderSlice();

$(':checkbox')
.addClass('pull-right')
.attr("data-onstyle", "default")
.bootstrapToggle({size: 'mini'});

$('div.toggle').addClass('pull-right');
});
Loading

0 comments on commit af34549

Please sign in to comment.