mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
# Backport This will backport the following commits from `main` to `8.18`: - [[Fleet] fix UI bug displaying default agent binary source (#214360)](https://github.com/elastic/kibana/pull/214360) <!--- 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-13T17:01:08Z","message":"[Fleet] fix UI bug displaying default agent binary source (#214360)\n\n## Summary\n\nFix UI bug when an agent policy uses the default download source\nexplicitly. The Agent binary download UI select was empty.\n\nTo verify:\n- create a new agent binary download source\n- create an agent policy with using the default download source\n- check on Agent policy details UI that the Agent binary download UI\nselect is populated correctly\n\n```\nPOST kbn:/api/fleet/agent_policies\n{\n \"name\": \"demo-policy-5\",\n \"description\": \"\",\n \"namespace\": \"default\",\n \"monitoring_enabled\": [\n \"logs\",\n \"metrics\",\n \"traces\"\n ],\n \"inactivity_timeout\": 1209600,\n \"is_protected\": false,\n \"download_source_id\": \"fleet-default-download-source\"\n}\n```\n\nBefore:\n\n\n\n\nAfter:\n\n<img width=\"1517\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/f5d19520-317e-4df8-aaed-0e367a2e6d9b\"\n/>","sha":"eb62a047bd06ebb70c6119bf3c19145df901fdda","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","backport:prev-minor","backport:prev-major","v9.1.0"],"title":"[Fleet] fix UI bug displaying default agent binary source","number":214360,"url":"https://github.com/elastic/kibana/pull/214360","mergeCommit":{"message":"[Fleet] fix UI bug displaying default agent binary source (#214360)\n\n## Summary\n\nFix UI bug when an agent policy uses the default download source\nexplicitly. The Agent binary download UI select was empty.\n\nTo verify:\n- create a new agent binary download source\n- create an agent policy with using the default download source\n- check on Agent policy details UI that the Agent binary download UI\nselect is populated correctly\n\n```\nPOST kbn:/api/fleet/agent_policies\n{\n \"name\": \"demo-policy-5\",\n \"description\": \"\",\n \"namespace\": \"default\",\n \"monitoring_enabled\": [\n \"logs\",\n \"metrics\",\n \"traces\"\n ],\n \"inactivity_timeout\": 1209600,\n \"is_protected\": false,\n \"download_source_id\": \"fleet-default-download-source\"\n}\n```\n\nBefore:\n\n\n\n\nAfter:\n\n<img width=\"1517\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/f5d19520-317e-4df8-aaed-0e367a2e6d9b\"\n/>","sha":"eb62a047bd06ebb70c6119bf3c19145df901fdda"}},"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/214360","number":214360,"mergeCommit":{"message":"[Fleet] fix UI bug displaying default agent binary source (#214360)\n\n## Summary\n\nFix UI bug when an agent policy uses the default download source\nexplicitly. The Agent binary download UI select was empty.\n\nTo verify:\n- create a new agent binary download source\n- create an agent policy with using the default download source\n- check on Agent policy details UI that the Agent binary download UI\nselect is populated correctly\n\n```\nPOST kbn:/api/fleet/agent_policies\n{\n \"name\": \"demo-policy-5\",\n \"description\": \"\",\n \"namespace\": \"default\",\n \"monitoring_enabled\": [\n \"logs\",\n \"metrics\",\n \"traces\"\n ],\n \"inactivity_timeout\": 1209600,\n \"is_protected\": false,\n \"download_source_id\": \"fleet-default-download-source\"\n}\n```\n\nBefore:\n\n\n\n\nAfter:\n\n<img width=\"1517\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/f5d19520-317e-4df8-aaed-0e367a2e6d9b\"\n/>","sha":"eb62a047bd06ebb70c6119bf3c19145df901fdda"}}]}] BACKPORT--> Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
This commit is contained in:
parent
deec2c7737
commit
5c3edf5171
3 changed files with 21 additions and 20 deletions
|
@ -681,6 +681,11 @@ describe('useFleetServerHostsOptions', () => {
|
|||
"inputDisplay": "Default (currently Default)",
|
||||
"value": "@@##DEFAULT_SELECT##@@",
|
||||
},
|
||||
Object {
|
||||
"disabled": false,
|
||||
"inputDisplay": "Default",
|
||||
"value": "default-host",
|
||||
},
|
||||
Object {
|
||||
"disabled": true,
|
||||
"inputDisplay": "Internal",
|
||||
|
|
|
@ -156,7 +156,7 @@ export function useOutputOptions(agentPolicy: Partial<NewAgentPolicy | AgentPoli
|
|||
);
|
||||
}
|
||||
|
||||
export function useDownloadSourcesOptions(agentPolicy: Partial<NewAgentPolicy | AgentPolicy>) {
|
||||
export function useDownloadSourcesOptions() {
|
||||
const downloadSourcesRequest = useGetDownloadSources();
|
||||
|
||||
const dataDownloadSourceOptions = useMemo(() => {
|
||||
|
@ -169,14 +169,12 @@ export function useDownloadSourcesOptions(agentPolicy: Partial<NewAgentPolicy |
|
|||
|
||||
return [
|
||||
getDefaultDownloadSource(defaultDownloadSourceName),
|
||||
...downloadSourcesRequest.data.items
|
||||
.filter((item) => !item.is_default)
|
||||
.map((item) => {
|
||||
return {
|
||||
value: item.id,
|
||||
inputDisplay: item.name,
|
||||
};
|
||||
}),
|
||||
...downloadSourcesRequest.data.items.map((item) => {
|
||||
return {
|
||||
value: item.id,
|
||||
inputDisplay: item.name,
|
||||
};
|
||||
}),
|
||||
];
|
||||
}, [downloadSourcesRequest]);
|
||||
|
||||
|
@ -222,17 +220,15 @@ export function useFleetServerHostsOptions(agentPolicy: Partial<NewAgentPolicy |
|
|||
|
||||
return [
|
||||
getDefaultFleetServerHosts(defaultFleetServerHostsName),
|
||||
...fleetServerHostsRequest.data.items
|
||||
.filter((item) => !item.is_default)
|
||||
.map((item) => {
|
||||
const isInternalFleetServerHost = !!item.is_internal;
|
||||
...fleetServerHostsRequest.data.items.map((item) => {
|
||||
const isInternalFleetServerHost = !!item.is_internal;
|
||||
|
||||
return {
|
||||
value: item.id,
|
||||
inputDisplay: item.name,
|
||||
disabled: isInternalFleetServerHost,
|
||||
};
|
||||
}),
|
||||
return {
|
||||
value: item.id,
|
||||
inputDisplay: item.name,
|
||||
disabled: isInternalFleetServerHost,
|
||||
};
|
||||
}),
|
||||
];
|
||||
}, [fleetServerHostsRequest]);
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent<Props> =
|
|||
maxAgentPoliciesWithInactivityTimeout !== undefined &&
|
||||
totalAgentPoliciesWithInactivityTimeout > (maxAgentPoliciesWithInactivityTimeout ?? 0);
|
||||
const { dataDownloadSourceOptions, isLoading: isLoadingDownloadSources } =
|
||||
useDownloadSourcesOptions(agentPolicy);
|
||||
useDownloadSourcesOptions();
|
||||
|
||||
const { fleetServerHostsOptions, isLoading: isLoadingFleetServerHostsOption } =
|
||||
useFleetServerHostsOptions(agentPolicy);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue