Skip to content

Commit

Permalink
[welcome page] shows the most recently updated items first (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Apr 14, 2016
1 parent 8fe5790 commit a76ccf4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions caravel/assets/javascripts/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ require('../node_modules/cal-heatmap/cal-heatmap.css');

var CalHeatMap = require('cal-heatmap');

function modelViewTable(selector, modelEndpoint) {
function modelViewTable(selector, modelView, orderCol, order) {
// Builds a dataTable from a flask appbuilder api endpoint
$.getJSON(modelEndpoint + '/api/read', function (data) {
var url = '/' + modelView.toLowerCase() + '/api/read';
url += '?_oc_' + modelView + '=' + orderCol;
url += '&_od_' + modelView +'=' + order;
$.getJSON(url, function (data) {
var tableData = jQuery.map(data.result, function (el, i) {
var row = $.map(data.list_columns, function (col, i) {
return el[col];
Expand Down Expand Up @@ -62,6 +65,6 @@ $(document).ready(function () {
itemName: "action",
tooltip: true
});
modelViewTable('#dash_table', '/dashboardmodelviewasync');
modelViewTable('#slice_table', '/sliceasync');
modelViewTable('#dash_table', 'DashboardModelViewAsync', 'changed_on', 'desc');
modelViewTable('#slice_table', 'SliceAsync', 'changed_on', 'desc');
});

0 comments on commit a76ccf4

Please sign in to comment.