diff --git a/examples/response_stream/README.md b/examples/response_stream/README.md index 3582f06fd216..9f66fc19f239 100644 --- a/examples/response_stream/README.md +++ b/examples/response_stream/README.md @@ -21,7 +21,7 @@ The request's headers get passed on to automatically identify if compression is On the client, the custom hook is used like this: ```ts -const { error, start, cancel, data, isRunning } = useFetchStream< +const { errors, start, cancel, data, isRunning } = useFetchStream< ApiSimpleStringStream, typeof basePath >(`${basePath}/internal/response_stream/simple_string_stream`); ``` diff --git a/examples/response_stream/public/containers/app/pages/page_reducer_stream/index.tsx b/examples/response_stream/public/containers/app/pages/page_reducer_stream/index.tsx index 8f5687db1749..075576537433 100644 --- a/examples/response_stream/public/containers/app/pages/page_reducer_stream/index.tsx +++ b/examples/response_stream/public/containers/app/pages/page_reducer_stream/index.tsx @@ -45,7 +45,7 @@ export const PageReducerStream: FC = () => { const [simulateErrors, setSimulateErrors] = useState(false); - const { dispatch, start, cancel, data, error, isCancelled, isRunning } = useFetchStream< + const { dispatch, start, cancel, data, errors, isCancelled, isRunning } = useFetchStream< ApiReducerStream, typeof basePath >( @@ -65,13 +65,15 @@ export const PageReducerStream: FC = () => { } }; + // TODO This approach needs to be adapted as it might miss when error messages arrive bulk. // This is for low level errors on the stream/HTTP level. useEffect(() => { - if (error) { - notifications.toasts.addDanger(error); + if (errors.length > 0) { + notifications.toasts.addDanger(errors[errors.length - 1]); } - }, [error, notifications.toasts]); + }, [errors, notifications.toasts]); + // TODO This approach needs to be adapted as it might miss when error messages arrive bulk. // This is for errors on the application level useEffect(() => { if (data.errors.length > 0) { diff --git a/examples/response_stream/public/containers/app/pages/page_simple_string_stream/index.tsx b/examples/response_stream/public/containers/app/pages/page_simple_string_stream/index.tsx index ba159887edfa..cfa76688d970 100644 --- a/examples/response_stream/public/containers/app/pages/page_simple_string_stream/index.tsx +++ b/examples/response_stream/public/containers/app/pages/page_simple_string_stream/index.tsx @@ -21,7 +21,7 @@ export const PageSimpleStringStream: FC = () => { const { core } = useDeps(); const basePath = core.http?.basePath.get() ?? ''; - const { dispatch, error, start, cancel, data, isRunning } = useFetchStream< + const { dispatch, errors, start, cancel, data, isRunning } = useFetchStream< ApiSimpleStringStream, typeof basePath >(`${basePath}/internal/response_stream/simple_string_stream`, { timeout: 500 }); @@ -61,9 +61,17 @@ export const PageSimpleStringStream: FC = () => {

{data}

- {error && ( + {errors.length > 0 && ( -

{error}

+ {errors.length === 1 ? ( +

{errors[0]}

+ ) : ( + + )}{' '}
)} diff --git a/src/plugins/unified_search/public/__stories__/search_bar.stories.tsx b/src/plugins/unified_search/public/__stories__/search_bar.stories.tsx index 551915a34b11..bff5becf3c74 100644 --- a/src/plugins/unified_search/public/__stories__/search_bar.stories.tsx +++ b/src/plugins/unified_search/public/__stories__/search_bar.stories.tsx @@ -430,6 +430,24 @@ storiesOf('SearchBar', module) showSubmitButton: false, } as SearchBarProps) ) + .add('show only datepicker without submit', () => + wrapSearchBarInContext({ + showDatePicker: true, + showFilterBar: false, + showAutoRefreshOnly: false, + showQueryInput: false, + showSubmitButton: false, + } as SearchBarProps) + ) + .add('show only query bar and timepicker without submit', () => + wrapSearchBarInContext({ + showDatePicker: true, + showFilterBar: false, + showAutoRefreshOnly: false, + showQueryInput: true, + showSubmitButton: false, + } as SearchBarProps) + ) .add('with filter bar on but pinning option is hidden from menus', () => wrapSearchBarInContext({ showDatePicker: false, diff --git a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx index fd1ea2e9bce7..1f879ebcae9a 100644 --- a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx @@ -113,6 +113,7 @@ function wrapQueryBarTopRowInContext(testProps: any) { describe('QueryBarTopRowTopRow', () => { const QUERY_INPUT_SELECTOR = 'QueryStringInputUI'; const TIMEPICKER_SELECTOR = 'Memo(EuiSuperDatePicker)'; + const REFRESH_BUTTON_SELECTOR = 'EuiSuperUpdateButton'; const TIMEPICKER_DURATION = '[data-shared-timefilter-duration]'; beforeEach(() => { @@ -195,6 +196,23 @@ describe('QueryBarTopRowTopRow', () => { expect(component.find(TIMEPICKER_SELECTOR).length).toBe(1); }); + it('Should render timepicker without the submit button if showSubmitButton is false', () => { + const component = mount( + wrapQueryBarTopRowInContext({ + isDirty: false, + screenTitle: 'Another Screen', + showDatePicker: true, + showSubmitButton: false, + dateRangeFrom: 'now-7d', + dateRangeTo: 'now', + timeHistory: mockTimeHistory, + }) + ); + + expect(component.find(REFRESH_BUTTON_SELECTOR).length).toBe(0); + expect(component.find(TIMEPICKER_SELECTOR).length).toBe(1); + }); + it('Should render the timefilter duration container for sharing', () => { const component = mount( wrapQueryBarTopRowInContext({ diff --git a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx index 200398137176..acad2a39d4c4 100644 --- a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx @@ -375,10 +375,9 @@ export const QueryBarTopRow = React.memo( } function renderUpdateButton() { - if (!shouldRenderUpdatebutton()) { + if (!shouldRenderUpdatebutton() && !shouldRenderDatePicker()) { return null; } - const buttonLabelUpdate = i18n.translate('unifiedSearch.queryBarTopRow.submitButton.update', { defaultMessage: 'Needs updating', }); @@ -421,7 +420,8 @@ export const QueryBarTopRow = React.memo( ); - if (!shouldRenderDatePicker()) { + // allows to render the button without the datepicker + if (!shouldRenderDatePicker() && shouldRenderUpdatebutton()) { return button; } @@ -429,8 +429,8 @@ export const QueryBarTopRow = React.memo( - {renderDatePicker()} - {button} + {shouldRenderDatePicker() ? renderDatePicker() : null} + {shouldRenderUpdatebutton() ? button : null} diff --git a/x-pack/packages/ml/aiops_utils/src/fetch_stream.ts b/x-pack/packages/ml/aiops_utils/src/fetch_stream.ts index 4a1ed282c3ee..d8d71adc81bc 100644 --- a/x-pack/packages/ml/aiops_utils/src/fetch_stream.ts +++ b/x-pack/packages/ml/aiops_utils/src/fetch_stream.ts @@ -44,17 +44,24 @@ export async function* fetchStream | Array> | undefined] > { - const stream = await fetch(endpoint, { - signal: abortCtrl.current.signal, - method: 'POST', - headers: { - // This refers to the format of the request body, - // not the response, which will be a uint8array Buffer. - 'Content-Type': 'application/json', - 'kbn-xsrf': 'stream', - }, - ...(Object.keys(body).length > 0 ? { body: JSON.stringify(body) } : {}), - }); + let stream: Response; + + try { + stream = await fetch(endpoint, { + signal: abortCtrl.current.signal, + method: 'POST', + headers: { + // This refers to the format of the request body, + // not the response, which will be a uint8array Buffer. + 'Content-Type': 'application/json', + 'kbn-xsrf': 'stream', + }, + ...(Object.keys(body).length > 0 ? { body: JSON.stringify(body) } : {}), + }); + } catch (error) { + yield [error.toString(), undefined]; + return; + } if (!stream.ok) { yield [`Error ${stream.status}: ${stream.statusText}`, undefined]; diff --git a/x-pack/packages/ml/aiops_utils/src/use_fetch_stream.ts b/x-pack/packages/ml/aiops_utils/src/use_fetch_stream.ts index 13436efc6d47..516a63e165ff 100644 --- a/x-pack/packages/ml/aiops_utils/src/use_fetch_stream.ts +++ b/x-pack/packages/ml/aiops_utils/src/use_fetch_stream.ts @@ -41,7 +41,7 @@ interface UseFetchStreamReturnType { cancel: () => void; data: Data; dispatch: Dispatch; - error: string | undefined; + errors: string[]; isCancelled: boolean; isRunning: boolean; start: () => Promise; @@ -76,7 +76,7 @@ export function useFetchStream } ): UseFetchStreamReturnType, ReducerAction> { - const [error, setError] = useState(); + const [errors, setErrors] = useState([]); const [isCancelled, setIsCancelled] = useState(false); const [isRunning, setIsRunning] = useState(false); @@ -87,13 +87,17 @@ export function useFetchStream { + setErrors((prevErrors) => [...prevErrors, error]); + }; + const start = async () => { if (isRunning) { - setError('Restart not supported yet.'); + addError('Restart not supported yet.'); return; } - setError(undefined); + setErrors([]); setIsRunning(true); setIsCancelled(false); @@ -104,7 +108,7 @@ export function useFetchStream(endpoint, abortCtrl, body, options !== undefined)) { if (fetchStreamError !== null) { - setError(fetchStreamError); + addError(fetchStreamError); } else if (actions.length > 0) { dispatch(actions as ReducerAction); } @@ -128,7 +132,7 @@ export function useFetchStream { loaded: 50, loadingState: 'Loaded 50%', changePoints: [], + errors: [], }); }); diff --git a/x-pack/plugins/aiops/common/api/stream_reducer.ts b/x-pack/plugins/aiops/common/api/stream_reducer.ts index 597527e80dae..4a19ecfdd035 100644 --- a/x-pack/plugins/aiops/common/api/stream_reducer.ts +++ b/x-pack/plugins/aiops/common/api/stream_reducer.ts @@ -12,6 +12,7 @@ import { API_ACTION_NAME, AiopsExplainLogRateSpikesApiAction } from './explain_l interface StreamState { ccsWarning: boolean; changePoints: ChangePoint[]; + errors: string[]; loaded: number; loadingState: string; } @@ -19,6 +20,7 @@ interface StreamState { export const initialState: StreamState = { ccsWarning: false, changePoints: [], + errors: [], loaded: 0, loadingState: '', }; @@ -45,6 +47,8 @@ export function streamReducer( return cp; }); return { ...state, changePoints }; + case API_ACTION_NAME.ADD_ERROR: + return { ...state, errors: [...state.errors, action.payload] }; case API_ACTION_NAME.RESET: return initialState; case API_ACTION_NAME.UPDATE_LOADING_STATE: diff --git a/x-pack/plugins/aiops/public/components/explain_log_rate_spikes/explain_log_rate_spikes_analysis.tsx b/x-pack/plugins/aiops/public/components/explain_log_rate_spikes/explain_log_rate_spikes_analysis.tsx index 18b99b9e68f6..c9b74a634001 100644 --- a/x-pack/plugins/aiops/public/components/explain_log_rate_spikes/explain_log_rate_spikes_analysis.tsx +++ b/x-pack/plugins/aiops/public/components/explain_log_rate_spikes/explain_log_rate_spikes_analysis.tsx @@ -8,12 +8,13 @@ import React, { useEffect, useMemo, useState, FC } from 'react'; import { isEqual } from 'lodash'; -import { EuiEmptyPrompt } from '@elastic/eui'; +import { EuiCallOut, EuiEmptyPrompt, EuiSpacer, EuiText } from '@elastic/eui'; import type { DataView } from '@kbn/data-views-plugin/public'; import { ProgressControls } from '@kbn/aiops-components'; import { useFetchStream } from '@kbn/aiops-utils'; import type { WindowParameters } from '@kbn/aiops-utils'; +import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import type { ChangePoint } from '@kbn/ml-agg-utils'; import type { Query } from '@kbn/es-query'; @@ -59,10 +60,13 @@ export const ExplainLogRateSpikesAnalysis: FC WindowParameters | undefined >(); - const { cancel, start, data, isRunning, error } = useFetchStream< - ApiExplainLogRateSpikes, - typeof basePath - >( + const { + cancel, + start, + data, + isRunning, + errors: streamErrors, + } = useFetchStream( `${basePath}/internal/aiops/explain_log_rate_spikes`, { start: earliest, @@ -76,11 +80,7 @@ export const ExplainLogRateSpikesAnalysis: FC { reducer: streamReducer, initialState } ); - useEffect(() => { - setCurrentAnalysisWindowParameters(windowParameters); - start(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + const errors = useMemo(() => [...streamErrors, ...data.errors], [streamErrors, data.errors]); // Start handler clears possibly hovered or pinned // change points on analysis refresh. @@ -96,6 +96,12 @@ export const ExplainLogRateSpikesAnalysis: FC start(); } + useEffect(() => { + setCurrentAnalysisWindowParameters(windowParameters); + start(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + const shouldRerunAnalysis = useMemo( () => currentAnalysisWindowParameters !== undefined && @@ -115,6 +121,7 @@ export const ExplainLogRateSpikesAnalysis: FC onCancel={cancel} shouldRerunAnalysis={shouldRerunAnalysis} /> + {!isRunning && !showSpikeAnalysisTable && ( } /> )} + {errors.length > 0 && ( + <> + + + {errors.length === 1 ? ( +

{errors[0]}

+ ) : ( +
    + {errors.map((e, i) => ( +
  • {e}
  • + ))} +
+ )} +
+
+ + + )} {showSpikeAnalysisTable && ( void; onSelectedChangePoint?: (changePoint: ChangePoint | null) => void; @@ -43,7 +42,6 @@ interface SpikeAnalysisTableProps { export const SpikeAnalysisTable: FC = ({ changePoints, - error, loading, onPinnedChangePoint, onSelectedChangePoint, @@ -218,7 +216,6 @@ export const SpikeAnalysisTable: FC = ({ onChange={onChange} pagination={pagination} loading={false} - error={error} sorting={sorting as EuiTableSortingType} rowProps={(changePoint) => { return { diff --git a/x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts b/x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts index 2f8a3a314ecd..9fba2b9e100a 100644 --- a/x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts +++ b/x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts @@ -21,7 +21,7 @@ import { addChangePointsAction, addChangePointsHistogramAction, aiopsExplainLogRateSpikesSchema, - errorAction, + addErrorAction, resetAction, updateLoadingStateAction, AiopsExplainLogRateSpikesApiAction, @@ -112,7 +112,7 @@ export const defineExplainLogRateSpikesRoute = ( try { fieldCandidates = await fetchFieldCandidates(client, request.body); } catch (e) { - push(errorAction(e.toString())); + push(addErrorAction(e.toString())); end(); return; } @@ -154,7 +154,7 @@ export const defineExplainLogRateSpikesRoute = ( try { pValues = await fetchChangePointPValues(client, request.body, fieldCandidatesChunk); } catch (e) { - push(errorAction(e.toString())); + push(addErrorAction(e.toString())); end(); return; } diff --git a/x-pack/plugins/cases/common/constants.ts b/x-pack/plugins/cases/common/constants.ts index e88a7baf2f58..9e85d6e4cbf7 100644 --- a/x-pack/plugins/cases/common/constants.ts +++ b/x-pack/plugins/cases/common/constants.ts @@ -157,3 +157,9 @@ export const READ_CASES_CAPABILITY = 'read_cases' as const; export const UPDATE_CASES_CAPABILITY = 'update_cases' as const; export const DELETE_CASES_CAPABILITY = 'delete_cases' as const; export const PUSH_CASES_CAPABILITY = 'push_cases' as const; + +/** + * User profiles + */ + +export const DEFAULT_USER_SIZE = 10; diff --git a/x-pack/plugins/cases/kibana.json b/x-pack/plugins/cases/kibana.json index 00b630cb7cab..d027023b7c96 100644 --- a/x-pack/plugins/cases/kibana.json +++ b/x-pack/plugins/cases/kibana.json @@ -11,7 +11,6 @@ "kibanaVersion":"kibana", "optionalPlugins":[ "home", - "security", "taskManager", "usageCollection" ], @@ -30,7 +29,8 @@ "kibanaUtils", "triggersActionsUi", "management", - "spaces" + "spaces", + "security" ], "requiredBundles": [ "savedObjects" diff --git a/x-pack/plugins/cases/public/containers/constants.ts b/x-pack/plugins/cases/public/containers/constants.ts index cfd7d5020e20..3a04b411cb8e 100644 --- a/x-pack/plugins/cases/public/containers/constants.ts +++ b/x-pack/plugins/cases/public/containers/constants.ts @@ -16,3 +16,11 @@ export const CASE_LIST_CACHE_KEY = 'case-list'; export const CASE_CONNECTORS_CACHE_KEY = 'case-connectors'; export const CASE_LICENSE_CACHE_KEY = 'case-license-action'; export const CASE_TAGS_CACHE_KEY = 'case-tags'; + +/** + * User profiles + */ + +export const USER_PROFILES_CACHE_KEY = 'user-profiles'; +export const USER_PROFILES_SUGGEST_CACHE_KEY = 'suggest'; +export const USER_PROFILES_BULK_GET_CACHE_KEY = 'bulk-get'; diff --git a/x-pack/plugins/cases/public/containers/user_profiles/__mocks__/api.ts b/x-pack/plugins/cases/public/containers/user_profiles/__mocks__/api.ts new file mode 100644 index 000000000000..36c88451124c --- /dev/null +++ b/x-pack/plugins/cases/public/containers/user_profiles/__mocks__/api.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { UserProfile } from '@kbn/security-plugin/common'; +import { userProfiles } from '../api.mock'; + +export const suggestUserProfiles = async (): Promise => + Promise.resolve(userProfiles); + +export const bulkGetUserProfiles = async (): Promise => + Promise.resolve(userProfiles); diff --git a/x-pack/plugins/cases/public/containers/user_profiles/api.mock.ts b/x-pack/plugins/cases/public/containers/user_profiles/api.mock.ts new file mode 100644 index 000000000000..b84e84d3523b --- /dev/null +++ b/x-pack/plugins/cases/public/containers/user_profiles/api.mock.ts @@ -0,0 +1,43 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { UserProfile } from '@kbn/security-plugin/common'; + +export const userProfiles: UserProfile[] = [ + { + uid: 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0', + data: {}, + user: { + username: 'damaged_raccoon', + email: 'damaged_raccoon@elastic.co', + full_name: 'Damaged Raccoon', + }, + enabled: true, + }, + { + uid: 'u_A_tM4n0wPkdiQ9smmd8o0Hr_h61XQfu8aRPh9GMoRoc_0', + data: {}, + user: { + username: 'physical_dinosaur', + email: 'physical_dinosaur@elastic.co', + full_name: 'Physical Dinosaur', + }, + enabled: true, + }, + { + uid: 'u_9xDEQqUqoYCnFnPPLq5mIRHKL8gBTo_NiKgOnd5gGk0_0', + data: {}, + user: { + username: 'wet_dingo', + email: 'wet_dingo@elastic.co', + full_name: 'Wet Dingo', + }, + enabled: true, + }, +]; + +export const userProfilesIds = userProfiles.map((profile) => profile.uid); diff --git a/x-pack/plugins/cases/public/containers/user_profiles/api.test.ts b/x-pack/plugins/cases/public/containers/user_profiles/api.test.ts new file mode 100644 index 000000000000..7234cc9fb54f --- /dev/null +++ b/x-pack/plugins/cases/public/containers/user_profiles/api.test.ts @@ -0,0 +1,82 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { GENERAL_CASES_OWNER } from '../../../common/constants'; +import { createStartServicesMock } from '../../common/lib/kibana/kibana_react.mock'; +import { bulkGetUserProfiles, suggestUserProfiles } from './api'; +import { userProfiles, userProfilesIds } from './api.mock'; + +describe('User profiles API', () => { + describe('suggestUserProfiles', () => { + const abortCtrl = new AbortController(); + const { http } = createStartServicesMock(); + + beforeEach(() => { + jest.clearAllMocks(); + http.post = jest.fn().mockResolvedValue(userProfiles); + }); + + it('returns the user profiles correctly', async () => { + const res = await suggestUserProfiles({ + http, + name: 'elastic', + owner: [GENERAL_CASES_OWNER], + signal: abortCtrl.signal, + }); + + expect(res).toEqual(userProfiles); + }); + + it('calls http.post correctly', async () => { + await suggestUserProfiles({ + http, + name: 'elastic', + owner: [GENERAL_CASES_OWNER], + signal: abortCtrl.signal, + }); + + expect(http.post).toHaveBeenCalledWith('/internal/cases/_suggest_user_profiles', { + body: '{"name":"elastic","size":10,"owner":["cases"]}', + signal: abortCtrl.signal, + }); + }); + }); + + describe('bulkGetUserProfiles', () => { + const { security } = createStartServicesMock(); + + beforeEach(() => { + jest.clearAllMocks(); + security.userProfiles.bulkGet = jest.fn().mockResolvedValue(userProfiles); + }); + + it('returns the user profiles correctly', async () => { + const res = await bulkGetUserProfiles({ + security, + uids: userProfilesIds, + }); + + expect(res).toEqual(userProfiles); + }); + + it('calls http.post correctly', async () => { + await bulkGetUserProfiles({ + security, + uids: userProfilesIds, + }); + + expect(security.userProfiles.bulkGet).toHaveBeenCalledWith({ + dataPath: 'avatar', + uids: new Set([ + 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0', + 'u_A_tM4n0wPkdiQ9smmd8o0Hr_h61XQfu8aRPh9GMoRoc_0', + 'u_9xDEQqUqoYCnFnPPLq5mIRHKL8gBTo_NiKgOnd5gGk0_0', + ]), + }); + }); + }); +}); diff --git a/x-pack/plugins/cases/public/containers/user_profiles/api.ts b/x-pack/plugins/cases/public/containers/user_profiles/api.ts new file mode 100644 index 000000000000..6da84d199142 --- /dev/null +++ b/x-pack/plugins/cases/public/containers/user_profiles/api.ts @@ -0,0 +1,46 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { HttpStart } from '@kbn/core/public'; +import { UserProfile } from '@kbn/security-plugin/common'; +import { SecurityPluginStart } from '@kbn/security-plugin/public'; +import { INTERNAL_SUGGEST_USER_PROFILES_URL, DEFAULT_USER_SIZE } from '../../../common/constants'; + +export interface SuggestUserProfilesArgs { + http: HttpStart; + name: string; + owner: string[]; + signal: AbortSignal; + size?: number; +} + +export const suggestUserProfiles = async ({ + http, + name, + size = DEFAULT_USER_SIZE, + owner, + signal, +}: SuggestUserProfilesArgs): Promise => { + const response = await http.post(INTERNAL_SUGGEST_USER_PROFILES_URL, { + body: JSON.stringify({ name, size, owner }), + signal, + }); + + return response; +}; + +export interface BulkGetUserProfilesArgs { + security: SecurityPluginStart; + uids: string[]; +} + +export const bulkGetUserProfiles = async ({ + security, + uids, +}: BulkGetUserProfilesArgs): Promise => { + return security.userProfiles.bulkGet({ uids: new Set(uids), dataPath: 'avatar' }); +}; diff --git a/x-pack/plugins/cases/public/containers/user_profiles/use_bulk_get_user_profiles.test.ts b/x-pack/plugins/cases/public/containers/user_profiles/use_bulk_get_user_profiles.test.ts new file mode 100644 index 000000000000..7591bf394d5c --- /dev/null +++ b/x-pack/plugins/cases/public/containers/user_profiles/use_bulk_get_user_profiles.test.ts @@ -0,0 +1,66 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { renderHook } from '@testing-library/react-hooks'; +import { useToasts } from '../../common/lib/kibana'; +import { AppMockRenderer, createAppMockRenderer } from '../../common/mock'; +import * as api from './api'; +import { useBulkGetUserProfiles } from './use_bulk_get_user_profiles'; +import { userProfilesIds } from './api.mock'; + +jest.mock('../../common/lib/kibana'); +jest.mock('./api'); + +describe('useBulkGetUserProfiles', () => { + const props = { + uids: userProfilesIds, + }; + + const addSuccess = jest.fn(); + (useToasts as jest.Mock).mockReturnValue({ addSuccess, addError: jest.fn() }); + + let appMockRender: AppMockRenderer; + + beforeEach(() => { + appMockRender = createAppMockRenderer(); + jest.clearAllMocks(); + }); + + it('calls bulkGetUserProfiles with correct arguments', async () => { + const spyOnSuggestUserProfiles = jest.spyOn(api, 'bulkGetUserProfiles'); + + const { result, waitFor } = renderHook(() => useBulkGetUserProfiles(props), { + wrapper: appMockRender.AppWrapper, + }); + + await waitFor(() => result.current.isSuccess); + + expect(spyOnSuggestUserProfiles).toBeCalledWith({ + ...props, + security: expect.anything(), + }); + }); + + it('shows a toast error message when an error occurs in the response', async () => { + const spyOnSuggestUserProfiles = jest.spyOn(api, 'bulkGetUserProfiles'); + + spyOnSuggestUserProfiles.mockImplementation(() => { + throw new Error('Something went wrong'); + }); + + const addError = jest.fn(); + (useToasts as jest.Mock).mockReturnValue({ addSuccess, addError }); + + const { result, waitFor } = renderHook(() => useBulkGetUserProfiles(props), { + wrapper: appMockRender.AppWrapper, + }); + + await waitFor(() => result.current.isError); + + expect(addError).toHaveBeenCalled(); + }); +}); diff --git a/x-pack/plugins/cases/public/containers/user_profiles/use_bulk_get_user_profiles.ts b/x-pack/plugins/cases/public/containers/user_profiles/use_bulk_get_user_profiles.ts new file mode 100644 index 000000000000..cdaee1848613 --- /dev/null +++ b/x-pack/plugins/cases/public/containers/user_profiles/use_bulk_get_user_profiles.ts @@ -0,0 +1,41 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useQuery, UseQueryResult } from 'react-query'; +import { UserProfile } from '@kbn/security-plugin/common'; +import * as i18n from '../translations'; +import { useKibana, useToasts } from '../../common/lib/kibana'; +import { ServerError } from '../../types'; +import { USER_PROFILES_CACHE_KEY, USER_PROFILES_BULK_GET_CACHE_KEY } from '../constants'; +import { bulkGetUserProfiles } from './api'; + +export const useBulkGetUserProfiles = ({ uids }: { uids: string[] }) => { + const { security } = useKibana().services; + + const toasts = useToasts(); + + return useQuery( + [USER_PROFILES_CACHE_KEY, USER_PROFILES_BULK_GET_CACHE_KEY, uids], + () => { + return bulkGetUserProfiles({ security, uids }); + }, + { + onError: (error: ServerError) => { + if (error.name !== 'AbortError') { + toasts.addError( + error.body && error.body.message ? new Error(error.body.message) : error, + { + title: i18n.ERROR_TITLE, + } + ); + } + }, + } + ); +}; + +export type UseSuggestUserProfiles = UseQueryResult; diff --git a/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.test.ts b/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.test.ts new file mode 100644 index 000000000000..5ae16c8fa6e0 --- /dev/null +++ b/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.test.ts @@ -0,0 +1,83 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { GENERAL_CASES_OWNER } from '../../../common/constants'; +import { renderHook } from '@testing-library/react-hooks'; +import { useToasts } from '../../common/lib/kibana'; +import { AppMockRenderer, createAppMockRenderer } from '../../common/mock'; +import * as api from './api'; +import { useSuggestUserProfiles } from './use_suggest_user_profiles'; + +jest.mock('../../common/lib/kibana'); +jest.mock('./api'); + +describe('useSuggestUserProfiles', () => { + const props = { + name: 'elastic', + owner: [GENERAL_CASES_OWNER], + }; + + const addSuccess = jest.fn(); + (useToasts as jest.Mock).mockReturnValue({ addSuccess, addError: jest.fn() }); + + let appMockRender: AppMockRenderer; + + beforeAll(() => { + jest.useFakeTimers(); + }); + + beforeEach(() => { + appMockRender = createAppMockRenderer(); + jest.clearAllMocks(); + }); + + afterEach(() => { + jest.clearAllTimers(); + }); + + afterAll(() => { + jest.useRealTimers(); + }); + + it('calls suggestUserProfiles with correct arguments', async () => { + const spyOnSuggestUserProfiles = jest.spyOn(api, 'suggestUserProfiles'); + + const { result, waitFor } = renderHook(() => useSuggestUserProfiles(props), { + wrapper: appMockRender.AppWrapper, + }); + + jest.advanceTimersByTime(500); + await waitFor(() => result.current.isSuccess); + + expect(spyOnSuggestUserProfiles).toBeCalledWith({ + ...props, + size: 10, + http: expect.anything(), + signal: expect.anything(), + }); + }); + + it('shows a toast error message when an error occurs in the response', async () => { + const spyOnSuggestUserProfiles = jest.spyOn(api, 'suggestUserProfiles'); + + spyOnSuggestUserProfiles.mockImplementation(() => { + throw new Error('Something went wrong'); + }); + + const addError = jest.fn(); + (useToasts as jest.Mock).mockReturnValue({ addSuccess, addError }); + + const { result, waitFor } = renderHook(() => useSuggestUserProfiles(props), { + wrapper: appMockRender.AppWrapper, + }); + + jest.advanceTimersByTime(500); + await waitFor(() => result.current.isError); + + expect(addError).toHaveBeenCalled(); + }); +}); diff --git a/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.ts b/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.ts new file mode 100644 index 000000000000..3705224e1d0c --- /dev/null +++ b/x-pack/plugins/cases/public/containers/user_profiles/use_suggest_user_profiles.ts @@ -0,0 +1,65 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useState } from 'react'; +import { useQuery, UseQueryResult } from 'react-query'; +import useDebounce from 'react-use/lib/useDebounce'; +import { UserProfile } from '@kbn/security-plugin/common'; +import { DEFAULT_USER_SIZE } from '../../../common/constants'; +import * as i18n from '../translations'; +import { useKibana, useToasts } from '../../common/lib/kibana'; +import { ServerError } from '../../types'; +import { USER_PROFILES_CACHE_KEY, USER_PROFILES_SUGGEST_CACHE_KEY } from '../constants'; +import { suggestUserProfiles, SuggestUserProfilesArgs } from './api'; + +const DEBOUNCE_MS = 500; + +export const useSuggestUserProfiles = ({ + name, + owner, + size = DEFAULT_USER_SIZE, +}: Omit) => { + const { http } = useKibana().services; + const [debouncedName, setDebouncedName] = useState(name); + + useDebounce(() => setDebouncedName(name), DEBOUNCE_MS, [name]); + + const toasts = useToasts(); + + return useQuery( + [ + USER_PROFILES_CACHE_KEY, + USER_PROFILES_SUGGEST_CACHE_KEY, + { name: debouncedName, owner, size }, + ], + () => { + const abortCtrlRef = new AbortController(); + return suggestUserProfiles({ + http, + name: debouncedName, + owner, + size, + signal: abortCtrlRef.signal, + }); + }, + { + retry: false, + onError: (error: ServerError) => { + if (error.name !== 'AbortError') { + toasts.addError( + error.body && error.body.message ? new Error(error.body.message) : error, + { + title: i18n.ERROR_TITLE, + } + ); + } + }, + } + ); +}; + +export type UseSuggestUserProfiles = UseQueryResult; diff --git a/x-pack/plugins/cases/public/types.ts b/x-pack/plugins/cases/public/types.ts index 90d417955377..00ffa538c2f9 100644 --- a/x-pack/plugins/cases/public/types.ts +++ b/x-pack/plugins/cases/public/types.ts @@ -15,7 +15,7 @@ import type { HomePublicPluginSetup } from '@kbn/home-plugin/public'; import type { ManagementSetup, ManagementAppMountParams } from '@kbn/management-plugin/public'; import type { FeaturesPluginStart } from '@kbn/features-plugin/public'; import type { LensPublicStart } from '@kbn/lens-plugin/public'; -import type { SecurityPluginSetup } from '@kbn/security-plugin/public'; +import type { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/public'; import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; import type { TriggersAndActionsUIPublicPluginStart as TriggersActionsStart } from '@kbn/triggers-actions-ui-plugin/public'; import type { DistributiveOmit } from '@elastic/eui'; @@ -57,6 +57,7 @@ export interface CasesPluginStart { storage: Storage; triggersActionsUi: TriggersActionsStart; features: FeaturesPluginStart; + security: SecurityPluginStart; spaces?: SpacesPluginStart; } @@ -66,10 +67,7 @@ export interface CasesPluginStart { * Leaving it out currently in lieu of RBAC changes */ -export type StartServices = CoreStart & - CasesPluginStart & { - security: SecurityPluginSetup; - }; +export type StartServices = CoreStart & CasesPluginStart; export interface RenderAppProps { mountParams: ManagementAppMountParams; diff --git a/x-pack/plugins/lens/public/async_services.ts b/x-pack/plugins/lens/public/async_services.ts index cd2a9787c9ce..9025b738c2e1 100644 --- a/x-pack/plugins/lens/public/async_services.ts +++ b/x-pack/plugins/lens/public/async_services.ts @@ -14,18 +14,18 @@ * This file causes all of them to be served in a single request. */ -export * from './datatable_visualization/datatable_visualization'; -export * from './datatable_visualization'; -export * from './metric_visualization/metric_visualization'; -export * from './metric_visualization'; +export * from './visualizations/datatable/datatable_visualization'; +export * from './visualizations/datatable'; +export * from './visualizations/legacy_metric/metric_visualization'; +export * from './visualizations/legacy_metric'; export * from './visualizations/metric/metric_visualization'; export * from './visualizations/metric'; -export * from './pie_visualization/pie_visualization'; -export * from './pie_visualization'; -export * from './xy_visualization/xy_visualization'; -export * from './xy_visualization'; -export * from './heatmap_visualization/heatmap_visualization'; -export * from './heatmap_visualization'; +export * from './visualizations/partition/pie_visualization'; +export * from './visualizations/partition'; +export * from './visualizations/xy/xy_visualization'; +export * from './visualizations/xy'; +export * from './visualizations/heatmap/heatmap_visualization'; +export * from './visualizations/heatmap'; export * from './visualizations/gauge/gauge_visualization'; export * from './visualizations/gauge'; diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx index 6797ca674a06..78aae56c5b9a 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx @@ -23,10 +23,10 @@ import { import type { LensByReferenceInput, LensByValueInput } from './embeddable'; import type { Document } from '../persistence'; import type { IndexPatternPersistedState } from '../indexpattern_datasource/types'; -import type { XYState } from '../xy_visualization/types'; +import type { XYState } from '../visualizations/xy/types'; import type { PieVisualizationState, MetricState } from '../../common'; -import type { DatatableVisualizationState } from '../datatable_visualization/visualization'; -import type { HeatmapVisualizationState } from '../heatmap_visualization/types'; +import type { DatatableVisualizationState } from '../visualizations/datatable/visualization'; +import type { HeatmapVisualizationState } from '../visualizations/heatmap/types'; import type { GaugeVisualizationState } from '../visualizations/gauge/constants'; type LensAttributes = Omit< diff --git a/x-pack/plugins/lens/public/index.ts b/x-pack/plugins/lens/public/index.ts index f0dae2ca2840..82e510dbb639 100644 --- a/x-pack/plugins/lens/public/index.ts +++ b/x-pack/plugins/lens/public/index.ts @@ -21,7 +21,7 @@ export type { YAxisMode, SeriesType, YConfig, -} from './xy_visualization/types'; +} from './visualizations/xy/types'; export type { DatasourcePublicAPI, DataType, @@ -39,8 +39,8 @@ export type { SharedPieLayerState, } from '../common/types'; -export type { DatatableVisualizationState } from './datatable_visualization/visualization'; -export type { HeatmapVisualizationState } from './heatmap_visualization/types'; +export type { DatatableVisualizationState } from './visualizations/datatable/visualization'; +export type { HeatmapVisualizationState } from './visualizations/heatmap/types'; export type { GaugeVisualizationState } from './visualizations/gauge/constants'; export type { IndexPatternPersistedState, diff --git a/x-pack/plugins/lens/public/mocks/lens_plugin_mock.tsx b/x-pack/plugins/lens/public/mocks/lens_plugin_mock.tsx index 09bf2f065c60..cbf310cb2f50 100644 --- a/x-pack/plugins/lens/public/mocks/lens_plugin_mock.tsx +++ b/x-pack/plugins/lens/public/mocks/lens_plugin_mock.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { createFormulaPublicApi } from '../async_services'; import { LensPublicStart } from '..'; -import { visualizationTypes } from '../xy_visualization/types'; +import { visualizationTypes } from '../visualizations/xy/types'; type Start = jest.Mocked; diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts index c66d538ed051..99585a0fd9a7 100644 --- a/x-pack/plugins/lens/public/plugin.ts +++ b/x-pack/plugins/lens/public/plugin.ts @@ -54,21 +54,21 @@ import type { import type { XyVisualization as XyVisualizationType, XyVisualizationPluginSetupPlugins, -} from './xy_visualization'; +} from './visualizations/xy'; import type { LegacyMetricVisualization as LegacyMetricVisualizationType, LegacyMetricVisualizationPluginSetupPlugins, -} from './metric_visualization'; +} from './visualizations/legacy_metric'; import type { MetricVisualization as MetricVisualizationType } from './visualizations/metric'; import type { DatatableVisualization as DatatableVisualizationType, DatatableVisualizationPluginSetupPlugins, -} from './datatable_visualization'; +} from './visualizations/datatable'; import type { PieVisualization as PieVisualizationType, PieVisualizationPluginSetupPlugins, -} from './pie_visualization'; -import type { HeatmapVisualization as HeatmapVisualizationType } from './heatmap_visualization'; +} from './visualizations/partition'; +import type { HeatmapVisualization as HeatmapVisualizationType } from './visualizations/heatmap'; import type { GaugeVisualization as GaugeVisualizationType } from './visualizations/gauge'; import { APP_ID, getEditPath, NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../common/constants'; @@ -504,7 +504,7 @@ export class LensPlugin { return Boolean(core.application.capabilities.visualize?.show); }, getXyVisTypes: async () => { - const { visualizationTypes } = await import('./xy_visualization/types'); + const { visualizationTypes } = await import('./visualizations/xy/types'); return visualizationTypes; }, diff --git a/x-pack/plugins/lens/public/shared_components/axis_title_settings.tsx b/x-pack/plugins/lens/public/shared_components/axis_title_settings.tsx index 5c1cc704671b..5378859fdc94 100644 --- a/x-pack/plugins/lens/public/shared_components/axis_title_settings.tsx +++ b/x-pack/plugins/lens/public/shared_components/axis_title_settings.tsx @@ -8,7 +8,7 @@ import React, { useCallback, useMemo } from 'react'; import { EuiSpacer, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { AxesSettingsConfig } from '../xy_visualization/types'; +import { AxesSettingsConfig } from '../visualizations/xy/types'; import { LabelMode, useDebouncedValue, VisLabel } from '.'; type AxesSettingsConfigKeys = keyof AxesSettingsConfig; diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index 56492d801d7c..78f104ce943f 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -32,14 +32,14 @@ import type { LensResizeActionData, LensToggleActionData, LensPagesizeActionData, -} from './datatable_visualization/components/types'; +} from './visualizations/datatable/components/types'; import { LENS_EDIT_SORT_ACTION, LENS_EDIT_RESIZE_ACTION, LENS_TOGGLE_ACTION, LENS_EDIT_PAGESIZE_ACTION, -} from './datatable_visualization/components/constants'; +} from './visualizations/datatable/components/constants'; import type { LensInspector } from './lens_inspector_service'; export type ErrorCallback = (e: { message: string }) => void; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/__snapshots__/table_basic.test.tsx.snap b/x-pack/plugins/lens/public/visualizations/datatable/components/__snapshots__/table_basic.test.tsx.snap similarity index 100% rename from x-pack/plugins/lens/public/datatable_visualization/components/__snapshots__/table_basic.test.tsx.snap rename to x-pack/plugins/lens/public/visualizations/datatable/components/__snapshots__/table_basic.test.tsx.snap diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/cell_value.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/cell_value.test.tsx index 94a55a393814..f6092e3dc299 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/cell_value.test.tsx @@ -14,7 +14,7 @@ import { Datatable } from '@kbn/expressions-plugin/public'; import { IUiSettingsClient } from '@kbn/core/public'; import { act } from 'react-dom/test-utils'; import { ReactWrapper } from 'enzyme'; -import { DatatableArgs, ColumnConfigArg } from '../../../common/expressions'; +import { DatatableArgs, ColumnConfigArg } from '../../../../common/expressions'; import { DataContextType } from './types'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/cell_value.tsx similarity index 91% rename from x-pack/plugins/lens/public/datatable_visualization/components/cell_value.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/cell_value.tsx index e43c08aec637..4db92a65f9c4 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/cell_value.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/cell_value.tsx @@ -9,11 +9,11 @@ import React, { useContext, useEffect } from 'react'; import type { EuiDataGridCellValueElementProps } from '@elastic/eui'; import type { IUiSettingsClient } from '@kbn/core/public'; import classNames from 'classnames'; -import type { FormatFactory } from '../../../common'; -import { getOriginalId } from '../../../common/expressions'; -import type { ColumnConfig } from '../../../common/expressions'; +import type { FormatFactory } from '../../../../common'; +import { getOriginalId } from '../../../../common/expressions'; +import type { ColumnConfig } from '../../../../common/expressions'; import type { DataContextType } from './types'; -import { getContrastColor, getNumericValue } from '../../shared_components/coloring/utils'; +import { getContrastColor, getNumericValue } from '../../../shared_components/coloring/utils'; export const createGridCell = ( formatters: Record>, diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/columns.tsx similarity index 98% rename from x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/columns.tsx index fd3a0acb2b0f..81b73b8f267b 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/columns.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/columns.tsx @@ -18,8 +18,8 @@ import type { DatatableColumn, DatatableColumnMeta, } from '@kbn/expressions-plugin/common'; -import type { FormatFactory } from '../../../common'; -import type { ColumnConfig } from '../../../common/expressions'; +import type { FormatFactory } from '../../../../common'; +import type { ColumnConfig } from '../../../../common/expressions'; export const createGridColumns = ( bucketColumns: string[], diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/constants.ts b/x-pack/plugins/lens/public/visualizations/datatable/components/constants.ts similarity index 100% rename from x-pack/plugins/lens/public/datatable_visualization/components/constants.ts rename to x-pack/plugins/lens/public/visualizations/datatable/components/constants.ts diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.scss b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.scss similarity index 100% rename from x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.scss rename to x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.scss diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.test.tsx similarity index 97% rename from x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.test.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.test.tsx index d56c1eee1c52..d182a9151d51 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.test.tsx @@ -12,15 +12,15 @@ import { FramePublicAPI, OperationDescriptor, VisualizationDimensionEditorProps, -} from '../../types'; +} from '../../../types'; import { DatatableVisualizationState } from '../visualization'; -import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; +import { createMockDatasource, createMockFramePublicAPI } from '../../../mocks'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TableDimensionEditor } from './dimension_editor'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { act } from 'react-dom/test-utils'; -import { PalettePanelContainer } from '../../shared_components'; -import { layerTypes } from '../../../common'; +import { PalettePanelContainer } from '../../../shared_components'; +import { layerTypes } from '../../../../common'; describe('data table dimension editor', () => { let frame: FramePublicAPI; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.tsx similarity index 98% rename from x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.tsx index ff4019e08549..da1f28ba579f 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.tsx @@ -18,7 +18,7 @@ import { EuiButtonEmpty, } from '@elastic/eui'; import { CustomizablePalette, PaletteRegistry, FIXED_PROGRESSION } from '@kbn/coloring'; -import { VisualizationDimensionEditorProps } from '../../types'; +import { VisualizationDimensionEditorProps } from '../../../types'; import { DatatableVisualizationState } from '../visualization'; import { @@ -26,11 +26,11 @@ import { defaultPaletteParams, PalettePanelContainer, findMinMaxByColumnId, -} from '../../shared_components'; -import { isNumericFieldForDatatable, getOriginalId } from '../../../common/expressions'; +} from '../../../shared_components'; +import { isNumericFieldForDatatable, getOriginalId } from '../../../../common/expressions'; import './dimension_editor.scss'; -import { CollapseSetting } from '../../shared_components/collapse_setting'; +import { CollapseSetting } from '../../../shared_components/collapse_setting'; const idPrefix = htmlIdGenerator()(); diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor_additional_section.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_additional_section.test.tsx similarity index 97% rename from x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor_additional_section.test.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_additional_section.test.tsx index ddf8468e9929..859c3867b0ce 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor_additional_section.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_additional_section.test.tsx @@ -8,13 +8,13 @@ import React from 'react'; import { EuiComboBox, EuiFieldText } from '@elastic/eui'; import type { PaletteRegistry } from '@kbn/coloring'; -import { FramePublicAPI, VisualizationDimensionEditorProps } from '../../types'; +import { FramePublicAPI, VisualizationDimensionEditorProps } from '../../../types'; import { DatatableVisualizationState } from '../visualization'; -import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; +import { createMockDatasource, createMockFramePublicAPI } from '../../../mocks'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { TableDimensionEditorAdditionalSection } from './dimension_editor_addtional_section'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; -import { layerTypes } from '../../../common'; +import { layerTypes } from '../../../../common'; describe('data table dimension editor additional section', () => { let frame: FramePublicAPI; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor_addtional_section.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_addtional_section.tsx similarity index 95% rename from x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor_addtional_section.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_addtional_section.tsx index 9105435e7ab3..c61a512991b6 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor_addtional_section.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_addtional_section.tsx @@ -10,17 +10,17 @@ import { i18n } from '@kbn/i18n'; import { css } from '@emotion/react'; import { EuiFormRow, EuiFieldText, EuiText, useEuiTheme, EuiComboBox } from '@elastic/eui'; import { PaletteRegistry } from '@kbn/coloring'; -import { VisualizationDimensionEditorProps } from '../../types'; +import { VisualizationDimensionEditorProps } from '../../../types'; import { DatatableVisualizationState } from '../visualization'; -import { useDebouncedValue } from '../../shared_components'; -import type { ColumnState } from '../../../common/expressions'; +import { useDebouncedValue } from '../../../shared_components'; +import type { ColumnState } from '../../../../common/expressions'; import { isNumericFieldForDatatable, getDefaultSummaryLabel, getFinalSummaryConfiguration, getSummaryRowOptions, -} from '../../../common/expressions'; +} from '../../../../common/expressions'; import './dimension_editor.scss'; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/row_height_settings.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/row_height_settings.tsx similarity index 100% rename from x-pack/plugins/lens/public/datatable_visualization/components/row_height_settings.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/row_height_settings.tsx diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_actions.test.ts b/x-pack/plugins/lens/public/visualizations/datatable/components/table_actions.test.ts similarity index 99% rename from x-pack/plugins/lens/public/datatable_visualization/components/table_actions.test.ts rename to x-pack/plugins/lens/public/visualizations/datatable/components/table_actions.test.ts index 3d3352309c10..760145e06c33 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_actions.test.ts +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/table_actions.test.ts @@ -17,7 +17,7 @@ import { createGridHideHandler, createTransposeColumnFilterHandler, } from './table_actions'; -import { LensGridDirection, ColumnConfig } from '../../../common/expressions'; +import { LensGridDirection, ColumnConfig } from '../../../../common/expressions'; function getDefaultConfig(): ColumnConfig { return { diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_actions.ts b/x-pack/plugins/lens/public/visualizations/datatable/components/table_actions.ts similarity index 96% rename from x-pack/plugins/lens/public/datatable_visualization/components/table_actions.ts rename to x-pack/plugins/lens/public/visualizations/datatable/components/table_actions.ts index 5d06584003ae..b4075ef84898 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_actions.ts +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/table_actions.ts @@ -9,8 +9,8 @@ import type { EuiDataGridSorting } from '@elastic/eui'; import type { Datatable, DatatableColumn } from '@kbn/expressions-plugin/common'; import { ClickTriggerEvent } from '@kbn/charts-plugin/public'; import type { LensResizeAction, LensSortAction, LensToggleAction } from './types'; -import type { ColumnConfig, LensGridDirection } from '../../../common/expressions'; -import { getOriginalId } from '../../../common/expressions'; +import type { ColumnConfig, LensGridDirection } from '../../../../common/expressions'; +import { getOriginalId } from '../../../../common/expressions'; export const createGridResizeHandler = ( diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.scss b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.scss similarity index 100% rename from x-pack/plugins/lens/public/datatable_visualization/components/table_basic.scss rename to x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.scss diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx index 44600b2c03b9..e40b7b0c079e 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx @@ -12,11 +12,11 @@ import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EuiDataGrid } from '@elastic/eui'; import { IAggType } from '@kbn/data-plugin/public'; import { IFieldFormat, SerializedFieldFormat } from '@kbn/field-formats-plugin/common'; -import { VisualizationContainer } from '../../visualization_container'; +import { VisualizationContainer } from '../../../visualization_container'; import { EmptyPlaceholder } from '@kbn/charts-plugin/public'; -import { LensIconChartDatatable } from '../../assets/chart_datatable'; +import { LensIconChartDatatable } from '../../../assets/chart_datatable'; import { DataContext, DatatableComponent } from './table_basic'; -import { DatatableProps } from '../../../common/expressions'; +import { DatatableProps } from '../../../../common/expressions'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { IUiSettingsClient } from '@kbn/core/public'; import { Datatable, RenderMode } from '@kbn/expressions-plugin/common'; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx similarity index 96% rename from x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx index 97d14bed8d06..0262d3d7cab4 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/table_basic.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.tsx @@ -29,12 +29,12 @@ import { } from '@elastic/eui'; import { EmptyPlaceholder } from '@kbn/charts-plugin/public'; import { ClickTriggerEvent } from '@kbn/charts-plugin/public'; -import type { LensTableRowContextMenuEvent } from '../../types'; -import type { FormatFactory } from '../../../common'; -import type { LensGridDirection } from '../../../common/expressions'; -import { VisualizationContainer } from '../../visualization_container'; -import { findMinMaxByColumnId } from '../../shared_components'; -import { LensIconChartDatatable } from '../../assets/chart_datatable'; +import type { LensTableRowContextMenuEvent } from '../../../types'; +import type { FormatFactory } from '../../../../common'; +import type { LensGridDirection } from '../../../../common/expressions'; +import { VisualizationContainer } from '../../../visualization_container'; +import { findMinMaxByColumnId } from '../../../shared_components'; +import { LensIconChartDatatable } from '../../../assets/chart_datatable'; import type { DataContextType, DatatableRenderProps, @@ -52,7 +52,7 @@ import { createGridSortingConfig, createTransposeColumnFilterHandler, } from './table_actions'; -import { getOriginalId, getFinalSummaryConfiguration } from '../../../common/expressions'; +import { getOriginalId, getFinalSummaryConfiguration } from '../../../../common/expressions'; export const DataContext = React.createContext({}); diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/toolbar.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/toolbar.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/datatable_visualization/components/toolbar.test.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/toolbar.test.tsx index 6c69b855dd65..281c4ef9c86a 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/toolbar.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/toolbar.test.tsx @@ -9,10 +9,10 @@ import React, { ChangeEvent, FormEvent } from 'react'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { DataTableToolbar } from './toolbar'; import { DatatableVisualizationState } from '../visualization'; -import { FramePublicAPI, VisualizationToolbarProps } from '../../types'; +import { FramePublicAPI, VisualizationToolbarProps } from '../../../types'; import { ToolbarButton } from '@kbn/kibana-react-plugin/public'; import { ReactWrapper } from 'enzyme'; -import { PagingState } from '../../../common/expressions'; +import { PagingState } from '../../../../common/expressions'; import { EuiButtonGroup, EuiRange } from '@elastic/eui'; // mocking random id generator function diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/toolbar.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/toolbar.tsx similarity index 96% rename from x-pack/plugins/lens/public/datatable_visualization/components/toolbar.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/components/toolbar.tsx index 656f8efcc09e..fee76d99593f 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/toolbar.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/toolbar.tsx @@ -8,8 +8,8 @@ import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFormRow, EuiSwitch, EuiToolTip } from '@elastic/eui'; -import { ToolbarPopover } from '../../shared_components'; -import type { VisualizationToolbarProps } from '../../types'; +import { ToolbarPopover } from '../../../shared_components'; +import type { VisualizationToolbarProps } from '../../../types'; import type { DatatableVisualizationState } from '../visualization'; import { RowHeightSettings } from './row_height_settings'; import { DEFAULT_PAGE_SIZE } from './table_basic'; diff --git a/x-pack/plugins/lens/public/datatable_visualization/components/types.ts b/x-pack/plugins/lens/public/visualizations/datatable/components/types.ts similarity index 95% rename from x-pack/plugins/lens/public/datatable_visualization/components/types.ts rename to x-pack/plugins/lens/public/visualizations/datatable/components/types.ts index c6a1560ce467..3338e9da8f4a 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/components/types.ts +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/types.ts @@ -10,15 +10,15 @@ import type { PaletteRegistry } from '@kbn/coloring'; import { CustomPaletteState } from '@kbn/charts-plugin/public'; import type { IAggType } from '@kbn/data-plugin/public'; import type { Datatable, RenderMode } from '@kbn/expressions-plugin/common'; -import type { ILensInterpreterRenderHandlers, LensEditEvent } from '../../types'; +import type { ILensInterpreterRenderHandlers, LensEditEvent } from '../../../types'; import { LENS_EDIT_SORT_ACTION, LENS_EDIT_RESIZE_ACTION, LENS_TOGGLE_ACTION, LENS_EDIT_PAGESIZE_ACTION, } from './constants'; -import type { FormatFactory } from '../../../common'; -import type { DatatableProps, LensGridDirection } from '../../../common/expressions'; +import type { FormatFactory } from '../../../../common'; +import type { DatatableProps, LensGridDirection } from '../../../../common/expressions'; export interface LensSortActionData { columnId: string | undefined; diff --git a/x-pack/plugins/lens/public/datatable_visualization/datatable_visualization.ts b/x-pack/plugins/lens/public/visualizations/datatable/datatable_visualization.ts similarity index 100% rename from x-pack/plugins/lens/public/datatable_visualization/datatable_visualization.ts rename to x-pack/plugins/lens/public/visualizations/datatable/datatable_visualization.ts diff --git a/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/expression.test.tsx similarity index 92% rename from x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/expression.test.tsx index 6bf6d27f35ed..7bd3bac4e950 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/expression.test.tsx @@ -5,10 +5,10 @@ * 2.0. */ -import type { DatatableProps } from '../../common/expressions'; +import type { DatatableProps } from '../../../common/expressions'; import { createMockExecutionContext } from '@kbn/expressions-plugin/common/mocks'; -import type { FormatFactory } from '../../common'; -import { getDatatable } from '../../common/expressions'; +import type { FormatFactory } from '../../../common'; +import { getDatatable } from '../../../common/expressions'; import { Datatable } from '@kbn/expressions-plugin/common'; function sampleArgs() { diff --git a/x-pack/plugins/lens/public/datatable_visualization/expression.tsx b/x-pack/plugins/lens/public/visualizations/datatable/expression.tsx similarity index 92% rename from x-pack/plugins/lens/public/datatable_visualization/expression.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/expression.tsx index a7ce6b2a9f67..93a41f9baf53 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/expression.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/expression.tsx @@ -14,12 +14,12 @@ import type { IAggType } from '@kbn/data-plugin/public'; import { IUiSettingsClient, ThemeServiceStart } from '@kbn/core/public'; import { ExpressionRenderDefinition } from '@kbn/expressions-plugin/common'; import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; -import { trackUiCounterEvents } from '../lens_ui_telemetry'; +import { trackUiCounterEvents } from '../../lens_ui_telemetry'; import { DatatableComponent } from './components/table_basic'; -import type { ILensInterpreterRenderHandlers } from '../types'; -import type { FormatFactory } from '../../common'; -import type { DatatableProps } from '../../common/expressions'; +import type { ILensInterpreterRenderHandlers } from '../../types'; +import type { FormatFactory } from '../../../common'; +import type { DatatableProps } from '../../../common/expressions'; export const getDatatableRenderer = (dependencies: { formatFactory: FormatFactory; diff --git a/x-pack/plugins/lens/public/datatable_visualization/index.ts b/x-pack/plugins/lens/public/visualizations/datatable/index.ts similarity index 91% rename from x-pack/plugins/lens/public/datatable_visualization/index.ts rename to x-pack/plugins/lens/public/visualizations/datatable/index.ts index 1d2821cb49c0..7999e7246a59 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/index.ts +++ b/x-pack/plugins/lens/public/visualizations/datatable/index.ts @@ -9,8 +9,8 @@ import type { CoreSetup } from '@kbn/core/public'; import type { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import type { ExpressionsSetup } from '@kbn/expressions-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import type { EditorFrameSetup } from '../types'; -import type { FormatFactory } from '../../common'; +import type { EditorFrameSetup } from '../../types'; +import type { FormatFactory } from '../../../common'; interface DatatableVisualizationPluginStartPlugins { data: DataPublicPluginStart; @@ -28,7 +28,9 @@ export class DatatableVisualization { { expressions, formatFactory, editorFrame, charts }: DatatableVisualizationPluginSetupPlugins ) { editorFrame.registerVisualization(async () => { - const { getDatatableRenderer, getDatatableVisualization } = await import('../async_services'); + const { getDatatableRenderer, getDatatableVisualization } = await import( + '../../async_services' + ); const palettes = await charts.palettes.getPalettes(); expressions.registerRenderer(() => getDatatableRenderer({ diff --git a/x-pack/plugins/lens/public/datatable_visualization/visualization.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/visualization.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/datatable_visualization/visualization.test.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/visualization.test.tsx index 87dc93b71f87..494be445670a 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/visualization.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/visualization.test.tsx @@ -7,7 +7,7 @@ import { Ast } from '@kbn/interpreter'; import { buildExpression } from '@kbn/expressions-plugin/public'; -import { createMockDatasource, createMockFramePublicAPI, DatasourceMock } from '../mocks'; +import { createMockDatasource, createMockFramePublicAPI, DatasourceMock } from '../../mocks'; import { DatatableVisualizationState, getDatatableVisualization } from './visualization'; import { Operation, @@ -15,9 +15,9 @@ import { FramePublicAPI, TableSuggestionColumn, VisualizationDimensionGroupConfig, -} from '../types'; +} from '../../types'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; import { themeServiceMock } from '@kbn/core/public/mocks'; function mockFrame(): FramePublicAPI { diff --git a/x-pack/plugins/lens/public/datatable_visualization/visualization.tsx b/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx similarity index 98% rename from x-pack/plugins/lens/public/datatable_visualization/visualization.tsx rename to x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx index 71399a7d1099..2ccef5a89b1b 100644 --- a/x-pack/plugins/lens/public/datatable_visualization/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx @@ -19,13 +19,13 @@ import type { Visualization, VisualizationSuggestion, DatasourceLayers, -} from '../types'; -import { LensIconChartDatatable } from '../assets/chart_datatable'; +} from '../../types'; +import { LensIconChartDatatable } from '../../assets/chart_datatable'; import { TableDimensionEditor } from './components/dimension_editor'; import { TableDimensionEditorAdditionalSection } from './components/dimension_editor_addtional_section'; -import { LayerType, layerTypes } from '../../common'; -import { getDefaultSummaryLabel, PagingState } from '../../common/expressions'; -import type { ColumnState, SortingState } from '../../common/expressions'; +import { LayerType, layerTypes } from '../../../common'; +import { getDefaultSummaryLabel, PagingState } from '../../../common/expressions'; +import type { ColumnState, SortingState } from '../../../common/expressions'; import { DataTableToolbar } from './components/toolbar'; export interface DatatableVisualizationState { diff --git a/x-pack/plugins/lens/public/heatmap_visualization/constants.ts b/x-pack/plugins/lens/public/visualizations/heatmap/constants.ts similarity index 100% rename from x-pack/plugins/lens/public/heatmap_visualization/constants.ts rename to x-pack/plugins/lens/public/visualizations/heatmap/constants.ts diff --git a/x-pack/plugins/lens/public/heatmap_visualization/dimension_editor.scss b/x-pack/plugins/lens/public/visualizations/heatmap/dimension_editor.scss similarity index 100% rename from x-pack/plugins/lens/public/heatmap_visualization/dimension_editor.scss rename to x-pack/plugins/lens/public/visualizations/heatmap/dimension_editor.scss diff --git a/x-pack/plugins/lens/public/heatmap_visualization/dimension_editor.tsx b/x-pack/plugins/lens/public/visualizations/heatmap/dimension_editor.tsx similarity index 96% rename from x-pack/plugins/lens/public/heatmap_visualization/dimension_editor.tsx rename to x-pack/plugins/lens/public/visualizations/heatmap/dimension_editor.tsx index ae7f01a7cebd..ef0700b7ca9f 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/visualizations/heatmap/dimension_editor.tsx @@ -15,8 +15,8 @@ import { EuiButtonEmpty, } from '@elastic/eui'; import { CustomizablePalette, FIXED_PROGRESSION, PaletteRegistry } from '@kbn/coloring'; -import type { VisualizationDimensionEditorProps } from '../types'; -import { PalettePanelContainer } from '../shared_components'; +import type { VisualizationDimensionEditorProps } from '../../types'; +import { PalettePanelContainer } from '../../shared_components'; import './dimension_editor.scss'; import type { HeatmapVisualizationState } from './types'; import { getSafePaletteParams } from './utils'; diff --git a/x-pack/plugins/lens/public/heatmap_visualization/heatmap_visualization.ts b/x-pack/plugins/lens/public/visualizations/heatmap/heatmap_visualization.ts similarity index 100% rename from x-pack/plugins/lens/public/heatmap_visualization/heatmap_visualization.ts rename to x-pack/plugins/lens/public/visualizations/heatmap/heatmap_visualization.ts diff --git a/x-pack/plugins/lens/public/heatmap_visualization/index.ts b/x-pack/plugins/lens/public/visualizations/heatmap/index.ts similarity index 86% rename from x-pack/plugins/lens/public/heatmap_visualization/index.ts rename to x-pack/plugins/lens/public/visualizations/heatmap/index.ts index e6bebd087c5b..dd132c371d71 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/index.ts +++ b/x-pack/plugins/lens/public/visualizations/heatmap/index.ts @@ -7,7 +7,7 @@ import type { CoreSetup } from '@kbn/core/public'; import type { ChartsPluginSetup } from '@kbn/charts-plugin/public'; -import type { EditorFrameSetup } from '../types'; +import type { EditorFrameSetup } from '../../types'; export interface HeatmapVisualizationPluginSetupPlugins { editorFrame: EditorFrameSetup; @@ -17,7 +17,7 @@ export interface HeatmapVisualizationPluginSetupPlugins { export class HeatmapVisualization { setup(core: CoreSetup, { editorFrame, charts }: HeatmapVisualizationPluginSetupPlugins) { editorFrame.registerVisualization(async () => { - const { getHeatmapVisualization } = await import('../async_services'); + const { getHeatmapVisualization } = await import('../../async_services'); const palettes = await charts.palettes.getPalettes(); return getHeatmapVisualization({ paletteService: palettes, theme: core.theme }); diff --git a/x-pack/plugins/lens/public/heatmap_visualization/suggestions.test.ts b/x-pack/plugins/lens/public/visualizations/heatmap/suggestions.test.ts similarity index 99% rename from x-pack/plugins/lens/public/heatmap_visualization/suggestions.test.ts rename to x-pack/plugins/lens/public/visualizations/heatmap/suggestions.test.ts index dbe2d9a7c977..70db8e0d4165 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/suggestions.test.ts +++ b/x-pack/plugins/lens/public/visualizations/heatmap/suggestions.test.ts @@ -9,7 +9,7 @@ import { Position } from '@elastic/charts'; import { getSuggestions } from './suggestions'; import type { HeatmapVisualizationState } from './types'; import { HEATMAP_GRID_FUNCTION, LEGEND_FUNCTION } from './constants'; -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; describe('heatmap suggestions', () => { describe('rejects suggestions', () => { diff --git a/x-pack/plugins/lens/public/heatmap_visualization/suggestions.ts b/x-pack/plugins/lens/public/visualizations/heatmap/suggestions.ts similarity index 97% rename from x-pack/plugins/lens/public/heatmap_visualization/suggestions.ts rename to x-pack/plugins/lens/public/visualizations/heatmap/suggestions.ts index c13b6eb655e3..a302be4cfceb 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/suggestions.ts +++ b/x-pack/plugins/lens/public/visualizations/heatmap/suggestions.ts @@ -8,10 +8,10 @@ import { partition } from 'lodash'; import { Position } from '@elastic/charts'; import { i18n } from '@kbn/i18n'; -import type { Visualization } from '../types'; +import type { Visualization } from '../../types'; import type { HeatmapVisualizationState } from './types'; import { CHART_SHAPES, HEATMAP_GRID_FUNCTION, LEGEND_FUNCTION } from './constants'; -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; export const getSuggestions: Visualization['getSuggestions'] = ({ table, diff --git a/x-pack/plugins/lens/public/heatmap_visualization/toolbar_component.scss b/x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.scss similarity index 100% rename from x-pack/plugins/lens/public/heatmap_visualization/toolbar_component.scss rename to x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.scss diff --git a/x-pack/plugins/lens/public/heatmap_visualization/toolbar_component.tsx b/x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.tsx similarity index 96% rename from x-pack/plugins/lens/public/heatmap_visualization/toolbar_component.tsx rename to x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.tsx index d653649dc104..b0a80ca297a0 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/toolbar_component.tsx +++ b/x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.tsx @@ -10,18 +10,18 @@ import { EuiFlexGroup, EuiFlexItem, IconType } from '@elastic/eui'; import { Position } from '@elastic/charts'; import { i18n } from '@kbn/i18n'; import { LegendSize } from '@kbn/visualizations-plugin/public'; -import type { VisualizationToolbarProps } from '../types'; +import type { VisualizationToolbarProps } from '../../types'; import { LegendSettingsPopover, ToolbarPopover, ValueLabelsSettings, AxisTitleSettings, TooltipWrapper, -} from '../shared_components'; -import { EuiIconAxisLeft } from '../assets/axis_left'; -import { EuiIconAxisBottom } from '../assets/axis_bottom'; +} from '../../shared_components'; +import { EuiIconAxisLeft } from '../../assets/axis_left'; +import { EuiIconAxisBottom } from '../../assets/axis_bottom'; import type { HeatmapVisualizationState } from './types'; -import { getDefaultVisualValuesForLayer } from '../shared_components/datasource_default_values'; +import { getDefaultVisualValuesForLayer } from '../../shared_components/datasource_default_values'; import './toolbar_component.scss'; const legendOptions: Array<{ id: string; value: 'auto' | 'show' | 'hide'; label: string }> = [ diff --git a/x-pack/plugins/lens/public/heatmap_visualization/types.ts b/x-pack/plugins/lens/public/visualizations/heatmap/types.ts similarity index 94% rename from x-pack/plugins/lens/public/heatmap_visualization/types.ts rename to x-pack/plugins/lens/public/visualizations/heatmap/types.ts index 1b92dca12ac2..08913ad25a7d 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/types.ts +++ b/x-pack/plugins/lens/public/visualizations/heatmap/types.ts @@ -7,7 +7,7 @@ import type { PaletteOutput, CustomPaletteParams } from '@kbn/coloring'; import type { HeatmapArguments } from '@kbn/expression-heatmap-plugin/common'; -import type { LayerType } from '../../common'; +import type { LayerType } from '../../../common'; export type ChartShapes = 'heatmap'; export type HeatmapLayerState = HeatmapArguments & { diff --git a/x-pack/plugins/lens/public/heatmap_visualization/utils.ts b/x-pack/plugins/lens/public/visualizations/heatmap/utils.ts similarity index 93% rename from x-pack/plugins/lens/public/heatmap_visualization/utils.ts rename to x-pack/plugins/lens/public/visualizations/heatmap/utils.ts index 66c70381a560..5e09ce2987ba 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/utils.ts +++ b/x-pack/plugins/lens/public/visualizations/heatmap/utils.ts @@ -7,7 +7,7 @@ import type { PaletteRegistry } from '@kbn/coloring'; import type { Datatable } from '@kbn/expressions-plugin/common'; -import { applyPaletteParams, findMinMaxByColumnId } from '../shared_components'; +import { applyPaletteParams, findMinMaxByColumnId } from '../../shared_components'; import { DEFAULT_PALETTE_NAME } from './constants'; import type { HeatmapVisualizationState, Palette } from './types'; diff --git a/x-pack/plugins/lens/public/heatmap_visualization/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/heatmap/visualization.test.ts similarity index 99% rename from x-pack/plugins/lens/public/heatmap_visualization/visualization.test.ts rename to x-pack/plugins/lens/public/visualizations/heatmap/visualization.test.ts index 7ef8d3ab132d..ee6a7030a0c9 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/heatmap/visualization.test.ts @@ -10,7 +10,7 @@ import { getHeatmapVisualization, isCellValueSupported, } from './visualization'; -import { createMockDatasource, createMockFramePublicAPI } from '../mocks'; +import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; import { CHART_SHAPES, FUNCTION_NAME, @@ -20,9 +20,9 @@ import { } from './constants'; import { Position } from '@elastic/charts'; import type { HeatmapVisualizationState } from './types'; -import type { DatasourceLayers, OperationDescriptor } from '../types'; +import type { DatasourceLayers, OperationDescriptor } from '../../types'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; import { themeServiceMock } from '@kbn/core/public/mocks'; function exampleState(): HeatmapVisualizationState { diff --git a/x-pack/plugins/lens/public/heatmap_visualization/visualization.tsx b/x-pack/plugins/lens/public/visualizations/heatmap/visualization.tsx similarity index 99% rename from x-pack/plugins/lens/public/heatmap_visualization/visualization.tsx rename to x-pack/plugins/lens/public/visualizations/heatmap/visualization.tsx index 723779875f81..9c97aa4dab60 100644 --- a/x-pack/plugins/lens/public/heatmap_visualization/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/heatmap/visualization.tsx @@ -16,7 +16,7 @@ import { ThemeServiceStart } from '@kbn/core/public'; import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; import { HeatmapIcon } from '@kbn/expression-heatmap-plugin/public'; -import type { OperationMetadata, Visualization } from '../types'; +import type { OperationMetadata, Visualization } from '../../types'; import type { HeatmapVisualizationState } from './types'; import { getSuggestions } from './suggestions'; import { @@ -32,7 +32,7 @@ import { import { HeatmapToolbar } from './toolbar_component'; import { HeatmapDimensionEditor } from './dimension_editor'; import { getSafePaletteParams } from './utils'; -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; const groupLabelForHeatmap = i18n.translate('xpack.lens.heatmapVisualization.heatmapGroupLabel', { defaultMessage: 'Magnitude', diff --git a/x-pack/plugins/lens/public/metric_visualization/dimension_editor.scss b/x-pack/plugins/lens/public/visualizations/legacy_metric/dimension_editor.scss similarity index 100% rename from x-pack/plugins/lens/public/metric_visualization/dimension_editor.scss rename to x-pack/plugins/lens/public/visualizations/legacy_metric/dimension_editor.scss diff --git a/x-pack/plugins/lens/public/metric_visualization/dimension_editor.test.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/dimension_editor.test.tsx similarity index 97% rename from x-pack/plugins/lens/public/metric_visualization/dimension_editor.test.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/dimension_editor.test.tsx index c83e83aad7b1..0deb21497978 100644 --- a/x-pack/plugins/lens/public/metric_visualization/dimension_editor.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/dimension_editor.test.tsx @@ -7,8 +7,8 @@ import React from 'react'; import { EuiButtonGroup } from '@elastic/eui'; -import { FramePublicAPI, VisualizationDimensionEditorProps } from '../types'; -import { createMockDatasource, createMockFramePublicAPI } from '../mocks'; +import { FramePublicAPI, VisualizationDimensionEditorProps } from '../../types'; +import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { MetricDimensionEditor } from './dimension_editor'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; @@ -21,9 +21,9 @@ import { } from '@kbn/coloring'; import { act } from 'react-dom/test-utils'; -import { PalettePanelContainer } from '../shared_components'; -import { layerTypes } from '../../common'; -import type { MetricState } from '../../common/types'; +import { PalettePanelContainer } from '../../shared_components'; +import { layerTypes } from '../../../common'; +import type { MetricState } from '../../../common/types'; // mocking random id generator function jest.mock('@elastic/eui', () => { diff --git a/x-pack/plugins/lens/public/metric_visualization/dimension_editor.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/dimension_editor.tsx similarity index 96% rename from x-pack/plugins/lens/public/metric_visualization/dimension_editor.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/dimension_editor.tsx index b3a2e7207e77..5acfe97c5b3e 100644 --- a/x-pack/plugins/lens/public/metric_visualization/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/dimension_editor.tsx @@ -22,10 +22,10 @@ import { import { i18n } from '@kbn/i18n'; import React, { useCallback, useState } from 'react'; import { ColorMode } from '@kbn/charts-plugin/common'; -import type { MetricState } from '../../common/types'; -import { isNumericFieldForDatatable } from '../../common/expressions'; -import { applyPaletteParams, PalettePanelContainer } from '../shared_components'; -import type { VisualizationDimensionEditorProps } from '../types'; +import type { MetricState } from '../../../common/types'; +import { isNumericFieldForDatatable } from '../../../common/expressions'; +import { applyPaletteParams, PalettePanelContainer } from '../../shared_components'; +import type { VisualizationDimensionEditorProps } from '../../types'; import { defaultPaletteParams } from './palette_config'; import './dimension_editor.scss'; diff --git a/x-pack/plugins/lens/public/metric_visualization/index.ts b/x-pack/plugins/lens/public/visualizations/legacy_metric/index.ts similarity index 91% rename from x-pack/plugins/lens/public/metric_visualization/index.ts rename to x-pack/plugins/lens/public/visualizations/legacy_metric/index.ts index ce733a033b6d..933bf4dab6ae 100644 --- a/x-pack/plugins/lens/public/metric_visualization/index.ts +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/index.ts @@ -7,7 +7,7 @@ import type { CoreSetup } from '@kbn/core/public'; import type { ChartsPluginSetup } from '@kbn/charts-plugin/public'; -import type { EditorFrameSetup } from '../types'; +import type { EditorFrameSetup } from '../../types'; export interface LegacyMetricVisualizationPluginSetupPlugins { editorFrame: EditorFrameSetup; @@ -18,7 +18,7 @@ export class LegacyMetricVisualization { setup(core: CoreSetup, { editorFrame, charts }: LegacyMetricVisualizationPluginSetupPlugins) { editorFrame.registerVisualization(async () => { const { getLegacyMetricVisualization: getMetricVisualization } = await import( - '../async_services' + '../../async_services' ); const palettes = await charts.palettes.getPalettes(); diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/align_options.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/align_options.tsx similarity index 96% rename from x-pack/plugins/lens/public/metric_visualization/metric_config_panel/align_options.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/align_options.tsx index cf077e6eaa77..0da058db3d5b 100644 --- a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/align_options.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/align_options.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonGroup } from '@elastic/eui'; -import { MetricState } from '../../../common/types'; +import { MetricState } from '../../../../common/types'; export interface TitlePositionProps { state: MetricState; diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/appearance_options_popover.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/appearance_options_popover.tsx similarity index 87% rename from x-pack/plugins/lens/public/metric_visualization/metric_config_panel/appearance_options_popover.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/appearance_options_popover.tsx index 280a036ab5da..14cf0860db2f 100644 --- a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/appearance_options_popover.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/appearance_options_popover.tsx @@ -7,10 +7,10 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { ToolbarPopover, TooltipWrapper } from '../../shared_components'; +import { ToolbarPopover, TooltipWrapper } from '../../../shared_components'; import { TitlePositionOptions } from './title_position_option'; -import { FramePublicAPI } from '../../types'; -import type { MetricState } from '../../../common/types'; +import { FramePublicAPI } from '../../../types'; +import type { MetricState } from '../../../../common/types'; import { TextFormattingOptions } from './text_formatting_options'; export interface VisualOptionsPopoverProps { diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/index.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/index.tsx similarity index 89% rename from x-pack/plugins/lens/public/metric_visualization/metric_config_panel/index.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/index.tsx index 947115fcee5d..0988aefa2449 100644 --- a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/index.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/index.tsx @@ -7,8 +7,8 @@ import React, { memo } from 'react'; import { EuiFlexGroup, EuiFlexItem, htmlIdGenerator } from '@elastic/eui'; -import type { VisualizationToolbarProps } from '../../types'; -import type { MetricState } from '../../../common/types'; +import type { VisualizationToolbarProps } from '../../../types'; +import type { MetricState } from '../../../../common/types'; import { AppearanceOptionsPopover } from './appearance_options_popover'; diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/size_options.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/size_options.tsx similarity index 97% rename from x-pack/plugins/lens/public/metric_visualization/metric_config_panel/size_options.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/size_options.tsx index 40af2d9a0e71..94efe0e00231 100644 --- a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/size_options.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/size_options.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonIcon, EuiSuperSelect } from '@elastic/eui'; -import type { MetricState } from '../../../common/types'; +import type { MetricState } from '../../../../common/types'; export interface TitlePositionProps { state: MetricState; diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/text_formatting_options.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/text_formatting_options.tsx similarity index 95% rename from x-pack/plugins/lens/public/metric_visualization/metric_config_panel/text_formatting_options.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/text_formatting_options.tsx index 149d66a2db3c..8a1f97cd8251 100644 --- a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/text_formatting_options.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/text_formatting_options.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import type { MetricState } from '../../../common/types'; +import type { MetricState } from '../../../../common/types'; import { SizeOptions } from './size_options'; import { AlignOptions } from './align_options'; diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/title_position_option.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/title_position_option.tsx similarity index 96% rename from x-pack/plugins/lens/public/metric_visualization/metric_config_panel/title_position_option.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/title_position_option.tsx index 63abd195d6e5..233a2e382669 100644 --- a/x-pack/plugins/lens/public/metric_visualization/metric_config_panel/title_position_option.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/title_position_option.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonGroup, EuiFormRow } from '@elastic/eui'; -import type { MetricState } from '../../../common/types'; +import type { MetricState } from '../../../../common/types'; export interface TitlePositionProps { state: MetricState; diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_suggestions.test.ts b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_suggestions.test.ts similarity index 98% rename from x-pack/plugins/lens/public/metric_visualization/metric_suggestions.test.ts rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_suggestions.test.ts index 791d282bfe9d..e1803e106f2e 100644 --- a/x-pack/plugins/lens/public/metric_visualization/metric_suggestions.test.ts +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_suggestions.test.ts @@ -6,7 +6,7 @@ */ import { getSuggestions } from './metric_suggestions'; -import { TableSuggestionColumn, TableSuggestion } from '../types'; +import { TableSuggestionColumn, TableSuggestion } from '../../types'; describe('metric_suggestions', () => { function numCol(columnId: string): TableSuggestionColumn { diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_suggestions.ts b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_suggestions.ts similarity index 89% rename from x-pack/plugins/lens/public/metric_visualization/metric_suggestions.ts rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_suggestions.ts index 4485571ffdb8..32a583161825 100644 --- a/x-pack/plugins/lens/public/metric_visualization/metric_suggestions.ts +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_suggestions.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { SuggestionRequest, VisualizationSuggestion, TableSuggestion } from '../types'; -import type { MetricState } from '../../common/types'; -import { layerTypes } from '../../common'; -import { LensIconChartMetric } from '../assets/chart_metric'; +import { SuggestionRequest, VisualizationSuggestion, TableSuggestion } from '../../types'; +import type { MetricState } from '../../../common/types'; +import { layerTypes } from '../../../common'; +import { LensIconChartMetric } from '../../assets/chart_metric'; import { legacyMetricSupportedTypes } from './visualization'; /** diff --git a/x-pack/plugins/lens/public/metric_visualization/metric_visualization.ts b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_visualization.ts similarity index 100% rename from x-pack/plugins/lens/public/metric_visualization/metric_visualization.ts rename to x-pack/plugins/lens/public/visualizations/legacy_metric/metric_visualization.ts diff --git a/x-pack/plugins/lens/public/metric_visualization/palette_config.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/palette_config.tsx similarity index 96% rename from x-pack/plugins/lens/public/metric_visualization/palette_config.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/palette_config.tsx index b44e94d84e0a..e34533c058e7 100644 --- a/x-pack/plugins/lens/public/metric_visualization/palette_config.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/palette_config.tsx @@ -6,7 +6,7 @@ */ import { RequiredPaletteParamTypes } from '@kbn/coloring'; -import { defaultPaletteParams as sharedDefaultParams } from '../shared_components'; +import { defaultPaletteParams as sharedDefaultParams } from '../../shared_components'; export const DEFAULT_PALETTE_NAME = 'status'; export const DEFAULT_COLOR_STEPS = 3; diff --git a/x-pack/plugins/lens/public/metric_visualization/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.test.ts similarity index 97% rename from x-pack/plugins/lens/public/metric_visualization/visualization.test.ts rename to x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.test.ts index d6b14e5e574c..399c29797ff8 100644 --- a/x-pack/plugins/lens/public/metric_visualization/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.test.ts @@ -6,16 +6,16 @@ */ import { getLegacyMetricVisualization } from './visualization'; -import type { MetricState } from '../../common/types'; -import { layerTypes } from '../../common'; -import { createMockDatasource, createMockFramePublicAPI } from '../mocks'; -import { generateId } from '../id_generator'; -import { DatasourcePublicAPI, FramePublicAPI } from '../types'; +import type { MetricState } from '../../../common/types'; +import { layerTypes } from '../../../common'; +import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; +import { generateId } from '../../id_generator'; +import { DatasourcePublicAPI, FramePublicAPI } from '../../types'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { ColorMode } from '@kbn/charts-plugin/common'; import { themeServiceMock } from '@kbn/core/public/mocks'; -jest.mock('../id_generator'); +jest.mock('../../id_generator'); function exampleState(): MetricState { return { diff --git a/x-pack/plugins/lens/public/metric_visualization/visualization.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.tsx similarity index 98% rename from x-pack/plugins/lens/public/metric_visualization/visualization.tsx rename to x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.tsx index e9d23469be7c..5550341a81e8 100644 --- a/x-pack/plugins/lens/public/metric_visualization/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.tsx @@ -15,10 +15,10 @@ import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; import { ColorMode, CustomPaletteState } from '@kbn/charts-plugin/common'; import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; import { getSuggestions } from './metric_suggestions'; -import { LensIconChartMetric } from '../assets/chart_metric'; -import { Visualization, OperationMetadata, DatasourceLayers } from '../types'; -import type { MetricState } from '../../common/types'; -import { layerTypes } from '../../common'; +import { LensIconChartMetric } from '../../assets/chart_metric'; +import { Visualization, OperationMetadata, DatasourceLayers } from '../../types'; +import type { MetricState } from '../../../common/types'; +import { layerTypes } from '../../../common'; import { MetricDimensionEditor } from './dimension_editor'; import { MetricToolbar } from './metric_config_panel'; import { DEFAULT_TITLE_POSITION } from './metric_config_panel/title_position_option'; diff --git a/x-pack/plugins/lens/public/pie_visualization/constants.ts b/x-pack/plugins/lens/public/visualizations/partition/constants.ts similarity index 100% rename from x-pack/plugins/lens/public/pie_visualization/constants.ts rename to x-pack/plugins/lens/public/visualizations/partition/constants.ts diff --git a/x-pack/plugins/lens/public/pie_visualization/index.ts b/x-pack/plugins/lens/public/visualizations/partition/index.ts similarity index 88% rename from x-pack/plugins/lens/public/pie_visualization/index.ts rename to x-pack/plugins/lens/public/visualizations/partition/index.ts index 6b7a9d68115d..09e98c6c6c80 100644 --- a/x-pack/plugins/lens/public/pie_visualization/index.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/index.ts @@ -8,7 +8,7 @@ import type { CoreSetup } from '@kbn/core/public'; import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import type { ChartsPluginSetup } from '@kbn/charts-plugin/public'; -import type { EditorFrameSetup } from '../types'; +import type { EditorFrameSetup } from '../../types'; export interface PieVisualizationPluginSetupPlugins { editorFrame: EditorFrameSetup; @@ -22,7 +22,7 @@ export interface PieVisualizationPluginStartPlugins { export class PieVisualization { setup(core: CoreSetup, { editorFrame, charts }: PieVisualizationPluginSetupPlugins) { editorFrame.registerVisualization(async () => { - const { getPieVisualization } = await import('../async_services'); + const { getPieVisualization } = await import('../../async_services'); const palettes = await charts.palettes.getPalettes(); return getPieVisualization({ paletteService: palettes, kibanaTheme: core.theme }); diff --git a/x-pack/plugins/lens/public/pie_visualization/partition_charts_meta.ts b/x-pack/plugins/lens/public/visualizations/partition/partition_charts_meta.ts similarity index 91% rename from x-pack/plugins/lens/public/pie_visualization/partition_charts_meta.ts rename to x-pack/plugins/lens/public/visualizations/partition/partition_charts_meta.ts index be2ddda9372b..6d948ce4332f 100644 --- a/x-pack/plugins/lens/public/pie_visualization/partition_charts_meta.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/partition_charts_meta.ts @@ -9,13 +9,18 @@ import { i18n } from '@kbn/i18n'; import type { EuiIconProps } from '@elastic/eui'; import type { DatatableColumn } from '@kbn/expressions-plugin/common'; -import { LensIconChartDonut } from '../assets/chart_donut'; -import { LensIconChartPie } from '../assets/chart_pie'; -import { LensIconChartTreemap } from '../assets/chart_treemap'; -import { LensIconChartMosaic } from '../assets/chart_mosaic'; -import { LensIconChartWaffle } from '../assets/chart_waffle'; -import { CategoryDisplay, NumberDisplay, SharedPieLayerState, EmptySizeRatios } from '../../common'; -import type { PieChartType } from '../../common/types'; +import { LensIconChartDonut } from '../../assets/chart_donut'; +import { LensIconChartPie } from '../../assets/chart_pie'; +import { LensIconChartTreemap } from '../../assets/chart_treemap'; +import { LensIconChartMosaic } from '../../assets/chart_mosaic'; +import { LensIconChartWaffle } from '../../assets/chart_waffle'; +import { + CategoryDisplay, + NumberDisplay, + SharedPieLayerState, + EmptySizeRatios, +} from '../../../common'; +import type { PieChartType } from '../../../common/types'; interface PartitionChartMeta { icon: ({ title, titleId, ...props }: Omit) => JSX.Element; diff --git a/x-pack/plugins/lens/public/pie_visualization/pie_visualization.ts b/x-pack/plugins/lens/public/visualizations/partition/pie_visualization.ts similarity index 100% rename from x-pack/plugins/lens/public/pie_visualization/pie_visualization.ts rename to x-pack/plugins/lens/public/visualizations/partition/pie_visualization.ts diff --git a/x-pack/plugins/lens/public/pie_visualization/render_helpers.test.ts b/x-pack/plugins/lens/public/visualizations/partition/render_helpers.test.ts similarity index 97% rename from x-pack/plugins/lens/public/pie_visualization/render_helpers.test.ts rename to x-pack/plugins/lens/public/visualizations/partition/render_helpers.test.ts index 6fe4d9b60420..b7137c3f8e06 100644 --- a/x-pack/plugins/lens/public/pie_visualization/render_helpers.test.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/render_helpers.test.ts @@ -8,7 +8,7 @@ import type { Datatable } from '@kbn/expressions-plugin/public'; import { checkTableForContainsSmallValues, shouldShowValuesInLegend } from './render_helpers'; -import { PieLayerState, PieChartTypes } from '../../common'; +import { PieLayerState, PieChartTypes } from '../../../common'; describe('render helpers', () => { describe('#checkTableForContainsSmallValues', () => { diff --git a/x-pack/plugins/lens/public/pie_visualization/render_helpers.ts b/x-pack/plugins/lens/public/visualizations/partition/render_helpers.ts similarity index 93% rename from x-pack/plugins/lens/public/pie_visualization/render_helpers.ts rename to x-pack/plugins/lens/public/visualizations/partition/render_helpers.ts index b34385d55b44..bce1031d2213 100644 --- a/x-pack/plugins/lens/public/pie_visualization/render_helpers.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/render_helpers.ts @@ -6,7 +6,7 @@ */ import type { Datatable } from '@kbn/expressions-plugin/public'; -import type { PieChartType, PieLayerState } from '../../common/types'; +import type { PieChartType, PieLayerState } from '../../../common/types'; import { PartitionChartsMeta } from './partition_charts_meta'; export const isPartitionShape = (shape: PieChartType | string) => diff --git a/x-pack/plugins/lens/public/pie_visualization/suggestions.test.ts b/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts similarity index 99% rename from x-pack/plugins/lens/public/pie_visualization/suggestions.test.ts rename to x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts index 44fbaebf91fc..fc449113adfa 100644 --- a/x-pack/plugins/lens/public/pie_visualization/suggestions.test.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts @@ -7,7 +7,7 @@ import type { PaletteOutput } from '@kbn/coloring'; import { suggestions } from './suggestions'; -import type { DataType, SuggestionRequest } from '../types'; +import type { DataType, SuggestionRequest } from '../../types'; import { CategoryDisplay, LegendDisplay, @@ -15,8 +15,8 @@ import { PieChartTypes, PieLayerState, PieVisualizationState, -} from '../../common'; -import { layerTypes } from '../../common'; +} from '../../../common'; +import { layerTypes } from '../../../common'; describe('suggestions', () => { describe('pie', () => { diff --git a/x-pack/plugins/lens/public/pie_visualization/suggestions.ts b/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts similarity index 98% rename from x-pack/plugins/lens/public/pie_visualization/suggestions.ts rename to x-pack/plugins/lens/public/visualizations/partition/suggestions.ts index 176fa2d5026e..f2541493be33 100644 --- a/x-pack/plugins/lens/public/pie_visualization/suggestions.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts @@ -7,7 +7,11 @@ import { partition } from 'lodash'; import { i18n } from '@kbn/i18n'; -import type { SuggestionRequest, TableSuggestionColumn, VisualizationSuggestion } from '../types'; +import type { + SuggestionRequest, + TableSuggestionColumn, + VisualizationSuggestion, +} from '../../types'; import { CategoryDisplay, layerTypes, @@ -15,8 +19,8 @@ import { NumberDisplay, PieChartTypes, PieVisualizationState, -} from '../../common'; -import type { PieChartType } from '../../common/types'; +} from '../../../common'; +import type { PieChartType } from '../../../common/types'; import { PartitionChartsMeta } from './partition_charts_meta'; import { isPartitionShape } from './render_helpers'; diff --git a/x-pack/plugins/lens/public/pie_visualization/to_expression.ts b/x-pack/plugins/lens/public/visualizations/partition/to_expression.ts similarity index 98% rename from x-pack/plugins/lens/public/pie_visualization/to_expression.ts rename to x-pack/plugins/lens/public/visualizations/partition/to_expression.ts index 20b7199bbc4c..6fa209a26a82 100644 --- a/x-pack/plugins/lens/public/pie_visualization/to_expression.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/to_expression.ts @@ -10,7 +10,7 @@ import { Position } from '@elastic/charts'; import type { PaletteOutput, PaletteRegistry } from '@kbn/coloring'; import { buildExpression, buildExpressionFunction } from '@kbn/expressions-plugin/public'; -import type { Operation, DatasourcePublicAPI, DatasourceLayers } from '../types'; +import type { Operation, DatasourcePublicAPI, DatasourceLayers } from '../../types'; import { DEFAULT_PERCENT_DECIMALS } from './constants'; import { shouldShowValuesInLegend } from './render_helpers'; import { @@ -21,8 +21,8 @@ import { PieVisualizationState, EmptySizeRatios, LegendDisplay, -} from '../../common'; -import { getDefaultVisualValuesForLayer } from '../shared_components/datasource_default_values'; +} from '../../../common'; +import { getDefaultVisualValuesForLayer } from '../../shared_components/datasource_default_values'; interface Attributes { isPreview: boolean; diff --git a/x-pack/plugins/lens/public/pie_visualization/toolbar.scss b/x-pack/plugins/lens/public/visualizations/partition/toolbar.scss similarity index 100% rename from x-pack/plugins/lens/public/pie_visualization/toolbar.scss rename to x-pack/plugins/lens/public/visualizations/partition/toolbar.scss diff --git a/x-pack/plugins/lens/public/pie_visualization/toolbar.tsx b/x-pack/plugins/lens/public/visualizations/partition/toolbar.tsx similarity index 98% rename from x-pack/plugins/lens/public/pie_visualization/toolbar.tsx rename to x-pack/plugins/lens/public/visualizations/partition/toolbar.tsx index aa17098cfad5..e72bc705ae23 100644 --- a/x-pack/plugins/lens/public/pie_visualization/toolbar.tsx +++ b/x-pack/plugins/lens/public/visualizations/partition/toolbar.tsx @@ -21,15 +21,15 @@ import type { PaletteRegistry } from '@kbn/coloring'; import { LegendSize } from '@kbn/visualizations-plugin/public'; import { DEFAULT_PERCENT_DECIMALS } from './constants'; import { PartitionChartsMeta } from './partition_charts_meta'; -import { LegendDisplay, PieVisualizationState, SharedPieLayerState } from '../../common'; -import { VisualizationDimensionEditorProps, VisualizationToolbarProps } from '../types'; +import { LegendDisplay, PieVisualizationState, SharedPieLayerState } from '../../../common'; +import { VisualizationDimensionEditorProps, VisualizationToolbarProps } from '../../types'; import { ToolbarPopover, LegendSettingsPopover, useDebouncedValue, PalettePicker, -} from '../shared_components'; -import { getDefaultVisualValuesForLayer } from '../shared_components/datasource_default_values'; +} from '../../shared_components'; +import { getDefaultVisualValuesForLayer } from '../../shared_components/datasource_default_values'; import { shouldShowValuesInLegend } from './render_helpers'; const legendOptions: Array<{ diff --git a/x-pack/plugins/lens/public/pie_visualization/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/partition/visualization.test.ts similarity index 95% rename from x-pack/plugins/lens/public/pie_visualization/visualization.test.ts rename to x-pack/plugins/lens/public/visualizations/partition/visualization.test.ts index a911b5f0e1ba..1b46c6eefea5 100644 --- a/x-pack/plugins/lens/public/pie_visualization/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/visualization.test.ts @@ -12,14 +12,14 @@ import { CategoryDisplay, NumberDisplay, LegendDisplay, -} from '../../common'; -import { layerTypes } from '../../common'; +} from '../../../common'; +import { layerTypes } from '../../../common'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; -import { createMockDatasource, createMockFramePublicAPI } from '../mocks'; -import { FramePublicAPI } from '../types'; +import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; +import { FramePublicAPI } from '../../types'; import { themeServiceMock } from '@kbn/core/public/mocks'; -jest.mock('../id_generator'); +jest.mock('../../id_generator'); const LAYER_ID = 'l1'; diff --git a/x-pack/plugins/lens/public/pie_visualization/visualization.tsx b/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx similarity index 99% rename from x-pack/plugins/lens/public/pie_visualization/visualization.tsx rename to x-pack/plugins/lens/public/visualizations/partition/visualization.tsx index 27961c91c0e9..5e453838aef5 100644 --- a/x-pack/plugins/lens/public/pie_visualization/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx @@ -18,14 +18,14 @@ import type { OperationMetadata, AccessorConfig, VisualizationDimensionGroupConfig, -} from '../types'; +} from '../../types'; import { getSortedGroups, toExpression, toPreviewExpression } from './to_expression'; -import { CategoryDisplay, layerTypes, LegendDisplay, NumberDisplay } from '../../common'; +import { CategoryDisplay, layerTypes, LegendDisplay, NumberDisplay } from '../../../common'; import { suggestions } from './suggestions'; import { PartitionChartsMeta } from './partition_charts_meta'; import { DimensionEditor, PieToolbar } from './toolbar'; import { checkTableForContainsSmallValues } from './render_helpers'; -import { PieChartTypes, PieLayerState, PieVisualizationState } from '../../common'; +import { PieChartTypes, PieLayerState, PieVisualizationState } from '../../../common'; function newLayerState(layerId: string): PieLayerState { return { diff --git a/x-pack/plugins/lens/public/xy_visualization/__snapshots__/to_expression.test.ts.snap b/x-pack/plugins/lens/public/visualizations/xy/__snapshots__/to_expression.test.ts.snap similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/__snapshots__/to_expression.test.ts.snap rename to x-pack/plugins/lens/public/visualizations/xy/__snapshots__/to_expression.test.ts.snap diff --git a/x-pack/plugins/lens/public/xy_visualization/annotations/helpers.test.ts b/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.test.ts similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/annotations/helpers.test.ts rename to x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.test.ts index 1e02f929e90c..1f923f85ee1b 100644 --- a/x-pack/plugins/lens/public/xy_visualization/annotations/helpers.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FramePublicAPI } from '../../types'; +import { FramePublicAPI } from '../../../types'; import { getStaticDate } from './helpers'; const frame = { diff --git a/x-pack/plugins/lens/public/xy_visualization/annotations/helpers.tsx b/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/annotations/helpers.tsx rename to x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx index 800366a71afe..480417ab2cba 100644 --- a/x-pack/plugins/lens/public/xy_visualization/annotations/helpers.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx @@ -13,8 +13,8 @@ import { isRangeAnnotation, } from '@kbn/event-annotation-plugin/public'; import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; -import { layerTypes } from '../../../common'; -import type { FramePublicAPI, Visualization } from '../../types'; +import { layerTypes } from '../../../../common'; +import type { FramePublicAPI, Visualization } from '../../../types'; import { isHorizontalChart } from '../state_helpers'; import type { XYState, XYDataLayerConfig, XYAnnotationLayerConfig, XYLayerConfig } from '../types'; import { @@ -24,8 +24,8 @@ import { getDataLayers, isAnnotationsLayer, } from '../visualization_helpers'; -import { LensIconChartBarAnnotations } from '../../assets/chart_bar_annotations'; -import { generateId } from '../../id_generator'; +import { LensIconChartBarAnnotations } from '../../../assets/chart_bar_annotations'; +import { generateId } from '../../../id_generator'; const MAX_DATE = 8640000000000000; const MIN_DATE = -8640000000000000; diff --git a/x-pack/plugins/lens/public/xy_visualization/axes_configuration.test.ts b/x-pack/plugins/lens/public/visualizations/xy/axes_configuration.test.ts similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/axes_configuration.test.ts rename to x-pack/plugins/lens/public/visualizations/xy/axes_configuration.test.ts index 0b14b54f2707..568cd38635ac 100644 --- a/x-pack/plugins/lens/public/xy_visualization/axes_configuration.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/axes_configuration.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; import { Datatable } from '@kbn/expressions-plugin/public'; import { getAxesConfiguration } from './axes_configuration'; import { XYDataLayerConfig } from './types'; diff --git a/x-pack/plugins/lens/public/xy_visualization/axes_configuration.ts b/x-pack/plugins/lens/public/visualizations/xy/axes_configuration.ts similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/axes_configuration.ts rename to x-pack/plugins/lens/public/visualizations/xy/axes_configuration.ts index d33604ea4508..0c8e829f7dc0 100644 --- a/x-pack/plugins/lens/public/xy_visualization/axes_configuration.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/axes_configuration.ts @@ -8,12 +8,12 @@ import { AxisExtentConfig } from '@kbn/expression-xy-plugin/common'; import { Datatable } from '@kbn/expressions-plugin/public'; import type { IFieldFormat, SerializedFieldFormat } from '@kbn/field-formats-plugin/common'; -import { FormatFactory } from '../../common'; +import { FormatFactory } from '../../../common'; import { getDataBounds, validateAxisDomain, validateZeroInclusivityExtent, -} from '../shared_components'; +} from '../../shared_components'; import { XYDataLayerConfig } from './types'; interface FormattedMetric { diff --git a/x-pack/plugins/lens/public/xy_visualization/color_assignment.test.ts b/x-pack/plugins/lens/public/visualizations/xy/color_assignment.test.ts similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/color_assignment.test.ts rename to x-pack/plugins/lens/public/visualizations/xy/color_assignment.test.ts index 666f729ffb79..b59aadda1fdf 100644 --- a/x-pack/plugins/lens/public/xy_visualization/color_assignment.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/color_assignment.test.ts @@ -6,8 +6,8 @@ */ import { getColorAssignments } from './color_assignment'; -import type { FormatFactory } from '../../common'; -import { layerTypes } from '../../common'; +import type { FormatFactory } from '../../../common'; +import { layerTypes } from '../../../common'; import { XYDataLayerConfig } from './types'; import { Datatable } from '@kbn/expressions-plugin/common'; diff --git a/x-pack/plugins/lens/public/xy_visualization/color_assignment.ts b/x-pack/plugins/lens/public/visualizations/xy/color_assignment.ts similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/color_assignment.ts rename to x-pack/plugins/lens/public/visualizations/xy/color_assignment.ts index e7853384ec79..4a3dbc94d35a 100644 --- a/x-pack/plugins/lens/public/xy_visualization/color_assignment.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/color_assignment.ts @@ -14,9 +14,9 @@ import { defaultAnnotationRangeColor, isRangeAnnotation, } from '@kbn/event-annotation-plugin/public'; -import type { AccessorConfig, FramePublicAPI } from '../types'; +import type { AccessorConfig, FramePublicAPI } from '../../types'; import { getColumnToLabelMap } from './state_helpers'; -import { FormatFactory } from '../../common'; +import { FormatFactory } from '../../../common'; import { isDataLayer, isReferenceLayer, isAnnotationsLayer } from './visualization_helpers'; import { getAnnotationsAccessorColorConfig } from './annotations/helpers'; import { diff --git a/x-pack/plugins/lens/public/xy_visualization/index.ts b/x-pack/plugins/lens/public/visualizations/xy/index.ts similarity index 86% rename from x-pack/plugins/lens/public/xy_visualization/index.ts rename to x-pack/plugins/lens/public/visualizations/xy/index.ts index a7de5374c92d..88a3a4a4ce04 100644 --- a/x-pack/plugins/lens/public/xy_visualization/index.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/index.ts @@ -10,9 +10,9 @@ import { EventAnnotationPluginSetup } from '@kbn/event-annotation-plugin/public' import type { ExpressionsSetup } from '@kbn/expressions-plugin/public'; import type { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import { LEGACY_TIME_AXIS } from '@kbn/charts-plugin/common'; -import type { EditorFrameSetup } from '../types'; -import type { LensPluginStartDependencies } from '../plugin'; -import type { FormatFactory } from '../../common'; +import type { EditorFrameSetup } from '../../types'; +import type { LensPluginStartDependencies } from '../../plugin'; +import type { FormatFactory } from '../../../common'; export interface XyVisualizationPluginSetupPlugins { expressions: ExpressionsSetup; @@ -28,7 +28,7 @@ export class XyVisualization { { editorFrame }: XyVisualizationPluginSetupPlugins ) { editorFrame.registerVisualization(async () => { - const { getXyVisualization } = await import('../async_services'); + const { getXyVisualization } = await import('../../async_services'); const [, { charts, data, fieldFormats, eventAnnotation }] = await core.getStartServices(); const palettes = await charts.palettes.getPalettes(); const eventAnnotationService = await eventAnnotation.getService(); diff --git a/x-pack/plugins/lens/public/xy_visualization/reference_line_helpers.test.ts b/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.test.ts similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/reference_line_helpers.test.ts rename to x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.test.ts index d83847cb54ca..61f32b3adfc6 100644 --- a/x-pack/plugins/lens/public/xy_visualization/reference_line_helpers.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FramePublicAPI } from '../types'; +import { FramePublicAPI } from '../../types'; import { computeOverallDataDomain, getStaticValue } from './reference_line_helpers'; import { XYDataLayerConfig } from './types'; diff --git a/x-pack/plugins/lens/public/xy_visualization/reference_line_helpers.tsx b/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/reference_line_helpers.tsx rename to x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx index fb308fc43c24..293dd8e67db8 100644 --- a/x-pack/plugins/lens/public/xy_visualization/reference_line_helpers.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx @@ -8,8 +8,8 @@ import { groupBy, partition } from 'lodash'; import { i18n } from '@kbn/i18n'; import { Datatable } from '@kbn/expressions-plugin/public'; -import { layerTypes } from '../../common'; -import type { DatasourceLayers, FramePublicAPI, Visualization } from '../types'; +import { layerTypes } from '../../../common'; +import type { DatasourceLayers, FramePublicAPI, Visualization } from '../../types'; import { groupAxesByType } from './axes_configuration'; import { isHorizontalChart, isPercentageSeries, isStackedChart } from './state_helpers'; import type { @@ -27,8 +27,8 @@ import { isNumericMetric, isReferenceLayer, } from './visualization_helpers'; -import { generateId } from '../id_generator'; -import { LensIconChartBarReferenceLine } from '../assets/chart_bar_reference_line'; +import { generateId } from '../../id_generator'; +import { LensIconChartBarReferenceLine } from '../../assets/chart_bar_reference_line'; import { defaultReferenceLineColor } from './color_assignment'; export interface ReferenceLineBase { diff --git a/x-pack/plugins/lens/public/xy_visualization/state_helpers.ts b/x-pack/plugins/lens/public/visualizations/xy/state_helpers.ts similarity index 97% rename from x-pack/plugins/lens/public/xy_visualization/state_helpers.ts rename to x-pack/plugins/lens/public/visualizations/xy/state_helpers.ts index 975676e241b7..4831c05b12af 100644 --- a/x-pack/plugins/lens/public/xy_visualization/state_helpers.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/state_helpers.ts @@ -6,7 +6,7 @@ */ import { EuiIconType } from '@elastic/eui/src/components/icon/icon'; -import type { FramePublicAPI, DatasourcePublicAPI } from '../types'; +import type { FramePublicAPI, DatasourcePublicAPI } from '../../types'; import { visualizationTypes, XYLayerConfig, diff --git a/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts b/x-pack/plugins/lens/public/visualizations/xy/to_expression.test.ts similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts rename to x-pack/plugins/lens/public/visualizations/xy/to_expression.test.ts index f0a2b9f28623..02b36d6b27c4 100644 --- a/x-pack/plugins/lens/public/xy_visualization/to_expression.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/to_expression.test.ts @@ -10,9 +10,9 @@ import { Position } from '@elastic/charts'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { createDatatableUtilitiesMock } from '@kbn/data-plugin/common/mocks'; import { getXyVisualization } from './xy_visualization'; -import { OperationDescriptor } from '../types'; -import { createMockDatasource, createMockFramePublicAPI } from '../mocks'; -import { layerTypes } from '../../common'; +import { OperationDescriptor } from '../../types'; +import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; +import { layerTypes } from '../../../common'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import { eventAnnotationServiceMock } from '@kbn/event-annotation-plugin/public/mocks'; import { defaultReferenceLineColor } from './color_assignment'; diff --git a/x-pack/plugins/lens/public/xy_visualization/to_expression.ts b/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/to_expression.ts rename to x-pack/plugins/lens/public/visualizations/xy/to_expression.ts index 6c06891f530e..491f392c7b6e 100644 --- a/x-pack/plugins/lens/public/xy_visualization/to_expression.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts @@ -19,11 +19,11 @@ import { AxisConfig, } from './types'; import type { ValidXYDataLayerConfig } from './types'; -import { OperationMetadata, DatasourcePublicAPI, DatasourceLayers } from '../types'; +import { OperationMetadata, DatasourcePublicAPI, DatasourceLayers } from '../../types'; import { getColumnToLabelMap } from './state_helpers'; import { hasIcon } from './xy_config_panel/shared/icon_select'; import { defaultReferenceLineColor } from './color_assignment'; -import { getDefaultVisualValuesForLayer } from '../shared_components/datasource_default_values'; +import { getDefaultVisualValuesForLayer } from '../../shared_components/datasource_default_values'; import { getLayerTypeOptions, getDataLayers, @@ -31,8 +31,8 @@ import { getAnnotationsLayers, } from './visualization_helpers'; import { getUniqueLabels } from './annotations/helpers'; -import { layerTypes } from '../../common'; -import { axisExtentConfigToExpression } from '../shared_components'; +import { layerTypes } from '../../../common'; +import { axisExtentConfigToExpression } from '../../shared_components'; export const getSortedAccessors = ( datasource: DatasourcePublicAPI, diff --git a/x-pack/plugins/lens/public/xy_visualization/types.ts b/x-pack/plugins/lens/public/visualizations/xy/types.ts similarity index 88% rename from x-pack/plugins/lens/public/xy_visualization/types.ts rename to x-pack/plugins/lens/public/visualizations/xy/types.ts index 58c4cfb7e26c..c2ca25c61c42 100644 --- a/x-pack/plugins/lens/public/xy_visualization/types.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/types.ts @@ -22,19 +22,19 @@ import type { YAxisConfig, } from '@kbn/expression-xy-plugin/common'; import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; -import { LensIconChartArea } from '../assets/chart_area'; -import { LensIconChartAreaStacked } from '../assets/chart_area_stacked'; -import { LensIconChartAreaPercentage } from '../assets/chart_area_percentage'; -import { LensIconChartBar } from '../assets/chart_bar'; -import { LensIconChartBarStacked } from '../assets/chart_bar_stacked'; -import { LensIconChartBarPercentage } from '../assets/chart_bar_percentage'; -import { LensIconChartBarHorizontal } from '../assets/chart_bar_horizontal'; -import { LensIconChartBarHorizontalStacked } from '../assets/chart_bar_horizontal_stacked'; -import { LensIconChartBarHorizontalPercentage } from '../assets/chart_bar_horizontal_percentage'; -import { LensIconChartLine } from '../assets/chart_line'; +import { LensIconChartArea } from '../../assets/chart_area'; +import { LensIconChartAreaStacked } from '../../assets/chart_area_stacked'; +import { LensIconChartAreaPercentage } from '../../assets/chart_area_percentage'; +import { LensIconChartBar } from '../../assets/chart_bar'; +import { LensIconChartBarStacked } from '../../assets/chart_bar_stacked'; +import { LensIconChartBarPercentage } from '../../assets/chart_bar_percentage'; +import { LensIconChartBarHorizontal } from '../../assets/chart_bar_horizontal'; +import { LensIconChartBarHorizontalStacked } from '../../assets/chart_bar_horizontal_stacked'; +import { LensIconChartBarHorizontalPercentage } from '../../assets/chart_bar_horizontal_percentage'; +import { LensIconChartLine } from '../../assets/chart_line'; -import type { VisualizationType, Suggestion } from '../types'; -import type { ValueLabelConfig } from '../../common/types'; +import type { VisualizationType, Suggestion } from '../../types'; +import type { ValueLabelConfig } from '../../../common/types'; export const YAxisModes = { AUTO: 'auto', diff --git a/x-pack/plugins/lens/public/xy_visualization/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/visualization.test.ts rename to x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts index 397bbb25d8c9..a9848561ecde 100644 --- a/x-pack/plugins/lens/public/xy_visualization/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts @@ -7,7 +7,7 @@ import { getXyVisualization } from './visualization'; import { Position } from '@elastic/charts'; -import { Operation, VisualizeEditorContext, Suggestion, OperationDescriptor } from '../types'; +import { Operation, VisualizeEditorContext, Suggestion, OperationDescriptor } from '../../types'; import type { State, XYState, @@ -18,9 +18,9 @@ import type { SeriesType, } from './types'; import { createDatatableUtilitiesMock } from '@kbn/data-plugin/common/mocks'; -import { layerTypes } from '../../common'; -import { createMockDatasource, createMockFramePublicAPI } from '../mocks'; -import { LensIconChartBar } from '../assets/chart_bar'; +import { layerTypes } from '../../../common'; +import { createMockDatasource, createMockFramePublicAPI } from '../../mocks'; +import { LensIconChartBar } from '../../assets/chart_bar'; import type { VisualizeEditorLayersContext } from '@kbn/visualizations-plugin/public'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; diff --git a/x-pack/plugins/lens/public/xy_visualization/visualization.tsx b/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/visualization.tsx rename to x-pack/plugins/lens/public/visualizations/xy/visualization.tsx index f49e44b67845..f5d241738dd4 100644 --- a/x-pack/plugins/lens/public/xy_visualization/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx @@ -22,7 +22,7 @@ import { getSuggestions } from './xy_suggestions'; import { XyToolbar } from './xy_config_panel'; import { DimensionEditor } from './xy_config_panel/dimension_editor'; import { LayerHeader } from './xy_config_panel/layer_header'; -import type { Visualization, AccessorConfig, FramePublicAPI } from '../types'; +import type { Visualization, AccessorConfig, FramePublicAPI } from '../../types'; import { State, visualizationTypes, @@ -33,7 +33,7 @@ import { YAxisMode, SeriesType, } from './types'; -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; import { isHorizontalChart } from './state_helpers'; import { toExpression, toPreviewExpression, getSortedAccessors } from './to_expression'; import { getAccessorColorConfigs, getColorAssignments } from './color_assignment'; @@ -74,9 +74,9 @@ import { groupAxesByType } from './axes_configuration'; import { XYState } from './types'; import { ReferenceLinePanel } from './xy_config_panel/reference_line_config_panel'; import { AnnotationsPanel } from './xy_config_panel/annotations_config_panel'; -import { DimensionTrigger } from '../shared_components/dimension_trigger'; +import { DimensionTrigger } from '../../shared_components/dimension_trigger'; import { defaultAnnotationLabel } from './annotations/helpers'; -import { onDropForVisualization } from '../editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils'; +import { onDropForVisualization } from '../../editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils'; export const getXyVisualization = ({ datatableUtilities, diff --git a/x-pack/plugins/lens/public/xy_visualization/visualization_helpers.tsx b/x-pack/plugins/lens/public/visualizations/xy/visualization_helpers.tsx similarity index 97% rename from x-pack/plugins/lens/public/xy_visualization/visualization_helpers.tsx rename to x-pack/plugins/lens/public/visualizations/xy/visualization_helpers.tsx index e89edab464bf..c36916f7f030 100644 --- a/x-pack/plugins/lens/public/xy_visualization/visualization_helpers.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization_helpers.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { uniq } from 'lodash'; -import { DatasourceLayers, OperationMetadata, VisualizationType } from '../types'; +import { DatasourceLayers, OperationMetadata, VisualizationType } from '../../types'; import { State, visualizationTypes, @@ -19,11 +19,11 @@ import { SeriesType, } from './types'; import { isHorizontalChart } from './state_helpers'; -import { layerTypes } from '..'; -import { LensIconChartBarHorizontal } from '../assets/chart_bar_horizontal'; -import { LensIconChartMixedXy } from '../assets/chart_mixed_xy'; -import { LensIconChartBarStacked } from '../assets/chart_bar_stacked'; -import { LayerType } from '../../common'; +import { layerTypes } from '../..'; +import { LensIconChartBarHorizontal } from '../../assets/chart_bar_horizontal'; +import { LensIconChartMixedXy } from '../../assets/chart_mixed_xy'; +import { LensIconChartBarStacked } from '../../assets/chart_bar_stacked'; +import { LayerType } from '../../../common'; export function getAxisName( axis: 'x' | 'y' | 'yLeft' | 'yRight', diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/annotations_panel.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/annotations_panel.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx index 5d6a807a262b..6c6a425c1409 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/annotations_panel.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx @@ -36,8 +36,12 @@ import { } from '@kbn/event-annotation-plugin/public'; import Color from 'color'; import { getDataLayers } from '../../visualization_helpers'; -import { FormatFactory } from '../../../../common'; -import { DimensionEditorSection, NameInput, useDebouncedValue } from '../../../shared_components'; +import { FormatFactory } from '../../../../../common'; +import { + DimensionEditorSection, + NameInput, + useDebouncedValue, +} from '../../../../shared_components'; import { isHorizontalChart } from '../../state_helpers'; import { defaultAnnotationLabel, defaultRangeAnnotationLabel } from '../../annotations/helpers'; import { ColorPicker } from '../color_picker'; @@ -45,7 +49,7 @@ import { IconSelectSetting, TextDecorationSetting } from '../shared/marker_decor import { LineStyleSettings } from '../shared/line_style_settings'; import { updateLayer } from '..'; import { annotationsIconSet } from './icon_set'; -import type { FramePublicAPI, VisualizationDimensionEditorProps } from '../../../types'; +import type { FramePublicAPI, VisualizationDimensionEditorProps } from '../../../../types'; import { State, XYState, XYAnnotationLayerConfig, XYDataLayerConfig } from '../../types'; export const toRangeAnnotationColor = (color = defaultAnnotationColor) => { diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/icon_set.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/icon_set.ts similarity index 97% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/icon_set.ts rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/icon_set.ts index 32721285a447..80cf7eccc962 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/icon_set.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/icon_set.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { AvailableAnnotationIcon } from '@kbn/event-annotation-plugin/common'; -import { IconTriangle, IconCircle } from '../../../assets/annotation_icons'; +import { IconTriangle, IconCircle } from '../../../../assets/annotation_icons'; import { IconSet } from '../shared/icon_select'; export const annotationsIconSet: IconSet = [ diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.scss b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.scss similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.scss rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.scss diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx similarity index 97% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.test.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx index 40d367072d1e..330fbf1f55da 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.test.tsx @@ -9,9 +9,9 @@ import React from 'react'; import { mountWithIntl as mount } from '@kbn/test-jest-helpers'; import { createDatatableUtilitiesMock } from '@kbn/data-plugin/common/mocks'; import { AnnotationsPanel } from '.'; -import { FramePublicAPI } from '../../../types'; -import { layerTypes } from '../../..'; -import { createMockFramePublicAPI } from '../../../mocks'; +import { FramePublicAPI } from '../../../../types'; +import { layerTypes } from '../../../..'; +import { createMockFramePublicAPI } from '../../../../mocks'; import { State } from '../../types'; import { Position } from '@elastic/charts'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/annotations_config_panel/index.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.scss b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.scss similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.scss rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.scss diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.test.tsx similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.test.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.test.tsx index 692aa25845b6..3589e0ff23d8 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { AxisSettingsPopover, AxisSettingsPopoverProps } from './axis_settings_popover'; -import { ToolbarPopover } from '../../shared_components'; -import { layerTypes } from '../../../common'; +import { ToolbarPopover } from '../../../shared_components'; +import { layerTypes } from '../../../../common'; import { ShallowWrapper } from 'enzyme'; function getRangeInputComponent(component: ShallowWrapper) { diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.tsx similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.tsx index 263a9131e129..65d7b9428148 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/axis_settings_popover.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.tsx @@ -25,12 +25,12 @@ import { AxisTitleSettings, RangeInputField, BucketAxisBoundsControl, -} from '../../shared_components'; +} from '../../../shared_components'; import { isHorizontalChart } from '../state_helpers'; -import { EuiIconAxisBottom } from '../../assets/axis_bottom'; -import { EuiIconAxisLeft } from '../../assets/axis_left'; -import { EuiIconAxisRight } from '../../assets/axis_right'; -import { EuiIconAxisTop } from '../../assets/axis_top'; +import { EuiIconAxisBottom } from '../../../assets/axis_bottom'; +import { EuiIconAxisLeft } from '../../../assets/axis_left'; +import { EuiIconAxisRight } from '../../../assets/axis_right'; +import { EuiIconAxisTop } from '../../../assets/axis_top'; import { validateExtent } from '../axes_configuration'; import './axis_settings_popover.scss'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/color_picker.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/color_picker.tsx similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/color_picker.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/color_picker.tsx index 2f3b00befc2d..2d0b28f4fac9 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/color_picker.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/color_picker.tsx @@ -16,7 +16,7 @@ import { EuiIcon, euiPaletteColorBlind, } from '@elastic/eui'; -import { TooltipWrapper } from '../../shared_components'; +import { TooltipWrapper } from '../../../shared_components'; const tooltipContent = { auto: i18n.translate('xpack.lens.configPanel.color.tooltip.auto', { diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/dimension_editor.tsx similarity index 96% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/dimension_editor.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/dimension_editor.tsx index 4e3e23c4b1da..3c0c2239aaf2 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/dimension_editor.tsx @@ -10,16 +10,16 @@ import { i18n } from '@kbn/i18n'; import { EuiButtonGroup, EuiFormRow, htmlIdGenerator } from '@elastic/eui'; import type { PaletteRegistry } from '@kbn/coloring'; import type { DatatableUtilitiesService } from '@kbn/data-plugin/common'; -import type { VisualizationDimensionEditorProps } from '../../types'; +import type { VisualizationDimensionEditorProps } from '../../../types'; import { State, XYState, XYDataLayerConfig, YConfig, YAxisMode } from '../types'; -import { FormatFactory } from '../../../common'; +import { FormatFactory } from '../../../../common'; import { getSeriesColor, isHorizontalChart } from '../state_helpers'; import { ColorPicker } from './color_picker'; -import { PalettePicker, useDebouncedValue } from '../../shared_components'; +import { PalettePicker, useDebouncedValue } from '../../../shared_components'; import { getDataLayers, isAnnotationsLayer, isReferenceLayer } from '../visualization_helpers'; import { ReferenceLinePanel } from './reference_line_config_panel'; import { AnnotationsPanel } from './annotations_config_panel'; -import { CollapseSetting } from '../../shared_components/collapse_setting'; +import { CollapseSetting } from '../../../shared_components/collapse_setting'; import { getSortedAccessors } from '../to_expression'; import { getColorAssignments, getAssignedColorConfig } from '../color_assignment'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/index.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/index.tsx similarity index 98% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/index.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/index.tsx index 4a160cf34240..d771edd9f10d 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/index.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/index.tsx @@ -11,18 +11,18 @@ import { Position, ScaleType } from '@elastic/charts'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { AxisExtentConfig } from '@kbn/expression-xy-plugin/common'; import { LegendSize } from '@kbn/visualizations-plugin/public'; -import type { VisualizationToolbarProps, FramePublicAPI } from '../../types'; +import type { VisualizationToolbarProps, FramePublicAPI } from '../../../types'; import { State, XYState, AxesSettingsConfig } from '../types'; import { isHorizontalChart } from '../state_helpers'; -import { hasNumericHistogramDimension, LegendSettingsPopover } from '../../shared_components'; +import { hasNumericHistogramDimension, LegendSettingsPopover } from '../../../shared_components'; import { AxisSettingsPopover } from './axis_settings_popover'; import { getAxesConfiguration, getXDomain, GroupsConfiguration } from '../axes_configuration'; import { VisualOptionsPopover } from './visual_options_popover'; import { getScaleType } from '../to_expression'; -import { TooltipWrapper } from '../../shared_components'; -import { getDefaultVisualValuesForLayer } from '../../shared_components/datasource_default_values'; +import { TooltipWrapper } from '../../../shared_components'; +import { getDefaultVisualValuesForLayer } from '../../../shared_components/datasource_default_values'; import { getDataLayers } from '../visualization_helpers'; -import { LegendSettingsPopoverProps } from '../../shared_components/legend_settings_popover'; +import { LegendSettingsPopoverProps } from '../../../shared_components/legend_settings_popover'; type UnwrapArray = T extends Array ? P : T; type AxesSettingsConfigKeys = keyof AxesSettingsConfig; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/layer_header.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/layer_header.tsx similarity index 94% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/layer_header.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/layer_header.tsx index d5523a0b1091..44d9f342cfcd 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/layer_header.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/layer_header.tsx @@ -9,12 +9,12 @@ import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiIcon, EuiPopover, EuiSelectable, EuiText, EuiPopoverTitle } from '@elastic/eui'; import { ToolbarButton } from '@kbn/kibana-react-plugin/public'; -import type { VisualizationLayerWidgetProps, VisualizationType } from '../../types'; +import type { VisualizationLayerWidgetProps, VisualizationType } from '../../../types'; import { State, visualizationTypes, SeriesType } from '../types'; import { isHorizontalChart, isHorizontalSeries } from '../state_helpers'; -import { StaticHeader } from '../../shared_components'; -import { LensIconChartBarReferenceLine } from '../../assets/chart_bar_reference_line'; -import { LensIconChartBarAnnotations } from '../../assets/chart_bar_annotations'; +import { StaticHeader } from '../../../shared_components'; +import { LensIconChartBarReferenceLine } from '../../../assets/chart_bar_reference_line'; +import { LensIconChartBarAnnotations } from '../../../assets/chart_bar_annotations'; import { updateLayer } from '.'; import { isAnnotationsLayer, isDataLayer, isReferenceLayer } from '../visualization_helpers'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_config_panel/icon_set.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/icon_set.ts similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_config_panel/icon_set.ts rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/icon_set.ts diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_config_panel/index.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/index.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_config_panel/index.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/index.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx similarity index 97% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx index fd4cad44c324..a64e9b07f488 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx @@ -10,13 +10,13 @@ import { i18n } from '@kbn/i18n'; import { EuiButtonGroup, EuiFormRow } from '@elastic/eui'; import type { PaletteRegistry } from '@kbn/coloring'; import { FillStyle } from '@kbn/expression-xy-plugin/common'; -import type { VisualizationDimensionEditorProps } from '../../../types'; +import type { VisualizationDimensionEditorProps } from '../../../../types'; import { State, XYState, XYReferenceLineLayerConfig, YConfig } from '../../types'; -import { FormatFactory } from '../../../../common'; +import { FormatFactory } from '../../../../../common'; import { ColorPicker } from '../color_picker'; import { updateLayer } from '..'; -import { useDebouncedValue } from '../../../shared_components'; +import { useDebouncedValue } from '../../../../shared_components'; import { idPrefix } from '../dimension_editor'; import { isHorizontalChart } from '../../state_helpers'; import { diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/icon_select.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/icon_select.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/icon_select.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/icon_select.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/line_style_settings.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/line_style_settings.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/line_style_settings.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/line_style_settings.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/marker_decoration_settings.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/marker_decoration_settings.tsx similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/marker_decoration_settings.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/marker_decoration_settings.tsx index 561e336400a3..e11c69f766a3 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/shared/marker_decoration_settings.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/marker_decoration_settings.tsx @@ -11,7 +11,7 @@ import { EuiButtonGroup, EuiFormRow } from '@elastic/eui'; import { IconPosition } from '@kbn/expression-xy-plugin/common'; import { YAxisMode } from '../../types'; -import { TooltipWrapper } from '../../../shared_components'; +import { TooltipWrapper } from '../../../../shared_components'; import { hasIcon, IconSelect, IconSet } from './icon_select'; import { idPrefix } from '../dimension_editor'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/end_value_definitions.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/end_value_definitions.ts similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/end_value_definitions.ts rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/end_value_definitions.ts diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.test.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.test.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.tsx similarity index 95% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.tsx index 09b381dd03f7..236fc4c9eec7 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fill_opacity_option.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiRange } from '@elastic/eui'; -import { useDebouncedValue } from '../../../shared_components'; +import { useDebouncedValue } from '../../../../shared_components'; export interface FillOpacityOptionProps { /** diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fitting_function_definitions.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fitting_function_definitions.ts similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/fitting_function_definitions.ts rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fitting_function_definitions.ts diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/index.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/index.tsx similarity index 97% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/index.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/index.tsx index ba8a246043bf..dc621b8b236e 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/index.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/index.tsx @@ -7,13 +7,13 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { ToolbarPopover, TooltipWrapper, ValueLabelsSettings } from '../../../shared_components'; +import { ToolbarPopover, TooltipWrapper, ValueLabelsSettings } from '../../../../shared_components'; import { MissingValuesOptions } from './missing_values_option'; import { LineCurveOption } from './line_curve_option'; import { FillOpacityOption } from './fill_opacity_option'; import { XYState } from '../../types'; import { hasHistogramSeries } from '../../state_helpers'; -import type { FramePublicAPI } from '../../../types'; +import type { FramePublicAPI } from '../../../../types'; import { getDataLayers } from '../../visualization_helpers'; function getValueLabelDisableReason({ diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/line_curve_option.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/line_curve_option.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/line_curve_option.test.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/line_curve_option.test.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/line_curve_option.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/line_curve_option.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/line_curve_option.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/line_curve_option.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/missing_value_option.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/missing_value_option.test.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/missing_value_option.test.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/missing_value_option.test.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/missing_values_option.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/missing_values_option.tsx similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/missing_values_option.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/missing_values_option.tsx diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx similarity index 97% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx index 5b91ee70c694..f48b8710d26d 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/visual_options_popover.test.tsx @@ -8,14 +8,14 @@ import React from 'react'; import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; import { Position } from '@elastic/charts'; -import type { FramePublicAPI } from '../../../types'; -import { createMockDatasource, createMockFramePublicAPI } from '../../../mocks'; +import type { FramePublicAPI } from '../../../../types'; +import { createMockDatasource, createMockFramePublicAPI } from '../../../../mocks'; import { State, XYLayerConfig } from '../../types'; import { VisualOptionsPopover } from '.'; -import { ToolbarPopover, ValueLabelsSettings } from '../../../shared_components'; +import { ToolbarPopover, ValueLabelsSettings } from '../../../../shared_components'; import { MissingValuesOptions } from './missing_values_option'; import { FillOpacityOption } from './fill_opacity_option'; -import { layerTypes } from '../../../../common'; +import { layerTypes } from '../../../../../common'; describe('Visual options popover', () => { let frame: FramePublicAPI; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/xy_config_panel.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/xy_config_panel.test.tsx similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/xy_config_panel/xy_config_panel.test.tsx rename to x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/xy_config_panel.test.tsx index f28e932ae2ca..83a14812b606 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_config_panel/xy_config_panel.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/xy_config_panel.test.tsx @@ -12,13 +12,13 @@ import { createDatatableUtilitiesMock } from '@kbn/data-plugin/common/mocks'; import { XyToolbar } from '.'; import { DimensionEditor } from './dimension_editor'; import { AxisSettingsPopover } from './axis_settings_popover'; -import { FramePublicAPI } from '../../types'; +import { FramePublicAPI } from '../../../types'; import { State, XYState, XYDataLayerConfig } from '../types'; import { Position } from '@elastic/charts'; -import { createMockFramePublicAPI, createMockDatasource } from '../../mocks'; +import { createMockFramePublicAPI, createMockDatasource } from '../../../mocks'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { EuiColorPicker } from '@elastic/eui'; -import { layerTypes } from '../../../common'; +import { layerTypes } from '../../../../common'; import { act } from 'react-dom/test-utils'; jest.mock('lodash', () => { diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.test.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.test.ts similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/xy_suggestions.test.ts rename to x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.test.ts index 14750dd34a12..52039d68a9fe 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.test.ts @@ -6,7 +6,7 @@ */ import { getSuggestions } from './xy_suggestions'; -import type { TableSuggestionColumn, VisualizationSuggestion, TableSuggestion } from '../types'; +import type { TableSuggestionColumn, VisualizationSuggestion, TableSuggestion } from '../../types'; import { State, XYState, @@ -14,17 +14,17 @@ import { XYAnnotationLayerConfig, XYDataLayerConfig, } from './types'; -import { generateId } from '../id_generator'; +import { generateId } from '../../id_generator'; import { getXyVisualization } from './xy_visualization'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { createDatatableUtilitiesMock } from '@kbn/data-plugin/common/mocks'; import { eventAnnotationServiceMock } from '@kbn/event-annotation-plugin/public/mocks'; import type { PaletteOutput } from '@kbn/coloring'; -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import { themeServiceMock } from '@kbn/core/public/mocks'; -jest.mock('../id_generator'); +jest.mock('../../id_generator'); const xyVisualization = getXyVisualization({ datatableUtilities: createDatatableUtilitiesMock(), diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.ts similarity index 99% rename from x-pack/plugins/lens/public/xy_visualization/xy_suggestions.ts rename to x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.ts index ca42aabe616b..7ae9374f0de9 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_suggestions.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.ts @@ -15,7 +15,7 @@ import { TableSuggestionColumn, TableSuggestion, TableChangeType, -} from '../types'; +} from '../../types'; import { State, XYState, @@ -24,7 +24,7 @@ import { XYDataLayerConfig, SeriesType, } from './types'; -import { layerTypes } from '../../common'; +import { layerTypes } from '../../../common'; import { getIconForSeries } from './state_helpers'; import { getDataLayers, isDataLayer } from './visualization_helpers'; diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_visualization.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_visualization.ts similarity index 100% rename from x-pack/plugins/lens/public/xy_visualization/xy_visualization.ts rename to x-pack/plugins/lens/public/visualizations/xy/xy_visualization.ts diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable.tsx b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable.tsx index bb239868aed7..639136b16947 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable.tsx +++ b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable.tsx @@ -53,6 +53,10 @@ export class AnomalySwimlaneEmbeddable extends Embeddable< ); } + public reportsEmbeddableLoad() { + return true; + } + public onLoading() { this.renderComplete.dispatchInProgress(); this.updateOutput({ loading: true, error: undefined }); diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_initializer.tsx b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_initializer.tsx index 4fc43fc640b9..e5e2c2fd3b6b 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_initializer.tsx +++ b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_initializer.tsx @@ -25,17 +25,19 @@ import { i18n } from '@kbn/i18n'; import { SWIMLANE_TYPE, SwimlaneType } from '../../application/explorer/explorer_constants'; import { AnomalySwimlaneEmbeddableInput } from '..'; +interface ExplicitInput { + panelTitle: string; + swimlaneType: SwimlaneType; + viewBy?: string; +} + export interface AnomalySwimlaneInitializerProps { defaultTitle: string; influencers: string[]; initialInput?: Partial< Pick >; - onCreate: (swimlaneProps: { - panelTitle: string; - swimlaneType: SwimlaneType; - viewBy?: string; - }) => void; + onCreate: (swimlaneProps: ExplicitInput) => void; onCancel: () => void; } @@ -47,7 +49,7 @@ export const AnomalySwimlaneInitializer: FC = ( initialInput, }) => { const [panelTitle, setPanelTitle] = useState(defaultTitle); - const [swimlaneType, setSwimlaneType] = useState( + const [swimlaneType, setSwimlaneType] = useState( initialInput?.swimlaneType ?? SWIMLANE_TYPE.OVERALL ); const [viewBySwimlaneFieldName, setViewBySwimlaneFieldName] = useState(initialInput?.viewBy); @@ -81,6 +83,12 @@ export const AnomalySwimlaneInitializer: FC = ( (swimlaneType === SWIMLANE_TYPE.OVERALL || (swimlaneType === SWIMLANE_TYPE.VIEW_BY && !!viewBySwimlaneFieldName)); + const resultInput = { + panelTitle, + swimlaneType, + ...(viewBySwimlaneFieldName ? { viewBy: viewBySwimlaneFieldName } : {}), + }; + return ( @@ -162,15 +170,7 @@ export const AnomalySwimlaneInitializer: FC = ( /> - + { + onCreate={(explicitInput) => { modalSession.close(); resolve({ jobIds, - title: panelTitle, - swimlaneType, - viewBy, + title: explicitInput.panelTitle, + ...explicitInput, }); }} onCancel={() => { diff --git a/x-pack/plugins/observability/kibana.json b/x-pack/plugins/observability/kibana.json index 32fa62976288..5464bffccd9c 100644 --- a/x-pack/plugins/observability/kibana.json +++ b/x-pack/plugins/observability/kibana.json @@ -31,7 +31,8 @@ "triggersActionsUi", "inspector", "unifiedSearch", - "sharedUX" + "sharedUX", + "security" ], "ui": true, "server": true, diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index 15cc0463feef..617dce2959f1 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -37,6 +37,7 @@ import { ActionTypeRegistryContract, RuleTypeRegistryContract, } from '@kbn/triggers-actions-ui-plugin/public'; +import { SecurityPluginStart } from '@kbn/security-plugin/public'; import { observabilityAppId, observabilityFeatureId, casesPath } from '../common'; import { createLazyObservabilityPageTemplate } from './components/shared'; import { registerDataHandler } from './data_handler'; @@ -51,6 +52,7 @@ import { getExploratoryViewEmbeddable } from './components/shared/exploratory_vi import { createExploratoryViewUrl } from './components/shared/exploratory_view/configurations/exploratory_view_url'; import { createUseRulesLink } from './hooks/create_use_rules_link'; import getAppDataView from './utils/observability_data_views/get_app_data_view'; + export type ObservabilityPublicSetup = ReturnType; export interface ObservabilityPublicPluginsSetup { @@ -73,6 +75,7 @@ export interface ObservabilityPublicPluginsStart { sharedUX: SharedUXPluginStart; ruleTypeRegistry: RuleTypeRegistryContract; actionTypeRegistry: ActionTypeRegistryContract; + security: SecurityPluginStart; } export type ObservabilityPublicStart = ReturnType; diff --git a/x-pack/plugins/security_solution/common/endpoint/models/policy_config.ts b/x-pack/plugins/security_solution/common/endpoint/models/policy_config.ts index a6e40325cac4..3ae8c8f6d064 100644 --- a/x-pack/plugins/security_solution/common/endpoint/models/policy_config.ts +++ b/x-pack/plugins/security_solution/common/endpoint/models/policy_config.ts @@ -153,7 +153,7 @@ export const policyFactoryWithoutPaidFeatures = ( ): PolicyConfig => { const rollbackConfig = { rollback: { - remediation: { + self_healing: { enabled: false, }, }, diff --git a/x-pack/plugins/security_solution/common/endpoint/types/index.ts b/x-pack/plugins/security_solution/common/endpoint/types/index.ts index 2f66b9848fb9..6e72d411768e 100644 --- a/x-pack/plugins/security_solution/common/endpoint/types/index.ts +++ b/x-pack/plugins/security_solution/common/endpoint/types/index.ts @@ -923,7 +923,7 @@ export interface PolicyConfig { alerts?: { [key: string]: unknown; rollback: { - remediation: { + self_healing: { enabled: boolean; }; }; diff --git a/x-pack/plugins/security_solution/common/license/policy_config.test.ts b/x-pack/plugins/security_solution/common/license/policy_config.test.ts index 97e18399cd26..d0066eeb051a 100644 --- a/x-pack/plugins/security_solution/common/license/policy_config.test.ts +++ b/x-pack/plugins/security_solution/common/license/policy_config.test.ts @@ -125,14 +125,14 @@ describe('policy_config and licenses', () => { it('allows advanced rollback option when Platinum', () => { const policy = policyFactory(); - policy.windows.advanced = { alerts: { rollback: { remediation: { enabled: true } } } }; // make policy change + policy.windows.advanced = { alerts: { rollback: { self_healing: { enabled: true } } } }; // make policy change const valid = isEndpointPolicyValidForLicense(policy, Platinum); expect(valid).toBeTruthy(); }); it('blocks advanced rollback option when below Platinum', () => { const policy = policyFactory(); - policy.windows.advanced = { alerts: { rollback: { remediation: { enabled: true } } } }; // make policy change + policy.windows.advanced = { alerts: { rollback: { self_healing: { enabled: true } } } }; // make policy change let valid = isEndpointPolicyValidForLicense(policy, Gold); expect(valid).toBeFalsy(); @@ -515,7 +515,7 @@ describe('policy_config and licenses', () => { policy.windows.advanced = { alerts: { rollback: { - remediation: { + self_healing: { enabled: true, }, }, diff --git a/x-pack/plugins/security_solution/common/license/policy_config.ts b/x-pack/plugins/security_solution/common/license/policy_config.ts index ac5f0458958d..5e2774ef6a01 100644 --- a/x-pack/plugins/security_solution/common/license/policy_config.ts +++ b/x-pack/plugins/security_solution/common/license/policy_config.ts @@ -234,8 +234,8 @@ function isEndpointAdvancedPolicyValidForLicense(policy: PolicyConfig, license: // only platinum or higher may use rollback if ( - policy.windows.advanced?.alerts?.rollback.remediation.enabled !== - defaults.windows.advanced?.alerts?.rollback.remediation.enabled + policy.windows.advanced?.alerts?.rollback.self_healing.enabled !== + defaults.windows.advanced?.alerts?.rollback.self_healing.enabled ) { return false; } diff --git a/x-pack/plugins/security_solution/cypress/integration/hosts/inspect.spec.ts b/x-pack/plugins/security_solution/cypress/integration/hosts/inspect.spec.ts index 892fc1eb4c7f..8246222f5598 100644 --- a/x-pack/plugins/security_solution/cypress/integration/hosts/inspect.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/hosts/inspect.spec.ts @@ -13,7 +13,6 @@ import { clickInspectButton, closesModal, openStatsAndTables } from '../../tasks import { login, visit, visitHostDetailsPage } from '../../tasks/login'; import { HOSTS_URL } from '../../urls/navigation'; -import { waitForPageToBeLoaded } from '../../tasks/common'; describe('Inspect', () => { before(() => { @@ -22,7 +21,6 @@ describe('Inspect', () => { context('Hosts stats and tables', () => { before(() => { visit(HOSTS_URL); - waitForPageToBeLoaded(); }); afterEach(() => { closesModal(); diff --git a/x-pack/plugins/security_solution/cypress/integration/ml/ml_conditional_links.spec.ts b/x-pack/plugins/security_solution/cypress/integration/ml/ml_conditional_links.spec.ts index 5ab92be404c9..b288ecc537e9 100644 --- a/x-pack/plugins/security_solution/cypress/integration/ml/ml_conditional_links.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/ml/ml_conditional_links.spec.ts @@ -146,7 +146,7 @@ describe('ml conditional links', () => { visitWithoutDateRange(mlHostSingleHostNullKqlQuery); cy.url().should( 'include', - '/app/security/hosts/siem-windows/anomalies?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)))' + '/app/security/hosts/name/siem-windows/anomalies?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)))' ); }); @@ -154,7 +154,7 @@ describe('ml conditional links', () => { visitWithoutDateRange(mlHostSingleHostKqlQueryVariable); cy.url().should( 'include', - '/app/security/hosts/siem-windows/anomalies?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)))' + '/app/security/hosts/name/siem-windows/anomalies?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)))' ); }); @@ -162,7 +162,7 @@ describe('ml conditional links', () => { visitWithoutDateRange(mlHostSingleHostKqlQuery); cy.url().should( 'include', - '/app/security/hosts/siem-windows/anomalies?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&query=(language:kuery,query:%27(process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22)%27)&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)))' + '/app/security/hosts/name/siem-windows/anomalies?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&query=(language:kuery,query:%27(process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22)%27)&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-06-06T06:00:00.000Z%27,kind:absolute,to:%272019-06-07T05:59:59.999Z%27)))' ); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/network/inspect.spec.ts b/x-pack/plugins/security_solution/cypress/integration/network/inspect.spec.ts index 58ba46616cda..c54072799b29 100644 --- a/x-pack/plugins/security_solution/cypress/integration/network/inspect.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/network/inspect.spec.ts @@ -6,7 +6,6 @@ */ import { INSPECT_MODAL, INSPECT_NETWORK_BUTTONS_IN_SECURITY } from '../../screens/inspect'; -import { waitForPageToBeLoaded } from '../../tasks/common'; import { closesModal, openStatsAndTables } from '../../tasks/inspect'; import { login, visit } from '../../tasks/login'; @@ -18,7 +17,6 @@ describe('Inspect', () => { before(() => { login(); visit(NETWORK_URL); - waitForPageToBeLoaded(); }); afterEach(() => { closesModal(); diff --git a/x-pack/plugins/security_solution/cypress/integration/urls/state.spec.ts b/x-pack/plugins/security_solution/cypress/integration/urls/state.spec.ts index faedd11b1d12..cc1cfdf40009 100644 --- a/x-pack/plugins/security_solution/cypress/integration/urls/state.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/urls/state.spec.ts @@ -255,7 +255,7 @@ describe('url state', () => { cy.get(ANOMALIES_TAB).should( 'have.attr', 'href', - "/app/security/hosts/siem-kibana/anomalies?sourcerer=(default:(id:security-solution-default,selectedPatterns:!('auditbeat-*')))&timerange=(global:(linkTo:!(timeline),timerange:(from:'2019-08-01T20:03:29.186Z',kind:absolute,to:'2023-01-01T21:33:29.186Z')),timeline:(linkTo:!(global),timerange:(from:'2019-08-01T20:03:29.186Z',kind:absolute,to:'2023-01-01T21:33:29.186Z')))&query=(language:kuery,query:'agent.type:%20%22auditbeat%22%20')" + "/app/security/hosts/name/siem-kibana/anomalies?sourcerer=(default:(id:security-solution-default,selectedPatterns:!('auditbeat-*')))&timerange=(global:(linkTo:!(timeline),timerange:(from:'2019-08-01T20:03:29.186Z',kind:absolute,to:'2023-01-01T21:33:29.186Z')),timeline:(linkTo:!(global),timerange:(from:'2019-08-01T20:03:29.186Z',kind:absolute,to:'2023-01-01T21:33:29.186Z')))&query=(language:kuery,query:'agent.type:%20%22auditbeat%22%20')" ); cy.get(BREADCRUMBS) @@ -270,7 +270,7 @@ describe('url state', () => { .should( 'have.attr', 'href', - `/app/security/hosts/siem-kibana?sourcerer=(default:(id:security-solution-default,selectedPatterns:!('auditbeat-*')))&query=(language:kuery,query:'agent.type:%20%22auditbeat%22%20')&timerange=(global:(linkTo:!(timeline),timerange:(from:'2019-08-01T20:03:29.186Z',kind:absolute,to:'2023-01-01T21:33:29.186Z')),timeline:(linkTo:!(global),timerange:(from:'2019-08-01T20:03:29.186Z',kind:absolute,to:'2023-01-01T21:33:29.186Z')))` + `/app/security/hosts/name/siem-kibana?sourcerer=(default:(id:security-solution-default,selectedPatterns:!('auditbeat-*')))&query=(language:kuery,query:'agent.type:%20%22auditbeat%22%20')&timerange=(global:(linkTo:!(timeline),timerange:(from:'2019-08-01T20:03:29.186Z',kind:absolute,to:'2023-01-01T21:33:29.186Z')),timeline:(linkTo:!(global),timerange:(from:'2019-08-01T20:03:29.186Z',kind:absolute,to:'2023-01-01T21:33:29.186Z')))` ); }); diff --git a/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_hosts.tsx b/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_hosts.tsx index 831ac9bb4f4c..caa9c00e1a90 100644 --- a/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_hosts.tsx +++ b/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_hosts.tsx @@ -15,10 +15,10 @@ export const getTabsOnHostsUrl = (tabName: HostsTableType, search?: string) => `/${tabName}${appendSearch(search)}`; export const getHostDetailsUrl = (detailName: string, search?: string) => - `/${detailName}${appendSearch(search)}`; + `/name/${detailName}${appendSearch(search)}`; export const getTabsOnHostDetailsUrl = ( detailName: string, tabName: HostsTableType, search?: string -) => `/${detailName}/${tabName}${appendSearch(search)}`; +) => `/name/${detailName}/${tabName}${appendSearch(search)}`; diff --git a/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_users.tsx b/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_users.tsx index 20171634ad6e..8a90810228d0 100644 --- a/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_users.tsx +++ b/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_users.tsx @@ -9,10 +9,10 @@ import type { UsersTableType } from '../../../users/store/model'; import { appendSearch } from './helpers'; export const getUsersDetailsUrl = (detailName: string, search?: string) => - `/${detailName}${appendSearch(search)}`; + `/name/${detailName}${appendSearch(search)}`; export const getTabsOnUsersDetailsUrl = ( detailName: string, tabName: UsersTableType, search?: string -) => `/${detailName}/${tabName}${appendSearch(search)}`; +) => `/name/${detailName}/${tabName}${appendSearch(search)}`; diff --git a/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx index 13fdb96b86ae..478916c2b6c0 100644 --- a/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx @@ -60,13 +60,13 @@ describe('Custom Links', () => { describe('HostDetailsLink', () => { test('should render valid link to Host Details with hostName as the display text', () => { const wrapper = mount(); - expect(wrapper.find('EuiLink').prop('href')).toEqual(`/${encodeURIComponent(hostName)}`); + expect(wrapper.find('EuiLink').prop('href')).toEqual(`/name/${encodeURIComponent(hostName)}`); expect(wrapper.text()).toEqual(hostName); }); test('should render valid link to Host Details with child text as the display text', () => { const wrapper = mount({hostName}); - expect(wrapper.find('EuiLink').prop('href')).toEqual(`/${encodeURIComponent(hostName)}`); + expect(wrapper.find('EuiLink').prop('href')).toEqual(`/name/${encodeURIComponent(hostName)}`); expect(wrapper.text()).toEqual(hostName); }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/ml/conditional_links/ml_host_conditional_container.tsx b/x-pack/plugins/security_solution/public/common/components/ml/conditional_links/ml_host_conditional_container.tsx index a18d51cb6377..17b46ca39819 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/conditional_links/ml_host_conditional_container.tsx +++ b/x-pack/plugins/security_solution/public/common/components/ml/conditional_links/ml_host_conditional_container.tsx @@ -88,7 +88,9 @@ export const MlHostConditionalContainer = React.memo(() => { }); return ( - + ); } }} diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts b/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts index 43ed208148ca..585e5f094da7 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts @@ -240,7 +240,7 @@ describe('Navigation Breadcrumbs', () => { hostsBreadcrumbs, { text: 'siem-kibana', - href: 'securitySolutionUI/hosts/siem-kibana', + href: 'securitySolutionUI/hosts/name/siem-kibana', }, { text: 'Authentications', href: '' }, ]); @@ -458,7 +458,7 @@ describe('Navigation Breadcrumbs', () => { }), expect.objectContaining({ text: 'siem-kibana', - href: 'securitySolutionUI/hosts/siem-kibana', + href: 'securitySolutionUI/hosts/name/siem-kibana', onClick: expect.any(Function), }), { @@ -556,7 +556,7 @@ describe('Navigation Breadcrumbs', () => { hostsBreadcrumbs, { text: 'siem-kibana', - href: 'securitySolutionUI/hosts/siem-kibana', + href: 'securitySolutionUI/hosts/name/siem-kibana', }, { text: 'Authentications', href: '' }, ]); @@ -787,7 +787,7 @@ describe('Navigation Breadcrumbs', () => { }), expect.objectContaining({ text: 'siem-kibana', - href: 'securitySolutionUI/hosts/siem-kibana', + href: 'securitySolutionUI/hosts/name/siem-kibana', onClick: expect.any(Function), }), { diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/tab_navigation/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/navigation/tab_navigation/index.test.tsx index 2648ac258b11..c5aa5fbfce88 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/tab_navigation/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/navigation/tab_navigation/index.test.tsx @@ -89,7 +89,7 @@ describe('Table Navigation', () => { `EuiTab[data-test-subj="navigation-${HostsTableType.authentications}"]` ); expect(firstTab.props().href).toBe( - `/app/securitySolutionUI/hosts/siem-window/authentications${SEARCH_QUERY}` + `/app/securitySolutionUI/hosts/name/siem-window/authentications${SEARCH_QUERY}` ); }); diff --git a/x-pack/plugins/security_solution/public/hosts/pages/details/details_tabs.test.tsx b/x-pack/plugins/security_solution/public/hosts/pages/details/details_tabs.test.tsx index da7495d79695..e40c32883e0c 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/details/details_tabs.test.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/details/details_tabs.test.tsx @@ -97,7 +97,7 @@ describe('body', () => { test(`it should pass expected object properties to ${componentName}`, () => { const wrapper = mount( - + - `${HOSTS_PATH}/${hostName}/${tabName}`; + `${HOSTS_PATH}/name/${hostName}/${tabName}`; export const navTabsHostDetails = ({ hasMlUserPermissions, diff --git a/x-pack/plugins/security_solution/public/hosts/pages/index.tsx b/x-pack/plugins/security_solution/public/hosts/pages/index.tsx index 105ab3e6e415..57f164ddd3b2 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/index.tsx @@ -55,7 +55,7 @@ export const HostsContainer = React.memo(() => ( /> )} /> - ( }) => ( )} /> - - ( + + )} + /> + ( diff --git a/x-pack/plugins/security_solution/public/hosts/pages/types.ts b/x-pack/plugins/security_solution/public/hosts/pages/types.ts index a102d9b06072..17e2af205f79 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/types.ts +++ b/x-pack/plugins/security_solution/public/hosts/pages/types.ts @@ -13,7 +13,7 @@ import type { GlobalTimeArgs } from '../../common/containers/use_global_time'; import type { InputsModelId } from '../../common/store/inputs/constants'; import { HOSTS_PATH } from '../../../common/constants'; -export const hostDetailsPagePath = `${HOSTS_PATH}/:detailName`; +export const hostDetailsPagePath = `${HOSTS_PATH}/name/:detailName`; export type HostsTabsProps = GlobalTimeArgs & { filterQuery: string; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/models/advanced_policy_schema.ts b/x-pack/plugins/security_solution/public/management/pages/policy/models/advanced_policy_schema.ts index ba96d4399440..6208416252cd 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/models/advanced_policy_schema.ts +++ b/x-pack/plugins/security_solution/public/management/pages/policy/models/advanced_policy_schema.ts @@ -938,13 +938,13 @@ export const AdvancedPolicySchema: AdvancedPolicySchemaType[] = [ ), }, { - key: 'windows.advanced.alerts.rollback.remediation.enabled', + key: 'windows.advanced.alerts.rollback.self_healing.enabled', first_supported_version: '8.4', documentation: i18n.translate( - 'xpack.securitySolution.endpoint.policy.advanced.windows.advanced.alerts.rollback.remediation.enabled', + 'xpack.securitySolution.endpoint.policy.advanced.windows.advanced.alerts.rollback.self_healing.enabled', { defaultMessage: - 'Remediate malware artifacts when prevention alerts are triggered. Warning: data loss can occur. Default: false', + 'Self-healing erases attack artifacts when prevention alerts are triggered. Warning: data loss can occur. Default: false', } ), license: 'platinum', diff --git a/x-pack/plugins/security_solution/public/plugin.tsx b/x-pack/plugins/security_solution/public/plugin.tsx index e7b92c5f5f75..42924f4a4088 100644 --- a/x-pack/plugins/security_solution/public/plugin.tsx +++ b/x-pack/plugins/security_solution/public/plugin.tsx @@ -137,7 +137,7 @@ export class Plugin implements IPlugin raspberrypi @@ -201,7 +201,7 @@ exports[`Field Renderers #hostNameRenderer it renders correctly against snapshot raspberrypi diff --git a/x-pack/plugins/security_solution/public/types.ts b/x-pack/plugins/security_solution/public/types.ts index 1104ff630b61..e639e1b3cc51 100644 --- a/x-pack/plugins/security_solution/public/types.ts +++ b/x-pack/plugins/security_solution/public/types.ts @@ -23,7 +23,7 @@ import type { TriggersAndActionsUIPublicPluginStart as TriggersActionsStart, } from '@kbn/triggers-actions-ui-plugin/public'; import type { CasesUiStart } from '@kbn/cases-plugin/public'; -import type { SecurityPluginSetup } from '@kbn/security-plugin/public'; +import type { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/public'; import type { TimelinesUIStart } from '@kbn/timelines-plugin/public'; import type { SessionViewStart } from '@kbn/session-view-plugin/public'; import type { KubernetesSecurityStart } from '@kbn/kubernetes-security-plugin/public'; @@ -87,7 +87,7 @@ export interface StartPlugins { spaces?: SpacesPluginStart; dataViewFieldEditor: IndexPatternFieldEditorStart; osquery?: OsqueryPluginStart; - security: SecurityPluginSetup; + security: SecurityPluginStart; cloudSecurityPosture: CspClientPluginStart; threatIntelligence: ThreatIntelligencePluginStart; } diff --git a/x-pack/plugins/security_solution/public/users/pages/constants.ts b/x-pack/plugins/security_solution/public/users/pages/constants.ts index b8788fb5ac29..c128de47236a 100644 --- a/x-pack/plugins/security_solution/public/users/pages/constants.ts +++ b/x-pack/plugins/security_solution/public/users/pages/constants.ts @@ -8,7 +8,7 @@ import { USERS_PATH } from '../../../common/constants'; import { UsersTableType } from '../store/model'; -export const usersDetailsPagePath = `${USERS_PATH}/:detailName`; +export const usersDetailsPagePath = `${USERS_PATH}/name/:detailName`; export const usersTabPath = `${USERS_PATH}/:tabName(${UsersTableType.allUsers}|${UsersTableType.authentications}|${UsersTableType.anomalies}|${UsersTableType.risk}|${UsersTableType.events}|)`; diff --git a/x-pack/plugins/security_solution/public/users/pages/details/nav_tabs.tsx b/x-pack/plugins/security_solution/public/users/pages/details/nav_tabs.tsx index b57d1014e016..90bc856e0d05 100644 --- a/x-pack/plugins/security_solution/public/users/pages/details/nav_tabs.tsx +++ b/x-pack/plugins/security_solution/public/users/pages/details/nav_tabs.tsx @@ -12,7 +12,7 @@ import { UsersTableType } from '../../store/model'; import { USERS_PATH } from '../../../../common/constants'; const getTabsOnUsersDetailsUrl = (userName: string, tabName: UsersTableType) => - `${USERS_PATH}/${userName}/${tabName}`; + `${USERS_PATH}/name/${userName}/${tabName}`; export const navTabsUsersDetails = ( userName: string, diff --git a/x-pack/plugins/security_solution/public/users/pages/index.tsx b/x-pack/plugins/security_solution/public/users/pages/index.tsx index 055bb2bb71ab..b75959b5265a 100644 --- a/x-pack/plugins/security_solution/public/users/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/users/pages/index.tsx @@ -34,7 +34,7 @@ export const UsersContainer = React.memo(() => { /> )} /> - { }) => ( )} /> - ( + + )} + /> + ( diff --git a/x-pack/test/api_integration/apis/aiops/explain_log_rate_spikes.ts b/x-pack/test/api_integration/apis/aiops/explain_log_rate_spikes.ts index 5bf3ae04a274..9261dc8b1bea 100644 --- a/x-pack/test/api_integration/apis/aiops/explain_log_rate_spikes.ts +++ b/x-pack/test/api_integration/apis/aiops/explain_log_rate_spikes.ts @@ -40,7 +40,7 @@ export default ({ getService }: FtrProviderContext) => { noIndexActionsLength: 3, changePointFilter: 'add_change_points', histogramFilter: 'add_change_points_histogram', - errorFilter: 'error', + errorFilter: 'add_error', changePoints: [ { fieldName: 'day_of_week',