3d0552e03c
Added example for using dashboard container by value 1.1 Refactored embeddable explorer e2e test to use new example, removed not needed kbn_tp_embeddable_explorer plugin. For embeddable explorer examples went away from using getFactoryById() to improve type checks There is new component a replacement for EmbeddableFactoryRenderer with slightly more flexible api: EmbeddableRenderer. 3.1 We can improve it going forward to support more use case
62 lines
2 KiB
TypeScript
62 lines
2 KiB
TypeScript
/*
|
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
* license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright
|
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
* not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
import { i18n } from '@kbn/i18n';
|
|
import {
|
|
ContainerOutput,
|
|
EmbeddableFactory,
|
|
EmbeddableFactoryDefinition,
|
|
EmbeddableStart,
|
|
} from '../../../../src/plugins/embeddable/public';
|
|
import {
|
|
SEARCHABLE_LIST_CONTAINER,
|
|
SearchableListContainer,
|
|
SearchableContainerInput,
|
|
} from './searchable_list_container';
|
|
|
|
interface StartServices {
|
|
embeddableServices: EmbeddableStart;
|
|
}
|
|
|
|
export type SearchableListContainerFactory = EmbeddableFactory<
|
|
SearchableContainerInput,
|
|
ContainerOutput
|
|
>;
|
|
export class SearchableListContainerFactoryDefinition
|
|
implements EmbeddableFactoryDefinition<SearchableContainerInput, ContainerOutput> {
|
|
public readonly type = SEARCHABLE_LIST_CONTAINER;
|
|
public readonly isContainerType = true;
|
|
|
|
constructor(private getStartServices: () => Promise<StartServices>) {}
|
|
|
|
public async isEditable() {
|
|
return true;
|
|
}
|
|
|
|
public create = async (initialInput: SearchableContainerInput) => {
|
|
const { embeddableServices } = await this.getStartServices();
|
|
return new SearchableListContainer(initialInput, embeddableServices);
|
|
};
|
|
|
|
public getDisplayName() {
|
|
return i18n.translate('embeddableExamples.searchableListContainer.displayName', {
|
|
defaultMessage: 'Searchable list container',
|
|
});
|
|
}
|
|
}
|