Skip to content

Commit

Permalink
Merge branch 'main' into create-categorization-job-from-pattern-analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Nov 13, 2023
2 parents b6359b0 + 19e43c8 commit 7802419
Show file tree
Hide file tree
Showing 93 changed files with 2,487 additions and 1,055 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -790,6 +790,7 @@ packages/kbn-unified-field-list @elastic/kibana-data-discovery
examples/unified_field_list_examples @elastic/kibana-data-discovery
src/plugins/unified_histogram @elastic/kibana-data-discovery
src/plugins/unified_search @elastic/kibana-visualizations
packages/kbn-unsaved-changes-badge @elastic/kibana-data-discovery
x-pack/plugins/upgrade_assistant @elastic/platform-deployment-management
x-pack/plugins/uptime @elastic/obs-ux-infra_services-team
x-pack/plugins/drilldowns/url_drilldown @elastic/appex-sharedux
Expand Down Expand Up @@ -1372,6 +1373,7 @@ x-pack/test/security_solution_api_integration/test_suites/detections_response/de
x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/rule_creation @elastic/security-detection-engine
x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/actions @elastic/security-detection-engine
x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/alerts @elastic/security-detection-engine
/x-pack/plugins/security_solution/server/lib/detection_engine/scripts/roles_users @elastic/security-detection-engine

## Security Threat Intelligence - Under Security Platform
/x-pack/plugins/security_solution/public/common/components/threat_match @elastic/security-detection-engine
Expand Down
3 changes: 2 additions & 1 deletion .i18nrc.json
Expand Up @@ -132,7 +132,8 @@
"unifiedSearch": "src/plugins/unified_search",
"unifiedFieldList": "packages/kbn-unified-field-list",
"unifiedHistogram": "src/plugins/unified_histogram",
"unifiedDataTable": "packages/kbn-unified-data-table"
"unifiedDataTable": "packages/kbn-unified-data-table",
"unsavedChangesBadge": "packages/kbn-unsaved-changes-badge"
},
"translations": []
}
23 changes: 23 additions & 0 deletions docs/CHANGELOG.asciidoc
Expand Up @@ -10,6 +10,7 @@

Review important information about the {kib} 8.x releases.

* <<release-notes-8.11.1>>
* <<release-notes-8.11.0>>
* <<release-notes-8.10.4>>
* <<release-notes-8.10.3>>
Expand Down Expand Up @@ -53,6 +54,28 @@ Review important information about the {kib} 8.x releases.
* <<release-notes-8.0.0-alpha1>>

--

[[release-notes-8.11.1]]
== {kib} 8.11.1

The 8.11.1 release includes the following bug fixes.

[float]
[[fixes-v8.11.1]]
=== Bug Fixes

Fleet::
* Fixes inability to upgrade agents from version 8.10.4 to version 8.11 ({kibana-pull}170974[#170974]).
* Append space ID to security solution tag ({kibana-pull}170789[#170789]).
* Modify bulk unenroll to include inactive agents ({kibana-pull}170249[#170249]).
Lens & Visualizations::
* Fixes error handling for ES|QL nested error messages ({kibana-pull}170005[#170005]).
Machine Learning::
* Disable anomaly detection job creation from ES|QL lens visualizations ({kibana-pull}170711[#170711]).
Presentation::
* Fixes vector tile layer with joins stuck in loading state when not visible ({kibana-pull}170984[#170984]).
* Fixes expand layer control is not clickable when layers are loading ({kibana-pull}170912[#170912]).

[[release-notes-8.11.0]]
== {kib} 8.11.0

Expand Down
11 changes: 11 additions & 0 deletions examples/discover_customization_examples/public/plugin.tsx
Expand Up @@ -163,6 +163,17 @@ export class DiscoverCustomizationExamplesPlugin implements Plugin {
order: 300,
},
],
getBadges: () => {
return [
{
data: {
badgeText: 'Example badge',
color: 'warning',
},
order: 10,
},
];
},
});

customizations.set({
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -781,6 +781,7 @@
"@kbn/unified-field-list-examples-plugin": "link:examples/unified_field_list_examples",
"@kbn/unified-histogram-plugin": "link:src/plugins/unified_histogram",
"@kbn/unified-search-plugin": "link:src/plugins/unified_search",
"@kbn/unsaved-changes-badge": "link:packages/kbn-unsaved-changes-badge",
"@kbn/upgrade-assistant-plugin": "link:x-pack/plugins/upgrade_assistant",
"@kbn/uptime-plugin": "link:x-pack/plugins/uptime",
"@kbn/url-drilldown-plugin": "link:x-pack/plugins/drilldowns/url_drilldown",
Expand Down
Expand Up @@ -85,6 +85,10 @@ export const useRowHeightsOptions = ({
defaultHeight,
lineHeight: rowLineHeight,
onChange: ({ defaultHeight: newRowHeight }: EuiDataGridRowHeightsOptions) => {
if (newRowHeight === defaultHeight && typeof rowHeightState === 'undefined') {
// ignore, no changes required
return;
}
const newSerializedRowHeight = serializeRowHeight(
// pressing "Reset to default" triggers onChange with the same value
newRowHeight === defaultHeight ? configRowHeight : newRowHeight
Expand Down
8 changes: 8 additions & 0 deletions packages/kbn-unsaved-changes-badge/README.md
@@ -0,0 +1,8 @@
# @kbn/unsaved-changes-badge

A yellow "Unsaved changes" badge which can be found for example on Discover page.
It supports callbacks to save or revert the changes.

To integrate it into TopNav component, consider using `getTopNavUnsavedChangesBadge(...)` util and pass the result to `badges` prop of the top nav.

There is also a standalone component `<UnsavedChangesBadge .../>`.
17 changes: 17 additions & 0 deletions packages/kbn-unsaved-changes-badge/index.ts
@@ -0,0 +1,17 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export {
UnsavedChangesBadge,
type UnsavedChangesBadgeProps,
} from './src/components/unsaved_changes_badge';

export {
getTopNavUnsavedChangesBadge,
type TopNavUnsavedChangesBadgeParams,
} from './src/utils/get_top_nav_unsaved_changes_badge';
13 changes: 13 additions & 0 deletions packages/kbn-unsaved-changes-badge/jest.config.js
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-unsaved-changes-badge'],
};
5 changes: 5 additions & 0 deletions packages/kbn-unsaved-changes-badge/kibana.jsonc
@@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/unsaved-changes-badge",
"owner": "@elastic/kibana-data-discovery"
}
10 changes: 10 additions & 0 deletions packages/kbn-unsaved-changes-badge/package.json
@@ -0,0 +1,10 @@
{
"name": "@kbn/unsaved-changes-badge",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": [
"*.css",
"*.scss"
]
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export { UnsavedChangesBadge, type UnsavedChangesBadgeProps } from './unsaved_changes_badge';
@@ -0,0 +1,89 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
import { render, act, screen, waitFor } from '@testing-library/react';
import { UnsavedChangesBadge } from './unsaved_changes_badge';

describe('<UnsavedChangesBadge />', () => {
test('should render correctly', async () => {
const onRevert = jest.fn();
const { getByTestId, queryByTestId } = render(
<UnsavedChangesBadge badgeText="test" onRevert={onRevert} />
);
expect(getByTestId('unsavedChangesBadge')).toBeInTheDocument();

getByTestId('unsavedChangesBadge').click();
await waitFor(() => {
return Boolean(queryByTestId('unsavedChangesBadgeMenuPanel'));
});
expect(queryByTestId('revertUnsavedChangesButton')).toBeInTheDocument();
expect(queryByTestId('saveUnsavedChangesButton')).not.toBeInTheDocument();
expect(queryByTestId('saveUnsavedChangesAsButton')).not.toBeInTheDocument();

expect(onRevert).not.toHaveBeenCalled();

act(() => {
getByTestId('revertUnsavedChangesButton').click();
});
expect(onRevert).toHaveBeenCalled();
});

test('should show all menu items', async () => {
const onRevert = jest.fn().mockResolvedValue(true);
const onSave = jest.fn().mockResolvedValue(true);
const onSaveAs = jest.fn().mockResolvedValue(true);
const { getByTestId, queryByTestId, container } = render(
<UnsavedChangesBadge
badgeText="test"
onRevert={onRevert}
onSave={onSave}
onSaveAs={onSaveAs}
/>
);

expect(container).toMatchSnapshot();

getByTestId('unsavedChangesBadge').click();
await waitFor(() => {
return Boolean(queryByTestId('unsavedChangesBadgeMenuPanel'));
});
expect(queryByTestId('revertUnsavedChangesButton')).toBeInTheDocument();
expect(queryByTestId('saveUnsavedChangesButton')).toBeInTheDocument();
expect(queryByTestId('saveUnsavedChangesAsButton')).toBeInTheDocument();

expect(screen.getByTestId('unsavedChangesBadgeMenuPanel')).toMatchSnapshot();
});

test('should call callbacks', async () => {
const onRevert = jest.fn().mockResolvedValue(true);
const onSave = jest.fn().mockResolvedValue(true);
const onSaveAs = jest.fn().mockResolvedValue(true);
const { getByTestId, queryByTestId } = render(
<UnsavedChangesBadge
badgeText="test"
onRevert={onRevert}
onSave={onSave}
onSaveAs={onSaveAs}
/>
);
act(() => {
getByTestId('unsavedChangesBadge').click();
});
await waitFor(() => {
return Boolean(queryByTestId('unsavedChangesBadgeMenuPanel'));
});

expect(onSave).not.toHaveBeenCalled();

act(() => {
getByTestId('saveUnsavedChangesButton').click();
});
expect(onSave).toHaveBeenCalled();
});
});

0 comments on commit 7802419

Please sign in to comment.