mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Fetch hosts when a label is clicked in the Host Side Panel (#1124)
This commit is contained in:
parent
9468fb3908
commit
1b54ce18ab
2 changed files with 16 additions and 0 deletions
|
|
@ -167,6 +167,7 @@ export class ManageHostsPage extends Component {
|
|||
const { slug } = selectedLabel;
|
||||
const nextLocation = slug === 'all-hosts' ? MANAGE_HOSTS : `${MANAGE_HOSTS}/${slug}`;
|
||||
|
||||
dispatch(hostActions.loadAll());
|
||||
dispatch(push(nextLocation));
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,21 @@ describe('ManageHostsPage - component', () => {
|
|||
|
||||
expect(page.find('QuerySidePanel').length).toEqual(1);
|
||||
});
|
||||
|
||||
it('fetches all hosts when a label is clicked', () => {
|
||||
const labels = [windowsLabel];
|
||||
const pageProps = { ...props, labels };
|
||||
const Page = mount(<ManageHostsPage {...pageProps} />);
|
||||
const SidePanel = Page.find('HostSidePanel');
|
||||
|
||||
spyOn(hostActions, 'loadAll');
|
||||
|
||||
expect(hostActions.loadAll).toNotHaveBeenCalled();
|
||||
|
||||
SidePanel.find('.panel-group-item__platform--windows').simulate('click');
|
||||
|
||||
expect(hostActions.loadAll).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('header', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue