#views users for created dashboards on profile page (#1667)

* Add #views and #distinct users to created dashboard on profile page

* Added index on logs to speed up query

* Added #views and #users for slice table

* Add a views column to dashboards and slices, prepopulate
them with Log data

* Remove index on Log model

* Remove unused index

* Update 1b2c3f7c96f9_.py

fix multiple heads

* Exclude postgres in prepopulating views column
This commit is contained in:
vera-liu
2017-01-06 16:31:20 -08:00
committed by GitHub
parent 783ad703d0
commit cec4cf014c
4 changed files with 80 additions and 13 deletions

View File

@@ -19,6 +19,7 @@ class CreatedContent extends React.PureComponent {
renderSliceTable() {
const mutator = (data) => data.map(slice => ({
slice: <a href={slice.url}>{slice.title}</a>,
views: slice.views,
favorited: moment.utc(slice.dttm).fromNow(),
_favorited: slice.dttm,
}));
@@ -26,7 +27,7 @@ class CreatedContent extends React.PureComponent {
<TableLoader
dataEndpoint={`/superset/created_slices/${this.props.user.userId}/`}
className="table table-condensed"
columns={['slice', 'favorited']}
columns={['slice', 'favorited', 'views']}
mutator={mutator}
noDataText="No slices"
sortable
@@ -36,6 +37,7 @@ class CreatedContent extends React.PureComponent {
renderDashboardTable() {
const mutator = (data) => data.map(dash => ({
dashboard: <a href={dash.url}>{dash.title}</a>,
views: dash.views,
favorited: moment.utc(dash.dttm).fromNow(),
_favorited: dash.dttm,
}));
@@ -45,7 +47,7 @@ class CreatedContent extends React.PureComponent {
mutator={mutator}
dataEndpoint={`/superset/created_dashboards/${this.props.user.userId}/`}
noDataText="No dashboards"
columns={['dashboard', 'favorited']}
columns={['dashboard', 'favorited', 'views']}
sortable
/>
);