mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
## Summary
Close https://github.com/elastic/kibana/issues/152002
In https://github.com/elastic/kibana/pull/151163 we introduced a simple
demo todo app run in a storybook with a custom client-side content
management client (no server-side cm registry usage).
This is a follow-up PR that re-uses the same demo todo app, but also
runs it in an example plugin with proper server-side content management
registry usage, so now we have a basic end-to-end demonstration of
content management capabilities. The demo app is covered by functional
tests, so now we also have basic end-to-end test coverage.
As this is the first kind of real-world end-to-end usage of the CM APIs,
I'd like to use this and
[previous](https://github.com/elastic/kibana/pull/151163) prs as a base
for the discussion and polishing current APIs. I'll leave a review with
comments where I think some API polishing is needed.
**Notable changes apart from the example plugin itself:**
1. Move `demo/` todo app and its stories introduced in
https://github.com/elastic/kibana/pull/151163 from
`src/plugins/content_management` to
`examples/content_management_examples`. This was mostly needed to not
export `demo/` code on the public plugin export to avoid increasing
bundle size.
2. Add needed exports to the plugin contract
3. Reshuffle `common/` to not import `@kbn/schema` client side
48aa41403b
4. Fix client-side RPC client to work with the latest server-side
changes (shouldn't break from now on because of the end-to-end test
coverage)
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
/*
|
|
* 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 { AppNavLinkStatus } from '@kbn/core-application-browser';
|
|
import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
|
import { StartDeps, SetupDeps } from './types';
|
|
|
|
export class ContentManagementExamplesPlugin
|
|
implements Plugin<unknown, unknown, SetupDeps, StartDeps>
|
|
{
|
|
public setup(core: CoreSetup<StartDeps>, { contentManagement, developerExamples }: SetupDeps) {
|
|
developerExamples.register({
|
|
appId: `contentManagementExamples`,
|
|
title: `Content Management Examples`,
|
|
description: 'Example plugin for the content management plugin',
|
|
});
|
|
|
|
core.application.register({
|
|
id: `contentManagementExamples`,
|
|
title: `Content Management Examples`,
|
|
navLinkStatus: AppNavLinkStatus.hidden,
|
|
async mount(params: AppMountParameters) {
|
|
const { renderApp } = await import('./examples');
|
|
const [coreStart, deps] = await core.getStartServices();
|
|
return renderApp(coreStart, deps, params);
|
|
},
|
|
});
|
|
|
|
return {};
|
|
}
|
|
|
|
public start(core: CoreStart) {
|
|
return {};
|
|
}
|
|
|
|
public stop() {}
|
|
}
|