Sort plugins by name
Summary: Sort plugins in sidebar by name (or ID as fallback). Reviewed By: passy Differential Revision: D13621422 fbshipit-source-id: dd264bde64409a2cd81caa0b41af81bf614f9e62
This commit is contained in:
committed by
Facebook Github Bot
parent
384529e97f
commit
cc0615c7d9
@@ -226,6 +226,9 @@ class MainSidebar extends PureComponent<MainSidebarProps> {
|
|||||||
)
|
)
|
||||||
.sort((a, b) => (a.query.app || '').localeCompare(b.query.app));
|
.sort((a, b) => (a.query.app || '').localeCompare(b.query.app));
|
||||||
|
|
||||||
|
const byPluginNameOrId = (a, b) =>
|
||||||
|
(a.title || a.id) > (b.title || b.id) ? 1 : -1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sidebar
|
<Sidebar
|
||||||
position="left"
|
position="left"
|
||||||
@@ -266,6 +269,7 @@ class MainSidebar extends PureComponent<MainSidebarProps> {
|
|||||||
{selectedDevice &&
|
{selectedDevice &&
|
||||||
Array.from(this.props.devicePlugins.values())
|
Array.from(this.props.devicePlugins.values())
|
||||||
.filter(plugin => plugin.supportsDevice(selectedDevice))
|
.filter(plugin => plugin.supportsDevice(selectedDevice))
|
||||||
|
.sort(byPluginNameOrId)
|
||||||
.map((plugin: Class<FlipperDevicePlugin<>>) => (
|
.map((plugin: Class<FlipperDevicePlugin<>>) => (
|
||||||
<PluginSidebarListItem
|
<PluginSidebarListItem
|
||||||
key={plugin.id}
|
key={plugin.id}
|
||||||
@@ -297,6 +301,7 @@ class MainSidebar extends PureComponent<MainSidebarProps> {
|
|||||||
(p: Class<FlipperPlugin<>>) =>
|
(p: Class<FlipperPlugin<>>) =>
|
||||||
client.plugins.indexOf(p.id) > -1,
|
client.plugins.indexOf(p.id) > -1,
|
||||||
)
|
)
|
||||||
|
.sort(byPluginNameOrId)
|
||||||
.map((plugin: Class<FlipperPlugin<>>) => (
|
.map((plugin: Class<FlipperPlugin<>>) => (
|
||||||
<PluginSidebarListItem
|
<PluginSidebarListItem
|
||||||
key={plugin.id}
|
key={plugin.id}
|
||||||
|
|||||||
Reference in New Issue
Block a user