-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* move LinkedAgentCount component to top-level components and adjust output * refactor integration details Policies list to use LinkedAgentCount component * test cases for agent counts on integrations
- Loading branch information
1 parent
8a2d6e6
commit df53ea7
Showing
7 changed files
with
295 additions
and
202 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
x-pack/plugins/fleet/public/applications/fleet/components/linked_agent_count.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { memo } from 'react'; | ||
import { EuiLink, EuiLinkAnchorProps } from '@elastic/eui'; | ||
import { useLink } from '../hooks'; | ||
import { AGENT_SAVED_OBJECT_TYPE } from '../constants'; | ||
|
||
/** | ||
* Displays the provided `count` number as a link to the Agents list if it is greater than zero | ||
*/ | ||
export const LinkedAgentCount = memo< | ||
Omit<EuiLinkAnchorProps, 'href'> & { count: number; agentPolicyId: string } | ||
>(({ count, agentPolicyId, ...otherEuiLinkProps }) => { | ||
const { getHref } = useLink(); | ||
return count > 0 ? ( | ||
<EuiLink | ||
{...otherEuiLinkProps} | ||
href={getHref('fleet_agent_list', { | ||
kuery: `${AGENT_SAVED_OBJECT_TYPE}.policy_id : ${agentPolicyId}`, | ||
})} | ||
> | ||
{count} | ||
</EuiLink> | ||
) : ( | ||
<span | ||
data-test-subj={otherEuiLinkProps['data-test-subj']} | ||
className={otherEuiLinkProps.className} | ||
> | ||
{count} | ||
</span> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
...s/fleet/public/applications/fleet/sections/agent_policy/components/linked_agent_count.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.