Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Aug 31, 2023
2 parents 2014fa3 + dba91b9 commit 4713f3e
Show file tree
Hide file tree
Showing 174 changed files with 1,972 additions and 1,609 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ steps:
build:
env:
SERVICE_COMMIT_HASH: "${BUILDKITE_COMMIT:0:12}"
REMOTE_SERVICE_CONFIG: https://raw.githubusercontent.com/elastic/serverless-gitops/main/gen/gpctl/kibana/tagged-release.yaml
REMOTE_SERVICE_CONFIG: https://raw.githubusercontent.com/elastic/serverless-gitops/main/gen/gpctl/kibana/config.yaml
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/artifacts/docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ steps:
build:
env:
SERVICE_COMMIT_HASH: "$GIT_ABBREV_COMMIT"
REMOTE_SERVICE_CONFIG: https://raw.githubusercontent.com/elastic/serverless-gitops/main/gen/gpctl/kibana/config.yaml
REMOTE_SERVICE_CONFIG: https://raw.githubusercontent.com/elastic/serverless-gitops/main/gen/gpctl/kibana/dev.yaml
EOF

Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,9 @@ test/plugin_functional/plugins/ui_settings_plugin @elastic/kibana-core
packages/kbn-ui-shared-deps-npm @elastic/kibana-operations
packages/kbn-ui-shared-deps-src @elastic/kibana-operations
packages/kbn-ui-theme @elastic/kibana-operations
packages/kbn-unified-doc-viewer @elastic/kibana-data-discovery
examples/unified_doc_viewer @elastic/kibana-core
src/plugins/unified_doc_viewer @elastic/kibana-data-discovery
packages/kbn-unified-field-list @elastic/kibana-data-discovery
examples/unified_field_list_examples @elastic/kibana-data-discovery
src/plugins/unified_histogram @elastic/kibana-data-discovery
Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"visTypeXy": "src/plugins/vis_types/xy",
"visualizations": "src/plugins/visualizations",
"visualizationUiComponents": "packages/kbn-visualization-ui-components",
"unifiedDocViewer": ["src/plugins/unified_doc_viewer", "packages/kbn-unified-doc-viewer"],
"unifiedSearch": "src/plugins/unified_search",
"unifiedFieldList": "packages/kbn-unified-field-list",
"unifiedHistogram": "src/plugins/unified_histogram"
Expand Down
4 changes: 4 additions & 0 deletions docs/concepts/data-views.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ To exclude a cluster with the name `cluster_one`:
Once you configure a {data-source} to use the {ccs} syntax, all searches and
aggregations using that {data-source} in {kib} take advantage of {ccs}.

For more information, refer to
{ref}/modules-cross-cluster-search.html#exclude-problematic-clusters[Excluding
clusters or indicies from cross-cluster search].

[float]
[[delete-data-view]]
=== Delete a {data-source}
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ In general this plugin provides:
|Registers commercially licensed generic actions like per panel time range and contains some code that supports drilldown work.
|{kib-repo}blob/{branch}/src/plugins/unified_doc_viewer/README.md[unifiedDocViewer]
|This plugin contains services reliant on the plugin lifecycle for the unified doc viewer component (see @kbn/unified-doc-viewer).
|{kib-repo}blob/{branch}/src/plugins/unified_histogram/README.md[unifiedHistogram]
|Unified Histogram is a UX Building Block including a layout with a resizable histogram and a main display.
It manages its own state and data fetching, and can easily be dropped into pages with minimal setup.
Expand Down
3 changes: 3 additions & 0 deletions examples/unified_doc_viewer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Unified Doc Viewer

An example plugin showing usage of the unified doc viewer plugin (plugins/unified_doc_viewer) and package (@kbn/unified-doc-viewer).
16 changes: 16 additions & 0 deletions examples/unified_doc_viewer/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "plugin",
"id": "@kbn/unified-doc-viewer-examples",
"owner": "@elastic/kibana-core",
"description": "Examples showing usage of the unified doc viewer.",
"plugin": {
"id": "unifiedDocViewerExamples",
"server": false,
"browser": true,
"requiredPlugins": [
"data",
"developerExamples",
"unifiedDocViewer"
]
}
}
72 changes: 72 additions & 0 deletions examples/unified_doc_viewer/public/application.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';
import type { AppMountParameters, CoreStart } from '@kbn/core/public';
import { buildDataTableRecord } from '@kbn/discover-utils';
import type { DataTableRecord } from '@kbn/discover-utils/types';
import type { DataView } from '@kbn/data-views-plugin/common';
import { UnifiedDocViewer } from '@kbn/unified-doc-viewer-plugin/public';
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { StartDeps } from './plugin';

export const renderApp = (
core: CoreStart,
{ data }: StartDeps,
{ element }: AppMountParameters
) => {
ReactDOM.render(<UnifiedDocViewerExamplesApp data={data} />, element);

return () => {
ReactDOM.unmountComponentAtNode(element);
};
};

function UnifiedDocViewerExamplesApp({ data }: { data: DataPublicPluginStart }) {
const [dataView, setDataView] = useState<DataView | null>();
const [hit, setHit] = useState<DataTableRecord | null>();

useEffect(() => {
data.dataViews.getDefault().then((defaultDataView) => setDataView(defaultDataView));
}, [data]);

useEffect(() => {
const setDefaultHit = async () => {
if (!dataView?.id) return;
const response = await data.search
.search({
params: {
index: dataView?.getIndexPattern(),
body: {
fields: ['*'],
_source: false,
},
},
})
.toPromise();
const docs = response?.rawResponse?.hits?.hits ?? [];
if (docs.length > 0) {
const record = buildDataTableRecord(docs[0], dataView);
setHit(record);
}
};

setDefaultHit();
}, [data, dataView]);

return (
<>
{dataView?.id && hit ? (
<UnifiedDocViewer hit={hit} dataView={dataView} />
) : (
'Loading... (make sure you have a default data view and at least one matching document)'
)}
</>
);
}
12 changes: 12 additions & 0 deletions examples/unified_doc_viewer/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { UnifiedDocViewerExamplesPlugin } from './plugin';

export function plugin() {
return new UnifiedDocViewerExamplesPlugin();
}
49 changes: 49 additions & 0 deletions examples/unified_doc_viewer/public/plugin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
import { DeveloperExamplesSetup } from '@kbn/developer-examples-plugin/public';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';

export interface SetupDeps {
developerExamples: DeveloperExamplesSetup;
}

export interface StartDeps {
data: DataPublicPluginStart;
}

export class UnifiedDocViewerExamplesPlugin implements Plugin<void, void, SetupDeps, StartDeps> {
public setup(core: CoreSetup<StartDeps>, deps: SetupDeps) {
// Register an application into the side navigation menu
core.application.register({
id: 'unifiedDocViewer',
title: 'Unified Doc Viewer Examples',
async mount(params: AppMountParameters) {
// Load application bundle
const { renderApp } = await import('./application');
// Get start services as specified in kibana.json
const [coreStart, depsStart] = await core.getStartServices();
// Render the application
return renderApp(coreStart, depsStart, params);
},
});

// This section is only needed to get this example plugin to show up in our Developer Examples.
deps.developerExamples.register({
appId: 'unifiedDocViewer',
title: 'Unified Doc Viewer Examples',
description: 'Examples showcasing the unified doc viewer.',
});
}

public start(core: CoreStart) {
return {};
}

public stop() {}
}
24 changes: 24 additions & 0 deletions examples/unified_doc_viewer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types"
},
"include": [
"index.ts",
"common/**/*.ts",
"public/**/*.ts",
"public/**/*.tsx",
"../../typings/**/*"
],
"exclude": [
"target/**/*",
],
"kbn_references": [
"@kbn/core",
"@kbn/data-plugin",
"@kbn/data-views-plugin",
"@kbn/developer-examples-plugin",
"@kbn/discover-utils",
"@kbn/unified-doc-viewer-plugin",
]
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,9 @@
"@kbn/ui-shared-deps-npm": "link:packages/kbn-ui-shared-deps-npm",
"@kbn/ui-shared-deps-src": "link:packages/kbn-ui-shared-deps-src",
"@kbn/ui-theme": "link:packages/kbn-ui-theme",
"@kbn/unified-doc-viewer": "link:packages/kbn-unified-doc-viewer",
"@kbn/unified-doc-viewer-examples": "link:examples/unified_doc_viewer",
"@kbn/unified-doc-viewer-plugin": "link:src/plugins/unified_doc_viewer",
"@kbn/unified-field-list": "link:packages/kbn-unified-field-list",
"@kbn/unified-field-list-examples-plugin": "link:examples/unified_field_list_examples",
"@kbn/unified-histogram-plugin": "link:src/plugins/unified_histogram",
Expand Down
4 changes: 4 additions & 0 deletions packages/kbn-discover-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export {
ENABLE_SQL,
FIELDS_LIMIT_SETTING,
HIDE_ANNOUNCEMENTS,
KNOWN_FIELD_TYPE_LIST,
KNOWN_FIELD_TYPES,
MAX_DOC_FIELDS_DISPLAYED,
MODIFY_COLUMNS_ON_SWITCH,
ROW_HEIGHT_OPTION,
Expand All @@ -34,8 +36,10 @@ export {
formatFieldValue,
formatHit,
getDocId,
getFieldTypeName,
getIgnoredReason,
getShouldShowFieldHandler,
isKnownFieldType,
isNestedFieldParent,
usePager,
} from './src';
2 changes: 1 addition & 1 deletion packages/kbn-discover-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import type { SearchHit } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';

export type { IgnoredReason, ShouldShowFieldInTableHandler } from './utils';
export type { FieldTypeKnown, IgnoredReason, ShouldShowFieldInTableHandler } from './utils';

export interface EsHitRecord extends Omit<SearchHit, '_source'> {
_source?: Record<string, unknown>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
* Side Public License, v 1.
*/

import { FieldTypeKnown } from '../../types';
import type { DataViewField } from '@kbn/data-views-plugin/common';

export type FieldTypeKnown = Exclude<
DataViewField['timeSeriesMetric'] | DataViewField['type'],
undefined
>;

/**
* Field types for which name and description are defined
Expand Down
Loading

0 comments on commit 4713f3e

Please sign in to comment.