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:
Maxime Beauchemin
2016-11-19 21:23:44 -08:00
committed by GitHub
parent 5ae98bc7c9
commit 7e1852ee88
28 changed files with 903 additions and 12 deletions

View File

@@ -0,0 +1,44 @@
import React from 'react';
import TableLoader from './TableLoader';
import moment from 'moment';
import $ from 'jquery';
const propTypes = {
user: React.PropTypes.object,
};
export default class RecentActivity extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
recentActions: [],
};
}
componentWillMount() {
$.get(`/superset/recent_activity/${this.props.user.userId}/`, (data) => {
this.setState({ recentActions: data });
});
}
render() {
const mutator = function (data) {
return data.map(row => ({
action: row.action,
item: <a href={row.item_url}>{row.item_title}</a>,
time: moment.utc(row.time).fromNow(),
_time: row.time,
}));
};
return (
<div>
<TableLoader
className="table table-condensed"
mutator={mutator}
sortable
dataEndpoint={`/superset/recent_activity/${this.props.user.userId}/`}
/>
</div>
);
}
}
RecentActivity.propTypes = propTypes;