mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-04 01:18:20 +02:00
feat: stort by stale
This commit is contained in:
parent
303b6edb99
commit
a0bad364e8
@ -34,8 +34,23 @@ exports[`renders correctly with one feature 1`] = `
|
|||||||
className="listLink truncate"
|
className="listLink truncate"
|
||||||
href="/features/strategies/Another"
|
href="/features/strategies/Another"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="toggleName"
|
||||||
>
|
>
|
||||||
Another
|
Another
|
||||||
|
|
||||||
|
</span>
|
||||||
|
<small
|
||||||
|
className="mdl-color-text--blue-grey-300"
|
||||||
|
>
|
||||||
|
<time
|
||||||
|
dateTime="2018-02-04T20:27:52.127Z"
|
||||||
|
title="2018-02-04T20:27:52.127Z"
|
||||||
|
>
|
||||||
|
3 years ago
|
||||||
|
</time>
|
||||||
|
</small>
|
||||||
<span
|
<span
|
||||||
className="mdl-list__item-sub-title truncate"
|
className="mdl-list__item-sub-title truncate"
|
||||||
>
|
>
|
||||||
@ -87,8 +102,23 @@ exports[`renders correctly with one feature without permission 1`] = `
|
|||||||
className="listLink truncate"
|
className="listLink truncate"
|
||||||
href="/features/strategies/Another"
|
href="/features/strategies/Another"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="toggleName"
|
||||||
>
|
>
|
||||||
Another
|
Another
|
||||||
|
|
||||||
|
</span>
|
||||||
|
<small
|
||||||
|
className="mdl-color-text--blue-grey-300"
|
||||||
|
>
|
||||||
|
<time
|
||||||
|
dateTime="2018-02-04T20:27:52.127Z"
|
||||||
|
title="2018-02-04T20:27:52.127Z"
|
||||||
|
>
|
||||||
|
3 years ago
|
||||||
|
</time>
|
||||||
|
</small>
|
||||||
<span
|
<span
|
||||||
className="mdl-list__item-sub-title truncate"
|
className="mdl-list__item-sub-title truncate"
|
||||||
>
|
>
|
||||||
|
@ -136,6 +136,12 @@ exports[`renders correctly with one feature 1`] = `
|
|||||||
>
|
>
|
||||||
Enabled
|
Enabled
|
||||||
</react-mdl-MenuItem>
|
</react-mdl-MenuItem>
|
||||||
|
<react-mdl-MenuItem
|
||||||
|
data-target="stale"
|
||||||
|
disabled={false}
|
||||||
|
>
|
||||||
|
Stale
|
||||||
|
</react-mdl-MenuItem>
|
||||||
<react-mdl-MenuItem
|
<react-mdl-MenuItem
|
||||||
data-target="created"
|
data-target="created"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
@ -301,6 +307,12 @@ exports[`renders correctly with one feature without permissions 1`] = `
|
|||||||
>
|
>
|
||||||
Enabled
|
Enabled
|
||||||
</react-mdl-MenuItem>
|
</react-mdl-MenuItem>
|
||||||
|
<react-mdl-MenuItem
|
||||||
|
data-target="stale"
|
||||||
|
disabled={false}
|
||||||
|
>
|
||||||
|
Stale
|
||||||
|
</react-mdl-MenuItem>
|
||||||
<react-mdl-MenuItem
|
<react-mdl-MenuItem
|
||||||
data-target="created"
|
data-target="created"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
|
@ -111,6 +111,9 @@ export default class FeatureListComponent extends React.Component {
|
|||||||
<MenuItem disabled={settings.sort === 'enabled'} data-target="enabled">
|
<MenuItem disabled={settings.sort === 'enabled'} data-target="enabled">
|
||||||
Enabled
|
Enabled
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem disabled={settings.sort === 'stale'} data-target="stale">
|
||||||
|
Stale
|
||||||
|
</MenuItem>
|
||||||
<MenuItem disabled={settings.sort === 'created'} data-target="created">
|
<MenuItem disabled={settings.sort === 'created'} data-target="created">
|
||||||
Created
|
Created
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
@ -33,6 +33,11 @@ export const mapStateToPropsConfigurable = isFeature => state => {
|
|||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
a.enabled === b.enabled ? 0 : a.enabled ? -1 : 1
|
a.enabled === b.enabled ? 0 : a.enabled ? -1 : 1
|
||||||
);
|
);
|
||||||
|
} else if (settings.sort === 'stale') {
|
||||||
|
features = features.sort((a, b) =>
|
||||||
|
// eslint-disable-next-line
|
||||||
|
a.stale === b.stale ? 0 : a.stale ? -1 : 1
|
||||||
|
);
|
||||||
} else if (settings.sort === 'created') {
|
} else if (settings.sort === 'created') {
|
||||||
features = features.sort((a, b) => (new Date(a.createdAt) > new Date(b.createdAt) ? -1 : 1));
|
features = features.sort((a, b) => (new Date(a.createdAt) > new Date(b.createdAt) ? -1 : 1));
|
||||||
} else if (settings.sort === 'name') {
|
} else if (settings.sort === 'name') {
|
||||||
|
Loading…
Reference in New Issue
Block a user