mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
add getVisibleTypes API to SO type registry (#70559)
* add getVisibleTypes API * doc nit * fix mocking in tests
This commit is contained in:
parent
a8347fad1c
commit
1cfc9356bd
10 changed files with 70 additions and 16 deletions
|
@ -10,19 +10,13 @@ const initContext = coreMock.createPluginInitializerContext();
|
|||
const coreSetup = coreMock.createSetup();
|
||||
const coreStart = coreMock.createStart();
|
||||
const typeRegistry = savedObjectsServiceMock.createTypeRegistryMock();
|
||||
typeRegistry.getAllTypes.mockReturnValue([
|
||||
typeRegistry.getVisibleTypes.mockReturnValue([
|
||||
{
|
||||
name: 'foo',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
namespaceType: 'single' as 'single',
|
||||
},
|
||||
{
|
||||
name: 'bar',
|
||||
hidden: true,
|
||||
mappings: { properties: {} },
|
||||
namespaceType: 'agnostic' as 'agnostic',
|
||||
},
|
||||
]);
|
||||
coreStart.savedObjects.getTypeRegistry.mockReturnValue(typeRegistry);
|
||||
|
||||
|
|
|
@ -80,10 +80,7 @@ export class Plugin {
|
|||
|
||||
private registerOssFeatures(savedObjects: SavedObjectsServiceStart) {
|
||||
const registry = savedObjects.getTypeRegistry();
|
||||
const savedObjectTypes = registry
|
||||
.getAllTypes()
|
||||
.filter((t) => !t.hidden)
|
||||
.map((t) => t.name);
|
||||
const savedObjectTypes = registry.getVisibleTypes().map((t) => t.name);
|
||||
|
||||
this.logger.debug(
|
||||
`Registering OSS features with SO types: ${savedObjectTypes.join(', ')}. "includeTimelion": ${
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue