mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.18`: - [[Fleet] disable unenroll action on agentless agents (#216299)](https://github.com/elastic/kibana/pull/216299) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Julia Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-28T15:51:02Z","message":"[Fleet] disable unenroll action on agentless agents (#216299)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/209173\n\nDisable Unenroll agent action on agentless agents\n\n<img width=\"1124\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/6603bac5-b0b1-4a20-8b16-f121bd69e969\"\n/>\n<img width=\"1126\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/e41bca5b-f73d-44bc-b095-9970a25f6322\"\n/>","sha":"6914495033b75d80af64a247768223547f501234","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","backport:prev-major","v9.1.0"],"title":"[Fleet] disable unenroll action on agentless agents","number":216299,"url":"https://github.com/elastic/kibana/pull/216299","mergeCommit":{"message":"[Fleet] disable unenroll action on agentless agents (#216299)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/209173\n\nDisable Unenroll agent action on agentless agents\n\n<img width=\"1124\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/6603bac5-b0b1-4a20-8b16-f121bd69e969\"\n/>\n<img width=\"1126\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/e41bca5b-f73d-44bc-b095-9970a25f6322\"\n/>","sha":"6914495033b75d80af64a247768223547f501234"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216299","number":216299,"mergeCommit":{"message":"[Fleet] disable unenroll action on agentless agents (#216299)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/209173\n\nDisable Unenroll agent action on agentless agents\n\n<img width=\"1124\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/6603bac5-b0b1-4a20-8b16-f121bd69e969\"\n/>\n<img width=\"1126\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/e41bca5b-f73d-44bc-b095-9970a25f6322\"\n/>","sha":"6914495033b75d80af64a247768223547f501234"}}]}] BACKPORT--> Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
This commit is contained in:
parent
15b5519963
commit
0316dab7a4
3 changed files with 10 additions and 4 deletions
|
@ -81,7 +81,7 @@ export const AgentDetailsActionMenu: React.FunctionComponent<{
|
|||
</EuiContextMenuItem>,
|
||||
<EuiContextMenuItem
|
||||
icon="refresh"
|
||||
disabled={!isAgentUpgradeable(agent)}
|
||||
disabled={!isAgentUpgradeable(agent) || agentPolicy?.supports_agentless === true}
|
||||
onClick={() => {
|
||||
setIsUpgradeModalOpen(true);
|
||||
}}
|
||||
|
@ -148,7 +148,9 @@ export const AgentDetailsActionMenu: React.FunctionComponent<{
|
|||
? [
|
||||
<EuiContextMenuItem
|
||||
icon="trash"
|
||||
disabled={!hasFleetAllPrivileges || !agent.active}
|
||||
disabled={
|
||||
!hasFleetAllPrivileges || !agent.active || agentPolicy?.supports_agentless === true
|
||||
}
|
||||
onClick={() => {
|
||||
setIsUnenrollModalOpen(true);
|
||||
}}
|
||||
|
|
|
@ -86,7 +86,7 @@ export const TableRowActions: React.FunctionComponent<{
|
|||
</EuiContextMenuItem>,
|
||||
<EuiContextMenuItem
|
||||
key="agentUnenrollBtn"
|
||||
disabled={!agent.active}
|
||||
disabled={!agent.active || agentPolicy?.supports_agentless === true}
|
||||
icon="trash"
|
||||
onClick={() => {
|
||||
onUnenrollClick();
|
||||
|
|
|
@ -10,7 +10,7 @@ import type { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/
|
|||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import type { Agent } from '../../types';
|
||||
import { HostedAgentPolicyRestrictionRelatedError } from '../../errors';
|
||||
import { FleetError, HostedAgentPolicyRestrictionRelatedError } from '../../errors';
|
||||
import { SO_SEARCH_LIMIT } from '../../constants';
|
||||
import { getCurrentNamespace } from '../spaces/get_current_namespace';
|
||||
import { agentsKueryNamespaceFilter } from '../spaces/agent_namespaces';
|
||||
|
@ -39,6 +39,10 @@ async function unenrollAgentIsAllowed(
|
|||
);
|
||||
}
|
||||
|
||||
if (agentPolicy?.supports_agentless) {
|
||||
throw new FleetError(`Cannot unenroll agentless agent ${agentId}`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue