Skip to content

Commit

Permalink
[welcome] removing calendar heatmap from welcome page (apache#1119)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored and dennisobrien committed Sep 19, 2016
1 parent 11af4ff commit 190e0d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 52 deletions.
29 changes: 0 additions & 29 deletions caravel/assets/javascripts/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ require('../stylesheets/welcome.css');
require('bootstrap');
require('datatables.net-bs');
require('../node_modules/datatables-bootstrap3-plugin/media/css/datatables-bootstrap3.css');
require('../node_modules/cal-heatmap/cal-heatmap.css');
const d3 = require('d3');
const CalHeatMap = require('cal-heatmap');
function modelViewTable(selector, modelView, orderCol, order) {
// Builds a dataTable from a flask appbuilder api endpoint
let url = '/' + modelView.toLowerCase() + '/api/read';
Expand Down Expand Up @@ -51,32 +49,5 @@ function modelViewTable(selector, modelView, orderCol, order) {
});
}
$(document).ready(function () {
d3.json('/caravel/activity_per_day', function (json) {
const ext = d3.extent(d3.values(json));
const cal = new CalHeatMap();
const range = 10;
const legendBounds = [];
const step = (ext[1] - ext[0]) / (range - 1);
for (let i = 0; i < range; i++) {
legendBounds.push(i * step + ext[0]);
}
cal.init({
start: new Date().setFullYear(new Date().getFullYear() - 1),
range: 13,
data: json,
legend: legendBounds,
legendColors: [
'#D6E685',
'#1E6823',
],
domain: 'month',
subDomain: 'day',
itemName: 'action',
tooltip: true,
cellSize: 10,
cellPadding: 2,
domainGutter: 22,
});
});
modelViewTable('#dash_table', 'DashboardModelViewAsync', 'changed_on', 'desc');
});
38 changes: 15 additions & 23 deletions caravel/templates/caravel/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,26 @@
{% block body %}
<div class="container welcome">
{% include 'caravel/flash_wrapper.html' %}
<div class="cal-heatmap-panel">
<div id="cal-heatmap"></div>
</div>
<br/>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<div class="row">
<div class="col-md-6">
<h2>{{ _("Dashboards") }}</h2>
</div>
<div class="col-md-6">
<div class="search-container pull-right">
<i class="fa fa-search"></i>
<span class="search"></span>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<div class="row">
<div class="col-md-6">
<h2>{{ _("Dashboards") }}</h2>
</div>
<div class="col-md-6">
<div class="search-container pull-right">
<i class="fa fa-search"></i>
<span class="search"></span>
</div>
</div>
</div>
<div class="panel-body">
<img class="loading" src="/static/assets/images/loading.gif"/>
<table id="dash_table" class="table" width="100%"></table>
</div>
</div>
</div>
<div class="panel-body">
<img class="loading" src="/static/assets/images/loading.gif"/>
<table id="dash_table" class="table" width="100%"></table>
</div>
</div>
</div>
{% endblock %}
Expand Down

0 comments on commit 190e0d5

Please sign in to comment.