From 8623672bae2acf13b45199b81d267d0818f8ebbe Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 7 Nov 2024 15:26:05 -0700 Subject: [PATCH 01/10] fix dashboard grid item performs 2 DOM queries every render --- .../core-rendering-browser-internal/index.ts | 2 +- .../src/index.ts | 1 + .../src/use_app_fixed_viewport.ts | 15 +++++++++++++ .../components/partition_vis_component.tsx | 3 ++- .../public/components/xy_chart.tsx | 4 +++- .../filters_notification_popover.tsx | 5 ++--- .../component/grid/dashboard_grid.tsx | 22 +++++++++++++++++-- .../component/grid/dashboard_grid_item.tsx | 10 +++++---- .../component/viewport/dashboard_viewport.tsx | 6 +++-- .../embeddable/dashboard_container.tsx | 2 +- .../waterfall/waterfall_bar_chart.tsx | 5 ++++- .../components/waterfall_bar_chart.tsx | 5 ++++- 12 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts diff --git a/packages/core/rendering/core-rendering-browser-internal/index.ts b/packages/core/rendering/core-rendering-browser-internal/index.ts index f1ff406cd2579..953ff0ae3b284 100644 --- a/packages/core/rendering/core-rendering-browser-internal/index.ts +++ b/packages/core/rendering/core-rendering-browser-internal/index.ts @@ -7,4 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { RenderingService } from './src'; +export { useAppFixedViewport, RenderingService } from './src'; diff --git a/packages/core/rendering/core-rendering-browser-internal/src/index.ts b/packages/core/rendering/core-rendering-browser-internal/src/index.ts index 4b6167f377a2e..dbb93674b1a36 100644 --- a/packages/core/rendering/core-rendering-browser-internal/src/index.ts +++ b/packages/core/rendering/core-rendering-browser-internal/src/index.ts @@ -8,3 +8,4 @@ */ export { RenderingService } from './rendering_service'; +export { useAppFixedViewport } from './use_app_fixed_viewport'; diff --git a/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts b/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts new file mode 100644 index 0000000000000..b62536b33ae90 --- /dev/null +++ b/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts @@ -0,0 +1,15 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { useRef } from "react"; + +export function useAppFixedViewport() { + const ref = useRef(document.getElementById('app-fixed-viewport') ?? undefined); + return ref.current; +} \ No newline at end of file diff --git a/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx b/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx index 5baf582877a68..79f87d8da315a 100644 --- a/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx +++ b/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx @@ -77,6 +77,7 @@ import { import { filterOutConfig } from '../utils/filter_out_config'; import { ColumnCellValueActions, FilterEvent, StartDeps } from '../types'; import { getMultiFilterCells } from '../utils/filter_helpers'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; declare global { interface Window { @@ -385,7 +386,7 @@ const PartitionVisComponent = (props: PartitionVisComponentProps) => { [visType, visParams, containerDimensions, rescaleFactor, hasOpenedOnAggBasedEditor] ); - const fixedViewPort = document.getElementById('app-fixed-viewport'); + const fixedViewPort = useAppFixedViewport(); const legendPosition = visParams.legendPosition ?? Position.Right; diff --git a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx index e1c428dd15c72..2ecf3ccc79ba2 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx @@ -744,6 +744,8 @@ export function XYChart({ formatFactory ); + const appFixedViewport = useAppFixedViewport(); + return (
{showLegend !== undefined && uiState && ( @@ -767,7 +769,7 @@ export function XYChart({ > , XYChartSeriesIdentifier> - boundary={document.getElementById('app-fixed-viewport') ?? undefined} + boundary={appFixedViewport} headerFormatter={ !args.detailedTooltip && xAxisColumn ? ({ value }) => ( diff --git a/src/plugins/dashboard/public/dashboard_actions/filters_notification_popover.tsx b/src/plugins/dashboard/public/dashboard_actions/filters_notification_popover.tsx index 5f23b21dc9155..5433646e3db8e 100644 --- a/src/plugins/dashboard/public/dashboard_actions/filters_notification_popover.tsx +++ b/src/plugins/dashboard/public/dashboard_actions/filters_notification_popover.tsx @@ -62,8 +62,7 @@ export function FiltersNotificationPopover({ api }: { api: FiltersNotificationAc } }, [api, setDisableEditButton]); - const [hasLockedHoverActions, dataViews, parentViewMode] = useBatchedOptionalPublishingSubjects( - api.hasLockedHoverActions$, + const [dataViews, parentViewMode] = useBatchedOptionalPublishingSubjects( api.parentApi?.dataViews, getViewModeSubject(api ?? undefined) ); @@ -77,7 +76,7 @@ export function FiltersNotificationPopover({ api }: { api: FiltersNotificationAc onClick={() => { setIsPopoverOpen(!isPopoverOpen); if (apiCanLockHoverActions(api)) { - api?.lockHoverActions(!hasLockedHoverActions); + api?.lockHoverActions(!api.hasLockedHoverActions$.value); } }} data-test-subj={`embeddablePanelNotification-${api.uuid}`} diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.tsx b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.tsx index 0ef976af51eb6..3ee7cac4107a8 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.tsx @@ -18,6 +18,7 @@ import { Layout, Responsive as ResponsiveReactGridLayout } from 'react-grid-layo import { ViewMode } from '@kbn/embeddable-plugin/public'; import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; import { DashboardPanelState } from '../../../../common'; import { DashboardGridItem } from './dashboard_grid_item'; import { useDashboardGridSettings } from './use_dashboard_grid_settings'; @@ -25,7 +26,13 @@ import { useDashboardApi } from '../../../dashboard_api/use_dashboard_api'; import { getPanelLayoutsAreEqual } from '../../state/diffing/dashboard_diffing_utils'; import { DASHBOARD_GRID_HEIGHT, DASHBOARD_MARGIN_SIZE } from '../../../dashboard_constants'; -export const DashboardGrid = ({ viewportWidth }: { viewportWidth: number }) => { +export const DashboardGrid = ({ + dashboardContainer, + viewportWidth, +}: { + dashboardContainer?: HTMLElement; + viewportWidth: number; +}) => { const dashboardApi = useDashboardApi(); const [animatePanelTransforms, expandedPanelId, focusedPanelId, panels, useMargins, viewMode] = @@ -51,6 +58,8 @@ export const DashboardGrid = ({ viewportWidth }: { viewportWidth: number }) => { } }, [expandedPanelId]); + const appFixedViewport = useAppFixedViewport(); + const panelsInOrder: string[] = useMemo(() => { return Object.keys(panels).sort((embeddableIdA, embeddableIdB) => { const panelA = panels[embeddableIdA]; @@ -72,6 +81,8 @@ export const DashboardGrid = ({ viewportWidth }: { viewportWidth: number }) => { const type = panels[embeddableId].type; return ( { /> ); }); - }, [expandedPanelId, panels, panelsInOrder, focusedPanelId]); + }, [ + appFixedViewport, + dashboardContainer, + expandedPanelId, + panels, + panelsInOrder, + focusedPanelId, + ]); const onLayoutChange = useCallback( (newLayout: Array) => { diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx index 9b5a00c628608..5ad1363e6f8af 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx @@ -23,6 +23,8 @@ import { embeddableService, presentationUtilService } from '../../../services/ki type DivProps = Pick, 'className' | 'style' | 'children'>; export interface Props extends DivProps { + appFixedViewport?: HTMLElement; + dashboardContainer?: HTMLElement; id: DashboardPanelState['explicitInput']['id']; index?: number; type: DashboardPanelState['type']; @@ -35,6 +37,8 @@ export interface Props extends DivProps { export const Item = React.forwardRef( ( { + appFixedViewport, + dashboardContainer, expandedPanelId, focusedPanelId, id, @@ -92,10 +96,8 @@ export const Item = React.forwardRef( } }, [id, dashboardApi, scrollToPanelId, highlightPanelId, ref, blurPanel]); - const dashboardContainerTopOffset = - (document.querySelector('.dashboardContainer') as HTMLDivElement)?.offsetTop || 0; - const globalNavTopOffset = - (document.querySelector('#app-fixed-viewport') as HTMLDivElement)?.offsetTop || 0; + const dashboardContainerTopOffset = dashboardContainer?.offsetTop || 0; + const globalNavTopOffset = appFixedViewport?.offsetTop || 0; const focusStyles = blurPanel ? css` diff --git a/src/plugins/dashboard/public/dashboard_container/component/viewport/dashboard_viewport.tsx b/src/plugins/dashboard/public/dashboard_container/component/viewport/dashboard_viewport.tsx index 027d2aee62b15..51f414bfcc298 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/viewport/dashboard_viewport.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/viewport/dashboard_viewport.tsx @@ -41,7 +41,7 @@ export const useDebouncedWidthObserver = (skipDebounce = false, wait = 100) => { return { ref, width }; }; -export const DashboardViewport = () => { +export const DashboardViewport = ({ dashboardContainer }: { dashboardContainer?: HTMLElement }) => { const dashboardApi = useDashboardApi(); const [hasControls, setHasControls] = useState(false); const [ @@ -160,7 +160,9 @@ export const DashboardViewport = () => { otherwise, there is a race condition where the panels can end up being squashed TODO only render when dashboardInitialized */} - {viewportWidth !== 0 && } + {viewportWidth !== 0 && ( + + )}
); diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx b/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx index a6765732c064c..2e7c1e943eb67 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx @@ -474,7 +474,7 @@ export class DashboardContainer coreStart={{ chrome: coreServices.chrome, customBranding: coreServices.customBranding }} > - + , diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx index 3f0a80082aec6..ba1c83d8fd42c 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx @@ -30,6 +30,7 @@ import { useWaterfallContext } from './context/waterfall_context'; import { WaterfallTooltipContent } from './waterfall_tooltip_content'; import { formatTooltipHeading } from '../../common/network_data/data_formatting'; import { WaterfallChartMarkers } from './waterfall_marker/waterfall_markers'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; const getChartHeight = (data: WaterfallData): number => { // We get the last item x(number of bars) and adds 1 to cater for 0 index @@ -86,6 +87,8 @@ export const WaterfallBarChart = ({ const handleProjectionClick = useMemo(() => onProjectionClick, [onProjectionClick]); const memoizedTickFormat = useCallback(tickFormat, [tickFormat]); + const appFixedViewport = useAppFixedViewport(); + return ( { // We get the last item x(number of bars) and adds 1 to cater for 0 index @@ -81,6 +82,8 @@ export const WaterfallBarChart = ({ const handleProjectionClick = useMemo(() => onProjectionClick, [onProjectionClick]); const memoizedTickFormat = useCallback(tickFormat, [tickFormat]); + const appFixedViewport = useAppFixedViewport(); + return ( Date: Thu, 7 Nov 2024 22:37:00 +0000 Subject: [PATCH 02/10] [CI] Auto-commit changed files from 'node scripts/notice' --- .../chart_expressions/expression_partition_vis/tsconfig.json | 1 + src/plugins/dashboard/tsconfig.json | 1 + 2 files changed, 2 insertions(+) diff --git a/src/plugins/chart_expressions/expression_partition_vis/tsconfig.json b/src/plugins/chart_expressions/expression_partition_vis/tsconfig.json index 7669646f40a6b..ff1a21089a6f9 100644 --- a/src/plugins/chart_expressions/expression_partition_vis/tsconfig.json +++ b/src/plugins/chart_expressions/expression_partition_vis/tsconfig.json @@ -30,6 +30,7 @@ "@kbn/chart-expressions-common", "@kbn/cell-actions", "@kbn/react-kibana-context-render", + "@kbn/core-rendering-browser-internal", ], "exclude": [ "target/**/*", diff --git a/src/plugins/dashboard/tsconfig.json b/src/plugins/dashboard/tsconfig.json index 3e95675ea64c3..6203a7cc7624d 100644 --- a/src/plugins/dashboard/tsconfig.json +++ b/src/plugins/dashboard/tsconfig.json @@ -81,6 +81,7 @@ "@kbn/core-custom-branding-browser-mocks", "@kbn/core-mount-utils-browser", "@kbn/visualization-utils", + "@kbn/core-rendering-browser-internal", ], "exclude": ["target/**/*"] } From c5d9524cc7c1c47236d2ac507aee1482f4a17eb2 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 7 Nov 2024 22:37:54 +0000 Subject: [PATCH 03/10] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- x-pack/plugins/observability_solution/synthetics/tsconfig.json | 3 ++- x-pack/plugins/observability_solution/uptime/tsconfig.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/observability_solution/synthetics/tsconfig.json b/x-pack/plugins/observability_solution/synthetics/tsconfig.json index 5df6d4257b4e9..eb8702524636e 100644 --- a/x-pack/plugins/observability_solution/synthetics/tsconfig.json +++ b/x-pack/plugins/observability_solution/synthetics/tsconfig.json @@ -105,7 +105,8 @@ "@kbn/slo-plugin", "@kbn/ebt-tools", "@kbn/alerting-types", - "@kbn/core-chrome-browser" + "@kbn/core-chrome-browser", + "@kbn/core-rendering-browser-internal" ], "exclude": ["target/**/*"] } diff --git a/x-pack/plugins/observability_solution/uptime/tsconfig.json b/x-pack/plugins/observability_solution/uptime/tsconfig.json index 8fa4d21627252..efca4b7e673b4 100644 --- a/x-pack/plugins/observability_solution/uptime/tsconfig.json +++ b/x-pack/plugins/observability_solution/uptime/tsconfig.json @@ -79,6 +79,7 @@ "@kbn/react-kibana-mount", "@kbn/deeplinks-observability", "@kbn/ebt-tools", + "@kbn/core-rendering-browser-internal", ], "exclude": ["target/**/*"] } From d74d9de0f059f57507b9ceef4c3cb376bfc5bf42 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 7 Nov 2024 16:03:50 -0700 Subject: [PATCH 04/10] tslint --- .../expression_xy/public/components/xy_chart.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx index 2ecf3ccc79ba2..2880dc0c5a533 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx @@ -55,6 +55,7 @@ import { } from '@kbn/visualizations-plugin/common/constants'; import { PersistedState } from '@kbn/visualizations-plugin/public'; import { getOverridesFor, ChartSizeSpec } from '@kbn/chart-expressions-common'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; import type { FilterEvent, BrushEvent, From 0910cc4f4ac5a2e2499da7dcc178c1ed7002d6b9 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:15:29 +0000 Subject: [PATCH 05/10] [CI] Auto-commit changed files from 'node scripts/notice' --- src/plugins/chart_expressions/expression_xy/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/chart_expressions/expression_xy/tsconfig.json b/src/plugins/chart_expressions/expression_xy/tsconfig.json index efa65a7f28a7d..a3f62006481cc 100644 --- a/src/plugins/chart_expressions/expression_xy/tsconfig.json +++ b/src/plugins/chart_expressions/expression_xy/tsconfig.json @@ -35,6 +35,7 @@ "@kbn/es-query", "@kbn/cell-actions", "@kbn/react-kibana-context-render", + "@kbn/core-rendering-browser-internal", ], "exclude": [ "target/**/*", From 68dcf5af65fc08aca919bf2107566b56d9501353 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:25:42 +0000 Subject: [PATCH 06/10] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../src/use_app_fixed_viewport.ts | 4 ++-- .../public/components/partition_vis_component.tsx | 2 +- .../step_waterfall_chart/waterfall/waterfall_bar_chart.tsx | 2 +- .../synthetics/waterfall/components/waterfall_bar_chart.tsx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts b/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts index b62536b33ae90..0844e214ccb34 100644 --- a/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts +++ b/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts @@ -7,9 +7,9 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { useRef } from "react"; +import { useRef } from 'react'; export function useAppFixedViewport() { const ref = useRef(document.getElementById('app-fixed-viewport') ?? undefined); return ref.current; -} \ No newline at end of file +} diff --git a/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx b/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx index 79f87d8da315a..b7031ed88856d 100644 --- a/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx +++ b/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx @@ -41,6 +41,7 @@ import { } from '@kbn/expressions-plugin/public'; import type { FieldFormat } from '@kbn/field-formats-plugin/common'; import { getOverridesFor } from '@kbn/chart-expressions-common'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; import { consolidateMetricColumns } from '../../common/utils'; import { DEFAULT_PERCENT_DECIMALS } from '../../common/constants'; import { @@ -77,7 +78,6 @@ import { import { filterOutConfig } from '../utils/filter_out_config'; import { ColumnCellValueActions, FilterEvent, StartDeps } from '../types'; import { getMultiFilterCells } from '../utils/filter_helpers'; -import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; declare global { interface Window { diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx index ba1c83d8fd42c..9c0e7d22844eb 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx @@ -22,6 +22,7 @@ import { } from '@elastic/charts'; import { useEuiTheme } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; import { useBaseChartTheme } from '../../../../../../hooks/use_base_chart_theme'; import { BAR_HEIGHT } from './constants'; import { WaterfallChartChartContainer, WaterfallChartTooltip } from './styles'; @@ -30,7 +31,6 @@ import { useWaterfallContext } from './context/waterfall_context'; import { WaterfallTooltipContent } from './waterfall_tooltip_content'; import { formatTooltipHeading } from '../../common/network_data/data_formatting'; import { WaterfallChartMarkers } from './waterfall_marker/waterfall_markers'; -import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; const getChartHeight = (data: WaterfallData): number => { // We get the last item x(number of bars) and adds 1 to cater for 0 index diff --git a/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx b/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx index cb65e43cd4895..af15314a61432 100644 --- a/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx +++ b/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx @@ -21,6 +21,7 @@ import { Tooltip, } from '@elastic/charts'; import { i18n } from '@kbn/i18n'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; import { BAR_HEIGHT } from './constants'; import { useBaseChartTheme } from '../../../../../hooks/use_base_chart_theme'; import { WaterfallChartChartContainer, WaterfallChartTooltip } from './styles'; @@ -28,7 +29,6 @@ import { useWaterfallContext, WaterfallData } from '..'; import { WaterfallTooltipContent } from './waterfall_tooltip_content'; import { formatTooltipHeading } from '../../step_detail/waterfall/data_formatting'; import { WaterfallChartMarkers } from './waterfall_markers'; -import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; const getChartHeight = (data: WaterfallData): number => { // We get the last item x(number of bars) and adds 1 to cater for 0 index From f549a7025aa167c72f744e0db4a7885a82e89614 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 7 Nov 2024 20:48:48 -0700 Subject: [PATCH 07/10] eslint --- .../expression_xy/public/components/xy_chart.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx index 2880dc0c5a533..b2ea6902241f0 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx @@ -233,6 +233,7 @@ export function XYChart({ const chartRef = useRef(null); const chartBaseTheme = chartsThemeService.useChartsBaseTheme(); const darkMode = chartsThemeService.useDarkMode(); + const appFixedViewport = useAppFixedViewport(); const filteredLayers = getFilteredLayers(layers); const layersById = filteredLayers.reduce>( (hashMap, layer) => ({ ...hashMap, [layer.layerId]: layer }), @@ -745,8 +746,6 @@ export function XYChart({ formatFactory ); - const appFixedViewport = useAppFixedViewport(); - return (
{showLegend !== undefined && uiState && ( From de0770d05cacc936d198867ba411da421facd5e5 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 13 Nov 2024 10:56:10 -0700 Subject: [PATCH 08/10] move useAppFixedViewport to @kbn/core-rendering-browser plugin --- .github/CODEOWNERS | 1 + package.json | 1 + .../core-rendering-browser-internal/index.ts | 2 +- .../src/index.ts | 3 +-- .../src/rendering_service.tsx | 4 +++- .../core-rendering-browser/README.md | 4 ++++ .../rendering/core-rendering-browser/index.ts | 10 +++++++++ .../core-rendering-browser/jest.config.js | 14 +++++++++++++ .../core-rendering-browser/kibana.jsonc | 5 +++++ .../core-rendering-browser/package.json | 7 +++++++ .../core-rendering-browser/src/index.ts | 10 +++++++++ .../src/use_app_fixed_viewport.ts | 3 ++- .../core-rendering-browser/tsconfig.json | 21 +++++++++++++++++++ .../components/partition_vis_component.tsx | 2 +- .../expression_partition_vis/tsconfig.json | 2 +- .../public/components/xy_chart.tsx | 2 +- .../expression_xy/tsconfig.json | 2 +- .../component/grid/dashboard_grid.tsx | 2 +- src/plugins/dashboard/tsconfig.json | 2 +- tsconfig.base.json | 2 ++ .../waterfall/waterfall_bar_chart.tsx | 2 +- .../synthetics/tsconfig.json | 2 +- .../components/waterfall_bar_chart.tsx | 2 +- .../uptime/tsconfig.json | 2 +- yarn.lock | 4 ++++ 25 files changed, 96 insertions(+), 15 deletions(-) create mode 100644 packages/core/rendering/core-rendering-browser/README.md create mode 100644 packages/core/rendering/core-rendering-browser/index.ts create mode 100644 packages/core/rendering/core-rendering-browser/jest.config.js create mode 100644 packages/core/rendering/core-rendering-browser/kibana.jsonc create mode 100644 packages/core/rendering/core-rendering-browser/package.json create mode 100644 packages/core/rendering/core-rendering-browser/src/index.ts rename packages/core/rendering/{core-rendering-browser-internal => core-rendering-browser}/src/use_app_fixed_viewport.ts (77%) create mode 100644 packages/core/rendering/core-rendering-browser/tsconfig.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1b9c828de461c..a9c8a306dfaf8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -193,6 +193,7 @@ packages/core/plugins/core-plugins-server-mocks @elastic/kibana-core packages/core/preboot/core-preboot-server @elastic/kibana-core packages/core/preboot/core-preboot-server-internal @elastic/kibana-core packages/core/preboot/core-preboot-server-mocks @elastic/kibana-core +packages/core/rendering/core-rendering-browser @elastic/kibana-core packages/core/rendering/core-rendering-browser-internal @elastic/kibana-core packages/core/rendering/core-rendering-browser-mocks @elastic/kibana-core packages/core/rendering/core-rendering-server-internal @elastic/kibana-core diff --git a/package.json b/package.json index e2491ea76b89b..d14e1a5334ed7 100644 --- a/package.json +++ b/package.json @@ -360,6 +360,7 @@ "@kbn/core-preboot-server": "link:packages/core/preboot/core-preboot-server", "@kbn/core-preboot-server-internal": "link:packages/core/preboot/core-preboot-server-internal", "@kbn/core-provider-plugin": "link:test/plugin_functional/plugins/core_provider_plugin", + "@kbn/core-rendering-browser": "link:packages/core/rendering/core-rendering-browser", "@kbn/core-rendering-browser-internal": "link:packages/core/rendering/core-rendering-browser-internal", "@kbn/core-rendering-server-internal": "link:packages/core/rendering/core-rendering-server-internal", "@kbn/core-root-browser-internal": "link:packages/core/root/core-root-browser-internal", diff --git a/packages/core/rendering/core-rendering-browser-internal/index.ts b/packages/core/rendering/core-rendering-browser-internal/index.ts index 953ff0ae3b284..d9c0582b74504 100644 --- a/packages/core/rendering/core-rendering-browser-internal/index.ts +++ b/packages/core/rendering/core-rendering-browser-internal/index.ts @@ -7,4 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { useAppFixedViewport, RenderingService } from './src'; +export { APP_FIXED_VIEWPORT_ID, RenderingService } from './src'; diff --git a/packages/core/rendering/core-rendering-browser-internal/src/index.ts b/packages/core/rendering/core-rendering-browser-internal/src/index.ts index dbb93674b1a36..0846542955ec1 100644 --- a/packages/core/rendering/core-rendering-browser-internal/src/index.ts +++ b/packages/core/rendering/core-rendering-browser-internal/src/index.ts @@ -7,5 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { RenderingService } from './rendering_service'; -export { useAppFixedViewport } from './use_app_fixed_viewport'; +export { APP_FIXED_VIEWPORT_ID, RenderingService } from './rendering_service'; diff --git a/packages/core/rendering/core-rendering-browser-internal/src/rendering_service.tsx b/packages/core/rendering/core-rendering-browser-internal/src/rendering_service.tsx index 700dad544cd2b..9fca3e4a281ee 100644 --- a/packages/core/rendering/core-rendering-browser-internal/src/rendering_service.tsx +++ b/packages/core/rendering/core-rendering-browser-internal/src/rendering_service.tsx @@ -33,6 +33,8 @@ export interface StartDeps extends StartServices { targetDomElement: HTMLDivElement; } +export const APP_FIXED_VIEWPORT_ID = 'app-fixed-viewport'; + /** * Renders all Core UI in a single React tree. * @@ -68,7 +70,7 @@ export class RenderingService { {/* The App Wrapper outside of the fixed headers that accepts custom class names from apps */} {/* Affixes a div to restrict the position of charts tooltip to the visible viewport minus the header */} -
+
{/* The actual plugin/app */} {appComponent} diff --git a/packages/core/rendering/core-rendering-browser/README.md b/packages/core/rendering/core-rendering-browser/README.md new file mode 100644 index 0000000000000..40141d7611e72 --- /dev/null +++ b/packages/core/rendering/core-rendering-browser/README.md @@ -0,0 +1,4 @@ +# @kbn/core-rendering-browser + +This package contains the types and implementation for Core's browser-side rendering service. + diff --git a/packages/core/rendering/core-rendering-browser/index.ts b/packages/core/rendering/core-rendering-browser/index.ts new file mode 100644 index 0000000000000..6eb9120e6b7e0 --- /dev/null +++ b/packages/core/rendering/core-rendering-browser/index.ts @@ -0,0 +1,10 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { useAppFixedViewport } from './src'; diff --git a/packages/core/rendering/core-rendering-browser/jest.config.js b/packages/core/rendering/core-rendering-browser/jest.config.js new file mode 100644 index 0000000000000..13f1819553812 --- /dev/null +++ b/packages/core/rendering/core-rendering-browser/jest.config.js @@ -0,0 +1,14 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../../..', + roots: ['/packages/core/rendering/core-rendering-browser'], +}; diff --git a/packages/core/rendering/core-rendering-browser/kibana.jsonc b/packages/core/rendering/core-rendering-browser/kibana.jsonc new file mode 100644 index 0000000000000..4b43c11865134 --- /dev/null +++ b/packages/core/rendering/core-rendering-browser/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-browser", + "id": "@kbn/core-rendering-browser", + "owner": "@elastic/kibana-core" +} diff --git a/packages/core/rendering/core-rendering-browser/package.json b/packages/core/rendering/core-rendering-browser/package.json new file mode 100644 index 0000000000000..4f1fa6f68ef01 --- /dev/null +++ b/packages/core/rendering/core-rendering-browser/package.json @@ -0,0 +1,7 @@ +{ + "name": "@kbn/core-rendering-browser", + "private": true, + "version": "1.0.0", + "author": "Kibana Core", + "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0" +} \ No newline at end of file diff --git a/packages/core/rendering/core-rendering-browser/src/index.ts b/packages/core/rendering/core-rendering-browser/src/index.ts new file mode 100644 index 0000000000000..098636e1bb8af --- /dev/null +++ b/packages/core/rendering/core-rendering-browser/src/index.ts @@ -0,0 +1,10 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +export { useAppFixedViewport } from './use_app_fixed_viewport'; diff --git a/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts b/packages/core/rendering/core-rendering-browser/src/use_app_fixed_viewport.ts similarity index 77% rename from packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts rename to packages/core/rendering/core-rendering-browser/src/use_app_fixed_viewport.ts index 0844e214ccb34..cccdd4c7adc15 100644 --- a/packages/core/rendering/core-rendering-browser-internal/src/use_app_fixed_viewport.ts +++ b/packages/core/rendering/core-rendering-browser/src/use_app_fixed_viewport.ts @@ -8,8 +8,9 @@ */ import { useRef } from 'react'; +import { APP_FIXED_VIEWPORT_ID } from '@kbn/core-rendering-browser-internal'; export function useAppFixedViewport() { - const ref = useRef(document.getElementById('app-fixed-viewport') ?? undefined); + const ref = useRef(document.getElementById(APP_FIXED_VIEWPORT_ID) ?? undefined); return ref.current; } diff --git a/packages/core/rendering/core-rendering-browser/tsconfig.json b/packages/core/rendering/core-rendering-browser/tsconfig.json new file mode 100644 index 0000000000000..3431d9e772bdc --- /dev/null +++ b/packages/core/rendering/core-rendering-browser/tsconfig.json @@ -0,0 +1,21 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node", + "react" + ] + }, + "include": [ + "**/*.ts", + "**/*.tsx", + ], + "kbn_references": [ + "@kbn/core-rendering-browser-internal" + ], + "exclude": [ + "target/**/*", + ] +} diff --git a/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx b/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx index b7031ed88856d..816a10509b425 100644 --- a/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx +++ b/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx @@ -41,7 +41,7 @@ import { } from '@kbn/expressions-plugin/public'; import type { FieldFormat } from '@kbn/field-formats-plugin/common'; import { getOverridesFor } from '@kbn/chart-expressions-common'; -import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser'; import { consolidateMetricColumns } from '../../common/utils'; import { DEFAULT_PERCENT_DECIMALS } from '../../common/constants'; import { diff --git a/src/plugins/chart_expressions/expression_partition_vis/tsconfig.json b/src/plugins/chart_expressions/expression_partition_vis/tsconfig.json index ff1a21089a6f9..1d8c4c4098728 100644 --- a/src/plugins/chart_expressions/expression_partition_vis/tsconfig.json +++ b/src/plugins/chart_expressions/expression_partition_vis/tsconfig.json @@ -30,7 +30,7 @@ "@kbn/chart-expressions-common", "@kbn/cell-actions", "@kbn/react-kibana-context-render", - "@kbn/core-rendering-browser-internal", + "@kbn/core-rendering-browser", ], "exclude": [ "target/**/*", diff --git a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx index b2ea6902241f0..349af46eb101a 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx @@ -55,7 +55,7 @@ import { } from '@kbn/visualizations-plugin/common/constants'; import { PersistedState } from '@kbn/visualizations-plugin/public'; import { getOverridesFor, ChartSizeSpec } from '@kbn/chart-expressions-common'; -import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser'; import type { FilterEvent, BrushEvent, diff --git a/src/plugins/chart_expressions/expression_xy/tsconfig.json b/src/plugins/chart_expressions/expression_xy/tsconfig.json index a3f62006481cc..cd8bd4db90b89 100644 --- a/src/plugins/chart_expressions/expression_xy/tsconfig.json +++ b/src/plugins/chart_expressions/expression_xy/tsconfig.json @@ -35,7 +35,7 @@ "@kbn/es-query", "@kbn/cell-actions", "@kbn/react-kibana-context-render", - "@kbn/core-rendering-browser-internal", + "@kbn/core-rendering-browser", ], "exclude": [ "target/**/*", diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.tsx b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.tsx index 3ee7cac4107a8..76a545d1ea9fc 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.tsx @@ -18,7 +18,7 @@ import { Layout, Responsive as ResponsiveReactGridLayout } from 'react-grid-layo import { ViewMode } from '@kbn/embeddable-plugin/public'; import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing'; -import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser'; import { DashboardPanelState } from '../../../../common'; import { DashboardGridItem } from './dashboard_grid_item'; import { useDashboardGridSettings } from './use_dashboard_grid_settings'; diff --git a/src/plugins/dashboard/tsconfig.json b/src/plugins/dashboard/tsconfig.json index 6203a7cc7624d..1bf6827433b66 100644 --- a/src/plugins/dashboard/tsconfig.json +++ b/src/plugins/dashboard/tsconfig.json @@ -81,7 +81,7 @@ "@kbn/core-custom-branding-browser-mocks", "@kbn/core-mount-utils-browser", "@kbn/visualization-utils", - "@kbn/core-rendering-browser-internal", + "@kbn/core-rendering-browser", ], "exclude": ["target/**/*"] } diff --git a/tsconfig.base.json b/tsconfig.base.json index e7a64097448ad..796230e664d09 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -542,6 +542,8 @@ "@kbn/core-preboot-server-mocks/*": ["packages/core/preboot/core-preboot-server-mocks/*"], "@kbn/core-provider-plugin": ["test/plugin_functional/plugins/core_provider_plugin"], "@kbn/core-provider-plugin/*": ["test/plugin_functional/plugins/core_provider_plugin/*"], + "@kbn/core-rendering-browser": ["packages/core/rendering/core-rendering-browser"], + "@kbn/core-rendering-browser/*": ["packages/core/rendering/core-rendering-browser/*"], "@kbn/core-rendering-browser-internal": ["packages/core/rendering/core-rendering-browser-internal"], "@kbn/core-rendering-browser-internal/*": ["packages/core/rendering/core-rendering-browser-internal/*"], "@kbn/core-rendering-browser-mocks": ["packages/core/rendering/core-rendering-browser-mocks"], diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx index 9c0e7d22844eb..cbe7507b3cfdc 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/step_waterfall_chart/waterfall/waterfall_bar_chart.tsx @@ -22,7 +22,7 @@ import { } from '@elastic/charts'; import { useEuiTheme } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser'; import { useBaseChartTheme } from '../../../../../../hooks/use_base_chart_theme'; import { BAR_HEIGHT } from './constants'; import { WaterfallChartChartContainer, WaterfallChartTooltip } from './styles'; diff --git a/x-pack/plugins/observability_solution/synthetics/tsconfig.json b/x-pack/plugins/observability_solution/synthetics/tsconfig.json index 1be1f40bfd62b..32d15f8080ffd 100644 --- a/x-pack/plugins/observability_solution/synthetics/tsconfig.json +++ b/x-pack/plugins/observability_solution/synthetics/tsconfig.json @@ -105,7 +105,7 @@ "@kbn/ebt-tools", "@kbn/alerting-types", "@kbn/core-chrome-browser", - "@kbn/core-rendering-browser-internal", + "@kbn/core-rendering-browser", "@kbn/index-lifecycle-management-common-shared" ], "exclude": ["target/**/*"] diff --git a/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx b/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx index af15314a61432..57b20eb3a179c 100644 --- a/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx +++ b/x-pack/plugins/observability_solution/uptime/public/legacy_uptime/components/monitor/synthetics/waterfall/components/waterfall_bar_chart.tsx @@ -21,7 +21,7 @@ import { Tooltip, } from '@elastic/charts'; import { i18n } from '@kbn/i18n'; -import { useAppFixedViewport } from '@kbn/core-rendering-browser-internal'; +import { useAppFixedViewport } from '@kbn/core-rendering-browser'; import { BAR_HEIGHT } from './constants'; import { useBaseChartTheme } from '../../../../../hooks/use_base_chart_theme'; import { WaterfallChartChartContainer, WaterfallChartTooltip } from './styles'; diff --git a/x-pack/plugins/observability_solution/uptime/tsconfig.json b/x-pack/plugins/observability_solution/uptime/tsconfig.json index efca4b7e673b4..22b5e9afb7381 100644 --- a/x-pack/plugins/observability_solution/uptime/tsconfig.json +++ b/x-pack/plugins/observability_solution/uptime/tsconfig.json @@ -79,7 +79,7 @@ "@kbn/react-kibana-mount", "@kbn/deeplinks-observability", "@kbn/ebt-tools", - "@kbn/core-rendering-browser-internal", + "@kbn/core-rendering-browser", ], "exclude": ["target/**/*"] } diff --git a/yarn.lock b/yarn.lock index 8e2333250dd7d..5b91141f52477 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4342,6 +4342,10 @@ version "0.0.0" uid "" +"@kbn/core-rendering-browser@link:packages/core/rendering/core-rendering-browser": + version "0.0.0" + uid "" + "@kbn/core-rendering-server-internal@link:packages/core/rendering/core-rendering-server-internal": version "0.0.0" uid "" From 9edc671c426080ff492c6988213a0f23532ec807 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 14 Nov 2024 11:39:15 -0700 Subject: [PATCH 09/10] move APP_FIXED_VIEWPORT_ID to core-rendering-browser --- .../core/rendering/core-rendering-browser-internal/index.ts | 2 +- .../rendering/core-rendering-browser-internal/src/index.ts | 2 +- .../core-rendering-browser-internal/src/rendering_service.tsx | 3 +-- .../rendering/core-rendering-browser-internal/tsconfig.json | 3 ++- packages/core/rendering/core-rendering-browser/index.ts | 2 +- packages/core/rendering/core-rendering-browser/src/index.ts | 2 +- .../core-rendering-browser/src/use_app_fixed_viewport.ts | 3 ++- packages/core/rendering/core-rendering-browser/tsconfig.json | 4 +--- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/core/rendering/core-rendering-browser-internal/index.ts b/packages/core/rendering/core-rendering-browser-internal/index.ts index d9c0582b74504..f1ff406cd2579 100644 --- a/packages/core/rendering/core-rendering-browser-internal/index.ts +++ b/packages/core/rendering/core-rendering-browser-internal/index.ts @@ -7,4 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { APP_FIXED_VIEWPORT_ID, RenderingService } from './src'; +export { RenderingService } from './src'; diff --git a/packages/core/rendering/core-rendering-browser-internal/src/index.ts b/packages/core/rendering/core-rendering-browser-internal/src/index.ts index 0846542955ec1..4b6167f377a2e 100644 --- a/packages/core/rendering/core-rendering-browser-internal/src/index.ts +++ b/packages/core/rendering/core-rendering-browser-internal/src/index.ts @@ -7,4 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { APP_FIXED_VIEWPORT_ID, RenderingService } from './rendering_service'; +export { RenderingService } from './rendering_service'; diff --git a/packages/core/rendering/core-rendering-browser-internal/src/rendering_service.tsx b/packages/core/rendering/core-rendering-browser-internal/src/rendering_service.tsx index 9fca3e4a281ee..12a597ba9318f 100644 --- a/packages/core/rendering/core-rendering-browser-internal/src/rendering_service.tsx +++ b/packages/core/rendering/core-rendering-browser-internal/src/rendering_service.tsx @@ -18,6 +18,7 @@ import type { I18nStart } from '@kbn/core-i18n-browser'; import type { OverlayStart } from '@kbn/core-overlays-browser'; import type { ThemeServiceStart } from '@kbn/core-theme-browser'; import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root'; +import { APP_FIXED_VIEWPORT_ID } from '@kbn/core-rendering-browser'; import { AppWrapper } from './app_containers'; interface StartServices { @@ -33,8 +34,6 @@ export interface StartDeps extends StartServices { targetDomElement: HTMLDivElement; } -export const APP_FIXED_VIEWPORT_ID = 'app-fixed-viewport'; - /** * Renders all Core UI in a single React tree. * diff --git a/packages/core/rendering/core-rendering-browser-internal/tsconfig.json b/packages/core/rendering/core-rendering-browser-internal/tsconfig.json index 42c59f96b2471..4b0c009a0a033 100644 --- a/packages/core/rendering/core-rendering-browser-internal/tsconfig.json +++ b/packages/core/rendering/core-rendering-browser-internal/tsconfig.json @@ -26,7 +26,8 @@ "@kbn/core-analytics-browser-mocks", "@kbn/core-analytics-browser", "@kbn/core-i18n-browser", - "@kbn/core-theme-browser" + "@kbn/core-theme-browser", + "@kbn/core-rendering-browser" ], "exclude": [ "target/**/*", diff --git a/packages/core/rendering/core-rendering-browser/index.ts b/packages/core/rendering/core-rendering-browser/index.ts index 6eb9120e6b7e0..d8ccea264df05 100644 --- a/packages/core/rendering/core-rendering-browser/index.ts +++ b/packages/core/rendering/core-rendering-browser/index.ts @@ -7,4 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { useAppFixedViewport } from './src'; +export { APP_FIXED_VIEWPORT_ID, useAppFixedViewport } from './src'; diff --git a/packages/core/rendering/core-rendering-browser/src/index.ts b/packages/core/rendering/core-rendering-browser/src/index.ts index 098636e1bb8af..aad756d296561 100644 --- a/packages/core/rendering/core-rendering-browser/src/index.ts +++ b/packages/core/rendering/core-rendering-browser/src/index.ts @@ -7,4 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { useAppFixedViewport } from './use_app_fixed_viewport'; +export { APP_FIXED_VIEWPORT_ID, useAppFixedViewport } from './use_app_fixed_viewport'; diff --git a/packages/core/rendering/core-rendering-browser/src/use_app_fixed_viewport.ts b/packages/core/rendering/core-rendering-browser/src/use_app_fixed_viewport.ts index cccdd4c7adc15..ecf44a0018b49 100644 --- a/packages/core/rendering/core-rendering-browser/src/use_app_fixed_viewport.ts +++ b/packages/core/rendering/core-rendering-browser/src/use_app_fixed_viewport.ts @@ -8,7 +8,8 @@ */ import { useRef } from 'react'; -import { APP_FIXED_VIEWPORT_ID } from '@kbn/core-rendering-browser-internal'; + +export const APP_FIXED_VIEWPORT_ID = 'app-fixed-viewport'; export function useAppFixedViewport() { const ref = useRef(document.getElementById(APP_FIXED_VIEWPORT_ID) ?? undefined); diff --git a/packages/core/rendering/core-rendering-browser/tsconfig.json b/packages/core/rendering/core-rendering-browser/tsconfig.json index 3431d9e772bdc..3a932605dfa75 100644 --- a/packages/core/rendering/core-rendering-browser/tsconfig.json +++ b/packages/core/rendering/core-rendering-browser/tsconfig.json @@ -12,9 +12,7 @@ "**/*.ts", "**/*.tsx", ], - "kbn_references": [ - "@kbn/core-rendering-browser-internal" - ], + "kbn_references": [], "exclude": [ "target/**/*", ] From 4759dd585089c2d81d0e8f3e2d41a0c1c09070ac Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 14 Nov 2024 20:08:24 +0000 Subject: [PATCH 10/10] [CI] Auto-commit changed files from 'make api-docs' --- oas_docs/output/kibana.serverless.yaml | 78 +++++---------------- oas_docs/output/kibana.yaml | 96 ++++++-------------------- 2 files changed, 40 insertions(+), 134 deletions(-) diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index 117e52586c5ad..4f54e401b14c2 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -1018,24 +1018,17 @@ paths: - last_execution_date flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch - states in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -1610,24 +1603,17 @@ paths: type: boolean flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch states - in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -1945,24 +1931,17 @@ paths: - last_execution_date flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch - states in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -2540,24 +2519,17 @@ paths: - active flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch states - in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -2847,24 +2819,17 @@ paths: - last_execution_date flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch - states in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -3902,24 +3867,17 @@ paths: - last_execution_date flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch - states in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index ceefaa13fcd4b..cb7d39cae0cab 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -1367,24 +1367,17 @@ paths: - last_execution_date flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch - states in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -1958,24 +1951,17 @@ paths: type: boolean flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch states - in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -2293,24 +2279,17 @@ paths: - last_execution_date flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch - states in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -2887,24 +2866,17 @@ paths: - active flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch states - in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -3194,24 +3166,17 @@ paths: - last_execution_date flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch - states in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -4241,24 +4206,17 @@ paths: - last_execution_date flapping: additionalProperties: false - description: >- - When flapping detection is turned on, alerts that switch - quickly between active and recovered states are identified - as “flapping” and notifications are reduced. + description: When flapping detection is turned on, alerts that switch quickly between active and recovered states are identified as “flapping” and notifications are reduced. nullable: true type: object properties: look_back_window: - description: >- - The minimum number of runs in which the threshold must - be met. + description: The minimum number of runs in which the threshold must be met. maximum: 20 minimum: 2 type: number status_change_threshold: - description: >- - The minimum number of times an alert must switch - states in the look back window. + description: The minimum number of times an alert must switch states in the look back window. maximum: 20 minimum: 2 type: number @@ -6708,14 +6666,9 @@ paths: - cases /api/cases/{caseId}/files: post: - description: > - Attach a file to a case. You must have `all` privileges for the - **Cases** feature in the **Management**, **Observability**, or - **Security** section of the Kibana feature privileges, depending on the - owner of the case you're updating. The request must include: - + description: | + Attach a file to a case. You must have `all` privileges for the **Cases** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the case you're updating. The request must include: - The `Content-Type: multipart/form-data` HTTP header. - - The location of the file that is being uploaded. operationId: addCaseFileDefaultSpace parameters: @@ -43715,9 +43668,7 @@ components: - $ref: '#/components/schemas/Cases_add_user_comment_request_properties' title: Add case comment request Cases_add_case_file_request: - description: >- - Defines the file that will be attached to the case. Optional parameters - will be generated automatically from the file metadata if not defined. + description: Defines the file that will be attached to the case. Optional parameters will be generated automatically from the file metadata if not defined. type: object properties: file: @@ -43725,10 +43676,7 @@ components: format: binary type: string filename: - description: >- - The desired name of the file being attached to the case, it can be - different than the name of the file in the filesystem. **This should - not include the file extension.** + description: The desired name of the file being attached to the case, it can be different than the name of the file in the filesystem. **This should not include the file extension.** type: string required: - file