mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
User profile pages (favorites, created content, recent activity, security & access) (#1615)
* Super * User profile page * Fixing python style * Python unit tests * Touchups and js tests * Addressing comments
This commit is contained in:
committed by
GitHub
parent
5ae98bc7c9
commit
7e1852ee88
@@ -0,0 +1,67 @@
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
import TableLoader from './TableLoader';
|
||||
|
||||
const propTypes = {
|
||||
user: React.PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
class CreatedContent extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
dashboardsLoading: true,
|
||||
slicesLoading: true,
|
||||
dashboards: [],
|
||||
slices: [],
|
||||
};
|
||||
}
|
||||
renderSliceTable() {
|
||||
const mutator = (data) => data.map(slice => ({
|
||||
slice: <a href={slice.url}>{slice.title}</a>,
|
||||
favorited: moment.utc(slice.dttm).fromNow(),
|
||||
_favorited: slice.dttm,
|
||||
}));
|
||||
return (
|
||||
<TableLoader
|
||||
dataEndpoint={`/superset/created_slices/${this.props.user.userId}/`}
|
||||
className="table table-condensed"
|
||||
columns={['slice', 'favorited']}
|
||||
mutator={mutator}
|
||||
noDataText="No slices"
|
||||
sortable
|
||||
/>
|
||||
);
|
||||
}
|
||||
renderDashboardTable() {
|
||||
const mutator = (data) => data.map(dash => ({
|
||||
dashboard: <a href={dash.url}>{dash.title}</a>,
|
||||
favorited: moment.utc(dash.dttm).fromNow(),
|
||||
_favorited: dash.dttm,
|
||||
}));
|
||||
return (
|
||||
<TableLoader
|
||||
className="table table-condensed"
|
||||
mutator={mutator}
|
||||
dataEndpoint={`/superset/created_dashboards/${this.props.user.userId}/`}
|
||||
noDataText="No dashboards"
|
||||
columns={['dashboard', 'favorited']}
|
||||
sortable
|
||||
/>
|
||||
);
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h3>Dashboards</h3>
|
||||
{this.renderDashboardTable()}
|
||||
<hr />
|
||||
<h3>Slices</h3>
|
||||
{this.renderSliceTable()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
CreatedContent.propTypes = propTypes;
|
||||
|
||||
export default CreatedContent;
|
||||
Reference in New Issue
Block a user