Skip to content

Commit 115eccf

Browse files
Merge branch '7.x' into backport/7.x/pr-87045
2 parents 00177a6 + 12a8bb3 commit 115eccf

File tree

83 files changed

+864
-2441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+864
-2441
lines changed

docs/settings/reporting-settings.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ a| `xpack.reporting.capture.browser`
195195
Defaults to `false`.
196196

197197
a| `xpack.reporting.capture.browser`
198-
.chromium.proxy.server`
198+
`.chromium.proxy.server`
199199
| The uri for the proxy server. Providing the username and password for the proxy server via the uri is not supported.
200200

201201
a| `xpack.reporting.capture.browser`
202-
.chromium.proxy.bypass`
202+
`.chromium.proxy.bypass`
203203
| An array of hosts that should not go through the proxy server and should use a direct connection instead.
204204
Examples of valid entries are "elastic.co", "*.elastic.co", ".elastic.co", ".elastic.co:5601".
205205

src/core/server/http/cookie_session_storage.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
import { Request, Server } from '@hapi/hapi';
2121
import hapiAuthCookie from '@hapi/cookie';
22-
// @ts-expect-error no TS definitions
23-
import Statehood from '@hapi/statehood';
2422

2523
import { KibanaRequest, ensureRawRequest } from './router';
2624
import { SessionStorageFactory, SessionStorage } from './session_storage';
@@ -148,7 +146,7 @@ export async function createCookieSessionStorageFactory<T>(
148146
path: basePath === undefined ? '/' : basePath,
149147
clearInvalid: false,
150148
isHttpOnly: true,
151-
isSameSite: cookieOptions.sameSite === 'None' ? false : cookieOptions.sameSite ?? false,
149+
isSameSite: cookieOptions.sameSite ?? false,
152150
},
153151
validateFunc: async (req: Request, session: T | T[]) => {
154152
const result = cookieOptions.validate(session);
@@ -159,23 +157,6 @@ export async function createCookieSessionStorageFactory<T>(
159157
},
160158
});
161159

162-
// A hack to support SameSite: 'None'.
163-
// Remove it after update Hapi to v19 that supports SameSite: 'None' out of the box.
164-
if (cookieOptions.sameSite === 'None') {
165-
log.debug('Patching Statehood.prepareValue');
166-
const originalPrepareValue = Statehood.prepareValue;
167-
Statehood.prepareValue = function kibanaStatehoodPrepareValueWrapper(
168-
name: string,
169-
value: unknown,
170-
options: any
171-
) {
172-
if (name === cookieOptions.name) {
173-
options.isSameSite = cookieOptions.sameSite;
174-
}
175-
return originalPrepareValue(name, value, options);
176-
};
177-
}
178-
179160
return {
180161
asScoped(request: KibanaRequest) {
181162
return new ScopedCookieSessionStorage<T>(log, server, ensureRawRequest(request));

src/plugins/data/public/ui/filter_bar/filter_item.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,27 @@ export function FilterItem(props: Props) {
7171

7272
useEffect(() => {
7373
const index = props.filter.meta.index;
74+
let isSubscribed = true;
7475
if (index) {
7576
getIndexPatterns()
7677
.get(index)
7778
.then((indexPattern) => {
78-
setIndexPatternExists(!!indexPattern);
79+
if (isSubscribed) {
80+
setIndexPatternExists(!!indexPattern);
81+
}
7982
})
8083
.catch(() => {
81-
setIndexPatternExists(false);
84+
if (isSubscribed) {
85+
setIndexPatternExists(false);
86+
}
8287
});
83-
} else {
88+
} else if (isSubscribed) {
8489
// Allow filters without an index pattern and don't validate them.
8590
setIndexPatternExists(true);
8691
}
92+
return () => {
93+
isSubscribed = false;
94+
};
8795
}, [props.filter.meta.index]);
8896

8997
function handleBadgeClick(e: MouseEvent<HTMLInputElement>) {
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
<kbn-top-nav
2-
app-name="'context'"
3-
show-search-bar="true"
4-
show-filter-bar="true"
5-
show-query-bar="false"
6-
show-save-query="false"
7-
show-date-picker="false"
8-
index-patterns="[contextApp.indexPattern]"
9-
use-default-behaviors="true"
10-
>
11-
</kbn-top-nav>
12-
131
<!-- Context App Legacy -->
142
<context-app-legacy
153
filter="contextApp.actions.addFilter"
@@ -29,4 +17,5 @@
2917
successor-available="contextApp.state.rows.successors.length"
3018
successor-status="contextApp.state.loadingStatus.successors.status"
3119
on-change-successor-count="contextApp.actions.fetchGivenSuccessorRows"
20+
top-nav-menu="contextApp.topNavMenu"
3221
></context-app-legacy>

src/plugins/discover/public/application/angular/context_app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,14 @@ getAngularModule().directive('contextApp', function ContextApp() {
5656
});
5757

5858
function ContextAppController($scope, Private) {
59-
const { filterManager, indexPatterns, uiSettings } = getServices();
59+
const { filterManager, indexPatterns, uiSettings, navigation } = getServices();
6060
const queryParameterActions = getQueryParameterActions(filterManager, indexPatterns);
6161
const queryActions = Private(QueryActionsProvider);
6262
this.state = createInitialState(
6363
parseInt(uiSettings.get(CONTEXT_STEP_SETTING), 10),
6464
getFirstSortableField(this.indexPattern, uiSettings.get(CONTEXT_TIE_BREAKER_FIELDS_SETTING))
6565
);
66+
this.topNavMenu = navigation.ui.TopNavMenu;
6667

6768
this.actions = _.mapValues(
6869
{
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import React from 'react';
21+
22+
export const TopNavMenuMock = () => <div>Hello World</div>;

src/plugins/discover/public/application/components/context_app/context_app_legacy.test.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { DocTableLegacy } from '../../angular/doc_table/create_doc_table_react';
2525
import { findTestSubject } from '@elastic/eui/lib/test';
2626
import { ActionBar } from '../../angular/context/components/action_bar/action_bar';
2727
import { ContextErrorMessage } from '../context_error_message';
28+
import { TopNavMenuMock } from './__mocks__/top_nav_menu';
2829

2930
describe('ContextAppLegacy test', () => {
3031
const hit = {
@@ -64,6 +65,17 @@ describe('ContextAppLegacy test', () => {
6465
onChangeSuccessorCount: jest.fn(),
6566
predecessorStatus: 'loaded',
6667
successorStatus: 'loaded',
68+
topNavMenu: TopNavMenuMock,
69+
};
70+
const topNavProps = {
71+
appName: 'context',
72+
showSearchBar: true,
73+
showQueryBar: false,
74+
showFilterBar: true,
75+
showSaveQuery: false,
76+
showDatePicker: false,
77+
indexPatterns: [indexPattern],
78+
useDefaultBehaviors: true,
6779
};
6880

6981
it('renders correctly', () => {
@@ -72,6 +84,9 @@ describe('ContextAppLegacy test', () => {
7284
const loadingIndicator = findTestSubject(component, 'contextApp_loadingIndicator');
7385
expect(loadingIndicator.length).toBe(0);
7486
expect(component.find(ActionBar).length).toBe(2);
87+
const topNavMenu = component.find(TopNavMenuMock);
88+
expect(topNavMenu.length).toBe(1);
89+
expect(topNavMenu.props()).toStrictEqual(topNavProps);
7590
});
7691

7792
it('renders loading indicator', () => {
@@ -82,6 +97,7 @@ describe('ContextAppLegacy test', () => {
8297
const loadingIndicator = findTestSubject(component, 'contextApp_loadingIndicator');
8398
expect(loadingIndicator.length).toBe(1);
8499
expect(component.find(ActionBar).length).toBe(2);
100+
expect(component.find(TopNavMenuMock).length).toBe(1);
85101
});
86102

87103
it('renders error message', () => {
@@ -90,6 +106,7 @@ describe('ContextAppLegacy test', () => {
90106
props.reason = 'something went wrong';
91107
const component = mountWithIntl(<ContextAppLegacy {...props} />);
92108
expect(component.find(DocTableLegacy).length).toBe(0);
109+
expect(component.find(TopNavMenuMock).length).toBe(0);
93110
const errorMessage = component.find(ContextErrorMessage);
94111
expect(errorMessage.length).toBe(1);
95112
});

src/plugins/discover/public/application/components/context_app/context_app_legacy.tsx

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ import {
2727
import { IIndexPattern, IndexPatternField } from '../../../../../data/common/index_patterns';
2828
import { LOADING_STATUS } from './constants';
2929
import { ActionBar, ActionBarProps } from '../../angular/context/components/action_bar/action_bar';
30+
import { TopNavMenuProps } from '../../../../../navigation/public';
3031

3132
export interface ContextAppProps {
33+
topNavMenu: React.ComponentType<TopNavMenuProps>;
3234
columns: string[];
3335
hits: Array<Record<string, unknown>>;
3436
indexPattern: IIndexPattern;
@@ -96,6 +98,20 @@ export function ContextAppLegacy(renderProps: ContextAppProps) {
9698
} as DocTableLegacyProps;
9799
};
98100

101+
const TopNavMenu = renderProps.topNavMenu;
102+
const getNavBarProps = () => {
103+
return {
104+
appName: 'context',
105+
showSearchBar: true,
106+
showQueryBar: false,
107+
showFilterBar: true,
108+
showSaveQuery: false,
109+
showDatePicker: false,
110+
indexPatterns: [renderProps.indexPattern],
111+
useDefaultBehaviors: true,
112+
};
113+
};
114+
99115
const loadingFeedback = () => {
100116
if (status === LOADING_STATUS.UNINITIALIZED || status === LOADING_STATUS.LOADING) {
101117
return (
@@ -112,20 +128,23 @@ export function ContextAppLegacy(renderProps: ContextAppProps) {
112128
{isFailed ? (
113129
<ContextErrorMessage status={status} reason={renderProps.reason} />
114130
) : (
115-
<EuiPage>
116-
<EuiPageContent paddingSize="s" className="dscCxtAppContent">
117-
<ActionBar {...actionBarProps(PREDECESSOR_TYPE)} />
118-
{loadingFeedback()}
119-
<EuiHorizontalRule margin="xs" />
120-
{isLoaded ? (
121-
<div className="discover-table">
122-
<DocTableLegacy {...docTableProps()} />
123-
</div>
124-
) : null}
125-
<EuiHorizontalRule margin="xs" />
126-
<ActionBar {...actionBarProps(SUCCESSOR_TYPE)} />
127-
</EuiPageContent>
128-
</EuiPage>
131+
<div>
132+
<TopNavMenu {...getNavBarProps()} />
133+
<EuiPage>
134+
<EuiPageContent paddingSize="s" className="dscCxtAppContent">
135+
<ActionBar {...actionBarProps(PREDECESSOR_TYPE)} />
136+
{loadingFeedback()}
137+
<EuiHorizontalRule margin="xs" />
138+
{isLoaded ? (
139+
<div className="discover-table">
140+
<DocTableLegacy {...docTableProps()} />
141+
</div>
142+
) : null}
143+
<EuiHorizontalRule margin="xs" />
144+
<ActionBar {...actionBarProps(SUCCESSOR_TYPE)} />
145+
</EuiPageContent>
146+
</EuiPage>
147+
</div>
129148
)}
130149
</I18nProvider>
131150
);

src/plugins/discover/public/application/components/context_app/context_app_legacy_directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ export function createContextAppLegacy(reactDirective: any) {
3737
['successorAvailable', { watchDepth: 'reference' }],
3838
['successorStatus', { watchDepth: 'reference' }],
3939
['onChangeSuccessorCount', { watchDepth: 'reference' }],
40+
['topNavMenu', { watchDepth: 'reference' }],
4041
]);
4142
}

src/plugins/discover/public/get_inner_angular.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ import {
5050
PromiseServiceCreator,
5151
registerListenEventListener,
5252
watchMultiDecorator,
53-
createTopNavDirective,
54-
createTopNavHelper,
5553
} from '../../kibana_legacy/public';
5654
import { DiscoverStartPlugins } from './plugin';
5755
import { getScopedHistory } from './kibana_services';
@@ -98,7 +96,6 @@ export function initializeInnerAngularModule(
9896
createLocalI18nModule();
9997
createLocalPrivateModule();
10098
createLocalPromiseModule();
101-
createLocalTopNavModule(navigation);
10299
createLocalStorageModule();
103100
createPagerFactoryModule();
104101
createDocTableModule();
@@ -131,7 +128,6 @@ export function initializeInnerAngularModule(
131128
'discoverI18n',
132129
'discoverPrivate',
133130
'discoverPromise',
134-
'discoverTopNav',
135131
'discoverLocalStorageProvider',
136132
'discoverDocTable',
137133
'discoverPagerFactory',
@@ -151,13 +147,6 @@ function createLocalPrivateModule() {
151147
angular.module('discoverPrivate', []).provider('Private', PrivateProvider);
152148
}
153149

154-
function createLocalTopNavModule(navigation: NavigationStart) {
155-
angular
156-
.module('discoverTopNav', ['react'])
157-
.directive('kbnTopNav', createTopNavDirective)
158-
.directive('kbnTopNavHelper', createTopNavHelper(navigation.ui));
159-
}
160-
161150
function createLocalI18nModule() {
162151
angular
163152
.module('discoverI18n', [])

0 commit comments

Comments
 (0)