mirror of
https://github.com/apache/superset.git
synced 2024-09-12 16:49:40 -04:00
Adding a view for featured datasets
This commit is contained in:
parent
dcd36780ef
commit
30df7be258
23
panoramix/migrations/versions/12d55656cbca_is_featured.py
Normal file
23
panoramix/migrations/versions/12d55656cbca_is_featured.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
"""is_featured
|
||||||
|
|
||||||
|
Revision ID: 12d55656cbca
|
||||||
|
Revises: 55179c7f25c7
|
||||||
|
Create Date: 2015-12-14 13:37:17.374852
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '12d55656cbca'
|
||||||
|
down_revision = '55179c7f25c7'
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.add_column('tables', sa.Column('is_featured', sa.Boolean(), nullable=True))
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_column('tables', 'is_featured')
|
||||||
|
|
@ -228,6 +228,7 @@ class SqlaTable(Model, Queryable, AuditMixinNullable):
|
|||||||
description = Column(Text)
|
description = Column(Text)
|
||||||
default_endpoint = Column(Text)
|
default_endpoint = Column(Text)
|
||||||
database_id = Column(Integer, ForeignKey('dbs.id'), nullable=False)
|
database_id = Column(Integer, ForeignKey('dbs.id'), nullable=False)
|
||||||
|
is_featured = Column(Boolean, default=False)
|
||||||
database = relationship(
|
database = relationship(
|
||||||
'Database', backref='tables', foreign_keys=[database_id])
|
'Database', backref='tables', foreign_keys=[database_id])
|
||||||
offset = Column(Integer, default=0)
|
offset = Column(Integer, default=0)
|
||||||
|
18
panoramix/static/featured_datasets.css
Normal file
18
panoramix/static/featured_datasets.css
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
.main-text {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 36px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-title{
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: strong;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-bottom: 1px solid #dddddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
27
panoramix/templates/panoramix/featured_datasets.html
Normal file
27
panoramix/templates/panoramix/featured_datasets.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{% extends "panoramix/base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<link rel="stylesheet" type="text/css" href="/static/featured_datasets.css" />
|
||||||
|
<div class="main-text">
|
||||||
|
Featured Datasets
|
||||||
|
</div>
|
||||||
|
<table class = "table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Table</th>
|
||||||
|
<th>Database</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for dataset in featured_datasets %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href='{{ dataset.default_endpoint }}' class="data-title">{{ dataset.table_name }}</a>
|
||||||
|
</br> {{ dataset.description }}
|
||||||
|
</td>
|
||||||
|
<td>{{ dataset.database }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -140,7 +140,7 @@ class TableView(PanoramixModelView, DeleteMixin):
|
|||||||
list_columns = ['table_link', 'database', 'changed_by', 'changed_on_']
|
list_columns = ['table_link', 'database', 'changed_by', 'changed_on_']
|
||||||
add_columns = ['table_name', 'database', 'default_endpoint', 'offset']
|
add_columns = ['table_name', 'database', 'default_endpoint', 'offset']
|
||||||
edit_columns = [
|
edit_columns = [
|
||||||
'table_name', 'database', 'description', 'main_dttm_col',
|
'table_name', 'is_featured', 'database', 'description', 'main_dttm_col',
|
||||||
'default_endpoint', 'offset']
|
'default_endpoint', 'offset']
|
||||||
related_views = [TableColumnInlineView, SqlMetricInlineView]
|
related_views = [TableColumnInlineView, SqlMetricInlineView]
|
||||||
base_order = ('changed_on','desc')
|
base_order = ('changed_on','desc')
|
||||||
@ -538,6 +538,19 @@ class Panoramix(BaseView):
|
|||||||
title=ascii_art.stacktrace,
|
title=ascii_art.stacktrace,
|
||||||
art=ascii_art.error), 500
|
art=ascii_art.error), 500
|
||||||
|
|
||||||
|
@has_access
|
||||||
|
@expose("/datasets", methods=['GET'])
|
||||||
|
def datasets(self):
|
||||||
|
session = db.session()
|
||||||
|
datasets_sqla = (session.query(models.SqlaTable)
|
||||||
|
.filter_by(is_featured=True).all())
|
||||||
|
datasets_druid = (session.query(models.Datasource)
|
||||||
|
.filter_by(is_featured=True).all())
|
||||||
|
featured_datasets = datasets_sqla + datasets_druid
|
||||||
|
return self.render_template(
|
||||||
|
'panoramix/featured_datasets.html',
|
||||||
|
featured_datasets=featured_datasets)
|
||||||
|
|
||||||
appbuilder.add_view_no_menu(Panoramix)
|
appbuilder.add_view_no_menu(Panoramix)
|
||||||
appbuilder.add_link(
|
appbuilder.add_link(
|
||||||
"Refresh Druid Metadata",
|
"Refresh Druid Metadata",
|
||||||
|
Loading…
Reference in New Issue
Block a user