+ In full screen mode, press ESC to exit. +
+ + {
+export const ExitFullScreenButton = ({ onClick, className, customLogo }: Props) => {
const { euiTheme } = useEuiTheme();
const { colors, size, border } = euiTheme;
@@ -63,7 +64,11 @@ export const ExitFullScreenButton = ({ onClick, className }: Props) => {
>
(definition: ContentTypeDefinition) {
+ if (this.types.has(definition.id)) {
+ throw new Error(`Content [${definition.id}] is already registered`);
+ }
+
+ const contentType = new ContentType(definition, this.eventBus);
+
+ this.types.set(contentType.id, contentType);
+ }
+
+ getContentType(id: string): ContentType {
+ const contentType = this.types.get(id);
+ if (!contentType) {
+ throw new Error(`Content [${id}] is not registered.`);
+ }
+ return contentType;
+ }
+
+ /** Get the definition for a specific content type */
+ getDefinition(id: string) {
+ return this.getContentType(id).definition;
+ }
+
+ /** Get the crud instance of a content type */
+ getCrud(id: string) {
+ return this.getContentType(id).crud;
+ }
+
+ /** Helper to validate if a content type has been registered */
+ isContentRegistered(id: string): boolean {
+ return this.types.has(id);
+ }
+}
diff --git a/src/plugins/content_management/server/core/types.ts b/src/plugins/content_management/server/core/types.ts
new file mode 100644
index 000000000000..4ebd79d60571
--- /dev/null
+++ b/src/plugins/content_management/server/core/types.ts
@@ -0,0 +1,38 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
+
+/** Context that is sent to all storage instance methods */
+export interface StorageContext {
+ requestHandlerContext?: RequestHandlerContext;
+}
+
+export interface ContentStorage {
+ /** Get a single item */
+ get(ctx: StorageContext, id: string, options: unknown): Promise {
+ /** Unique id for the content type */
+ id: string;
+ /** The storage layer for the content. It must implment the ContentStorage interface. */
+ storage: S;
+}
diff --git a/src/plugins/content_management/server/plugin.ts b/src/plugins/content_management/server/plugin.ts
index 54ed5ba7a7c2..5e3ba371a4e1 100755
--- a/src/plugins/content_management/server/plugin.ts
+++ b/src/plugins/content_management/server/plugin.ts
@@ -6,7 +6,14 @@
* Side Public License, v 1.
*/
-import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/server';
+import type {
+ CoreSetup,
+ CoreStart,
+ Plugin,
+ PluginInitializerContext,
+ Logger,
+} from '@kbn/core/server';
+import { Core } from './core';
import {
ContentManagementServerSetup,
ContentManagementServerStart,
@@ -16,10 +23,20 @@ import {
export class ContentManagementPlugin
implements Plugin
{{name}}
{{/form}}') .withInput({ name: 'Yehuda' }) - .withHelper('form', function (this: any, options: Handlebars.HelperOptions) { + .withHelper('form', function (this: any, options: HelperOptions) { return ''; }) .toCompileTo(''); }); it('block helper should have context in this', () => { - function link(this: any, options: Handlebars.HelperOptions) { + function link(this: any, options: HelperOptions) { return '' + options.fn(this) + ''; } @@ -201,7 +201,7 @@ describe('helpers', () => { it('block helper passing a new context', () => { expectTemplate('{{#form yehuda}}{{name}}
{{/form}}') .withInput({ yehuda: { name: 'Yehuda' } }) - .withHelper('form', function (context, options: Handlebars.HelperOptions) { + .withHelper('form', function (context, options: HelperOptions) { return ''; }) .toCompileTo(''); @@ -210,7 +210,7 @@ describe('helpers', () => { it('block helper passing a complex path context', () => { expectTemplate('{{#form yehuda/cat}}{{name}}
{{/form}}') .withInput({ yehuda: { name: 'Yehuda', cat: { name: 'Harold' } } }) - .withHelper('form', function (context, options: Handlebars.HelperOptions) { + .withHelper('form', function (context, options: HelperOptions) { return ''; }) .toCompileTo(''); @@ -221,10 +221,10 @@ describe('helpers', () => { .withInput({ yehuda: { name: 'Yehuda' }, }) - .withHelper('link', function (this: any, options: Handlebars.HelperOptions) { + .withHelper('link', function (this: any, options: HelperOptions) { return '' + options.fn(this) + ''; }) - .withHelper('form', function (context, options: Handlebars.HelperOptions) { + .withHelper('form', function (context, options: HelperOptions) { return ''; }) .toCompileTo(''); @@ -232,7 +232,7 @@ describe('helpers', () => { it('block helper inverted sections', () => { const string = "{{#list people}}{{name}}{{^}}Nobody's here{{/list}}"; - function list(this: any, context: any, options: Handlebars.HelperOptions) { + function list(this: any, context: any, options: HelperOptions) { if (context.length > 0) { let out = '{i18n.TO_CHECK_INDICES_ON_REMOTE_CLUSTERS}
+