{
savedObjects: {
client: SavedObjectsClientContract;
typeRegistry: ISavedObjectTypeRegistry;
exporter: ISavedObjectsExporter;
importer: ISavedObjectsImporter;
};
elasticsearch: {
client: IScopedClusterClient;
legacy: {
client: ILegacyScopedClusterClient;
};
};
uiSettings: {
client: IUiSettingsClient;
};
}
| |
+| [core](./kibana-plugin-core-server.requesthandlercontext.core.md) | {
savedObjects: {
client: SavedObjectsClientContract;
typeRegistry: ISavedObjectTypeRegistry;
getClient: (options?: SavedObjectsClientProviderOptions) => SavedObjectsClientContract;
getExporter: (client: SavedObjectsClientContract) => ISavedObjectsExporter;
getImporter: (client: SavedObjectsClientContract) => ISavedObjectsImporter;
};
elasticsearch: {
client: IScopedClusterClient;
legacy: {
client: ILegacyScopedClusterClient;
};
};
uiSettings: {
client: IUiSettingsClient;
};
}
| |
diff --git a/src/core/server/core_route_handler_context.ts b/src/core/server/core_route_handler_context.ts
index f3e06ad8f1daa..f5123a91e7100 100644
--- a/src/core/server/core_route_handler_context.ts
+++ b/src/core/server/core_route_handler_context.ts
@@ -13,8 +13,7 @@ import { SavedObjectsClientContract } from './saved_objects/types';
import {
InternalSavedObjectsServiceStart,
ISavedObjectTypeRegistry,
- ISavedObjectsExporter,
- ISavedObjectsImporter,
+ SavedObjectsClientProviderOptions,
} from './saved_objects';
import {
InternalElasticsearchServiceStart,
@@ -58,8 +57,6 @@ class CoreSavedObjectsRouteHandlerContext {
) {}
#scopedSavedObjectsClient?: SavedObjectsClientContract;
#typeRegistry?: ISavedObjectTypeRegistry;
- #exporter?: ISavedObjectsExporter;
- #importer?: ISavedObjectsImporter;
public get client() {
if (this.#scopedSavedObjectsClient == null) {
@@ -75,19 +72,18 @@ class CoreSavedObjectsRouteHandlerContext {
return this.#typeRegistry;
}
- public get exporter() {
- if (this.#exporter == null) {
- this.#exporter = this.savedObjectsStart.createExporter(this.client);
- }
- return this.#exporter;
- }
+ public getClient = (options?: SavedObjectsClientProviderOptions) => {
+ if (!options) return this.client;
+ return this.savedObjectsStart.getScopedClient(this.request, options);
+ };
- public get importer() {
- if (this.#importer == null) {
- this.#importer = this.savedObjectsStart.createImporter(this.client);
- }
- return this.#importer;
- }
+ public getExporter = (client: SavedObjectsClientContract) => {
+ return this.savedObjectsStart.createExporter(client);
+ };
+
+ public getImporter = (client: SavedObjectsClientContract) => {
+ return this.savedObjectsStart.createImporter(client);
+ };
}
class CoreUiSettingsRouteHandlerContext {
diff --git a/src/core/server/index.ts b/src/core/server/index.ts
index dac2d210eb395..8e4cdc7d59e32 100644
--- a/src/core/server/index.ts
+++ b/src/core/server/index.ts
@@ -49,6 +49,7 @@ import {
SavedObjectsServiceStart,
ISavedObjectsExporter,
ISavedObjectsImporter,
+ SavedObjectsClientProviderOptions,
} from './saved_objects';
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
import { MetricsServiceSetup, MetricsServiceStart } from './metrics';
@@ -415,8 +416,9 @@ export interface RequestHandlerContext {
savedObjects: {
client: SavedObjectsClientContract;
typeRegistry: ISavedObjectTypeRegistry;
- exporter: ISavedObjectsExporter;
- importer: ISavedObjectsImporter;
+ getClient: (options?: SavedObjectsClientProviderOptions) => SavedObjectsClientContract;
+ getExporter: (client: SavedObjectsClientContract) => ISavedObjectsExporter;
+ getImporter: (client: SavedObjectsClientContract) => ISavedObjectsImporter;
};
elasticsearch: {
client: IScopedClusterClient;
diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts
index a4ce94b177612..19056ae1b9bc7 100644
--- a/src/core/server/mocks.ts
+++ b/src/core/server/mocks.ts
@@ -196,8 +196,9 @@ function createCoreRequestHandlerContextMock() {
savedObjects: {
client: savedObjectsClientMock.create(),
typeRegistry: savedObjectsTypeRegistryMock.create(),
- exporter: savedObjectsServiceMock.createExporter(),
- importer: savedObjectsServiceMock.createImporter(),
+ getClient: savedObjectsClientMock.create,
+ getExporter: savedObjectsServiceMock.createExporter,
+ getImporter: savedObjectsServiceMock.createImporter,
},
elasticsearch: {
client: elasticsearchServiceMock.createScopedClusterClient(),
diff --git a/src/core/server/saved_objects/routes/delete.ts b/src/core/server/saved_objects/routes/delete.ts
index 609ce2692c777..fe08acf23fd23 100644
--- a/src/core/server/saved_objects/routes/delete.ts
+++ b/src/core/server/saved_objects/routes/delete.ts
@@ -32,11 +32,13 @@ export const registerDeleteRoute = (router: IRouter, { coreUsageData }: RouteDep
catchAndReturnBoomErrors(async (context, req, res) => {
const { type, id } = req.params;
const { force } = req.query;
+ const { getClient } = context.core.savedObjects;
const usageStatsClient = coreUsageData.getClient();
usageStatsClient.incrementSavedObjectsDelete({ request: req }).catch(() => {});
- const result = await context.core.savedObjects.client.delete(type, id, { force });
+ const client = getClient();
+ const result = await client.delete(type, id, { force });
return res.ok({ body: result });
})
);
diff --git a/src/core/server/saved_objects/routes/export.ts b/src/core/server/saved_objects/routes/export.ts
index fa5517303f18f..e0293a4522fc1 100644
--- a/src/core/server/saved_objects/routes/export.ts
+++ b/src/core/server/saved_objects/routes/export.ts
@@ -165,9 +165,9 @@ export const registerExportRoute = (
},
catchAndReturnBoomErrors(async (context, req, res) => {
const cleaned = cleanOptions(req.body);
- const supportedTypes = context.core.savedObjects.typeRegistry
- .getImportableAndExportableTypes()
- .map((t) => t.name);
+ const { typeRegistry, getExporter, getClient } = context.core.savedObjects;
+ const supportedTypes = typeRegistry.getImportableAndExportableTypes().map((t) => t.name);
+
let options: EitherExportOptions;
try {
options = validateOptions(cleaned, {
@@ -181,7 +181,12 @@ export const registerExportRoute = (
});
}
- const exporter = context.core.savedObjects.exporter;
+ const includedHiddenTypes = supportedTypes.filter((supportedType) =>
+ typeRegistry.isHidden(supportedType)
+ );
+
+ const client = getClient({ includedHiddenTypes });
+ const exporter = getExporter(client);
const usageStatsClient = coreUsageData.getClient();
usageStatsClient
diff --git a/src/core/server/saved_objects/routes/import.ts b/src/core/server/saved_objects/routes/import.ts
index e84c638d3ec99..6f75bcf9fd5bf 100644
--- a/src/core/server/saved_objects/routes/import.ts
+++ b/src/core/server/saved_objects/routes/import.ts
@@ -63,6 +63,7 @@ export const registerImportRoute = (
},
catchAndReturnBoomErrors(async (context, req, res) => {
const { overwrite, createNewCopies } = req.query;
+ const { getClient, getImporter, typeRegistry } = context.core.savedObjects;
const usageStatsClient = coreUsageData.getClient();
usageStatsClient
@@ -84,7 +85,15 @@ export const registerImportRoute = (
});
}
- const { importer } = context.core.savedObjects;
+ const supportedTypes = typeRegistry.getImportableAndExportableTypes().map((t) => t.name);
+
+ const includedHiddenTypes = supportedTypes.filter((supportedType) =>
+ typeRegistry.isHidden(supportedType)
+ );
+
+ const client = getClient({ includedHiddenTypes });
+ const importer = getImporter(client);
+
try {
const result = await importer.import({
readStream,
diff --git a/src/core/server/saved_objects/routes/integration_tests/delete.test.ts b/src/core/server/saved_objects/routes/integration_tests/delete.test.ts
index 7b7a71b7ca858..eaec6e16cbd8c 100644
--- a/src/core/server/saved_objects/routes/integration_tests/delete.test.ts
+++ b/src/core/server/saved_objects/routes/integration_tests/delete.test.ts
@@ -26,7 +26,8 @@ describe('DELETE /api/saved_objects/{type}/{id}', () => {
beforeEach(async () => {
({ server, httpSetup, handlerContext } = await setupServer());
- savedObjectsClient = handlerContext.savedObjects.client;
+ savedObjectsClient = handlerContext.savedObjects.getClient();
+ handlerContext.savedObjects.getClient = jest.fn().mockImplementation(() => savedObjectsClient);
const router = httpSetup.createRouter('/api/saved_objects/');
coreUsageStatsClient = coreUsageStatsClientMock.create();
diff --git a/src/core/server/saved_objects/routes/integration_tests/export.test.ts b/src/core/server/saved_objects/routes/integration_tests/export.test.ts
index 40f13064b53f0..09d475f29f362 100644
--- a/src/core/server/saved_objects/routes/integration_tests/export.test.ts
+++ b/src/core/server/saved_objects/routes/integration_tests/export.test.ts
@@ -40,9 +40,13 @@ describe('POST /api/saved_objects/_export', () => {
handlerContext.savedObjects.typeRegistry.getImportableAndExportableTypes.mockReturnValue(
allowedTypes.map(createExportableType)
);
- exporter = handlerContext.savedObjects.exporter;
+ exporter = handlerContext.savedObjects.getExporter();
const router = httpSetup.createRouter('/api/saved_objects/');
+ handlerContext.savedObjects.getExporter = jest
+ .fn()
+ .mockImplementation(() => exporter as ReturnType- | + |
{i18n.translate('discover.fieldChooser.discoverField.multiFields', {
defaultMessage: 'Multi fields',
@@ -142,10 +147,12 @@ export function DocViewTable({
displayUnderscoreWarning={displayUnderscoreWarning}
isCollapsed={isCollapsed}
isCollapsible={isCollapsible}
- isColumnActive={Array.isArray(columns) && columns.includes(field)}
+ isColumnActive={Array.isArray(columns) && columns.includes(multiField)}
onFilter={filter}
- onToggleCollapse={() => toggleValueCollapse(field)}
- onToggleColumn={toggleColumn}
+ onToggleCollapse={() => {
+ toggleValueCollapse(multiField);
+ }}
+ onToggleColumn={() => toggleColumn(multiField)}
value={value}
valueRaw={valueRaw}
/>
diff --git a/src/plugins/home/server/services/sample_data/data_sets/ecommerce/ecommerce.json.gz b/src/plugins/home/server/services/sample_data/data_sets/ecommerce/ecommerce.json.gz
index d47426df12ddf..0ab2b67c72dba 100644
Binary files a/src/plugins/home/server/services/sample_data/data_sets/ecommerce/ecommerce.json.gz and b/src/plugins/home/server/services/sample_data/data_sets/ecommerce/ecommerce.json.gz differ
diff --git a/src/plugins/home/server/services/sample_data/routes/install.ts b/src/plugins/home/server/services/sample_data/routes/install.ts
index d32a854f2bc4b..7c00a46602e26 100644
--- a/src/plugins/home/server/services/sample_data/routes/install.ts
+++ b/src/plugins/home/server/services/sample_data/routes/install.ts
@@ -143,7 +143,15 @@ export function createInstallRoute(
let createResults;
try {
- createResults = await context.core.savedObjects.client.bulkCreate(
+ const { getClient, typeRegistry } = context.core.savedObjects;
+
+ const includedHiddenTypes = sampleDataset.savedObjects
+ .map((object) => object.type)
+ .filter((supportedType) => typeRegistry.isHidden(supportedType));
+
+ const client = getClient({ includedHiddenTypes });
+
+ createResults = await client.bulkCreate(
sampleDataset.savedObjects.map(({ version, ...savedObject }) => savedObject),
{ overwrite: true }
);
@@ -156,8 +164,8 @@ export function createInstallRoute(
return Boolean(savedObjectCreateResult.error);
});
if (errors.length > 0) {
- const errMsg = `sample_data install errors while loading saved objects. Errors: ${errors.join(
- ','
+ const errMsg = `sample_data install errors while loading saved objects. Errors: ${JSON.stringify(
+ errors
)}`;
logger.warn(errMsg);
return res.customError({ body: errMsg, statusCode: 403 });
diff --git a/src/plugins/home/server/services/sample_data/routes/uninstall.ts b/src/plugins/home/server/services/sample_data/routes/uninstall.ts
index 54e6fa0936abc..aa8ed67cf840a 100644
--- a/src/plugins/home/server/services/sample_data/routes/uninstall.ts
+++ b/src/plugins/home/server/services/sample_data/routes/uninstall.ts
@@ -33,7 +33,7 @@ export function createUninstallRoute(
client: { callAsCurrentUser },
},
},
- savedObjects: { client: savedObjectsClient },
+ savedObjects: { getClient: getSavedObjectsClient, typeRegistry },
},
},
request,
@@ -61,6 +61,12 @@ export function createUninstallRoute(
}
}
+ const includedHiddenTypes = sampleDataset.savedObjects
+ .map((object) => object.type)
+ .filter((supportedType) => typeRegistry.isHidden(supportedType));
+
+ const savedObjectsClient = getSavedObjectsClient({ includedHiddenTypes });
+
const deletePromises = sampleDataset.savedObjects.map(({ type, id }) =>
savedObjectsClient.delete(type, id)
);
diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.tsx
index b1570bb1fff0d..8b07351f6c2c2 100644
--- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.tsx
+++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.tsx
@@ -123,7 +123,10 @@ const CountIndicators: FC<{ importItems: ImportItem[] }> = ({ importItems }) =>
{errorCount && (
+ {isNewPolicy ? i18n.translate('xpack.indexLifecycleMgmt.editPolicy.createPolicyMessage', { - defaultMessage: 'Create Policy', + defaultMessage: 'Create policy', }) : i18n.translate('xpack.indexLifecycleMgmt.editPolicy.editPolicyMessage', { - defaultMessage: 'Edit Policy {originalPolicyName}', + defaultMessage: 'Edit policy {originalPolicyName}', values: { originalPolicyName }, })}diff --git a/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx index c520243b5b24e..00c6b1f93ef88 100644 --- a/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx @@ -7,97 +7,31 @@ import { EuiButton } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import React from 'react'; -import { encode } from 'rison-node'; -import { TimeRange } from '../../../../common/http_api/shared/time_range'; -import { useLinkProps, LinkDescriptor } from '../../../hooks/use_link_props'; +import React, { useCallback } from 'react'; +import { useKibanaContextForPlugin } from '../../../hooks/use_kibana'; +import { shouldHandleLinkEvent } from '../../../hooks/use_link_props'; export const AnalyzeInMlButton: React.FunctionComponent<{ - jobId: string; - partition?: string; - timeRange: TimeRange; -}> = ({ jobId, partition, timeRange }) => { - const linkProps = useLinkProps( - typeof partition === 'string' - ? getEntitySpecificSingleMetricViewerLink(jobId, timeRange, { - 'event.dataset': partition, - }) - : getOverallAnomalyExplorerLinkDescriptor(jobId, timeRange) - ); - const buttonLabel = ( -
+
{React.cloneElement(children, {
'data-test-subj': dataTestSubj || 'lnsDragDrop',
className: classNames(children.props.className, classes, className),
@@ -426,7 +460,13 @@ const DropInner = memo(function DropInner(props: DropInnerProps) {
onDrop: drop,
draggable,
})}
- >
+ {ghost
+ ? React.cloneElement(ghost.children, {
+ className: classNames(ghost.children.props.className, 'lnsDragDrop_ghost'),
+ style: ghost.style,
+ })
+ : null}
+
);
});
diff --git a/x-pack/plugins/lens/public/drag_drop/providers.tsx b/x-pack/plugins/lens/public/drag_drop/providers.tsx
index 0478765328de4..1a056902a474d 100644
--- a/x-pack/plugins/lens/public/drag_drop/providers.tsx
+++ b/x-pack/plugins/lens/public/drag_drop/providers.tsx
@@ -25,6 +25,13 @@ export type DragDropIdentifier = Record
+
+ );
+}
+
export function ExpressionWrapper({
ExpressionRenderer: ExpressionRendererComponent,
expression,
@@ -50,23 +92,12 @@ export function ExpressionWrapper({
hasCompatibleActions,
style,
className,
+ errors,
}: ExpressionWrapperProps) {
return (
{errors[0].longMessage} + {errors.length > 1 ? ( +
+
+
{i18n.translate('xpack.lens.indexPattern.dateHistogram.autoBasicExplanation', { - defaultMessage: 'The auto date histogram splits a date field into buckets by interval.', + defaultMessage: 'The auto date histogram splits a data field into buckets by interval.', })}
{i18n.translate('xpack.lens.indexPattern.ranges.granularityPopoverAdvancedExplanation', {
defaultMessage:
- 'Intervals are incremented by 10, 5 or 2: for example an interval can be 100 or 0.2 .',
+ 'Intervals are incremented by 10, 5 or 2. For example, an interval can be 100 or 0.2 .',
})}
|