Skip to content

Commit

Permalink
rename index pattern editor to data view editor (#119264)
Browse files Browse the repository at this point in the history
* rename index pattern editor to data view editor
  • Loading branch information
mattkime authored Nov 23, 2021
1 parent ee09d0a commit 67ebc5d
Show file tree
Hide file tree
Showing 98 changed files with 116 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
/src/plugins/embeddable/ @elastic/kibana-app-services
/src/plugins/expressions/ @elastic/kibana-app-services
/src/plugins/field_formats/ @elastic/kibana-app-services
/src/plugins/index_pattern_editor/ @elastic/kibana-app-services
/src/plugins/data_view_editor/ @elastic/kibana-app-services
/src/plugins/inspector/ @elastic/kibana-app-services
/src/plugins/kibana_react/ @elastic/kibana-app-services
/src/plugins/kibana_react/public/code_editor @elastic/kibana-presentation
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"monaco": "packages/kbn-monaco/src",
"esQuery": "packages/kbn-es-query/src",
"presentationUtil": "src/plugins/presentation_util",
"indexPatternEditor": "src/plugins/index_pattern_editor",
"indexPatternEditor": "src/plugins/data_view_editor",
"indexPatternFieldEditor": "src/plugins/data_view_field_editor",
"indexPatternManagement": "src/plugins/data_view_management",
"interactiveSetup": "src/plugins/interactive_setup",
Expand Down
8 changes: 4 additions & 4 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ as uiSettings within the code.
|The data plugin provides common data access services, such as search and query, for solutions and application developers.
|{kib-repo}blob/{branch}/src/plugins/data_view_editor/README.md[dataViewEditor]
|Create data views from within Kibana apps.
|{kib-repo}blob/{branch}/src/plugins/data_view_field_editor/README.md[dataViewFieldEditor]
|The reusable field editor across Kibana!
Expand Down Expand Up @@ -145,10 +149,6 @@ for use in their own application.
|Moves the legacy ui/registry/feature_catalogue module for registering "features" that should be shown in the home page's feature catalogue to a service within a "home" plugin. The feature catalogue refered to here should not be confused with the "feature" plugin for registering features used to derive UI capabilities for feature controls.
|{kib-repo}blob/{branch}/src/plugins/index_pattern_editor/README.md[indexPatternEditor]
|Create index patterns from within Kibana apps.
|{kib-repo}blob/{branch}/src/plugins/input_control_vis/README.md[inputControlVis]
|Contains the input control visualization allowing to place custom filter controls on a dashboard.
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pageLoadAssetSize:
embeddableEnhanced: 22107
uiActionsEnhanced: 38494
urlDrilldown: 30063
indexPatternEditor: 19123
dataViewEditor: 12000
dataViewFieldEditor: 20000
dataViewManagement: 5000
reporting: 57003
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Index pattern editor
# Data view editor

Create index patterns from within Kibana apps.
Create data views from within Kibana apps.

## How to use

You first need to add in your kibana.json the "`indexPatternEditor`" plugin as a required dependency of your plugin.
You first need to add in your kibana.json the "`dataViewEditor`" plugin as a required dependency of your plugin.

You will then receive in the start contract of the indexPatternEditor plugin the following API:
You will then receive in the start contract of the dataViewEditor plugin the following API:

### `userPermissions.editIndexPattern(): boolean`
### `userPermissions.editDataView(): boolean`

Convenience method that uses the `core.application.capabilities` api to determine whether the user can create or edit the index pattern.
Convenience method that uses the `core.application.capabilities` api to determine whether the user can create or edit the data view.

### `openEditor(options: IndexPatternEditorProps): CloseEditor`
### `openEditor(options: DataViewEditorProps): CloseEditor`

Use this method to display the index pattern editor to create an index pattern.
Use this method to display the data view editor to create an index pattern.

#### `options`

`onSave: (indexPattern: IndexPattern) => void` (**required**)
`onSave: (dataView: DataView) => void` (**required**)

You must provide an `onSave` handler to be notified when an index pattern has been created/updated. This handler is called after the index pattern has been persisted as a saved object.
You must provide an `onSave` handler to be notified when a data vuew has been created/updated. This handler is called after the dataview has been persisted as a saved object.

`onCancel: () => void;` (optional)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/src/plugins/index_pattern_editor'],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/src/plugins/index_pattern_editor',
roots: ['<rootDir>/src/plugins/data_view_editor'],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/src/plugins/data_view_editor',
coverageReporters: ['text', 'html'],
collectCoverageFrom: ['<rootDir>/src/plugins/index_pattern_editor/public/**/*.{ts,tsx}'],
collectCoverageFrom: ['<rootDir>/src/plugins/data_view_editor/public/**/*.{ts,tsx}'],
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"id": "indexPatternEditor",
"id": "dataViewEditor",
"version": "kibana",
"server": false,
"ui": true,
"requiredPlugins": ["data"],
"requiredPlugins": ["data", "dataViews"],
"requiredBundles": ["kibanaReact", "esUiShared"],
"owner": {
"name": "App Services",
"githubTeam": "kibana-app-services"
},
"description": "This plugin provides the ability to create index patterns via a modal flyout from any kibana app"
"description": "This plugin provides the ability to create data views via a modal flyout from any kibana app"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@

import React from 'react';
import { EuiFlyout } from '@elastic/eui';
import { IndexPatternEditorLazy } from './index_pattern_editor_lazy';
import { IndexPatternEditorContext, IndexPatternEditorProps } from '../types';
import { DataViewEditorLazy } from './data_view_editor_lazy';
import { DataViewEditorContext, DataViewEditorProps } from '../types';
import { createKibanaReactContext } from '../shared_imports';
import './index_pattern_editor.scss';
import './data_view_editor.scss';

export interface IndexPatternEditorPropsWithServices extends IndexPatternEditorProps {
services: IndexPatternEditorContext;
export interface DataViewEditorPropsWithServices extends DataViewEditorProps {
services: DataViewEditorContext;
}

export const IndexPatternEditor = ({
export const DataViewEditor = ({
onSave,
onCancel = () => {},
services,
defaultTypeIsRollup = false,
requireTimestampField = false,
}: IndexPatternEditorPropsWithServices) => {
}: DataViewEditorPropsWithServices) => {
const { Provider: KibanaReactContextProvider } =
createKibanaReactContext<IndexPatternEditorContext>(services);
createKibanaReactContext<DataViewEditorContext>(services);

return (
<KibanaReactContextProvider>
<EuiFlyout onClose={() => {}} hideCloseButton={true} size="l">
<IndexPatternEditorLazy
<DataViewEditorLazy
onSave={onSave}
onCancel={onCancel}
defaultTypeIsRollup={defaultTypeIsRollup}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { FlyoutPanels } from './flyout_panels';

import {
MatchedItem,
IndexPatternEditorContext,
DataViewEditorContext,
RollupIndicesCapsResponse,
INDEX_PATTERN_TYPE,
IndexPatternConfig,
Expand Down Expand Up @@ -70,8 +70,8 @@ const IndexPatternEditorFlyoutContentComponent = ({
requireTimestampField = false,
}: Props) => {
const {
services: { http, indexPatternService, uiSettings, searchClient },
} = useKibana<IndexPatternEditorContext>();
services: { http, dataViews, uiSettings, searchClient },
} = useKibana<DataViewEditorContext>();

const { form } = useForm<IndexPatternConfig, FormInternal>({
defaultValue: {
Expand Down Expand Up @@ -155,13 +155,13 @@ const IndexPatternEditorFlyoutContentComponent = ({
useEffect(() => {
loadSources();
const getTitles = async () => {
const indexPatternTitles = await indexPatternService.getTitles();
const indexPatternTitles = await dataViews.getTitles();

setExistingIndexPatterns(indexPatternTitles);
setIsLoadingIndexPatterns(false);
};
getTitles();
}, [http, indexPatternService, loadSources]);
}, [http, dataViews, loadSources]);

// loading rollup info
useEffect(() => {
Expand Down Expand Up @@ -199,9 +199,7 @@ const IndexPatternEditorFlyoutContentComponent = ({
getFieldsOptions.rollupIndex = rollupIndex;
}

const fields = await ensureMinimumTime(
indexPatternService.getFieldsForWildcard(getFieldsOptions)
);
const fields = await ensureMinimumTime(dataViews.getFieldsForWildcard(getFieldsOptions));
timestampOptions = extractTimeFields(fields, requireTimestampField);
}
if (currentLoadingTimestampFieldsIdx === currentLoadingTimestampFieldsRef.current) {
Expand All @@ -212,7 +210,7 @@ const IndexPatternEditorFlyoutContentComponent = ({
},
[
existingIndexPatterns,
indexPatternService,
dataViews,
requireTimestampField,
rollupIndex,
type,
Expand Down Expand Up @@ -392,8 +390,8 @@ const loadMatchedIndices = memoizeOne(
searchClient,
}: {
isRollupIndex: (index: string) => boolean;
http: IndexPatternEditorContext['http'];
searchClient: IndexPatternEditorContext['searchClient'];
http: DataViewEditorContext['http'];
searchClient: DataViewEditorContext['searchClient'];
}
): Promise<{
matchedIndicesResult: MatchedIndicesSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import React, { lazy, Suspense } from 'react';
import { EuiLoadingSpinner } from '@elastic/eui';

import { IndexPatternEditorProps } from '../types';
import { DataViewEditorProps } from '../types';

const IndexPatternFlyoutContentContainer = lazy(
() => import('./index_pattern_flyout_content_container')
() => import('./data_view_flyout_content_container')
);

export const IndexPatternEditorLazy = (props: IndexPatternEditorProps) => (
export const DataViewEditorLazy = (props: DataViewEditorProps) => (
<Suspense fallback={<EuiLoadingSpinner size="xl" />}>
<IndexPatternFlyoutContentContainer {...props} />
</Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import React from 'react';
import { i18n } from '@kbn/i18n';

import { IndexPatternSpec, useKibana } from '../shared_imports';
import { IndexPatternEditorFlyoutContent } from './index_pattern_editor_flyout_content';
import { IndexPatternEditorContext, IndexPatternEditorProps } from '../types';
import { IndexPatternEditorFlyoutContent } from './data_view_editor_flyout_content';
import { DataViewEditorContext, DataViewEditorProps } from '../types';

const IndexPatternFlyoutContentContainer = ({
onSave,
onCancel = () => {},
defaultTypeIsRollup,
requireTimestampField = false,
}: IndexPatternEditorProps) => {
}: DataViewEditorProps) => {
const {
services: { indexPatternService, notifications },
} = useKibana<IndexPatternEditorContext>();
services: { dataViews, notifications },
} = useKibana<DataViewEditorContext>();

const onSaveClick = async (indexPatternSpec: IndexPatternSpec) => {
try {
const indexPattern = await indexPatternService.createAndSave(indexPatternSpec);
const indexPattern = await dataViews.createAndSave(indexPatternSpec);

const message = i18n.translate('indexPatternEditor.saved', {
defaultMessage: "Saved '{indexPatternTitle}'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import useAsync from 'react-use/lib/useAsync';

import { useKibana } from '../../shared_imports';

import { MatchedItem, ResolveIndexResponseItemAlias, IndexPatternEditorContext } from '../../types';
import { MatchedItem, ResolveIndexResponseItemAlias, DataViewEditorContext } from '../../types';

import { getIndices } from '../../lib';

Expand Down Expand Up @@ -46,18 +46,16 @@ export function isUserDataIndex(source: MatchedItem) {

export const EmptyPrompts: FC<Props> = ({ allSources, onCancel, children, loadSources }) => {
const {
services: { docLinks, application, http, searchClient, indexPatternService },
} = useKibana<IndexPatternEditorContext>();
services: { docLinks, application, http, searchClient, dataViews },
} = useKibana<DataViewEditorContext>();

const [remoteClustersExist, setRemoteClustersExist] = useState<boolean>(false);
const [hasCheckedRemoteClusters, setHasCheckedRemoteClusters] = useState<boolean>(false);

const [goToForm, setGoToForm] = useState<boolean>(false);

const hasDataIndices = allSources.some(isUserDataIndex);
const hasUserIndexPattern = useAsync(() =>
indexPatternService.hasUserDataView().catch(() => true)
);
const hasUserIndexPattern = useAsync(() => dataViews.hasUserDataView().catch(() => true));

useEffect(() => {
if (!hasDataIndices && !hasCheckedRemoteClusters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* Side Public License, v 1.
*/

export type { Props as IndexPatternEditorFlyoutContentProps } from './index_pattern_editor_flyout_content';
export { IndexPatternEditorFlyoutContent } from './index_pattern_editor_flyout_content';
export type { Props as IndexPatternEditorFlyoutContentProps } from './data_view_editor_flyout_content';
export { IndexPatternEditorFlyoutContent } from './data_view_editor_flyout_content';

export { IndexPatternEditor } from './index_pattern_editor';
export { DataViewEditor } from './data_view_editor';

export { schema } from './form_schema';
export { TimestampField, TypeField, TitleField } from './form_fields';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
* either types, or static code.
*/

import { IndexPatternEditorPlugin } from './plugin';
import { DataViewEditorPlugin } from './plugin';

export type { PluginStart as IndexPatternEditorStart, IndexPatternEditorProps } from './types';
export type { PluginStart as DataViewEditorStart, DataViewEditorProps } from './types';

export function plugin() {
return new IndexPatternEditorPlugin();
return new DataViewEditorPlugin();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* Side Public License, v 1.
*/

import { IndexPatternEditorPlugin } from './plugin';
import { DataViewEditorPlugin } from './plugin';

export type Start = jest.Mocked<ReturnType<IndexPatternEditorPlugin['start']>>;
export type Start = jest.Mocked<ReturnType<DataViewEditorPlugin['start']>>;

export type Setup = jest.Mocked<ReturnType<IndexPatternEditorPlugin['setup']>>;
export type Setup = jest.Mocked<ReturnType<DataViewEditorPlugin['setup']>>;

const createSetupContract = (): Setup => {
return {};
Expand All @@ -21,7 +21,7 @@ const createStartContract = (): Start => {
openEditor: jest.fn(),
IndexPatternEditorComponent: jest.fn(),
userPermissions: {
editIndexPattern: jest.fn(),
editDataView: jest.fn(),
},
};
};
Expand Down
Loading

0 comments on commit 67ebc5d

Please sign in to comment.