-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover] Context aware Single Document & Surrounding Documents pages (
#190540) - Closes #188178 ## Summary This PR makes sure to resolve profiles on: - [x] Single document page (also added doc viewer extension support) - [x] Surrounding documents page (also added cell renderes support) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
- Loading branch information
1 parent
f2aba46
commit 0017463
Showing
18 changed files
with
465 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/plugins/discover/public/application/doc/components/single_doc_viewer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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, { useMemo } from 'react'; | ||
import { UnifiedDocViewer } from '@kbn/unified-doc-viewer-plugin/public'; | ||
import type { DocViewsRegistry } from '@kbn/unified-doc-viewer'; | ||
import type { DataTableRecord } from '@kbn/discover-utils'; | ||
import type { DataView } from '@kbn/data-views-plugin/public'; | ||
import { useProfileAccessor } from '../../../context_awareness'; | ||
|
||
interface SingleDocViewerProps { | ||
record: DataTableRecord; | ||
dataView: DataView; | ||
} | ||
|
||
export const SingleDocViewer: React.FC<SingleDocViewerProps> = ({ record, dataView }) => { | ||
const getDocViewerAccessor = useProfileAccessor('getDocViewer', { | ||
record, | ||
}); | ||
const docViewer = useMemo(() => { | ||
const getDocViewer = getDocViewerAccessor(() => ({ | ||
title: undefined, | ||
docViewsRegistry: (registry: DocViewsRegistry) => registry, | ||
})); | ||
|
||
return getDocViewer({ record }); | ||
}, [getDocViewerAccessor, record]); | ||
|
||
return ( | ||
<UnifiedDocViewer | ||
hit={record} | ||
dataView={dataView} | ||
hideActionsColumn | ||
docViewsRegistry={docViewer.docViewsRegistry} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.