A better welcome page

This commit is contained in:
Maxime Beauchemin 2016-04-04 16:12:28 -07:00
parent 92f73b67ca
commit f1830c36cf
10 changed files with 77 additions and 36 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -4,12 +4,13 @@ var jQuery = window.jQuery = $;
require('../stylesheets/caravel.css');
require('../stylesheets/welcome.css');
require('bootstrap');
require('datatables');
require('datatables.net-bs');
require('../node_modules/datatables-bootstrap3-plugin/media/css/datatables-bootstrap3.css');
require('../node_modules/cal-heatmap/cal-heatmap.css');
var CalHeatMap = require('cal-heatmap');
function modelViewTable(selector, modelEndpoint, ordering) {
function modelViewTable(selector, modelEndpoint) {
// Builds a dataTable from a flask appbuilder api endpoint
$.getJSON(modelEndpoint + '/api/read', function (data) {
var tableData = jQuery.map(data.result, function (el, i) {
@ -21,13 +22,24 @@ function modelViewTable(selector, modelEndpoint, ordering) {
var cols = jQuery.map(data.list_columns, function (col, i) {
return { sTitle: data.label_columns[col] };
});
var panel = $(selector).parents('.panel');
panel.find("img.loading").remove();
$(selector).DataTable({
aaData: tableData,
aoColumns: cols,
bPaginate: false,
order: ordering,
searching: false
bPaginate: true,
pageLength: 10,
bLengthChange: false,
aaSorting: [],
searching: true
});
var search = panel.find(".dataTables_filter input");
search.addClass('form-control').detach();
search.appendTo(panel.find(".search"));
panel.find('.dataTables_filter').remove();
$(selector).slideDown();
$('[data-toggle="tooltip"]').tooltip({ container: 'body' });
});
}

View File

@ -51,7 +51,7 @@
"d3-tip": "^0.6.7",
"datamaps": "^0.4.4",
"datatables-bootstrap3-plugin": "^0.4.0",
"datatables.net": "^1.10.11",
"datatables.net-bs": "^1.10.11",
"exports-loader": "^0.6.3",
"font-awesome": "^4.5.0",
"gridster": "^0.5.6",

View File

@ -1,21 +1,17 @@
.welcome .widget{
border-radius: 0;
border: 1px solid #ccc;
box-shadow: 2px 1px 5px -2px #aaa;
background-color: #fff;
}
.welcome .widget .header {
background-color: #f1f1f1;
text-align: center;
}
.welcome .widget>div {
padding: 3px;
overflow: auto;
max-height: 500px;
}
.table i {
padding-top: 6px;
}
img.loading {
width: 25px;
}
.welcome table {
display: none;
width: 100%;
}
input {
margin-left: 5px;
margin-top: 8px;
}

View File

@ -1,7 +1,7 @@
var $ = window.$ = require('jquery');
var jQuery = window.jQuery = $;
require('datatables');
require('datatables.net-bs');
require('./pivot_table.css');
require('../node_modules/datatables-bootstrap3-plugin/media/css/datatables-bootstrap3.css');

View File

@ -3,7 +3,7 @@ var jQuery = window.jQuery = $;
var d3 = require('d3');
require('./table.css');
require('datatables');
require('datatables.net-bs');
require('../node_modules/datatables-bootstrap3-plugin/media/css/datatables-bootstrap3.css');
function tableVis(slice) {

View File

@ -1,7 +1,7 @@
{% extends "appbuilder/baselayout.html" %}
{% block head_css %}
<link rel="icon" type="image/png" href="/static/img/favicon.png">
<link rel="icon" type="image/png" href="/static/assets/images/favicon.png">
<link rel="stylesheet" type="text/css" href="/static/assets/stylesheets/caravel.css" />
{{super()}}
{% endblock %}

View File

@ -8,7 +8,7 @@
{% block head_meta %}{% endblock %}
{% block head_css %}
<link rel="stylesheet" type="text/css" href="/static/assets/node_modules/font-awesome/css/font-awesome.min.css" />
<link rel="icon" type="image/png" href="/static/img/favicon.png">
<link rel="icon" type="image/png" href="/static/assets/images/favicon.png">
{% endblock %}
{% block head_js %}
<script src="/static/assets/javascripts/dist/css-theme.entry.js"></script>

View File

@ -17,18 +17,44 @@
<hr/>
<div class="row">
<div class="col-md-6">
<div class="widget">
<div class="header"><h4><i class="fa fa-dashboard"></i> Dashboards</h4></div>
<div>
<table id="dash_table" class="table"></table>
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-md-12">
<span class="pull-left">
<h5><i class="fa fa-dashboard"></i> Dashboards</h5>
</span>
<span class="search pull-right"></span>
<span class="pull-right">
<h5><i class="fa fa-search"></i></h5>
</span>
</div>
</div>
</div>
<div class="panel-body">
<img class="loading" src="/static/assets/images/loading.gif"/>
<table id="dash_table" class="table table-condensed" width="100%"></table>
</div>
</div>
</div>
<div class="col-md-6">
<div class="widget">
<div class="header"><h4><i class="fa fa-bar-chart"></i> Slices</h4></div>
<div>
<table id="slice_table" class="table"></table>
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-md-12">
<span class="pull-left">
<h5><i class="fa fa-bar-chart"></i> Slices</h5>
</span>
<span class="search pull-right"></span>
<span class="pull-right">
<h5><i class="fa fa-search"></i></h5>
</span>
</div>
</div>
</div>
<div class="panel-body">
<img class="loading" src="/static/assets/images/loading.gif"/>
<table id="slice_table" class="table table-condensed" width="100%"></table>
</div>
</div>
</div>

View File

@ -248,6 +248,9 @@ class SliceAsync(SliceModelView): # noqa
'created_by_', 'modified', 'icons']
label_columns = {
'icons': ' ',
'created_by_': 'Creator',
'viz_type': 'Type',
'slice_link': 'Slice',
}
appbuilder.add_view_no_menu(SliceAsync)
@ -298,6 +301,10 @@ appbuilder.add_view(
class DashboardModelViewAsync(DashboardModelView): # noqa
list_columns = ['dashboard_link', 'created_by_', 'modified']
label_columns = {
'created_by_': 'Creator',
'dashboard_link': 'Dashboard',
}
appbuilder.add_view_no_menu(DashboardModelViewAsync)