Filter displayed plugins by selected device
Summary: Now that android devices know their own serial, we can filter plugins by the selected device. Reviewed By: passy Differential Revision: D9481461 fbshipit-source-id: 4a53eea1e61caa09c3d63ca0076fbc1b6dceb99f
This commit is contained in:
committed by
Facebook Github Bot
parent
edff177c3f
commit
0f08b04571
@@ -198,31 +198,41 @@ class MainSidebar extends Component<MainSidebarProps> {
|
|||||||
plugin={plugin}
|
plugin={plugin}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{clients.map((client: Client) => (
|
{clients
|
||||||
<React.Fragment key={client.id}>
|
.filter(
|
||||||
<SidebarHeader>{client.query.app}</SidebarHeader>
|
(client: Client) =>
|
||||||
{plugins
|
(selectedDevice &&
|
||||||
.filter(
|
client.query.device_id === selectedDevice.serial) ||
|
||||||
(p: Class<SonarPlugin<>>) => client.plugins.indexOf(p.id) > -1,
|
// Old android sdk versions don't know their device_id
|
||||||
)
|
// Display their plugins under all selected devices until they die out
|
||||||
.map((plugin: Class<SonarPlugin<>>) => (
|
client.query.device_id === 'unknown',
|
||||||
<PluginSidebarListItem
|
)
|
||||||
key={plugin.id}
|
.map((client: Client) => (
|
||||||
isActive={
|
<React.Fragment key={client.id}>
|
||||||
plugin.id === selectedPlugin && selectedApp === client.id
|
<SidebarHeader>{client.query.app}</SidebarHeader>
|
||||||
}
|
{plugins
|
||||||
onClick={() =>
|
.filter(
|
||||||
selectPlugin({
|
(p: Class<SonarPlugin<>>) =>
|
||||||
selectedPlugin: plugin.id,
|
client.plugins.indexOf(p.id) > -1,
|
||||||
selectedApp: client.id,
|
)
|
||||||
})
|
.map((plugin: Class<SonarPlugin<>>) => (
|
||||||
}
|
<PluginSidebarListItem
|
||||||
plugin={plugin}
|
key={plugin.id}
|
||||||
app={client.query.app}
|
isActive={
|
||||||
/>
|
plugin.id === selectedPlugin && selectedApp === client.id
|
||||||
))}
|
}
|
||||||
</React.Fragment>
|
onClick={() =>
|
||||||
))}
|
selectPlugin({
|
||||||
|
selectedPlugin: plugin.id,
|
||||||
|
selectedApp: client.id,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
plugin={plugin}
|
||||||
|
app={client.query.app}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</React.Fragment>
|
||||||
|
))}
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user