Skip to content

Commit 64e29d2

Browse files
authored
Merge branch 'main' into jul-31
2 parents 9a9be86 + 2ed81b3 commit 64e29d2

37 files changed

Lines changed: 807 additions & 357 deletions

File tree

oas_docs/bundle.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,15 +5746,22 @@
57465746
}
57475747
},
57485748
{
5749+
"description": "The fields to return in the `attributes` key of the response.",
57495750
"in": "query",
57505751
"name": "fields",
57515752
"required": false,
57525753
"schema": {
5753-
"items": {
5754-
"description": "The fields to return in the `attributes` key of the response.",
5755-
"type": "string"
5756-
},
5757-
"type": "array"
5754+
"anyOf": [
5755+
{
5756+
"items": {
5757+
"type": "string"
5758+
},
5759+
"type": "array"
5760+
},
5761+
{
5762+
"type": "string"
5763+
}
5764+
]
57585765
}
57595766
},
57605767
{

oas_docs/bundle.serverless.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,15 +5746,22 @@
57465746
}
57475747
},
57485748
{
5749+
"description": "The fields to return in the `attributes` key of the response.",
57495750
"in": "query",
57505751
"name": "fields",
57515752
"required": false,
57525753
"schema": {
5753-
"items": {
5754-
"description": "The fields to return in the `attributes` key of the response.",
5755-
"type": "string"
5756-
},
5757-
"type": "array"
5754+
"anyOf": [
5755+
{
5756+
"items": {
5757+
"type": "string"
5758+
},
5759+
"type": "array"
5760+
},
5761+
{
5762+
"type": "string"
5763+
}
5764+
]
57585765
}
57595766
},
57605767
{

oas_docs/output/kibana.serverless.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4416,14 +4416,16 @@ paths:
44164416
required:
44174417
- type
44184418
- id
4419-
- in: query
4419+
- description: The fields to return in the `attributes` key of the response.
4420+
in: query
44204421
name: fields
44214422
required: false
44224423
schema:
4423-
items:
4424-
description: The fields to return in the `attributes` key of the response.
4425-
type: string
4426-
type: array
4424+
anyOf:
4425+
- items:
4426+
type: string
4427+
type: array
4428+
- type: string
44274429
- description: 'A KQL string that you filter with an attribute from your saved object. It should look like `savedObjectType.attributes.title: "myTitle"`. However, if you used a direct attribute of a saved object, such as `updatedAt`, you must define your filter, for example, `savedObjectType.updatedAt > 2018-12-22`.'
44284430
in: query
44294431
name: filter

oas_docs/output/kibana.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4946,14 +4946,16 @@ paths:
49464946
required:
49474947
- type
49484948
- id
4949-
- in: query
4949+
- description: The fields to return in the `attributes` key of the response.
4950+
in: query
49504951
name: fields
49514952
required: false
49524953
schema:
4953-
items:
4954-
description: The fields to return in the `attributes` key of the response.
4955-
type: string
4956-
type: array
4954+
anyOf:
4955+
- items:
4956+
type: string
4957+
type: array
4958+
- type: string
49574959
- description: 'A KQL string that you filter with an attribute from your saved object. It should look like `savedObjectType.attributes.title: "myTitle"`. However, if you used a direct attribute of a saved object, such as `updatedAt`, you must define your filter, for example, `savedObjectType.updatedAt > 2018-12-22`.'
49584960
in: query
49594961
name: filter

src/platform/packages/private/kbn-esql-editor/src/esql_editor.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { i18n } from '@kbn/i18n';
2323
import moment from 'moment';
2424
import { isEqual, memoize } from 'lodash';
2525
import { CodeEditor, CodeEditorProps } from '@kbn/code-editor';
26+
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
2627
import useObservable from 'react-use/lib/useObservable';
2728
import { KBN_FIELD_TYPES } from '@kbn/field-types';
2829
import type { CoreStart } from '@kbn/core/public';
@@ -127,17 +128,8 @@ const ESQLEditorInternal = function ESQLEditor({
127128
const datePickerOpenStatusRef = useRef<boolean>(false);
128129
const theme = useEuiTheme();
129130
const kibana = useKibana<ESQLEditorDeps>();
130-
const {
131-
dataViews,
132-
expressions,
133-
indexManagementApiService,
134-
application,
135-
core,
136-
fieldsMetadata,
137-
uiSettings,
138-
uiActions,
139-
data,
140-
} = kibana.services;
131+
const { dataViews, expressions, application, core, fieldsMetadata, uiSettings, uiActions, data } =
132+
kibana.services;
141133

142134
const activeSolutionId = useObservable(core.chrome.getActiveSolutionNavId$());
143135

@@ -510,12 +502,15 @@ const ESQLEditorInternal = function ESQLEditor({
510502
return [];
511503
},
512504
getPolicies: async () => {
513-
const { data: policies, error } =
514-
(await indexManagementApiService?.getAllEnrichPolicies()) || {};
515-
if (error || !policies) {
505+
try {
506+
const policies = (await core.http.get(
507+
`/internal/index_management/enrich_policies`
508+
)) as SerializedEnrichPolicy[];
509+
510+
return policies.map(({ type, query: policyQuery, ...rest }) => rest);
511+
} catch (error) {
516512
return [];
517513
}
518-
return policies.map(({ type, query: policyQuery, ...rest }) => rest);
519514
},
520515
getPreferences: async () => {
521516
return {
@@ -576,7 +571,6 @@ const ESQLEditorInternal = function ESQLEditor({
576571
abortController,
577572
variablesService?.esqlVariables,
578573
variablesService?.areSuggestionsEnabled,
579-
indexManagementApiService,
580574
histogramBarTarget,
581575
activeSolutionId,
582576
]);

src/platform/packages/private/kbn-esql-editor/src/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import type { CoreStart } from '@kbn/core/public';
1111
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
1212
import type { AggregateQuery } from '@kbn/es-query';
1313
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
14-
import type { IndexManagementPluginSetup } from '@kbn/index-management-shared-types';
1514
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';
1615
import type { ILicense } from '@kbn/licensing-plugin/public';
1716
import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
@@ -131,7 +130,6 @@ export interface ESQLEditorDeps {
131130
expressions: ExpressionsStart;
132131
storage: Storage;
133132
uiActions: UiActionsStart;
134-
indexManagementApiService?: IndexManagementPluginSetup['apiService'];
135133
fieldsMetadata?: FieldsMetadataPublicStart;
136134
usageCollection?: UsageCollectionStart;
137135
esql?: EsqlPluginStartBase;

src/platform/packages/shared/kbn-unified-tabs/src/components/tabbed_content/tabbed_content.tsx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface TabbedContentProps extends Pick<TabsBarProps, 'maxItemsCount'>
3232
recentlyClosedItems: TabItem[];
3333
'data-test-subj'?: string;
3434
services: TabsServices;
35+
hideTabsBar?: boolean;
3536
renderContent: (selectedItem: TabItem) => React.ReactNode;
3637
createItem: () => TabItem;
3738
onChanged: (state: TabbedContentState) => void;
@@ -49,6 +50,7 @@ export const TabbedContent: React.FC<TabbedContentProps> = ({
4950
recentlyClosedItems,
5051
maxItemsCount,
5152
services,
53+
hideTabsBar = false,
5254
renderContent,
5355
createItem,
5456
onChanged,
@@ -180,25 +182,27 @@ export const TabbedContent: React.FC<TabbedContentProps> = ({
180182
gutterSize="none"
181183
className="eui-fullHeight"
182184
>
183-
<EuiFlexItem grow={false}>
184-
<TabsBar
185-
ref={tabsBarApi}
186-
items={items}
187-
selectedItem={selectedItem}
188-
recentlyClosedItems={recentlyClosedItems}
189-
maxItemsCount={maxItemsCount}
190-
tabContentId={tabContentId}
191-
getTabMenuItems={getTabMenuItems}
192-
services={services}
193-
onAdd={onAdd}
194-
onLabelEdited={onLabelEdited}
195-
onSelect={onSelect}
196-
onSelectRecentlyClosed={onSelectRecentlyClosed}
197-
onReorder={onReorder}
198-
onClose={onClose}
199-
getPreviewData={getPreviewData}
200-
/>
201-
</EuiFlexItem>
185+
{!hideTabsBar && (
186+
<EuiFlexItem grow={false}>
187+
<TabsBar
188+
ref={tabsBarApi}
189+
items={items}
190+
selectedItem={selectedItem}
191+
recentlyClosedItems={recentlyClosedItems}
192+
maxItemsCount={maxItemsCount}
193+
tabContentId={tabContentId}
194+
getTabMenuItems={getTabMenuItems}
195+
services={services}
196+
onAdd={onAdd}
197+
onLabelEdited={onLabelEdited}
198+
onSelect={onSelect}
199+
onSelectRecentlyClosed={onSelectRecentlyClosed}
200+
onReorder={onReorder}
201+
onClose={onClose}
202+
getPreviewData={getPreviewData}
203+
/>
204+
</EuiFlexItem>
205+
)}
202206
{selectedItem ? (
203207
<EuiFlexItem
204208
data-test-subj="unifiedTabs_selectedTabContent"

src/platform/plugins/shared/data/public/query/mocks.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ const createStartContractMock = () => {
3939
addToQueryLog: jest.fn(),
4040
filterManager: createFilterManagerMock(),
4141
queryString: queryStringManagerMock.createStartContract(),
42-
savedQueries: { getSavedQuery: jest.fn(), getSavedQueryCount: jest.fn() } as any,
42+
savedQueries: {
43+
getSavedQuery: jest.fn(),
44+
getSavedQueryCount: jest.fn(),
45+
isDuplicateTitle: jest.fn(),
46+
createQuery: jest.fn(),
47+
} as any,
4348
state$: new Observable(),
4449
getState: jest.fn(),
4550
timefilter: timefilterServiceMock.createStartContract(),

src/platform/plugins/shared/discover/public/application/main/components/session_view/session_view.tsx

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { RedirectWhenSavedObjectNotFound } from './redirect_not_found';
5050
import { DiscoverMainApp } from './main_app';
5151
import { useAsyncFunction } from '../../hooks/use_async_function';
5252
import { ScopedServicesProvider } from '../../../../components/scoped_services_provider';
53+
import { HideTabsBar } from '../tabs_view/hide_tabs_bar';
5354

5455
export interface DiscoverSessionViewProps {
5556
customizationContext: DiscoverCustomizationContext;
@@ -194,27 +195,29 @@ export const DiscoverSessionView = ({
194195

195196
if (initializeSessionState.value.showNoDataPage) {
196197
return (
197-
<NoDataPage
198-
{...initializationState}
199-
onDataViewCreated={async (dataViewUnknown) => {
200-
await dispatch(internalStateActions.loadDataViewList());
201-
dispatch(
202-
internalStateActions.setInitializationState({
203-
hasESData: true,
204-
hasUserDataView: true,
205-
})
206-
);
207-
const dataView = dataViewUnknown as DataView;
208-
initializeSession({
209-
defaultUrlState: dataView.id
210-
? { dataSource: createDataViewDataSource({ dataViewId: dataView.id }) }
211-
: undefined,
212-
});
213-
}}
214-
onESQLNavigationComplete={() => {
215-
initializeSession();
216-
}}
217-
/>
198+
<HideTabsBar>
199+
<NoDataPage
200+
{...initializationState}
201+
onDataViewCreated={async (dataViewUnknown) => {
202+
await dispatch(internalStateActions.loadDataViewList());
203+
dispatch(
204+
internalStateActions.setInitializationState({
205+
hasESData: true,
206+
hasUserDataView: true,
207+
})
208+
);
209+
const dataView = dataViewUnknown as DataView;
210+
initializeSession({
211+
defaultUrlState: dataView.id
212+
? { dataSource: createDataViewDataSource({ dataViewId: dataView.id }) }
213+
: undefined,
214+
});
215+
}}
216+
onESQLNavigationComplete={() => {
217+
initializeSession();
218+
}}
219+
/>
220+
</HideTabsBar>
218221
);
219222
}
220223

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
import type { FC, ReactNode } from 'react';
11+
import { useEffect } from 'react';
12+
import { internalStateActions, useInternalStateDispatch } from '../../state_management/redux';
13+
import { TabsBarVisibility } from '../../state_management/redux/types';
14+
15+
export const HideTabsBar: FC<{ children: ReactNode }> = ({ children }) => {
16+
const dispatch = useInternalStateDispatch();
17+
18+
useEffect(() => {
19+
dispatch(internalStateActions.setTabsBarVisibility(TabsBarVisibility.hidden));
20+
return () => {
21+
dispatch(internalStateActions.setTabsBarVisibility(TabsBarVisibility.default));
22+
};
23+
}, [dispatch]);
24+
25+
return children;
26+
};

0 commit comments

Comments
 (0)