[Fleet] Allow user-configured namespace for managed policies (#116523)
* Disable agent monitoring settings in UI for managed policies * Allow namespace to be changed for preconfigured managed policies Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
2c887539d5
commit
e793b3a225
|
@ -237,6 +237,7 @@ export const AgentPolicyForm: React.FunctionComponent<Props> = ({
|
|||
}
|
||||
>
|
||||
<EuiCheckboxGroup
|
||||
disabled={agentPolicy.is_managed === true}
|
||||
options={[
|
||||
{
|
||||
id: dataTypes.Logs,
|
||||
|
|
|
@ -547,6 +547,17 @@ describe('comparePreconfiguredPolicyToCurrent', () => {
|
|||
);
|
||||
expect(hasChanged).toBe(false);
|
||||
});
|
||||
|
||||
it('should not return hasChanged when only namespace field changes', () => {
|
||||
const { hasChanged } = comparePreconfiguredPolicyToCurrent(
|
||||
{
|
||||
...baseConfig,
|
||||
namespace: 'newnamespace',
|
||||
},
|
||||
basePackagePolicy
|
||||
);
|
||||
expect(hasChanged).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('output preconfiguration', () => {
|
||||
|
|
|
@ -389,7 +389,9 @@ export function comparePreconfiguredPolicyToCurrent(
|
|||
policyFromConfig: PreconfiguredAgentPolicy,
|
||||
currentPolicy: AgentPolicy
|
||||
) {
|
||||
const configTopLevelFields = omit(policyFromConfig, 'package_policies', 'id');
|
||||
// Namespace is omitted from being compared because even for managed policies, we still
|
||||
// want users to be able to pick their own namespace: https://github.com/elastic/kibana/issues/110533
|
||||
const configTopLevelFields = omit(policyFromConfig, 'package_policies', 'id', 'namespace');
|
||||
const currentTopLevelFields = pick(currentPolicy, ...Object.keys(configTopLevelFields));
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue