mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
fixed add remove tags stuck (#137074)
This commit is contained in:
parent
2880c66823
commit
857821f22c
5 changed files with 14 additions and 4 deletions
|
@ -224,6 +224,9 @@ export const AgentBulkActions: React.FunctionComponent<Props> = ({
|
|||
onTagsUpdated={() => {
|
||||
refreshAgents({ refreshTags: true });
|
||||
}}
|
||||
onClosePopover={() => {
|
||||
setIsTagAddVisible(false);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<EuiFlexGroup gutterSize="m" alignItems="center">
|
||||
|
|
|
@ -21,7 +21,6 @@ export const TableRowActions: React.FunctionComponent<{
|
|||
onUnenrollClick: () => void;
|
||||
onUpgradeClick: () => void;
|
||||
onAddRemoveTagsClick: (button: HTMLElement) => void;
|
||||
allTags: string[];
|
||||
}> = ({
|
||||
agent,
|
||||
agentPolicy,
|
||||
|
@ -29,7 +28,6 @@ export const TableRowActions: React.FunctionComponent<{
|
|||
onUnenrollClick,
|
||||
onUpgradeClick,
|
||||
onAddRemoveTagsClick,
|
||||
allTags,
|
||||
}) => {
|
||||
const { getHref } = useLink();
|
||||
const hasFleetAllPrivileges = useAuthz().fleet.all;
|
||||
|
|
|
@ -26,6 +26,7 @@ describe('TagsAddRemove', () => {
|
|||
const onTagsUpdated = jest.fn();
|
||||
const mockUpdateTags = useUpdateTags().updateTags as jest.Mock;
|
||||
const mockBulkUpdateTags = useUpdateTags().bulkUpdateTags as jest.Mock;
|
||||
const onClosePopover = jest.fn();
|
||||
|
||||
beforeEach(() => {
|
||||
onTagsUpdated.mockReset();
|
||||
|
@ -44,6 +45,7 @@ describe('TagsAddRemove', () => {
|
|||
selectedTags={selectedTags}
|
||||
button={button}
|
||||
onTagsUpdated={onTagsUpdated}
|
||||
onClosePopover={onClosePopover}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -41,6 +41,7 @@ interface Props {
|
|||
selectedTags: string[];
|
||||
button: HTMLElement;
|
||||
onTagsUpdated: () => void;
|
||||
onClosePopover: () => void;
|
||||
}
|
||||
|
||||
export const TagsAddRemove: React.FC<Props> = ({
|
||||
|
@ -50,6 +51,7 @@ export const TagsAddRemove: React.FC<Props> = ({
|
|||
selectedTags,
|
||||
button,
|
||||
onTagsUpdated,
|
||||
onClosePopover,
|
||||
}: Props) => {
|
||||
const labelsFromTags = useCallback(
|
||||
(tags: string[]) =>
|
||||
|
@ -65,7 +67,10 @@ export const TagsAddRemove: React.FC<Props> = ({
|
|||
const [searchValue, setSearchValue] = useState<string | undefined>(undefined);
|
||||
const [isPopoverOpen, setIsPopoverOpen] = useState(true);
|
||||
const [isTagHovered, setIsTagHovered] = useState<{ [tagName: string]: boolean }>({});
|
||||
const closePopover = () => setIsPopoverOpen(false);
|
||||
const closePopover = () => {
|
||||
setIsPopoverOpen(false);
|
||||
onClosePopover();
|
||||
};
|
||||
|
||||
const updateTagsHook = useUpdateTags();
|
||||
|
||||
|
|
|
@ -531,7 +531,6 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
|
|||
setAgentToAddRemoveTags(agent);
|
||||
setShowTagsAddRemove(!showTagsAddRemove);
|
||||
}}
|
||||
allTags={allTags ?? []}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
@ -602,6 +601,9 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
|
|||
onTagsUpdated={() => {
|
||||
fetchData();
|
||||
}}
|
||||
onClosePopover={() => {
|
||||
setShowTagsAddRemove(false);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isFleetServerUnhealthy && (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue