Skip to content

Commit

Permalink
Merge branch 'main' into api/serverlessQA
Browse files Browse the repository at this point in the history
  • Loading branch information
MadameSheema authored Apr 15, 2024
2 parents ec2c07b + f1abe4f commit 77fa125
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 30 deletions.
15 changes: 11 additions & 4 deletions test/functional/apps/discover/group2/_data_grid_field_tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

async function findFirstColumnTokens() {
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
return await findFirstFieldIcons('euiDataGridBody > dataGridHeader');
}

async function findFirstDocViewerTokens() {
await dataGrid.clickRowToggle({ rowIndex: 0 });
return await findFirstFieldIcons('docTableDetailsFlyout');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
let fieldTokens: string[] | undefined = [];
await retry.try(async () => {
await dataGrid.clickRowToggle({ rowIndex: 0 });
fieldTokens = await findFirstFieldIcons('docTableDetailsFlyout');
});
return fieldTokens;
}

async function findFirstFieldIcons(elementSelector: string) {
Expand All @@ -62,8 +70,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
return firstFieldIcons;
}

// FLAKY: https://github.com/elastic/kibana/issues/180622
describe.skip('discover data grid field tokens', function () {
describe('discover data grid field tokens', function () {
before(async () => {
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
Expand Down
16 changes: 16 additions & 0 deletions x-pack/plugins/fleet/common/constants/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@ export const LICENSE_FOR_SCHEDULE_UPGRADE = 'platinum';
export const DEFAULT_MAX_AGENT_POLICIES_WITH_INACTIVITY_TIMEOUT = 750;

export const AGENTLESS_POLICY_ID = 'agentless'; // the policy id defined here: https://github.com/elastic/project-controller/blob/main/internal/project/security/security_kibana_config.go#L86

export const AGENT_LOG_LEVELS = {
ERROR: 'error',
WARNING: 'warning',
INFO: 'info',
DEBUG: 'debug',
};

export const DEFAULT_LOG_LEVEL = AGENT_LOG_LEVELS.INFO;

export const agentLoggingLevels = {
Info: 'info',
Debug: 'debug',
Warning: 'warning',
Error: 'error',
} as const;
19 changes: 19 additions & 0 deletions x-pack/plugins/fleet/common/settings/agent_policy_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import { i18n } from '@kbn/i18n';
import { z } from 'zod';

import { agentLoggingLevels } from '../constants';

import type { SettingsConfig } from './types';

export const zodStringWithDurationValidation = z
Expand Down Expand Up @@ -126,4 +128,21 @@ export const AGENT_POLICY_ADVANCED_SETTINGS: SettingsConfig[] = [
})
.default({}),
},
{
name: 'agent.logging.level',
hidden: true,
title: i18n.translate('xpack.fleet.settings.agentPolicyAdvanced.agentLoggingLevelTitle', {
defaultMessage: 'Agent Logging Level',
}),
description: i18n.translate(
'xpack.fleet.settings.agentPolicyAdvanced.agentLoggingLevelDescription',
{
defaultMessage: 'Set the Agent log level. The default log level is "info".',
}
),
api_field: {
name: 'agent_logging_level',
},
schema: z.nativeEnum(agentLoggingLevels),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { ZodFirstPartyTypeKind } from 'zod';
import React from 'react';
import { EuiFieldNumber, EuiFieldText } from '@elastic/eui';
import { EuiFieldNumber, EuiFieldText, EuiSelect } from '@elastic/eui';

import type { SettingsConfig } from '../../../../../common/settings/types';

Expand Down Expand Up @@ -61,6 +61,27 @@ settingComponentRegistry.set(ZodFirstPartyTypeKind.ZodString, (settingsConfig) =
);
});

settingComponentRegistry.set(ZodFirstPartyTypeKind.ZodNativeEnum, (settingsConfig) => {
return (
<SettingsFieldWrapper
settingsConfig={settingsConfig}
typeName={ZodFirstPartyTypeKind.ZodString}
renderItem={({ fieldKey, fieldValue, handleChange, coercedSchema }: any) => (
<EuiSelect
data-test-subj={fieldKey}
value={fieldValue}
fullWidth
onChange={handleChange}
options={Object.keys(coercedSchema.enum).map((level) => ({
text: level,
value: coercedSchema.enum[level],
}))}
/>
)}
/>
);
});

export function ConfiguredSettings({
configuredSettings,
}: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,13 @@ interface Props {
agentPolicy: Partial<NewAgentPolicy | AgentPolicy>;
updateAgentPolicy: (u: Partial<NewAgentPolicy | AgentPolicy>) => void;
validation: ValidationResults;
isEditing?: boolean;
disabled?: boolean;
}

export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent<Props> = ({
agentPolicy,
updateAgentPolicy,
validation,
isEditing = false,
disabled = false,
}) => {
const { docLinks } = useStartServices();
Expand Down Expand Up @@ -401,7 +399,6 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent<Props> =
}}
/>
</EuiDescribedFormGroup>

{AgentTamperProtectionSection}

<EuiDescribedFormGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export const AgentPolicyCreateInlineForm: React.FunctionComponent<Props> = ({
agentPolicy={newAgentPolicy}
updateAgentPolicy={updateNewAgentPolicy}
validation={validation}
isEditing={false}
/>
</StyledEuiAccordion>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export const AgentPolicyForm: React.FunctionComponent<Props> = ({
agentPolicy={agentPolicy}
updateAgentPolicy={updateAgentPolicy}
validation={validation}
isEditing={isEditing}
/>

{advancedPolicySettings ? (
Expand All @@ -168,7 +167,6 @@ export const AgentPolicyForm: React.FunctionComponent<Props> = ({
agentPolicy={agentPolicy}
updateAgentPolicy={updateAgentPolicy}
validation={validation}
isEditing={isEditing}
disabled={disabled}
/>
{advancedPolicySettings ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ interface Props {
withSysMonitoring: boolean;
updateSysMonitoring: (newValue: boolean) => void;
validation: ValidationResults;
isEditing?: boolean;
onDelete?: () => void;
}

export const AgentPolicyIntegrationForm: React.FunctionComponent<Props> = ({
Expand All @@ -45,8 +43,6 @@ export const AgentPolicyIntegrationForm: React.FunctionComponent<Props> = ({
withSysMonitoring,
updateSysMonitoring,
validation,
isEditing = false,
onDelete = () => {},
}) => {
return (
<EuiForm>
Expand Down Expand Up @@ -101,7 +97,6 @@ export const AgentPolicyIntegrationForm: React.FunctionComponent<Props> = ({
agentPolicy={agentPolicy}
updateAgentPolicy={updateAgentPolicy}
validation={validation}
isEditing={isEditing}
/>
</StyledEuiAccordion>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,3 @@ export const DEFAULT_LOGS_STATE: AgentLogsState = {

export const STATE_STORAGE_KEY = '_q';
export const STATE_DATASET_FIELD = 'datasets';

export const AGENT_LOG_LEVELS = {
ERROR: 'error',
WARNING: 'warning',
INFO: 'info',
DEBUG: 'debug',
};

export const DEFAULT_LOG_LEVEL = AGENT_LOG_LEVELS.INFO;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { EuiSelectableOption } from '@elastic/eui';
import { EuiPopover, EuiFilterButton, EuiSelectable } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { AGENT_LOG_LEVELS } from './constants';
import { AGENT_LOG_LEVELS } from '../../../../../../../../common/constants';

const LEVEL_VALUES = Object.values(AGENT_LOG_LEVELS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EuiSelect, EuiFormLabel, EuiButtonEmpty, EuiFlexItem, EuiFlexGroup } fr
import type { Agent } from '../../../../../types';
import { sendPostAgentAction, useAuthz, useStartServices } from '../../../../../hooks';

import { AGENT_LOG_LEVELS, DEFAULT_LOG_LEVEL } from './constants';
import { AGENT_LOG_LEVELS, DEFAULT_LOG_LEVEL } from '../../../../../../../../common/constants';

const LEVEL_VALUES = Object.values(AGENT_LOG_LEVELS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ describe('getFullAgentPolicy', () => {
mockAgentPolicy({
advanced_settings: {
agent_limits_go_max_procs: 2,
agent_logging_level: 'debug',
},
});
const agentPolicy = await getFullAgentPolicy(savedObjectsClientMock.create(), 'agent-policy');
Expand All @@ -727,6 +728,7 @@ describe('getFullAgentPolicy', () => {
id: 'agent-policy',
agent: {
limits: { go_max_procs: 2 },
logging: { level: 'debug' },
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ const handleIntercepts = () => {
});
};

describe(
// Failing: See https://github.com/elastic/kibana/issues/180755
describe.skip(
'Discover Timeline State Integration',
{
tags: ['@ess', '@skipInServerless'],
},

() => {
beforeEach(() => {
login();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const ESQL_QUERY = 'from auditbeat-* | where ecs.version == "8.0.0"';
const KQL_QUERY = '_index : "auditbeat-*" and ecs.version : "8.0.0"';
const EQL_QUERY = 'process where process.name == "zsh"';

describe(
// Failing: See https://github.com/elastic/kibana/issues/180756
describe.skip(
'Basic Assistant tests',
{
tags: ['@ess'],
Expand Down

0 comments on commit 77fa125

Please sign in to comment.