diff --git a/x-pack/examples/embedded_lens_example/public/app.tsx b/x-pack/examples/embedded_lens_example/public/app.tsx index 04f90dfbb96d4..200b44bf6eebf 100644 --- a/x-pack/examples/embedded_lens_example/public/app.tsx +++ b/x-pack/examples/embedded_lens_example/public/app.tsx @@ -27,7 +27,6 @@ import type { DateHistogramIndexPatternColumn, } from '@kbn/lens-plugin/public'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; import type { StartDependencies } from './plugin'; @@ -268,7 +267,7 @@ export const App = (props: { onTableRowClick={(_data) => { // call back event for on table row click event }} - viewMode={ViewMode.VIEW} + viewMode={'view'} extraActions={[ { id: 'testAction', diff --git a/x-pack/examples/lens_config_builder_example/public/app.tsx b/x-pack/examples/lens_config_builder_example/public/app.tsx index eb9225cf8528b..3e1851327509a 100644 --- a/x-pack/examples/lens_config_builder_example/public/app.tsx +++ b/x-pack/examples/lens_config_builder_example/public/app.tsx @@ -22,7 +22,6 @@ import { import type { CoreStart } from '@kbn/core/public'; import type { LensEmbeddableInput, FormulaPublicApi } from '@kbn/lens-plugin/public'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; import { LensConfig, LensConfigBuilder } from '@kbn/lens-embeddable-utils/config_builder'; import { DataViewsContract } from '@kbn/data-views-plugin/public'; @@ -128,7 +127,7 @@ export const App = (props: { onTableRowClick={(_data) => { // call back event for on table row click event }} - viewMode={ViewMode.VIEW} + viewMode={'view'} extraActions={[ { id: 'testAction', diff --git a/x-pack/examples/testing_embedded_lens/public/app.tsx b/x-pack/examples/testing_embedded_lens/public/app.tsx index 699db0d0dc644..8cbcff6500103 100644 --- a/x-pack/examples/testing_embedded_lens/public/app.tsx +++ b/x-pack/examples/testing_embedded_lens/public/app.tsx @@ -24,7 +24,6 @@ import type { CoreStart } from '@kbn/core/public'; import useDebounce from 'react-use/lib/useDebounce'; import { DOCUMENT_FIELD_NAME } from '@kbn/lens-plugin/common/constants'; import type { DataView } from '@kbn/data-views-plugin/public'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import type { TypedLensByValueInput, PersistedIndexPatternLayer, @@ -631,7 +630,7 @@ export const App = (props: { // call back event for on table row click event }} disableTriggers={!enableTriggers} - viewMode={ViewMode.VIEW} + viewMode={'view'} withDefaultActions={enableDefaultAction} extraActions={ enableExtraAction diff --git a/x-pack/platform/plugins/shared/ml/public/application/services/dashboard_service.ts b/x-pack/platform/plugins/shared/ml/public/application/services/dashboard_service.ts index ffa6f6a5d3ede..2ef3cfc1b7c0b 100644 --- a/x-pack/platform/plugins/shared/ml/public/application/services/dashboard_service.ts +++ b/x-pack/platform/plugins/shared/ml/public/application/services/dashboard_service.ts @@ -7,7 +7,7 @@ import { useMemo } from 'react'; import type { DashboardStart } from '@kbn/dashboard-plugin/public'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; +import type { ViewMode } from '@kbn/presentation-publishing'; import { useMlKibana } from '../contexts/kibana'; export type DashboardService = ReturnType; @@ -38,10 +38,10 @@ export function dashboardServiceProvider(dashboardService: DashboardStart) { /** * Generates dashboard url */ - async getDashboardUrl(dashboardId: string, viewMode: ViewMode = ViewMode.EDIT) { + async getDashboardUrl(dashboardId: string, viewMode: ViewMode = 'edit') { return await dashboardService.locator?.getUrl({ dashboardId, - viewMode: ViewMode.EDIT, + viewMode: 'edit', useHash: false, }); }, diff --git a/x-pack/platform/plugins/shared/ml/public/application/supplied_configurations/supplied_configurations_flyout/kibana_tab_content.tsx b/x-pack/platform/plugins/shared/ml/public/application/supplied_configurations/supplied_configurations_flyout/kibana_tab_content.tsx index 715ebf0bd75df..813dba5338aa4 100644 --- a/x-pack/platform/plugins/shared/ml/public/application/supplied_configurations/supplied_configurations_flyout/kibana_tab_content.tsx +++ b/x-pack/platform/plugins/shared/ml/public/application/supplied_configurations/supplied_configurations_flyout/kibana_tab_content.tsx @@ -20,7 +20,6 @@ import { } from '@elastic/eui'; import { useEuiTheme } from '@elastic/eui'; import { asyncForEach } from '@kbn/std'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import type { Module } from '../../../../common/types/modules'; import { useDashboardService } from '../../services/dashboard_service'; import { useMlKibana } from '../../contexts/kibana'; @@ -53,7 +52,7 @@ export const KibanaTabContent: FC = ({ module, selectedKibanaSubTab }) => const result = await dashboardService.fetchDashboardsById(dashboardIds); await asyncForEach(result, async ({ id }) => { - const url = await dashboardService.getDashboardUrl(id, ViewMode.VIEW); + const url = await dashboardService.getDashboardUrl(id, 'view'); if (url) { allUrls[id] = url; } diff --git a/x-pack/plugins/discover_enhanced/public/actions/explore_data/abstract_explore_data_action.ts b/x-pack/plugins/discover_enhanced/public/actions/explore_data/abstract_explore_data_action.ts index 143e83589399a..9de250d8999c1 100644 --- a/x-pack/plugins/discover_enhanced/public/actions/explore_data/abstract_explore_data_action.ts +++ b/x-pack/plugins/discover_enhanced/public/actions/explore_data/abstract_explore_data_action.ts @@ -8,7 +8,6 @@ import { CoreStart } from '@kbn/core/public'; import { DiscoverAppLocatorParams } from '@kbn/discover-plugin/common'; import { DiscoverStart } from '@kbn/discover-plugin/public'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { i18n } from '@kbn/i18n'; import { StartServicesGetter } from '@kbn/kibana-utils-plugin/public'; import { DOC_TYPE as LENS_DOC_TYPE } from '@kbn/lens-plugin/common/constants'; @@ -51,7 +50,7 @@ const isApiCompatible = (api: unknown | null): api is AbstractExploreDataActionA const compatibilityCheck = (api: EmbeddableApiContext['embeddable']) => { return ( isApiCompatible(api) && - getInheritedViewMode(api) === ViewMode.VIEW && + getInheritedViewMode(api) === 'view' && !apiIsOfType(api, LENS_DOC_TYPE) ); }; diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/service_dashboards/index.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/service_dashboards/index.tsx index a92d781e3dd7c..e44fd3187b4a6 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/service_dashboards/index.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/service_dashboards/index.tsx @@ -17,7 +17,6 @@ import { EuiLoadingLogo, } from '@elastic/eui'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { DashboardApi, DashboardCreationOptions, @@ -104,7 +103,7 @@ export function ServiceDashboards() { const getCreationOptions = useCallback((): Promise => { const getInitialInput = () => ({ - viewMode: ViewMode.VIEW, + viewMode: 'view', timeRange: { from: rangeFrom, to: rangeTo }, }); return Promise.resolve({ diff --git a/x-pack/plugins/observability_solution/infra/public/alerting/log_threshold/components/alert_details_app_section/components/threhsold_chart/log_threshold_count_chart.tsx b/x-pack/plugins/observability_solution/infra/public/alerting/log_threshold/components/alert_details_app_section/components/threhsold_chart/log_threshold_count_chart.tsx index 4a474ea7f5ef1..931f025400561 100644 --- a/x-pack/plugins/observability_solution/infra/public/alerting/log_threshold/components/alert_details_app_section/components/threhsold_chart/log_threshold_count_chart.tsx +++ b/x-pack/plugins/observability_solution/infra/public/alerting/log_threshold/components/alert_details_app_section/components/threhsold_chart/log_threshold_count_chart.tsx @@ -5,7 +5,6 @@ * 2.0. */ import React from 'react'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { useEuiTheme } from '@elastic/eui'; import { useKibanaContextForPlugin } from '../../../../../../hooks/use_kibana'; import { @@ -56,7 +55,7 @@ export function LogThresholdCountChart({ style={{ height }} timeRange={timeRange} attributes={lensDef} - viewMode={ViewMode.VIEW} + viewMode={'view'} noPadding /> diff --git a/x-pack/plugins/observability_solution/infra/public/alerting/log_threshold/components/alert_details_app_section/components/threhsold_chart/log_threshold_ratio_chart.tsx b/x-pack/plugins/observability_solution/infra/public/alerting/log_threshold/components/alert_details_app_section/components/threhsold_chart/log_threshold_ratio_chart.tsx index 2e415b0e5468d..1477365a65167 100644 --- a/x-pack/plugins/observability_solution/infra/public/alerting/log_threshold/components/alert_details_app_section/components/threhsold_chart/log_threshold_ratio_chart.tsx +++ b/x-pack/plugins/observability_solution/infra/public/alerting/log_threshold/components/alert_details_app_section/components/threhsold_chart/log_threshold_ratio_chart.tsx @@ -5,7 +5,6 @@ * 2.0. */ import React from 'react'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { useEuiTheme } from '@elastic/eui'; import { useKibanaContextForPlugin } from '../../../../../../hooks/use_kibana'; import { @@ -59,7 +58,7 @@ export function LogThresholdRatioChart({ style={{ height }} timeRange={timeRange} attributes={lensDef} - viewMode={ViewMode.VIEW} + viewMode={'view'} noPadding /> diff --git a/x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/dashboards/dashboards.tsx b/x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/dashboards/dashboards.tsx index 694fe5cd1ed2b..d25d164b1e099 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/dashboards/dashboards.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/asset_details/tabs/dashboards/dashboards.tsx @@ -17,7 +17,6 @@ import { EuiLoadingLogo, } from '@elastic/eui'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { DashboardApi, DashboardCreationOptions, @@ -132,7 +131,7 @@ export function Dashboards() { const getCreationOptions = useCallback((): Promise => { const getInitialInput = () => ({ - viewMode: ViewMode.VIEW, + viewMode: 'view', timeRange: { from: dateRange.from, to: dateRange.to }, }); return Promise.resolve({ diff --git a/x-pack/plugins/observability_solution/infra/public/components/lens/lens_wrapper.tsx b/x-pack/plugins/observability_solution/infra/public/components/lens/lens_wrapper.tsx index 01ce60b593462..c1051e8b476a4 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/lens/lens_wrapper.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/lens/lens_wrapper.tsx @@ -5,7 +5,6 @@ * 2.0. */ import React, { useEffect, useState, useRef, useCallback } from 'react'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { TypedLensByValueInput } from '@kbn/lens-plugin/public'; import { css } from '@emotion/react'; import { useEuiTheme } from '@elastic/eui'; @@ -115,7 +114,7 @@ export const LensWrapper = ({ onLoad={handleOnLoad} query={state.query} timeRange={dateRange} - viewMode={ViewMode.VIEW} + viewMode={'view'} /> )} diff --git a/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx index fad8077e7811e..94ad4390e1e2c 100644 --- a/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx +++ b/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx @@ -5,7 +5,6 @@ * 2.0. */ -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { SLOWithSummaryResponse } from '@kbn/slo-schema'; import moment from 'moment'; import React from 'react'; @@ -58,7 +57,7 @@ export function ErrorRateChart({ to, }} attributes={lensDef} - viewMode={ViewMode.VIEW} + viewMode={'view'} onBrushEnd={({ range }) => { onBrushed?.({ from: moment(range[0]).toDate(), diff --git a/x-pack/solutions/observability/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx b/x-pack/solutions/observability/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx index 71738fbe246f9..441d9b63f2b32 100644 --- a/x-pack/solutions/observability/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx +++ b/x-pack/solutions/observability/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx @@ -7,7 +7,6 @@ import React, { useCallback, useMemo, useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { CountIndexPatternColumn, PersistedIndexPatternLayer, @@ -97,7 +96,7 @@ export function VisitorBreakdownChart({ from: start ?? '', to: end ?? '', }} - viewMode={ViewMode.VIEW} + viewMode={'view'} onFilter={filterHandler} /> ); diff --git a/x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx b/x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx index 871750d5ad00f..a67a032c2c6f7 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/common/components/visualization_actions/lens_embeddable.tsx @@ -9,7 +9,6 @@ import React, { useCallback, useMemo } from 'react'; import { useDispatch } from 'react-redux'; import { FormattedMessage } from '@kbn/i18n-react'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import styled from 'styled-components'; import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; import type { RangeFilterParams } from '@kbn/es-query'; @@ -256,7 +255,7 @@ const LensEmbeddableComponent: React.FC = ({ syncCursor={false} syncTooltips={false} timeRange={timerange} - viewMode={ViewMode.VIEW} + viewMode={'view'} withDefaultActions={false} /> diff --git a/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_renderer.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_renderer.test.tsx index 6897f59af6ffd..f78daee1a98ef 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_renderer.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_renderer.test.tsx @@ -6,7 +6,6 @@ */ import { render } from '@testing-library/react'; import React from 'react'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { DashboardRenderer as DashboardContainerRenderer } from '@kbn/dashboard-plugin/public'; import { TestProviders } from '../../common/mock'; @@ -57,7 +56,7 @@ describe('DashboardRenderer', () => { expect(input).toEqual( expect.objectContaining({ timeRange: props.timeRange, - viewMode: ViewMode.VIEW, + viewMode: 'view', query: undefined, filters: undefined, }) diff --git a/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_renderer.tsx b/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_renderer.tsx index 183f62f6cb923..1cce8a02be2a2 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_renderer.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_renderer.tsx @@ -14,7 +14,7 @@ import type { DashboardLocatorParams, } from '@kbn/dashboard-plugin/public'; import { DashboardRenderer as DashboardContainerRenderer } from '@kbn/dashboard-plugin/public'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; +import type { ViewMode } from '@kbn/presentation-publishing'; import type { Filter, Query } from '@kbn/es-query'; import { useDispatch } from 'react-redux'; @@ -40,7 +40,7 @@ const DashboardRendererComponent = ({ query, savedObjectId, timeRange, - viewMode = ViewMode.VIEW, + viewMode = 'view', }: { canReadDashboard: boolean; dashboardContainer?: DashboardApi; diff --git a/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_tool_bar.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_tool_bar.test.tsx index c6d38870e73ce..a20e4b7721a2c 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_tool_bar.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_tool_bar.test.tsx @@ -11,7 +11,6 @@ import { DashboardToolBar } from './dashboard_tool_bar'; import type { DashboardApi } from '@kbn/dashboard-plugin/public'; import { coreMock } from '@kbn/core/public/mocks'; import { DashboardTopNav } from '@kbn/dashboard-plugin/public'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { APP_NAME } from '../../../common/constants'; import { NavigationProvider, SecurityPageName } from '@kbn/security-solution-navigation'; import { TestProviders } from '../../common/mock'; @@ -60,7 +59,7 @@ describe('DashboardToolBar', () => { }); it('should render the DashboardToolBar component with the correct props for view mode', () => { - expect(mockOnLoad).toHaveBeenCalledWith(ViewMode.VIEW); + expect(mockOnLoad).toHaveBeenCalledWith('view'); }); it('should render the DashboardTopNav component with the correct redirect to listing url', () => { diff --git a/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_tool_bar.tsx b/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_tool_bar.tsx index c3783f359031b..269f74d229894 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_tool_bar.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/dashboards/components/dashboard_tool_bar.tsx @@ -8,7 +8,7 @@ import React, { useCallback, useEffect, useMemo } from 'react'; import type { DashboardApi } from '@kbn/dashboard-plugin/public'; import { DashboardTopNav, LEGACY_DASHBOARD_APP_ID } from '@kbn/dashboard-plugin/public'; -import type { ViewMode } from '@kbn/embeddable-plugin/public'; +import type { ViewMode } from '@kbn/presentation-publishing'; import type { ChromeBreadcrumb } from '@kbn/core/public'; import type { DashboardCapabilities } from '@kbn/dashboard-plugin/common'; @@ -56,7 +56,7 @@ const DashboardToolBarComponent = ({ ); useEffect(() => { - onLoad?.((viewMode as ViewMode) ?? 'view'); + onLoad?.(viewMode ?? 'view'); }, [onLoad, viewMode]); const embedSettings = useMemo( diff --git a/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.test.tsx index 3c85a18f2d3aa..0734c38de2b50 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.test.tsx @@ -11,7 +11,6 @@ import { Router } from '@kbn/shared-ux-router'; import { DashboardView } from '.'; import { useCapabilities } from '../../../common/lib/kibana'; import { TestProviders } from '../../../common/mock'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; jest.mock('react-router-dom', () => { const actual = jest.requireActual('react-router-dom'); @@ -69,7 +68,7 @@ describe('DashboardView', () => { test('render when no error state', () => { const { queryByTestId } = render( - + , { wrapper: TestProviders } ); @@ -84,7 +83,7 @@ describe('DashboardView', () => { }); const { queryByTestId } = render( - + , { wrapper: TestProviders } ); @@ -96,7 +95,7 @@ describe('DashboardView', () => { test('render dashboard view with height', () => { const { queryByTestId } = render( - + , { wrapper: TestProviders } ); diff --git a/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.tsx index d9e4e56ed919e..6be67170bc296 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/details/index.tsx @@ -12,7 +12,7 @@ import type { DashboardCapabilities } from '@kbn/dashboard-plugin/common/types'; import { useParams } from 'react-router-dom'; import { pick } from 'lodash/fp'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import type { ViewMode } from '@kbn/embeddable-plugin/common'; +import type { ViewMode } from '@kbn/presentation-publishing'; import { SecurityPageName } from '../../../../common/constants'; import { SpyRoute } from '../../../common/utils/route/spy_routes'; import { useCapabilities } from '../../../common/lib/kibana'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/index.tsx index 993a4b37a1ec7..1fba163cea165 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/index.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/dashboards/pages/index.tsx @@ -7,7 +7,6 @@ import React from 'react'; import { Routes, Route } from '@kbn/shared-ux-router'; -import { ViewMode } from '@kbn/embeddable-plugin/public'; import { DashboardsLandingPage } from './landing_page'; import { DashboardView } from './details'; import { DASHBOARDS_PATH } from '../../../common/constants'; @@ -18,13 +17,13 @@ const DashboardsContainerComponent = () => { - + - + - +