Skip to content

Commit

Permalink
Merge branch 'main' into eui-v78.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored May 15, 2023
2 parents 8a6e647 + 86d691f commit 47cf567
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 36 deletions.
61 changes: 51 additions & 10 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[[advanced-options]]
== Advanced Settings

*Advanced Settings* control the behavior of {kib}. For example, you can change the format used to display dates,
specify the default data view, and set the precision for displayed decimal values.
*Advanced Settings* control the behavior of {kib}. You can change the settings that apply to spaces, or to all of {kib}. For example, you can change the format used to display dates,
specify the default data view, and apply your own branding.

. Open the main menu, then click *Stack Management > Advanced Settings*.
. Scroll or search for the setting.
. Make your change, then click *Save changes*.
WARNING: Changing a setting can affect {kib} performance and cause problems
that are difficult to diagnose. Setting a property value to a blank field
reverts to the default behavior, which might not be compatible with other
configuration settings. Deleting a custom setting permanently removes it from {kib}.

[float]
=== Required permissions
Expand All @@ -25,12 +26,14 @@ For more information on granting access to {kib}, refer to <<xpack-security-auth

[float]
[[kibana-settings-reference]]
=== {kib} settings reference
=== Change the space settings

WARNING: Changing a setting can affect {kib} performance and cause problems
that are difficult to diagnose. Setting a property value to a blank field
reverts to the default behavior, which might not be compatible with other
configuration settings. Deleting a custom setting permanently removes it from {kib}.
Change the settings that apply only to {kib} spaces.

. Open the main menu, then click *Stack Management > Advanced Settings*.
. Click *Space Settings*.
. Scroll or search for the setting.
. Make your change, then click *Save changes*.

[float]
[[kibana-general-settings]]
Expand Down Expand Up @@ -554,3 +557,41 @@ only production-ready visualizations are available to users.
[[telemetry-enabled-advanced-setting]]`telemetry:enabled`::
When enabled, helps improve the Elastic Stack by providing usage statistics for
basic features.

[float]
[[kibana-global-settings-reference]]
=== Change the global settings

Change the settings that apply only to {kib} spaces.

. Open the main menu, then click *Stack Management > Advanced Settings*.
. Click *Global Settings*.
. Scroll or search for the setting.
. Make your change, then click *Save changes*.

[float]
[[kibana-custom-branding-settings]]
==== Custom branding

[horizontal]
[[custom-logo]]`xpackCustomBranding:logo`::
A custom image that appears in the header of all {kib} pages. Images must have a transparent background, and 128 x 128 pixels or smaller.

[[organization-name]]`xpackCustomBranding:customizedLogo`::
The custom text that appears in the header of all {kib} pages. Images must have a transparent background, and 200 x 84 pixels or smaller.

[[page-title]]`xpackCustomBranding:pageTitle`::
The custom text that appears on {kib} browser tabs.

[[favicon-svg]]`xpackCustomBranding:faviconSVG`::
The URL of a custom SVG image that appears on {kib} browser tabs. Images must be 16 x 16 pixels.

[[favicon-png]]`xpackCustomBranding:faviconPNG`::
The URL of a custom PNG image that appears on {kib} browser tabs.

[float]
[[kibana-usage-data-settings]]
==== Usage Data

[[provide-usage-data]]`telemetry:enabled`::
When enabled, helps manage and improve Elastic products and services by providing usage statistics.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React, { FC, useState, useEffect, useCallback, useRef } from 'react';
import React, { FC, useState, useEffect, useCallback, useRef, useMemo } from 'react';
import type { SavedSearch } from '@kbn/discover-plugin/public';
import type { DataView, DataViewField } from '@kbn/data-views-plugin/public';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -60,12 +60,15 @@ export const LogCategorizationFlyout: FC<LogCategorizationPageProps> = ({
uiSettings,
} = useAiopsAppContext();
const { euiTheme } = useEuiTheme();
const { filters, query } = useMemo(() => getState(), [getState]);

const mounted = useRef(false);
const { runCategorizeRequest, cancelRequest, randomSampler } = useCategorizeRequest();
const [aiopsListState, setAiopsListState] = usePageUrlState<AiOpsPageUrlState>(
const [aiopsListState] = usePageUrlState<AiOpsPageUrlState>(
'AIOPS_INDEX_VIEWER',
getDefaultAiOpsListState()
getDefaultAiOpsListState({
searchQuery: createMergedEsQuery(query, filters, dataView, uiSettings),
})
);
const [selectedCategory, setSelectedCategory] = useState<Category | null>(null);
const [selectedSavedSearch /* , setSelectedSavedSearch*/] = useState(savedSearch);
Expand Down Expand Up @@ -109,16 +112,6 @@ export const LogCategorizationFlyout: FC<LogCategorizationPageProps> = ({
true
);

useEffect(() => {
const { filters, query } = getState();

setAiopsListState({
...aiopsListState,
searchQuery: createMergedEsQuery(query, filters, dataView, uiSettings),
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const loadCategories = useCallback(async () => {
const { title: index, timeFieldName: timeField } = dataView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,32 @@
import React from 'react';
import { type CustomAssetsAccordionProps, CustomAssetsAccordion } from '@kbn/fleet-plugin/public';
import { i18n } from '@kbn/i18n';
import { useParams } from 'react-router-dom';
import { EuiSpacer } from '@elastic/eui';
import { CloudSecurityPolicyTemplate } from '../../../common/types';
import { VULN_MGMT_POLICY_TEMPLATE } from '../../../common/constants';
import { useKibana } from '../../common/hooks/use_kibana';
import { benchmarksNavigation, cloudPosturePages } from '../../common/navigation/constants';

const SECURITY_APP_NAME = 'securitySolutionUI';

export const CspCustomAssetsExtension = () => {
const { application } = useKibana().services;
const integration = useParams<{ integration: CloudSecurityPolicyTemplate | undefined }>()
.integration;

const viewsCNVM: CustomAssetsAccordionProps['views'] = [
{
name: cloudPosturePages.findings.name,
url: application.getUrlForApp(SECURITY_APP_NAME, {
path: cloudPosturePages.findings.path + '/vulnerabilities',
}),
description: i18n.translate(
'xpack.csp.createPackagePolicy.customAssetsTab.vulnerabilityFindingsViewLabel',
{ defaultMessage: 'View Vulnerability Findings ' }
),
},
];

const views: CustomAssetsAccordionProps['views'] = [
{
Expand All @@ -27,7 +46,9 @@ export const CspCustomAssetsExtension = () => {
},
{
name: cloudPosturePages.findings.name,
url: application.getUrlForApp(SECURITY_APP_NAME, { path: cloudPosturePages.findings.path }),
url: application.getUrlForApp(SECURITY_APP_NAME, {
path: cloudPosturePages.findings.path,
}),
description: i18n.translate(
'xpack.csp.createPackagePolicy.customAssetsTab.findingsViewLabel',
{ defaultMessage: 'View CSP Findings ' }
Expand All @@ -42,6 +63,34 @@ export const CspCustomAssetsExtension = () => {
},
];

if (!integration) {
return (
<>
<CustomAssetsAccordion
views={views}
initialIsOpen
title={i18n.translate(
'xpack.csp.createPackagePolicy.customAssetsTab.cloudPostureTitleLabel',
{ defaultMessage: 'Cloud Posture ' }
)}
/>
<EuiSpacer size="m" />
<CustomAssetsAccordion
views={viewsCNVM}
initialIsOpen
title={i18n.translate(
'xpack.csp.createPackagePolicy.customAssetsTab.cloudNativeVulnerabilityManagementTitleLabel',
{ defaultMessage: 'Cloud Native Vulnerability Management ' }
)}
/>
</>
);
}

if (integration === VULN_MGMT_POLICY_TEMPLATE) {
return <CustomAssetsAccordion views={viewsCNVM} initialIsOpen />;
}

return <CustomAssetsAccordion views={views} initialIsOpen />;
};
// eslint-disable-next-line import/no-default-export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ export interface CustomAssetsAccordionProps {
description: string;
}>;
initialIsOpen?: boolean;
title?: string;
}

export const CustomAssetsAccordion: FunctionComponent<CustomAssetsAccordionProps> = ({
views,
initialIsOpen = false,
title,
}) => {
const { application } = useStartServices();

Expand All @@ -46,7 +48,7 @@ export const CustomAssetsAccordion: FunctionComponent<CustomAssetsAccordionProps
<EuiFlexGroup justifyContent="center" alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>
<EuiText size="m">
<h3>{AssetTitleMap.view}</h3>
<h3>{title ?? AssetTitleMap.view}</h3>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,28 @@ describe('ruleType Params validate()', () => {
);
});

it('uses default value "count" if aggType is undefined', async () => {
params.aggType = undefined;
expect(onValidate()).not.toThrow();
});

it('fails for invalid groupBy', async () => {
params.groupBy = 42;
expect(onValidate()).toThrowErrorMatchingInlineSnapshot(
`"[groupBy]: expected value of type [string] but got [number]"`
);

params.groupBy = '-not-a-valid-groupBy-';
expect(onValidate()).toThrowErrorMatchingInlineSnapshot(
`"[groupBy]: invalid groupBy: \\"-not-a-valid-groupBy-\\""`
);
});

it('uses default value "all" if groupBy is undefined', async () => {
params.groupBy = undefined;
expect(onValidate()).not.toThrow();
});

it('fails for invalid aggField', async () => {
params.aggField = 42;
expect(onValidate()).toThrowErrorMatchingInlineSnapshot(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ const EsQueryRuleParamsSchemaProperties = {
threshold: schema.arrayOf(schema.number(), { minSize: 1, maxSize: 2 }),
thresholdComparator: getComparatorSchemaType(validateComparator),
// aggregation type
aggType: schema.string({ validate: validateAggType }),
aggType: schema.string({ validate: validateAggType, defaultValue: 'count' }),
// aggregation field
aggField: schema.maybe(schema.string({ minLength: 1 })),
// how to group
groupBy: schema.string({ validate: validateGroupBy }),
groupBy: schema.string({ validate: validateGroupBy, defaultValue: 'all' }),
// field to group on (for groupBy: top)
termField: schema.maybe(schema.string({ minLength: 1 })),
// limit on number of groups returned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ export function runTests(schema: ObjectType, defaultTypeParams: Record<string, u
);
});

it('uses default value "count" if aggType is undefined', async () => {
params.aggType = undefined;
expect(onValidate()).not.toThrow();
});

it('fails for invalid groupBy', async () => {
params.groupBy = 42;
expect(onValidate()).toThrowErrorMatchingInlineSnapshot(
`"[groupBy]: expected value of type [string] but got [number]"`
);

params.groupBy = '-not-a-valid-groupBy-';
expect(onValidate()).toThrowErrorMatchingInlineSnapshot(
`"[groupBy]: invalid groupBy: \\"-not-a-valid-groupBy-\\""`
);
});

it('uses default value "all" if groupBy is undefined', async () => {
params.groupBy = undefined;
expect(onValidate()).not.toThrow();
});

it('fails for invalid aggField', async () => {
params.aggField = 42;
expect(onValidate()).toThrowErrorMatchingInlineSnapshot(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export const CoreQueryParamsSchemaProperties = {
// field in index used for date/time
timeField: schema.string({ minLength: 1 }),
// aggregation type
aggType: schema.string({ validate: validateAggType }),
aggType: schema.string({ validate: validateAggType, defaultValue: 'count' }),
// aggregation field
aggField: schema.maybe(schema.string({ minLength: 1 })),
// how to group
groupBy: schema.string({ validate: validateGroupBy }),
groupBy: schema.string({ validate: validateGroupBy, defaultValue: 'all' }),
// field to group on (for groupBy: top)
termField: schema.maybe(schema.string({ minLength: 1 })),
// filter field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,34 @@ export default function ruleTests({ getService }: FtrProviderContext) {
});
});

describe('aggType and groupBy', () => {
it('sets aggType: "count" and groupBy: "all" when they are undefined', async () => {
endDate = new Date().toISOString();

await createEsDocumentsInGroups(ES_GROUPS_TO_WRITE, endDate);

await createRule({
name: 'always fire',
esQuery: `{\n \"query\":{\n \"match_all\" : {}\n }\n}`,
size: 100,
thresholdComparator: '>',
threshold: [0],
aggType: undefined,
groupBy: undefined,
});

const docs = await waitForDocs(2);

expect(docs[0]._source.hits.length).greaterThan(0);
const messagePattern =
/rule 'always fire' is active:\n\n- Value: \d+\n- Conditions Met: Number of matching documents is greater than 0 over 20s\n- Timestamp: \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;
expect(docs[0]._source.params.message).to.match(messagePattern);

expect(docs[1]._source.hits.length).to.be(0);
expect(docs[1]._source.params.message).to.match(/rule 'always fire' is recovered/);
});
});

async function waitForDocs(count: number): Promise<any[]> {
return await esTestIndexToolOutput.waitForDocs(
ES_TEST_INDEX_SOURCE,
Expand Down Expand Up @@ -1080,8 +1108,8 @@ export default function ruleTests({ getService }: FtrProviderContext) {
thresholdComparator: params.thresholdComparator,
threshold: params.threshold,
searchType: params.searchType,
aggType: params.aggType ?? 'count',
groupBy: params.groupBy ?? 'all',
aggType: params.aggType,
groupBy: params.groupBy,
aggField: params.aggField,
termField: params.termField,
termSize: params.termSize,
Expand Down
3 changes: 2 additions & 1 deletion x-pack/test/functional/apps/infra/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});

describe('alerts flyouts', () => {
// FLAKY: https://github.com/elastic/kibana/issues/157711
describe.skip('alerts flyouts', () => {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs');
await pageObjects.common.navigateToApp('infraOps');
Expand Down
3 changes: 2 additions & 1 deletion x-pack/test/functional/apps/infra/hosts_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
expect(pageUrl).to.contain(HOSTS_VIEW_PATH);
});

describe('#Landing page', () => {
// FLAKY: https://github.com/elastic/kibana/issues/157718
describe.skip('#Landing page', () => {
beforeEach(() => {
setHostViewEnabled(false);
});
Expand Down
3 changes: 2 additions & 1 deletion x-pack/test/functional/apps/infra/metrics_explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});

describe('Saved Views', () => {
// FLAKY: https://github.com/elastic/kibana/issues/157738
describe.skip('Saved Views', () => {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs');
await pageObjects.infraHome.goToMetricExplorer();
Expand Down
3 changes: 2 additions & 1 deletion x-pack/test/functional/apps/security/security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const spaces = getService('spaces');

describe('Security', function () {
// FLAKY: https://github.com/elastic/kibana/issues/157722
describe.skip('Security', function () {
this.tags('includeFirefox');
describe('Login Page', () => {
before(async () => {
Expand Down
Loading

0 comments on commit 47cf567

Please sign in to comment.