mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
[SharedUX] Remove usage of deprecated React rendering utilities (#180516)
## Summary
Partially addresses https://github.com/elastic/kibana-team/issues/805
Follows https://github.com/elastic/kibana/pull/180003
These changes come up from searching in the code and finding where
certain kinds of deprecated AppEx-SharedUX modules are imported.
**Reviewers: Please interact with critical paths through the UI
components touched in this PR, ESPECIALLY in terms of testing dark mode
and i18n.**
This focuses on code within AppEx-SharedUX. [Reporting changes are
separate](https://github.com/elastic/kibana/pull/).
<img width="1107" alt="image"
src="c0d2ce08
-ac35-45a7-8192-0b2256fceb0e">
### Checklist
Delete any items that are not applicable to this PR.
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
This commit is contained in:
parent
4c90777dee
commit
e4a32f8f3c
54 changed files with 226 additions and 258 deletions
|
@ -10,8 +10,6 @@
|
|||
"requiredPlugins": [
|
||||
"uiActions"
|
||||
],
|
||||
"requiredBundles": [
|
||||
"kibanaReact"
|
||||
]
|
||||
"requiredBundles": []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,12 @@
|
|||
|
||||
import React from 'react';
|
||||
import { EuiText, EuiModalBody, EuiButton } from '@elastic/eui';
|
||||
import { OverlayStart } from '@kbn/core/public';
|
||||
import { toMountPoint } from '@kbn/kibana-react-plugin/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { toMountPoint } from '@kbn/react-kibana-mount';
|
||||
|
||||
export const ACTION_HELLO_WORLD = 'ACTION_HELLO_WORLD';
|
||||
|
||||
interface StartServices {
|
||||
openModal: OverlayStart['openModal'];
|
||||
}
|
||||
type StartServices = Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'>;
|
||||
|
||||
export const createHelloWorldActionDefinition = (
|
||||
getStartServices: () => Promise<StartServices>
|
||||
|
@ -24,15 +22,16 @@ export const createHelloWorldActionDefinition = (
|
|||
type: ACTION_HELLO_WORLD,
|
||||
getDisplayName: () => 'Hello World!',
|
||||
execute: async () => {
|
||||
const { openModal } = await getStartServices();
|
||||
const overlay = openModal(
|
||||
const { overlays, ...startServices } = await getStartServices();
|
||||
const overlay = overlays.openModal(
|
||||
toMountPoint(
|
||||
<EuiModalBody>
|
||||
<EuiText data-test-subj="helloWorldActionText">Hello world!</EuiText>
|
||||
<EuiButton data-test-subj="closeModal" onClick={() => overlay.close()}>
|
||||
Close
|
||||
</EuiButton>
|
||||
</EuiModalBody>
|
||||
</EuiModalBody>,
|
||||
startServices
|
||||
)
|
||||
);
|
||||
},
|
||||
|
|
|
@ -29,14 +29,14 @@ export class UiActionExamplesPlugin
|
|||
) {
|
||||
uiActions.registerTrigger(helloWorldTrigger);
|
||||
|
||||
const helloWorldAction = createHelloWorldActionDefinition(async () => ({
|
||||
openModal: (await core.getStartServices())[0].overlays.openModal,
|
||||
}));
|
||||
const helloWorldAction = createHelloWorldActionDefinition(
|
||||
async () => (await core.getStartServices())[0]
|
||||
);
|
||||
|
||||
uiActions.addTriggerAction(helloWorldTrigger.id, helloWorldAction);
|
||||
}
|
||||
|
||||
public start(core: CoreStart, plugins: UiActionExamplesStartDependencies) {}
|
||||
public start(_core: CoreStart, _plugins: UiActionExamplesStartDependencies) {}
|
||||
|
||||
public stop() {}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
"target/**/*",
|
||||
],
|
||||
"kbn_references": [
|
||||
"@kbn/kibana-react-plugin",
|
||||
"@kbn/ui-actions-plugin",
|
||||
"@kbn/core",
|
||||
"@kbn/react-kibana-mount",
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue