Sort searched queries by recency (#1735)

* Sort searched queries by recency

* Fixed sqllab tests

* Add one more tr to QueryTable spec for pagination

* Change desc to asc as we reverse queries in component
This commit is contained in:
vera-liu
2016-12-14 10:14:54 -08:00
committed by GitHub
parent 2fb94a89e2
commit e1e20b8757
6 changed files with 31 additions and 22 deletions

View File

@@ -65,14 +65,20 @@ class QueryTable extends React.PureComponent {
removeQuery(query) {
this.props.actions.removeQuery(query);
}
render() {
const data = this.props.queries.map((query) => {
const q = Object.assign({}, query);
if (q.endDttm) {
q.duration = fDuration(q.startDttm, q.endDttm);
}
q.date = moment(q.startDttm).format('MMM Do YYYY');
const time = moment(q.startDttm).format().split('T');
q.time = (
<div>
<span>
{time[0]} <br /> {time[1]}
</span>
</div>
);
q.user = (
<button
className="btn btn-link btn-xs"
@@ -188,6 +194,7 @@ class QueryTable extends React.PureComponent {
columns={this.props.columns}
className="table table-condensed"
data={data}
itemsPerPage={50}
/>
</div>
);