Skip to content

Commit

Permalink
[Embeddable Rebuild] [Controls] Remove react_controls top-level fol…
Browse files Browse the repository at this point in the history
…der (#193451)

Final part of #192005

## Summary

This PR marks the "final" major cleanup step for the control group
refactor. This one is the simplest and does two things:
1. It removes the outer `react_controls` folder so that the new controls
live directly under the `public` folder
2. It moves the `external_api` folder under the `control_group` folder

Any files marked as "new" were not actually modified - this PR contains
**no** logic changes. It **only** contains import changes due to the
folder structure changing.



### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
  • Loading branch information
Heenawter authored Sep 20, 2024
1 parent 35edfd0 commit 574eb26
Show file tree
Hide file tree
Showing 109 changed files with 106 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@
import { BehaviorSubject } from 'rxjs';

import { ViewMode } from '@kbn/presentation-publishing';
import { getOptionsListControlFactory } from '../react_controls/controls/data_controls/options_list_control/get_options_list_control_factory';
import { OptionsListControlApi } from '../react_controls/controls/data_controls/options_list_control/types';
import {
getMockedBuildApi,
getMockedControlGroupApi,
} from '../react_controls/controls/mocks/control_mocks';
import { DeleteControlAction } from './delete_control_action';
import { getOptionsListControlFactory } from '../controls/data_controls/options_list_control/get_options_list_control_factory';
import { OptionsListControlApi } from '../controls/data_controls/options_list_control/types';
import { getMockedBuildApi, getMockedControlGroupApi } from '../controls/mocks/control_mocks';
import { coreServices } from '../services/kibana_services';
import { DeleteControlAction } from './delete_control_action';

const dashboardApi = {
viewMode: new BehaviorSubject<ViewMode>('view'),
Expand Down
11 changes: 4 additions & 7 deletions src/plugins/controls/public/actions/edit_control_action.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ import dateMath from '@kbn/datemath';
import type { TimeRange } from '@kbn/es-query';
import type { ViewMode } from '@kbn/presentation-publishing';

import { getOptionsListControlFactory } from '../react_controls/controls/data_controls/options_list_control/get_options_list_control_factory';
import type { OptionsListControlApi } from '../react_controls/controls/data_controls/options_list_control/types';
import {
getMockedBuildApi,
getMockedControlGroupApi,
} from '../react_controls/controls/mocks/control_mocks';
import { getTimesliderControlFactory } from '../react_controls/controls/timeslider_control/get_timeslider_control_factory';
import { getOptionsListControlFactory } from '../controls/data_controls/options_list_control/get_options_list_control_factory';
import type { OptionsListControlApi } from '../controls/data_controls/options_list_control/types';
import { getMockedBuildApi, getMockedControlGroupApi } from '../controls/mocks/control_mocks';
import { getTimesliderControlFactory } from '../controls/timeslider_control/get_timeslider_control_factory';
import { dataService } from '../services/kibana_services';
import { EditControlAction } from './edit_control_action';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { ViewMode } from '@kbn/embeddable-plugin/public';
import { apiIsPresentationContainer } from '@kbn/presentation-containers';
import {
apiCanAccessViewMode,
Expand All @@ -17,9 +18,9 @@ import {
getInheritedViewMode,
hasEditCapabilities,
} from '@kbn/presentation-publishing';
import { ViewMode } from '@kbn/embeddable-plugin/public';

import { CONTROL_GROUP_TYPE } from '../../common';
import { DataControlApi } from '../react_controls/controls/data_controls/types';
import { DataControlApi } from '../controls/data_controls/types';

export const compatibilityCheck = (api: unknown): api is DataControlApi => {
return Boolean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiFormLabel, EuiIcon } from '@elastic/eui';
import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing';
import { BehaviorSubject } from 'rxjs';
import { DEFAULT_CONTROL_GROW } from '../../../../common';
import { DEFAULT_CONTROL_GROW } from '../../../common';

import { DefaultControlApi } from '../../controls/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiPanel, EuiToolTip } from '
import { css } from '@emotion/react';
import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing';

import type { ControlLabelPosition } from '../../../../common';
import type { ControlLabelPosition } from '../../../common';
import type { DefaultControlApi } from '../../controls/types';
import { ControlGroupStrings } from '../control_group_strings';
import { ControlsInOrder } from '../init_controls_manager';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { BehaviorSubject } from 'rxjs';

import { render } from '@testing-library/react';

import { ControlGroupApi } from '../../..';
import { ControlGroupApi } from '../..';
import {
ControlGroupChainingSystem,
ControlLabelPosition,
DEFAULT_CONTROL_LABEL_POSITION,
ParentIgnoreSettings,
} from '../../../../common';
} from '../../../common';
import { DefaultControlApi } from '../../controls/types';
import { ControlGroupEditor } from './control_group_editor';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '@elastic/eui';
import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing';

import type { ControlLabelPosition, ParentIgnoreSettings } from '../../../../common';
import type { ControlLabelPosition, ParentIgnoreSettings } from '../../../common';
import { CONTROL_LAYOUT_OPTIONS } from '../../controls/data_controls/editor_constants';
import type { ControlStateManager } from '../../controls/types';
import { ControlGroupStrings } from '../control_group_strings';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { pluginServices as presentationUtilPluginServices } from '@kbn/presentat
import { registry as presentationUtilServicesRegistry } from '@kbn/presentation-util-plugin/public/services/plugin_services.story';
import { render, waitFor } from '@testing-library/react';

import type { ControlLabelPosition, ControlWidth } from '../../../../common';
import type { ControlLabelPosition, ControlWidth } from '../../../common';
import { ControlPanel } from './control_panel';

describe('render', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
useBatchedOptionalPublishingSubjects,
} from '@kbn/presentation-publishing';
import { FloatingActions } from '@kbn/presentation-util-plugin/public';
import { DEFAULT_CONTROL_GROW, DEFAULT_CONTROL_WIDTH } from '../../../../common';
import { DEFAULT_CONTROL_GROW, DEFAULT_CONTROL_WIDTH } from '../../../common';

import { ControlPanelProps, DefaultControlApi } from '../../controls/types';
import { ControlError } from './control_error';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { BehaviorSubject } from 'rxjs';
import { initializeUnsavedChanges } from '@kbn/presentation-containers';
import { StateComparators } from '@kbn/presentation-publishing';

import type { DefaultControlState } from '../../../../common';
import type { DefaultControlState } from '../../../common';
import { getControlFactory } from '../../control_factory_registry';
import type { ControlApiRegistration, DefaultControlApi } from '../../controls/types';
import type { ControlGroupApi } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { BehaviorSubject, skip } from 'rxjs';

import { Filter } from '@kbn/es-query';

import { ControlGroupChainingSystem } from '../../../../common';
import { ControlGroupChainingSystem } from '../../../common';
import { chaining$ } from './chaining';

const FILTER_ALPHA = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
apiPublishesTimeslice,
} from '@kbn/presentation-publishing';

import type { ControlGroupChainingSystem } from '../../../../common';
import type { ControlGroupChainingSystem } from '../../../common';

export interface ChainingContext {
chainingFilters?: Filter[] | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AggregateQuery, Filter, Query, TimeRange } from '@kbn/es-query';
import { PublishesUnifiedSearch, PublishingSubject } from '@kbn/presentation-publishing';
import { apiPublishesReload } from '@kbn/presentation-publishing/interfaces/fetch/publishes_reload';
import { BehaviorSubject, debounceTime, map, merge, Observable, switchMap } from 'rxjs';
import { ParentIgnoreSettings } from '../../../../common';
import { ParentIgnoreSettings } from '../../../common';

export interface ControlGroupFetchContext {
unifiedSearchFilters?: Filter[] | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { act, render, waitFor } from '@testing-library/react';

import { ControlGroupRendererApi } from '.';
import { CONTROL_GROUP_TYPE } from '../..';
import { getControlGroupEmbeddableFactory } from '../control_group/get_control_group_factory';
import { getControlGroupEmbeddableFactory } from '../get_control_group_factory';
import { ControlGroupRenderer, ControlGroupRendererProps } from './control_group_renderer';

type ParentApiType = PublishesUnifiedSearch & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
import {
type ControlGroupStateBuilder,
controlGroupStateBuilder,
} from '../control_group/utils/control_group_state_builder';
import { getDefaultControlGroupRuntimeState } from '../control_group/utils/initialization_utils';
} from '../utils/control_group_state_builder';
import { getDefaultControlGroupRuntimeState } from '../utils/initialization_utils';
import type { ControlGroupCreationOptions, ControlGroupRendererApi } from './types';

export interface ControlGroupRendererProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
type StateComparators,
} from '@kbn/presentation-publishing';

import type { ControlGroupRuntimeState, ControlPanelsState } from '../../../common';
import type { ControlGroupRuntimeState, ControlPanelsState } from '../../common';
import { apiPublishesAsyncFilters } from '../controls/data_controls/publishes_async_filters';
import { getControlsInOrder, type ControlsInOrder } from './init_controls_manager';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import type {
ControlLabelPosition,
ControlPanelsState,
ParentIgnoreSettings,
} from '../../../common';
import { CONTROL_GROUP_TYPE, DEFAULT_CONTROL_LABEL_POSITION } from '../../../common';
} from '../../common';
import { CONTROL_GROUP_TYPE, DEFAULT_CONTROL_LABEL_POSITION } from '../../common';
import { openDataControlEditor } from '../controls/data_controls/open_data_control_editor';
import { coreServices, dataViewsService } from '../services/kibana_services';
import { ControlGroup } from './components/control_group';
import { chaining$, controlFetch$, controlGroupFetch$ } from './control_fetch';
import { initializeControlGroupUnsavedChanges } from './control_group_unsaved_changes_api';
Expand All @@ -43,7 +44,6 @@ import { openEditControlGroupFlyout } from './open_edit_control_group_flyout';
import { initSelectionsManager } from './selections_manager';
import type { ControlGroupApi } from './types';
import { deserializeControlGroup } from './utils/serialization_utils';
import { coreServices, dataViewsService } from '../../services/kibana_services';

const DEFAULT_CHAINING_SYSTEM = 'HIERARCHICAL';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
*/

import { BehaviorSubject } from 'rxjs';
import type { ControlPanelState, ControlPanelsState, DefaultDataControlState } from '../../common';
import type { DefaultControlApi } from '../controls/types';
import { initControlsManager, getLastUsedDataViewId } from './init_controls_manager';
import type {
ControlPanelState,
DefaultDataControlState,
ControlPanelsState,
} from '../../../common';
import { getLastUsedDataViewId, initControlsManager } from './init_controls_manager';

jest.mock('uuid', () => ({
v4: jest.fn().mockReturnValue('delta'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import type {
ControlWidth,
DefaultControlState,
DefaultDataControlState,
} from '../../../common';
import { DEFAULT_CONTROL_GROW, DEFAULT_CONTROL_WIDTH } from '../../../common';
} from '../../common';
import { DEFAULT_CONTROL_GROW, DEFAULT_CONTROL_WIDTH } from '../../common';
import type { DefaultControlApi } from '../controls/types';
import type { ControlGroupComparatorState } from './control_group_unsaved_changes_api';
import type { ControlGroupApi } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { BehaviorSubject } from 'rxjs';
import { ControlStateManager } from '../controls/types';
import { ControlGroupEditor } from './components/control_group_editor';
import { ControlGroupApi, ControlGroupEditorState } from './types';
import { coreServices } from '../../services/kibana_services';
import { coreServices } from '../services/kibana_services';

export const openEditControlGroupFlyout = (
controlGroupApi: ControlGroupApi,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/

import type { EmbeddableSetup } from '@kbn/embeddable-plugin/public';
import { CONTROL_GROUP_TYPE } from '../../../common';
import { untilPluginStartServicesReady } from '../../services/kibana_services';
import { CONTROL_GROUP_TYPE } from '../../common';
import { untilPluginStartServicesReady } from '../services/kibana_services';

export function registerControlGroupEmbeddable(embeddableSetup: EmbeddableSetup) {
embeddableSetup.registerReactEmbeddableFactory(CONTROL_GROUP_TYPE, async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
ControlPanelState,
DefaultControlState,
ParentIgnoreSettings,
} from '../../../common';
} from '../../common';
import { ControlFetchContext } from './control_fetch/control_fetch';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {
type ControlGroupRuntimeState,
type ControlPanelsState,
type DefaultDataControlState,
} from '../../../../common';
import type { OptionsListControlState } from '../../../../common/options_list';
import { dataViewsService } from '../../../services/kibana_services';
} from '../../../common';
import type { OptionsListControlState } from '../../../common/options_list';
import { dataViewsService } from '../../services/kibana_services';
import { getDataControlFieldRegistry } from '../../controls/data_controls/data_control_editor_utils';
import type { RangesliderControlState } from '../../controls/data_controls/range_slider/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { DEFAULT_CONTROL_LABEL_POSITION, type ControlGroupRuntimeState } from '../../../../common';
import { DEFAULT_CONTROL_LABEL_POSITION, type ControlGroupRuntimeState } from '../../../common';

export const getDefaultControlGroupRuntimeState = (): ControlGroupRuntimeState => ({
initialChildControlState: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { omit } from 'lodash';

import { SerializedPanelState } from '@kbn/presentation-containers';
import type { ControlGroupRuntimeState, ControlGroupSerializedState } from '../../../../common';
import type { ControlGroupRuntimeState, ControlGroupSerializedState } from '../../../common';
import { parseReferenceName } from '../../controls/data_controls/reference_name_utils';

export const deserializeControlGroup = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { i18n } from '@kbn/i18n';
import { RANGE_SLIDER_CONTROL } from '../../../../common';
import { RANGE_SLIDER_CONTROL } from '../../../common';

export const DataControlEditorStrings = {
manageControl: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
DEFAULT_CONTROL_GROW,
DEFAULT_CONTROL_WIDTH,
type DefaultDataControlState,
} from '../../../../common';
import { dataViewsService } from '../../../services/kibana_services';
} from '../../../common';
import { dataViewsService } from '../../services/kibana_services';
import { getAllControlTypes, getControlFactory } from '../../control_factory_registry';
import type { ControlGroupApi } from '../../control_group/types';
import type { ControlFactory } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import {
DEFAULT_CONTROL_WIDTH,
type ControlWidth,
type DefaultDataControlState,
} from '../../../../common';
import { dataViewsService } from '../../../services/kibana_services';
} from '../../../common';
import { dataViewsService } from '../../services/kibana_services';
import { getAllControlTypes, getControlFactory } from '../../control_factory_registry';
import type { ControlGroupApi } from '../../control_group/types';
import { DataControlEditorStrings } from './data_control_constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import type { DataView } from '@kbn/data-views-plugin/public';
import { first, skip } from 'rxjs';
import { dataViewsService } from '../../../services/kibana_services';
import { dataViewsService } from '../../services/kibana_services';
import { ControlGroupApi } from '../../control_group/types';
import { initializeDataControl } from './initialize_data_control';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { SerializedPanelState } from '@kbn/presentation-containers';
import { StateComparators } from '@kbn/presentation-publishing';

import { i18n } from '@kbn/i18n';
import type { DefaultControlState, DefaultDataControlState } from '../../../../common';
import { dataViewsService } from '../../../services/kibana_services';
import type { DefaultControlState, DefaultDataControlState } from '../../../common';
import { dataViewsService } from '../../services/kibana_services';
import type { ControlGroupApi } from '../../control_group/types';
import { initializeDefaultControlApi } from '../initialize_default_control_api';
import type { ControlApiInitialization, ControlStateManager } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
OptionsListSelection,
OptionsListSortingType,
OptionsListSuggestions,
} from '../../../../../common/options_list';
} from '../../../../common/options_list';

export const getOptionsListMocks = () => {
const selectedOptions$ = new BehaviorSubject<OptionsListSelection[] | undefined>(undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { tracksOverlays } from '@kbn/presentation-containers';
import { apiHasParentApi } from '@kbn/presentation-publishing';
import { toMountPoint } from '@kbn/react-kibana-mount';

import type { DefaultDataControlState } from '../../../../common';
import { coreServices } from '../../../services/kibana_services';
import type { DefaultDataControlState } from '../../../common';
import { coreServices } from '../../services/kibana_services';
import type { ControlGroupApi } from '../../control_group/types';
import { DataControlEditor } from './data_control_editor';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
useBatchedPublishingSubjects,
} from '@kbn/presentation-publishing';

import { OptionsListSelection } from '../../../../../../common/options_list/options_list_selections';
import { OptionsListSelection } from '../../../../../common/options_list/options_list_selections';
import { MIN_POPOVER_WIDTH } from '../../../constants';
import { useOptionsListContext } from '../options_list_context_provider';
import { OptionsListPopover } from './options_list_popover';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { DataViewField } from '@kbn/data-views-plugin/common';
import { act, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

import type { DefaultDataControlState } from '../../../../../../common';
import type { OptionsListControlState } from '../../../../../../common/options_list';
import type { DefaultDataControlState } from '../../../../../common';
import type { OptionsListControlState } from '../../../../../common/options_list';
import type { ControlGroupApi } from '../../../../control_group/types';
import { getMockedControlGroupApi } from '../../../mocks/control_mocks';
import type { CustomOptionsComponentProps } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { useStateFromPublishingSubject } from '@kbn/presentation-publishing';
import type {
OptionsListControlState,
OptionsListSearchTechnique,
} from '../../../../../../common/options_list';
import { getCompatibleSearchTechniques } from '../../../../../../common/options_list/suggestions_searching';
} from '../../../../../common/options_list';
import { getCompatibleSearchTechniques } from '../../../../../common/options_list/suggestions_searching';
import { ControlSettingTooltipLabel } from '../../../../control_group/components/control_setting_tooltip_label';
import { CustomOptionsComponentProps } from '../../types';
import { DEFAULT_SEARCH_TECHNIQUE } from '../constants';
Expand Down
Loading

0 comments on commit 574eb26

Please sign in to comment.