1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: add last seen as sort option

This commit is contained in:
Ivar Conradi Østhus 2020-12-22 10:05:56 +01:00
parent 6b742a0b92
commit cc96134e2f
2 changed files with 5 additions and 0 deletions

View File

@ -117,6 +117,9 @@ export default class FeatureListComponent extends React.Component {
<MenuItem disabled={settings.sort === 'created'} data-target="created">
Created
</MenuItem>
<MenuItem disabled={settings.sort === 'Last seen'} data-target="Last seen">
Last seen
</MenuItem>
<MenuItem disabled={settings.sort === 'strategies'} data-target="strategies">
Strategies
</MenuItem>

View File

@ -45,6 +45,8 @@ export const mapStateToPropsConfigurable = isFeature => state => {
);
} else if (settings.sort === 'created') {
features = features.sort((a, b) => (new Date(a.createdAt) > new Date(b.createdAt) ? -1 : 1));
} else if (settings.sort === 'Last seen') {
features = features.sort((a, b) => (new Date(a.lastSeenAt) > new Date(b.lastSeenAt) ? -1 : 1));
} else if (settings.sort === 'name') {
features = features.sort((a, b) => {
if (a.name < b.name) {