Skip to content

Commit

Permalink
Merge branch 'main' into eui/43.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 20, 2021
2 parents b4c2ab7 + eea2fc3 commit a280d69
Show file tree
Hide file tree
Showing 485 changed files with 7,459 additions and 3,109 deletions.
2 changes: 1 addition & 1 deletion .buildkite/scripts/build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [[ "${GITHUB_PR_LABELS:-}" == *"ci:deploy-cloud"* ]]; then
--docker-tag-qualifier="$GIT_COMMIT" \
--docker-push \
--skip-docker-ubi \
--skip-docker-centos \
--skip-docker-ubuntu \
--skip-docker-contexts

CLOUD_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" docker.elastic.co/kibana-ci/kibana-cloud)
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/demo_env/kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source "$(dirname "${0}")/config.sh"
export KIBANA_IMAGE="gcr.io/elastic-kibana-184716/demo/kibana:$DEPLOYMENT_NAME-$(git rev-parse HEAD)"

echo '--- Build Kibana'
node scripts/build --debug --docker-images --example-plugins --skip-os-packages --skip-docker-ubi
node scripts/build --debug --docker-images --example-plugins --skip-docker-ubi

echo '--- Build Docker image with example plugins'
cd target/example_plugins
Expand Down
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
/packages/elastic-datemath/ @elastic/kibana-app-services
/packages/kbn-interpreter/ @elastic/kibana-app-services
/packages/kbn-react-field/ @elastic/kibana-app-services
/packages/kbn-es-query/ @elastic/kibana-app-services
/packages/kbn-field-types/ @elastic/kibana-app-services
/src/plugins/bfetch/ @elastic/kibana-app-services
/src/plugins/data/ @elastic/kibana-app-services
/src/plugins/data_views/ @elastic/kibana-app-services
Expand Down
46 changes: 20 additions & 26 deletions examples/data_view_field_editor_example/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,20 @@ import {
DefaultItemAction,
} from '@elastic/eui';
import { AppMountParameters } from '../../../src/core/public';
import {
DataPublicPluginStart,
IndexPattern,
IndexPatternField,
} from '../../../src/plugins/data/public';
import { DataPublicPluginStart } from '../../../src/plugins/data/public';
import type { DataView, DataViewField } from '../../../src/plugins/data_views/public';
import { IndexPatternFieldEditorStart } from '../../../src/plugins/data_view_field_editor/public';

interface Props {
indexPattern?: IndexPattern;
dataView?: DataView;
dataViewFieldEditor: IndexPatternFieldEditorStart;
}

const IndexPatternFieldEditorExample = ({ indexPattern, dataViewFieldEditor }: Props) => {
const [fields, setFields] = useState<IndexPatternField[]>(
indexPattern?.getNonScriptedFields() || []
const DataViewFieldEditorExample = ({ dataView, dataViewFieldEditor }: Props) => {
const [fields, setFields] = useState<DataViewField[]>(
dataView?.fields.getAll().filter((f) => !f.scripted) || []
);
const refreshFields = () => setFields(indexPattern?.getNonScriptedFields() || []);
const refreshFields = () => setFields(dataView?.fields.getAll().filter((f) => !f.scripted) || []);
const columns = [
{
field: 'name',
Expand All @@ -51,9 +48,9 @@ const IndexPatternFieldEditorExample = ({ indexPattern, dataViewFieldEditor }: P
icon: 'pencil',
type: 'icon',
'data-test-subj': 'editField',
onClick: (fld: IndexPatternField) =>
onClick: (fld: DataViewField) =>
dataViewFieldEditor.openEditor({
ctx: { dataView: indexPattern! },
ctx: { dataView: dataView! },
fieldName: fld.name,
onSave: refreshFields,
}),
Expand All @@ -65,27 +62,27 @@ const IndexPatternFieldEditorExample = ({ indexPattern, dataViewFieldEditor }: P
type: 'icon',
'data-test-subj': 'deleteField',
available: (fld) => !!fld.runtimeField,
onClick: (fld: IndexPatternField) =>
onClick: (fld: DataViewField) =>
dataViewFieldEditor.openDeleteModal({
fieldName: fld.name,
ctx: {
dataView: indexPattern!,
dataView: dataView!,
},
onDelete: refreshFields,
}),
},
] as Array<DefaultItemAction<IndexPatternField>>,
] as Array<DefaultItemAction<DataViewField>>,
},
];

const content = indexPattern ? (
const content = dataView ? (
<>
<EuiText data-test-subj="indexPatternTitle">Index pattern: {indexPattern?.title}</EuiText>
<EuiText data-test-subj="dataViewTitle">Data view: {dataView.title}</EuiText>
<div>
<EuiButton
onClick={() =>
dataViewFieldEditor.openEditor({
ctx: { dataView: indexPattern! },
ctx: { dataView },
onSave: refreshFields,
})
}
Expand All @@ -94,7 +91,7 @@ const IndexPatternFieldEditorExample = ({ indexPattern, dataViewFieldEditor }: P
Add field
</EuiButton>
</div>
<EuiInMemoryTable<IndexPatternField>
<EuiInMemoryTable<DataViewField>
items={fields}
columns={columns}
pagination={true}
Expand All @@ -108,13 +105,13 @@ const IndexPatternFieldEditorExample = ({ indexPattern, dataViewFieldEditor }: P
/>
</>
) : (
<p>Please create an index pattern</p>
<p>Please create a data view</p>
);

return (
<EuiPage>
<EuiPageBody>
<EuiPageHeader>Index pattern field editor demo</EuiPageHeader>
<EuiPageHeader>Data view field editor demo</EuiPageHeader>
<EuiPageContent>
<EuiPageContentBody>{content}</EuiPageContentBody>
</EuiPageContent>
Expand All @@ -132,12 +129,9 @@ export const renderApp = async (
{ data, dataViewFieldEditor }: RenderAppDependencies,
{ element }: AppMountParameters
) => {
const indexPattern = (await data.indexPatterns.getDefault()) || undefined;
const dataView = (await data.dataViews.getDefault()) || undefined;
ReactDOM.render(
<IndexPatternFieldEditorExample
indexPattern={indexPattern}
dataViewFieldEditor={dataViewFieldEditor}
/>,
<DataViewFieldEditorExample dataView={dataView} dataViewFieldEditor={dataViewFieldEditor} />,
element
);

Expand Down
4 changes: 2 additions & 2 deletions examples/data_view_field_editor_example/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
* Side Public License, v 1.
*/

import { IndexPatternFieldEditorPlugin } from './plugin';
import { DataViewFieldEditorPlugin } from './plugin';

export const plugin = () => new IndexPatternFieldEditorPlugin();
export const plugin = () => new DataViewFieldEditorPlugin();
14 changes: 7 additions & 7 deletions examples/data_view_field_editor_example/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ interface SetupDeps {
developerExamples: DeveloperExamplesSetup;
}

export class IndexPatternFieldEditorPlugin implements Plugin<void, void, SetupDeps, StartDeps> {
export class DataViewFieldEditorPlugin implements Plugin<void, void, SetupDeps, StartDeps> {
public setup(core: CoreSetup<StartDeps>, deps: SetupDeps) {
core.application.register({
id: 'indexPatternFieldEditorExample',
title: 'Index pattern field editor example',
id: 'dataViewFieldEditorExample',
title: 'Data view field editor example',
navLinkStatus: AppNavLinkStatus.hidden,
async mount(params: AppMountParameters) {
const [, depsStart] = await core.getStartServices();
Expand All @@ -34,13 +34,13 @@ export class IndexPatternFieldEditorPlugin implements Plugin<void, void, SetupDe
});

deps.developerExamples.register({
appId: 'indexPatternFieldEditorExample',
title: 'Index pattern field editor',
description: `IndexPatternFieldEditor provides a UI for editing index pattern fields directly from Kibana apps. This example plugin demonstrates integration.`,
appId: 'dataViewFieldEditorExample',
title: 'Data view field editor',
description: `DataViewFieldEditor provides a UI for editing data view fields directly from Kibana apps. This example plugin demonstrates integration.`,
links: [
{
label: 'README',
href: 'https://github.com/elastic/kibana/blob/main/src/plugins/index_pattern_field_editor/README.md',
href: 'https://github.com/elastic/kibana/blob/main/src/plugins/data_view_field_editor/README.md',
iconType: 'logoGithub',
size: 's',
target: '_blank',
Expand Down
1 change: 1 addition & 0 deletions examples/data_view_field_editor_example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../../src/plugins/kibana_react/tsconfig.json" },
{ "path": "../../src/plugins/data/tsconfig.json" },
{ "path": "../../src/plugins/data_views/tsconfig.json" },
{ "path": "../../src/plugins/data_view_field_editor/tsconfig.json" },
{ "path": "../developer_examples/tsconfig.json" },
]
Expand Down
22 changes: 11 additions & 11 deletions examples/field_formats_example/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface Deps {
/**
* Just for demo purposes
*/
openIndexPatternNumberFieldEditor: () => void;
openDateViewNumberFieldEditor: () => void;
}

const UsingAnExistingFieldFormatExample: React.FC<{ deps: Deps }> = (props) => {
Expand Down Expand Up @@ -123,15 +123,15 @@ const CreatingCustomFieldFormat: React.FC<{ deps: Deps }> = (props) => {
<EuiSpacer size={'s'} />

<EuiCallOut
title="Seamless integration with index patterns!"
title="Seamless integration with data views!"
color="success"
iconType="indexManagementApp"
>
<p>
Currency formatter that we&apos;ve just created is already integrated with index patterns.
It can be applied to any <EuiCode>numeric</EuiCode> field of any index pattern.{' '}
<EuiLink onClick={() => props.deps.openIndexPatternNumberFieldEditor()}>
Open index pattern field editor to give it a try.
Currency formatter that we&apos;ve just created is already integrated with data views. It
can be applied to any <EuiCode>numeric</EuiCode> field of any data view.{' '}
<EuiLink onClick={() => props.deps.openDateViewNumberFieldEditor()}>
Open data view field editor to give it a try.
</EuiLink>
</p>
</EuiCallOut>
Expand All @@ -155,15 +155,15 @@ const CreatingCustomFieldFormatEditor: React.FC<{ deps: Deps }> = (props) => {
<EuiSpacer size={'s'} />

<EuiCallOut
title="Check the result in the index pattern field editor!"
title="Check the result in the data view field editor!"
color="primary"
iconType="indexManagementApp"
>
<p>
Currency formatter and its custom editor are integrated with index patterns. It can be
applied to any <EuiCode>numeric</EuiCode> field of any index pattern.{' '}
<EuiLink onClick={() => props.deps.openIndexPatternNumberFieldEditor()}>
Open index pattern field editor to give it a try.
Currency formatter and its custom editor are integrated with data views. It can be applied
to any <EuiCode>numeric</EuiCode> field of any data view.{' '}
<EuiLink onClick={() => props.deps.openDateViewNumberFieldEditor()}>
Open date view field editor to give it a try.
</EuiLink>
</p>
</EuiCallOut>
Expand Down
22 changes: 11 additions & 11 deletions examples/field_formats_example/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,29 @@ export class FieldFormatsExamplePlugin implements Plugin<void, void, SetupDeps,
registerExampleFormatEditor(deps.dataViewFieldEditor);

// just for demonstration purposes:
// opens a field editor using default index pattern and first number field
const openIndexPatternNumberFieldEditor = async () => {
// opens a field editor using default data view and first number field
const openDateViewNumberFieldEditor = async () => {
const [, plugins] = await core.getStartServices();
const indexPattern = await plugins.data.indexPatterns.getDefault();
if (!indexPattern) {
alert('Creating at least one index pattern to continue with this example');
const dataView = await plugins.data.dataViews.getDefault();
if (!dataView) {
alert('Create at least one data view to continue with this example');
return;
}

const numberField = indexPattern
.getNonScriptedFields()
.find((f) => !f.name.startsWith('_') && f.type === KBN_FIELD_TYPES.NUMBER);
const numberField = dataView.fields
.getAll()
.find((f) => !f.name.startsWith('_') && f.type === KBN_FIELD_TYPES.NUMBER && !f.scripted);

if (!numberField) {
alert(
'Default index pattern needs at least a single field of type `number` to continue with this example'
'Default data view needs at least a single field of type `number` to continue with this example'
);
return;
}

plugins.dataViewFieldEditor.openEditor({
ctx: {
dataView: indexPattern,
dataView,
},
fieldName: numberField.name,
});
Expand All @@ -81,7 +81,7 @@ export class FieldFormatsExamplePlugin implements Plugin<void, void, SetupDeps,
async mount({ element }: AppMountParameters) {
const [, plugins] = await core.getStartServices();
ReactDOM.render(
<App deps={{ fieldFormats: plugins.fieldFormats, openIndexPatternNumberFieldEditor }} />,
<App deps={{ fieldFormats: plugins.fieldFormats, openDateViewNumberFieldEditor }} />,
element
);
return () => ReactDOM.unmountComponentAtNode(element);
Expand Down
Loading

0 comments on commit a280d69

Please sign in to comment.