mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
# Backport This will backport the following commits from `main` to `8.10`: - [[Content Management] Fix content editor flyout footer (#165907)](https://github.com/elastic/kibana/pull/165907) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Catherine Liu","email":"catherine.liu@elastic.co"},"sourceCommit":{"committedDate":"2023-09-08T16:07:10Z","message":"[Content Management] Fix content editor flyout footer (#165907)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/163460.\r\n\r\nInstead of using the `EuiThemeProvider` to wrap the flyout content,\r\nwhich added a `span` element causing the footer to not stick to the\r\nbottom of the flyout, I pass `theme# Backport This will backport the following commits from `main` to `8.10`: - [[Content Management] Fix content editor flyout footer (#165907)](https://github.com/elastic/kibana/pull/165907) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT as a param in `toMountPoint` as\r\npart of the `openFlyout` function available in services. This applies\r\ndark mode support to any other consumer of `openFlyout` and fixes the\r\nfooter position issue for both dashboard and visualize listing pages and\r\npreserves the dark mode colors.\r\n\r\n<img width=\"604\" alt=\"Screenshot 2023-09-06 at 12 45 08 PM\"\r\nsrc=\"c4c569cd
-c070-4ab8-9de4-5dd8c5ec8cf8\">\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### Risk Matrix\r\n\r\nDelete this section if it is not applicable to this PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other developers to\r\nidentify risks that should be tested prior to the change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider some of the following examples\r\nand how they may potentially impact the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes |\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n| Multiple Spaces—unexpected behavior in non-default Kibana Space.\r\n| Low | High | Integration tests will verify that all features are still\r\nsupported in non-default Kibana Space and when user switches between\r\nspaces. |\r\n| Multiple nodes—Elasticsearch polling might have race conditions\r\nwhen multiple Kibana nodes are polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so executing them multiple times will not result\r\nin logical error, but will degrade performance. To test for this case we\r\nadd plenty of unit tests around this logic and document manual testing\r\nprocedure. |\r\n| Code should gracefully handle cases when feature X or plugin Y are\r\ndisabled. | Medium | High | Unit tests will verify that any feature flag\r\nor plugin combination still results in our service operational. |\r\n| [See more potential risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b6eb7a6af501a68188be33c78998c7d3d4ab6e6b","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Dashboard","release_note:fix","Team:Presentation","loe:small","impact:high","Team:SharedUX","Feature:Content Management","v8.11.0","v8.10.1"],"number":165907,"url":"https://github.com/elastic/kibana/pull/165907","mergeCommit":{"message":"[Content Management] Fix content editor flyout footer (#165907)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/163460.\r\n\r\nInstead of using the `EuiThemeProvider` to wrap the flyout content,\r\nwhich added a `span` element causing the footer to not stick to the\r\nbottom of the flyout, I pass `theme# Backport This will backport the following commits from `main` to `8.10`: - [[Content Management] Fix content editor flyout footer (#165907)](https://github.com/elastic/kibana/pull/165907) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT as a param in `toMountPoint` as\r\npart of the `openFlyout` function available in services. This applies\r\ndark mode support to any other consumer of `openFlyout` and fixes the\r\nfooter position issue for both dashboard and visualize listing pages and\r\npreserves the dark mode colors.\r\n\r\n<img width=\"604\" alt=\"Screenshot 2023-09-06 at 12 45 08 PM\"\r\nsrc=\"c4c569cd
-c070-4ab8-9de4-5dd8c5ec8cf8\">\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### Risk Matrix\r\n\r\nDelete this section if it is not applicable to this PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other developers to\r\nidentify risks that should be tested prior to the change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider some of the following examples\r\nand how they may potentially impact the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes |\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n| Multiple Spaces—unexpected behavior in non-default Kibana Space.\r\n| Low | High | Integration tests will verify that all features are still\r\nsupported in non-default Kibana Space and when user switches between\r\nspaces. |\r\n| Multiple nodes—Elasticsearch polling might have race conditions\r\nwhen multiple Kibana nodes are polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so executing them multiple times will not result\r\nin logical error, but will degrade performance. To test for this case we\r\nadd plenty of unit tests around this logic and document manual testing\r\nprocedure. |\r\n| Code should gracefully handle cases when feature X or plugin Y are\r\ndisabled. | Medium | High | Unit tests will verify that any feature flag\r\nor plugin combination still results in our service operational. |\r\n| [See more potential risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b6eb7a6af501a68188be33c78998c7d3d4ab6e6b"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165907","number":165907,"mergeCommit":{"message":"[Content Management] Fix content editor flyout footer (#165907)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/163460.\r\n\r\nInstead of using the `EuiThemeProvider` to wrap the flyout content,\r\nwhich added a `span` element causing the footer to not stick to the\r\nbottom of the flyout, I pass `theme# Backport This will backport the following commits from `main` to `8.10`: - [[Content Management] Fix content editor flyout footer (#165907)](https://github.com/elastic/kibana/pull/165907) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT as a param in `toMountPoint` as\r\npart of the `openFlyout` function available in services. This applies\r\ndark mode support to any other consumer of `openFlyout` and fixes the\r\nfooter position issue for both dashboard and visualize listing pages and\r\npreserves the dark mode colors.\r\n\r\n<img width=\"604\" alt=\"Screenshot 2023-09-06 at 12 45 08 PM\"\r\nsrc=\"c4c569cd
-c070-4ab8-9de4-5dd8c5ec8cf8\">\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n### Risk Matrix\r\n\r\nDelete this section if it is not applicable to this PR.\r\n\r\nBefore closing this PR, invite QA, stakeholders, and other developers to\r\nidentify risks that should be tested prior to the change/feature\r\nrelease.\r\n\r\nWhen forming the risk matrix, consider some of the following examples\r\nand how they may potentially impact the change:\r\n\r\n| Risk | Probability | Severity | Mitigation/Notes |\r\n\r\n|---------------------------|-------------|----------|-------------------------|\r\n| Multiple Spaces—unexpected behavior in non-default Kibana Space.\r\n| Low | High | Integration tests will verify that all features are still\r\nsupported in non-default Kibana Space and when user switches between\r\nspaces. |\r\n| Multiple nodes—Elasticsearch polling might have race conditions\r\nwhen multiple Kibana nodes are polling for the same tasks. | High | Low\r\n| Tasks are idempotent, so executing them multiple times will not result\r\nin logical error, but will degrade performance. To test for this case we\r\nadd plenty of unit tests around this logic and document manual testing\r\nprocedure. |\r\n| Code should gracefully handle cases when feature X or plugin Y are\r\ndisabled. | Medium | High | Unit tests will verify that any feature flag\r\nor plugin combination still results in our service operational. |\r\n| [See more potential risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |\r\n\r\n\r\n### For maintainers\r\n\r\n- [ ] This was checked for breaking API changes and was [labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b6eb7a6af501a68188be33c78998c7d3d4ab6e6b"}},{"branch":"8.10","label":"v8.10.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Catherine Liu <catherine.liu@elastic.co>
This commit is contained in:
parent
582629c6ea
commit
ef87cfe0ee
5 changed files with 11 additions and 35 deletions
|
@ -7,14 +7,11 @@
|
|||
*/
|
||||
import React from 'react';
|
||||
import type { ComponentType } from 'react';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { TagSelector, TagList } from '../mocks';
|
||||
import { ContentEditorProvider } from '../services';
|
||||
import type { Services } from '../services';
|
||||
|
||||
const theme$ = of({ darkMode: false });
|
||||
|
||||
export const getMockServices = (overrides?: Partial<Services>) => {
|
||||
const services = {
|
||||
openFlyout: jest.fn(() => ({
|
||||
|
@ -24,7 +21,6 @@ export const getMockServices = (overrides?: Partial<Services>) => {
|
|||
TagList,
|
||||
TagSelector,
|
||||
notifyError: () => undefined,
|
||||
theme$,
|
||||
...overrides,
|
||||
};
|
||||
|
||||
|
|
|
@ -7,21 +7,11 @@
|
|||
*/
|
||||
|
||||
import React, { useState, useCallback, useEffect } from 'react';
|
||||
import { EuiFlyoutHeader, EuiFlyoutBody, EuiFlyoutFooter, EuiThemeProvider } from '@elastic/eui';
|
||||
import useObservable from 'react-use/lib/useObservable';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
import { Theme } from '../services';
|
||||
import { EuiFlyoutHeader, EuiFlyoutBody, EuiFlyoutFooter } from '@elastic/eui';
|
||||
import type { Props } from './editor_flyout_content_container';
|
||||
|
||||
const themeDefault = { darkMode: false };
|
||||
|
||||
export const ContentEditorLoader: React.FC<Props & { theme$?: Observable<Theme> }> = ({
|
||||
theme$,
|
||||
...rest
|
||||
}) => {
|
||||
export const ContentEditorLoader: React.FC<Props> = (props) => {
|
||||
const [Editor, setEditor] = useState<React.ComponentType<Props> | null>(null);
|
||||
const { darkMode } = useObservable(theme$ ?? of(themeDefault), themeDefault);
|
||||
|
||||
const loadEditor = useCallback(async () => {
|
||||
const { ContentEditorFlyoutContentContainer } = await import(
|
||||
|
@ -36,9 +26,7 @@ export const ContentEditorLoader: React.FC<Props & { theme$?: Observable<Theme>
|
|||
}, [loadEditor]);
|
||||
|
||||
return Editor ? (
|
||||
<EuiThemeProvider colorMode={darkMode ? 'dark' : 'light'}>
|
||||
<Editor {...rest} />
|
||||
</EuiThemeProvider>
|
||||
<Editor {...props} />
|
||||
) : (
|
||||
<>
|
||||
<EuiFlyoutHeader />
|
||||
|
|
|
@ -20,7 +20,7 @@ export type OpenContentEditorParams = Pick<
|
|||
|
||||
export function useOpenContentEditor() {
|
||||
const services = useServices();
|
||||
const { openFlyout, theme$ } = services;
|
||||
const { openFlyout } = services;
|
||||
const flyout = useRef<OverlayRef | null>(null);
|
||||
|
||||
return useCallback(
|
||||
|
@ -35,12 +35,7 @@ export function useOpenContentEditor() {
|
|||
};
|
||||
|
||||
flyout.current = openFlyout(
|
||||
<ContentEditorLoader
|
||||
{...args}
|
||||
onCancel={closeFlyout}
|
||||
services={services}
|
||||
theme$={theme$}
|
||||
/>,
|
||||
<ContentEditorLoader {...args} onCancel={closeFlyout} services={services} />,
|
||||
{
|
||||
maxWidth: 600,
|
||||
size: 'm',
|
||||
|
@ -51,6 +46,6 @@ export function useOpenContentEditor() {
|
|||
|
||||
return closeFlyout;
|
||||
},
|
||||
[openFlyout, services, theme$]
|
||||
[openFlyout, services]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ export interface Services {
|
|||
notifyError: NotifyFn;
|
||||
TagList?: FC<{ references: SavedObjectsReference[] }>;
|
||||
TagSelector?: React.FC<TagSelectorProps>;
|
||||
theme$: Observable<Theme>;
|
||||
}
|
||||
|
||||
const ContentEditorContext = React.createContext<Services | null>(null);
|
||||
|
@ -111,6 +110,7 @@ export const ContentEditorKibanaProvider: FC<ContentEditorKibanaDependencies> =
|
|||
}) => {
|
||||
const { core, toMountPoint, savedObjectsTagging } = services;
|
||||
const { openFlyout: coreOpenFlyout } = core.overlays;
|
||||
const { theme$ } = core.theme;
|
||||
|
||||
const TagList = useMemo(() => {
|
||||
const Comp: Services['TagList'] = ({ references }) => {
|
||||
|
@ -126,9 +126,9 @@ export const ContentEditorKibanaProvider: FC<ContentEditorKibanaDependencies> =
|
|||
|
||||
const openFlyout = useCallback(
|
||||
(node: ReactNode, options: OverlayFlyoutOpenOptions) => {
|
||||
return coreOpenFlyout(toMountPoint(node), options);
|
||||
return coreOpenFlyout(toMountPoint(node, { theme$ }), options);
|
||||
},
|
||||
[toMountPoint, coreOpenFlyout]
|
||||
[coreOpenFlyout, toMountPoint, theme$]
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -139,7 +139,6 @@ export const ContentEditorKibanaProvider: FC<ContentEditorKibanaDependencies> =
|
|||
}}
|
||||
TagList={TagList}
|
||||
TagSelector={savedObjectsTagging?.ui.components.SavedObjectSaveModalTagSelector}
|
||||
theme$={core.theme.theme$}
|
||||
>
|
||||
{children}
|
||||
</ContentEditorProvider>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
import React from 'react';
|
||||
import type { ComponentType } from 'react';
|
||||
import { from, of } from 'rxjs';
|
||||
import { from } from 'rxjs';
|
||||
import { ContentEditorProvider } from '@kbn/content-management-content-editor';
|
||||
|
||||
import { TagList } from '../mocks';
|
||||
|
@ -31,13 +31,11 @@ export const getMockServices = (overrides?: Partial<Services>) => {
|
|||
return services;
|
||||
};
|
||||
|
||||
const theme$ = of({ darkMode: false });
|
||||
|
||||
export function WithServices<P>(Comp: ComponentType<P>, overrides: Partial<Services> = {}) {
|
||||
return (props: P) => {
|
||||
const services = getMockServices(overrides);
|
||||
return (
|
||||
<ContentEditorProvider openFlyout={jest.fn()} notifyError={() => undefined} theme$={theme$}>
|
||||
<ContentEditorProvider openFlyout={jest.fn()} notifyError={() => undefined}>
|
||||
<TableListViewProvider {...services}>
|
||||
<Comp {...(props as any)} />
|
||||
</TableListViewProvider>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue