feat(ui) - cards - cards sort
This commit is contained in:
parent
9f3d5e553f
commit
2fa02e2ebb
2 changed files with 1 additions and 13 deletions
|
|
@ -53,18 +53,6 @@ function MetricsList({
|
|||
|
||||
const lenth = list.length;
|
||||
|
||||
const sortList = () => {
|
||||
list.sort((a, b) => {
|
||||
const aDate = new Date(a.lastModified);
|
||||
const bDate = new Date(b.lastModified);
|
||||
return sortBy === 'asc'
|
||||
? aDate.getTime() - bDate.getTime()
|
||||
: bDate.getTime() - aDate.getTime();
|
||||
});
|
||||
};
|
||||
|
||||
sortList();
|
||||
|
||||
useEffect(() => {
|
||||
metricStore.updateKey('sessionsPage', 1);
|
||||
}, []);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default class MetricStore {
|
|||
}
|
||||
|
||||
get sortedWidgets() {
|
||||
return [...this.metrics].sort((a, b) => b.lastModified - a.lastModified);
|
||||
return [...this.metrics].sort((a, b) => this.sort.by === 'desc' ? b.lastModified - a.lastModified : a.lastModified - b.lastModified)
|
||||
}
|
||||
|
||||
// State Actions
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue