Fix document URLs in the query analytics view (#134685)

* Fix document URLs in the query analytics view

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Remove engine prop from QueryClick

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Ioana Tagirta 2022-06-20 16:37:42 +02:00 committed by GitHub
parent b2ef47b2d8
commit f59fd4a343
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View file

@ -22,7 +22,6 @@ describe('QueryClicksTable', () => {
{
key: 'some-document',
document: {
engine: 'some-engine',
id: 'some-document',
},
tags: ['tagA'],
@ -31,7 +30,6 @@ describe('QueryClicksTable', () => {
{
key: 'another-document',
document: {
engine: 'another-engine',
id: 'another-document',
},
tags: ['tagB'],
@ -57,7 +55,7 @@ describe('QueryClicksTable', () => {
'/app/enterprise_search/engines/some-engine/documents/some-document'
);
expect(wrapper.find(EuiLink).last().prop('href')).toEqual(
'/app/enterprise_search/engines/another-engine/documents/another-document'
'/app/enterprise_search/engines/some-engine/documents/another-document'
);
// deleted-document should not have a link

View file

@ -13,7 +13,7 @@ import { i18n } from '@kbn/i18n';
import { EuiLinkTo } from '../../../../../shared/react_router_helpers';
import { ENGINE_DOCUMENT_DETAIL_PATH } from '../../../../routes';
import { DOCUMENTS_TITLE } from '../../../documents';
import { generateEnginePath } from '../../../engine';
import { generateEnginePath, EngineLogic } from '../../../engine';
import { QueryClick } from '../../types';
@ -25,6 +25,8 @@ interface Props {
type Columns = Array<EuiBasicTableColumn<QueryClick>>;
export const QueryClicksTable: React.FC<Props> = ({ items }) => {
const { engineName } = EngineLogic.values;
const DOCUMENT_COLUMN = {
...FIRST_COLUMN_PROPS,
field: 'document',
@ -33,7 +35,7 @@ export const QueryClicksTable: React.FC<Props> = ({ items }) => {
return document ? (
<EuiLinkTo
to={generateEnginePath(ENGINE_DOCUMENT_DETAIL_PATH, {
engineName: document.engine,
engineName,
documentId: document.id,
})}
>

View file

@ -15,7 +15,6 @@ export interface Query {
export interface QueryClick extends Query {
document?: {
id: string;
engine: string;
};
}