mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
Merge branch 'master' into improve-application-list-view-layout
This commit is contained in:
commit
1b37348b72
@ -66,7 +66,7 @@ export default class FeatureListComponent extends React.PureComponent {
|
||||
</FABButton>
|
||||
</Link>
|
||||
</div>
|
||||
<Card shadow={0} className={commonStyles.fullwidth}>
|
||||
<Card shadow={0} className={commonStyles.fullwidth} style={{ overflow: 'visible' }}>
|
||||
<CardActions>
|
||||
<DropdownButton id="metric" label={`Last ${settings.showLastHour ? 'hour' : 'minute'}`}/>
|
||||
<Menu target="metric" onClick={() => this.toggleMetrics()}
|
||||
@ -79,7 +79,7 @@ export default class FeatureListComponent extends React.PureComponent {
|
||||
<DropdownButton id="sorting" label={`By ${settings.sort}`}/>
|
||||
<Menu target="sorting" onClick={(e) => this.setSort(e.target.getAttribute('data-target'))}
|
||||
style={{ width: '168px' }}>
|
||||
<MenuItem disabled={!settings.sort || settings.sort === 'name'} data-target="name">Name</MenuItem>
|
||||
<MenuItem disabled={settings.sort === 'name'} data-target="name">Name</MenuItem>
|
||||
<MenuItem disabled={settings.sort === 'enabled'} data-target="enabled">Enabled</MenuItem>
|
||||
<MenuItem disabled={settings.sort === 'created'} data-target="created">Created</MenuItem>
|
||||
<MenuItem disabled={settings.sort === 'strategies'} data-target="strategies">Strategies</MenuItem>
|
||||
|
@ -21,38 +21,40 @@ const mapStateToProps = (state) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (settings.sort) {
|
||||
if (settings.sort === 'enabled') {
|
||||
features = features.sort((a, b) => (
|
||||
// eslint-disable-next-line
|
||||
a.enabled === b.enabled ? 0 : a.enabled ? -1 : 1
|
||||
));
|
||||
} else if (settings.sort === 'created') {
|
||||
features = features.sort((a, b) => (
|
||||
new Date(a.createdAt) > new Date(b.createdAt) ? -1 : 1
|
||||
));
|
||||
} else if (settings.sort === 'name') {
|
||||
features = features.sort((a, b) => {
|
||||
if (a.name < b.name) { return -1; }
|
||||
if (a.name > b.name) { return 1; }
|
||||
return 0;
|
||||
});
|
||||
} else if (settings.sort === 'strategies') {
|
||||
features = features.sort((a, b) => (
|
||||
a.strategies.length > b.strategies.length ? -1 : 1
|
||||
));
|
||||
} else if (settings.sort === 'metrics') {
|
||||
const target = settings.showLastHour ? featureMetrics.lastHour : featureMetrics.lastMinute;
|
||||
if (!settings.sort) {
|
||||
settings.sort = 'name';
|
||||
}
|
||||
|
||||
features = features.sort((a, b) => {
|
||||
if (!target[a.name]) { return 1; }
|
||||
if (!target[b.name]) { return -1; }
|
||||
if (target[a.name].yes > target[b.name].yes) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
if (settings.sort === 'enabled') {
|
||||
features = features.sort((a, b) => (
|
||||
// eslint-disable-next-line
|
||||
a.enabled === b.enabled ? 0 : a.enabled ? -1 : 1
|
||||
));
|
||||
} else if (settings.sort === 'created') {
|
||||
features = features.sort((a, b) => (
|
||||
new Date(a.createdAt) > new Date(b.createdAt) ? -1 : 1
|
||||
));
|
||||
} else if (settings.sort === 'name') {
|
||||
features = features.sort((a, b) => {
|
||||
if (a.name < b.name) { return -1; }
|
||||
if (a.name > b.name) { return 1; }
|
||||
return 0;
|
||||
});
|
||||
} else if (settings.sort === 'strategies') {
|
||||
features = features.sort((a, b) => (
|
||||
a.strategies.length > b.strategies.length ? -1 : 1
|
||||
));
|
||||
} else if (settings.sort === 'metrics') {
|
||||
const target = settings.showLastHour ? featureMetrics.lastHour : featureMetrics.lastMinute;
|
||||
|
||||
features = features.sort((a, b) => {
|
||||
if (!target[a.name]) { return 1; }
|
||||
if (!target[b.name]) { return -1; }
|
||||
if (target[a.name].yes > target[b.name].yes) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user