mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
Tackling Featured Datasets
This commit is contained in:
parent
71b11117d7
commit
8dcd5e0628
@ -1,7 +1,8 @@
|
||||
import logging
|
||||
import os
|
||||
from flask import Flask
|
||||
from flask import Flask, redirect
|
||||
from flask.ext.appbuilder import SQLA, AppBuilder, IndexView
|
||||
from flask.ext.appbuilder.baseviews import expose
|
||||
from flask.ext.migrate import Migrate
|
||||
from panoramix import config
|
||||
|
||||
@ -20,7 +21,9 @@ migrate = Migrate(app, db, directory=APP_DIR + "/migrations")
|
||||
|
||||
|
||||
class MyIndexView(IndexView):
|
||||
index_template = 'panoramix/featured_datasets.html'
|
||||
@expose('/')
|
||||
def index(self):
|
||||
return redirect('/panoramix/featured')
|
||||
|
||||
appbuilder = AppBuilder(
|
||||
app, db.session,
|
||||
|
45
panoramix/assets/html/featured.html
Normal file
45
panoramix/assets/html/featured.html
Normal file
@ -0,0 +1,45 @@
|
||||
{% extends "refactor/basic.html" %}
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h3><i class='fa fa-star'></i> Featured Datasets </h3>
|
||||
</div>
|
||||
<hr/>
|
||||
<table class="table table-hover dataTable table-bordered" id="dataset-table" style="display:None">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Table</th>
|
||||
<th>Database</th>
|
||||
<th>Owner</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for dataset in featured_datasets %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="intable-longtext">
|
||||
<h4>{{ dataset.table_name }}</h4>
|
||||
<p>{{ utils.markdown(dataset.description) | safe }}</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="small_table">{{ dataset.database }}</td>
|
||||
<td class="small_table">{{ dataset.owner }}</td>
|
||||
<td class="small_table"><a class="btn btn-default" href="{{ dataset.default_endpoint }}"><i class='fa fa-line-chart'/></a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<hr/>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block head_css %}
|
||||
{{ super() }}
|
||||
<link rel="stylesheet" type="text/css" href="/static/assets/node_modules/datatables-bootstrap3-plugin/media/css/datatables-bootstrap3.css" />
|
||||
{% endblock %}
|
||||
|
||||
{% block tail_js %}
|
||||
{{ super() }}
|
||||
<script src="/static/assets/javascripts/dist/featured.entry.js"></script>
|
||||
{% endblock %}
|
14
panoramix/assets/javascripts/featured.js
Normal file
14
panoramix/assets/javascripts/featured.js
Normal file
@ -0,0 +1,14 @@
|
||||
var $ = window.$ = require('jquery');
|
||||
var jQuery = window.jQuery = $;
|
||||
require('datatables');
|
||||
require('datatables-bootstrap3-plugin');
|
||||
require('bootstrap');
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#dataset-table').DataTable({
|
||||
"bPaginate": false,
|
||||
"order": [[ 1, "asc" ]]
|
||||
});
|
||||
$('#dataset-table_info').remove();
|
||||
$('#dataset-table').show();
|
||||
} );
|
@ -2,6 +2,7 @@ var $ = window.$ = require('jquery');
|
||||
var jQuery = window.jQuery = $;
|
||||
require('select2');
|
||||
require('datatables');
|
||||
require('bootstrap');
|
||||
|
||||
var ace = require('brace');
|
||||
require('brace/mode/sql');
|
||||
|
@ -46,6 +46,7 @@
|
||||
"d3-tip": "^0.6.7",
|
||||
"d3.layout.cloud": "^1.2.0",
|
||||
"datatables": "^1.10.9",
|
||||
"datatables-bootstrap3-plugin": "^0.4.0",
|
||||
"exports-loader": "^0.6.3",
|
||||
"font-awesome": "^4.5.0",
|
||||
"gridster": "^0.5.6",
|
||||
|
@ -10,6 +10,7 @@ var config = {
|
||||
//dashboard: APP_DIR + '/javascripts/dist/dashboard.js',
|
||||
explore: APP_DIR + '/javascripts/explore.js',
|
||||
sql: APP_DIR + '/javascripts/sql.js',
|
||||
featured: APP_DIR + '/javascripts/featured.js',
|
||||
},
|
||||
output: {
|
||||
path: BUILD_DIR,
|
||||
|
@ -1,54 +0,0 @@
|
||||
{% extends "panoramix/base.html" %}
|
||||
{% block content %}
|
||||
<div class="header">
|
||||
<h3><i class='fa fa-star'></i> Featured Datasets </h3>
|
||||
</div>
|
||||
<hr/>
|
||||
<table class="table table-hover dataTable table-bordered" id="dataset-table" style="display:None">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Table</th>
|
||||
<th>Database</th>
|
||||
<th>Owner</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for dataset in featured_datasets %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="intable-longtext">
|
||||
<h4>{{ dataset.table_name }}</h4>
|
||||
<p>{{ utils.markdown(dataset.description) | safe }}</p>
|
||||
</div>
|
||||
</td>
|
||||
<td class="small_table">{{ dataset.database }}</td>
|
||||
<td class="small_table">{{ dataset.owner }}</td>
|
||||
<td class="small_table"><a class="btn btn-default" href="{{ dataset.default_endpoint }}"><i class='fa fa-line-chart'/></a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<hr/>
|
||||
{% endblock %}
|
||||
|
||||
{% block head_css %}
|
||||
{{ super() }}
|
||||
<link rel="stylesheet" type="text/css" href="/static/assets/vendor/dataTables/dataTables.bootstrap.css" />
|
||||
{% endblock %}
|
||||
|
||||
{% block tail_js %}
|
||||
{{ super() }}
|
||||
<script src="/static/assets/vendor/dataTables/jquery.dataTables.min.js"></script>
|
||||
<script src="/static/assets/vendor/dataTables/dataTables.bootstrap.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#dataset-table').DataTable({
|
||||
"bPaginate": false,
|
||||
"order": [[ 1, "asc" ]]
|
||||
});
|
||||
$('#dataset-table_info').remove();
|
||||
$('#dataset-table').show();
|
||||
} );
|
||||
</script>
|
||||
{% endblock %}
|
@ -64,7 +64,7 @@ appbuilder.add_view_no_menu(TableColumnInlineView)
|
||||
|
||||
appbuilder.add_link(
|
||||
"Featured Datasets",
|
||||
href='/panoramix/featured_datasets',
|
||||
href='/panoramix/featured',
|
||||
category='Sources',
|
||||
category_icon='fa-table',
|
||||
icon="fa-star")
|
||||
@ -703,8 +703,8 @@ class Panoramix(BaseView):
|
||||
art=ascii_art.error), 500
|
||||
|
||||
@has_access
|
||||
@expose("/featured_datasets", methods=['GET'])
|
||||
def featured_datasets(self):
|
||||
@expose("/featured", methods=['GET'])
|
||||
def featured(self):
|
||||
session = db.session()
|
||||
datasets_sqla = (
|
||||
session.query(models.SqlaTable)
|
||||
@ -718,7 +718,7 @@ class Panoramix(BaseView):
|
||||
)
|
||||
featured_datasets = datasets_sqla + datasets_druid
|
||||
return self.render_template(
|
||||
'panoramix/featured_datasets.html',
|
||||
'refactor/featured.html',
|
||||
featured_datasets=featured_datasets,
|
||||
utils=utils)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user