All files / javascripts/profile/components RecentActivity.jsx

0% Statements 0/11
100% Branches 0/0
0% Functions 0/3
0% Lines 0/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34                                                                   
import React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
 
import TableLoader from './TableLoader';
 
const propTypes = {
  user: PropTypes.object,
};
 
export default class RecentActivity extends React.PureComponent {
  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;