mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Enterprise Search][Search Applications] Remove overview page (#155098)
## Summary Removed the search applications overview page and replaced it as the default page with the search preview page.
This commit is contained in:
parent
0a38f85002
commit
e0002476ef
12 changed files with 13 additions and 760 deletions
|
@ -30,7 +30,7 @@ export const fetchIndices = async ({
|
|||
const { http } = HttpLogic.values;
|
||||
const route = '/internal/enterprise_search/indices';
|
||||
const query = {
|
||||
page: 1,
|
||||
from: 0,
|
||||
return_hidden_indices: false,
|
||||
search_query: searchQuery || null,
|
||||
size: INDEX_SEARCH_PAGE_SIZE,
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { useValues } from 'kea';
|
||||
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiPanel, EuiStat, useEuiTheme } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { generateEncodedPath } from '../../../shared/encode_path_params';
|
||||
import { EuiLinkTo } from '../../../shared/react_router_helpers';
|
||||
import { EngineViewTabs, ENGINE_TAB_PATH } from '../../routes';
|
||||
import { EnterpriseSearchEnginesPageTemplate } from '../layout/engines_page_template';
|
||||
|
||||
import { EngineOverviewLogic } from './engine_overview_logic';
|
||||
import { EngineViewHeaderActions } from './engine_view_header_actions';
|
||||
|
||||
export const EngineOverview: React.FC = () => {
|
||||
const {
|
||||
euiTheme: { colors: colors },
|
||||
} = useEuiTheme();
|
||||
const {
|
||||
documentsCount,
|
||||
engineName,
|
||||
fieldsCount,
|
||||
hasUnknownIndices,
|
||||
indicesCount,
|
||||
isLoadingEngine,
|
||||
} = useValues(EngineOverviewLogic);
|
||||
|
||||
return (
|
||||
<EnterpriseSearchEnginesPageTemplate
|
||||
pageChrome={[engineName]}
|
||||
pageViewTelemetry={EngineViewTabs.OVERVIEW}
|
||||
isLoading={isLoadingEngine}
|
||||
pageHeader={{
|
||||
pageTitle: i18n.translate('xpack.enterpriseSearch.content.engine.overview.pageTitle', {
|
||||
defaultMessage: 'Overview',
|
||||
}),
|
||||
rightSideItems: [<EngineViewHeaderActions />],
|
||||
}}
|
||||
engineName={engineName}
|
||||
>
|
||||
<>
|
||||
<EuiPanel hasShadow={false} hasBorder paddingSize="l">
|
||||
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center">
|
||||
<EuiFlexItem>
|
||||
<EuiLinkTo
|
||||
to={generateEncodedPath(ENGINE_TAB_PATH, {
|
||||
engineName,
|
||||
tabId: EngineViewTabs.INDICES,
|
||||
})}
|
||||
color="text"
|
||||
>
|
||||
<EuiFlexGroup alignItems="center">
|
||||
{hasUnknownIndices ? (
|
||||
<EuiIcon size="xxl" type="warning" color={colors.warning} />
|
||||
) : (
|
||||
<EuiIcon size="xxl" type="visTable" color={colors.mediumShade} />
|
||||
)}
|
||||
<EuiStat
|
||||
titleSize="l"
|
||||
isLoading={isLoadingEngine}
|
||||
title={indicesCount.toLocaleString()}
|
||||
description={i18n.translate(
|
||||
'xpack.enterpriseSearch.content.engine.overview.indicesDescription',
|
||||
{ defaultMessage: 'Indices' }
|
||||
)}
|
||||
titleColor={hasUnknownIndices ? colors.warningText : 'primary'}
|
||||
/>
|
||||
</EuiFlexGroup>
|
||||
</EuiLinkTo>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem>
|
||||
<EuiLinkTo
|
||||
to={generateEncodedPath(ENGINE_TAB_PATH, {
|
||||
engineName,
|
||||
tabId: EngineViewTabs.PREVIEW,
|
||||
})}
|
||||
color="text"
|
||||
>
|
||||
<EuiFlexGroup alignItems="center">
|
||||
<EuiIcon size="xxl" type="documents" color={colors.mediumShade} />
|
||||
<EuiStat
|
||||
titleSize="l"
|
||||
isLoading={isLoadingEngine}
|
||||
title={documentsCount.toLocaleString()}
|
||||
description={i18n.translate(
|
||||
'xpack.enterpriseSearch.content.engine.overview.documentsDescription',
|
||||
{ defaultMessage: 'Documents' }
|
||||
)}
|
||||
titleColor="primary"
|
||||
/>
|
||||
</EuiFlexGroup>
|
||||
</EuiLinkTo>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem>
|
||||
<EuiLinkTo
|
||||
to={generateEncodedPath(ENGINE_TAB_PATH, {
|
||||
engineName,
|
||||
tabId: EngineViewTabs.SCHEMA,
|
||||
})}
|
||||
color="text"
|
||||
>
|
||||
<EuiFlexGroup alignItems="center">
|
||||
<EuiIcon size="xxl" type="documents" color={colors.mediumShade} />
|
||||
<EuiStat
|
||||
titleSize="l"
|
||||
isLoading={false}
|
||||
title={fieldsCount.toLocaleString()}
|
||||
description={i18n.translate(
|
||||
'xpack.enterpriseSearch.content.engine.overview.fieldsDescription',
|
||||
{ defaultMessage: 'Fields' }
|
||||
)}
|
||||
titleColor="primary"
|
||||
/>
|
||||
</EuiFlexGroup>
|
||||
</EuiLinkTo>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</EuiPanel>
|
||||
</>
|
||||
</EnterpriseSearchEnginesPageTemplate>
|
||||
);
|
||||
};
|
|
@ -1,487 +0,0 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { LogicMounter } from '../../../__mocks__/kea_logic';
|
||||
|
||||
import { Status } from '../../../../../common/types/api';
|
||||
import { EnterpriseSearchEngineIndex, SchemaField } from '../../../../../common/types/engines';
|
||||
|
||||
import {
|
||||
EngineOverviewLogic,
|
||||
EngineOverviewValues,
|
||||
selectDocumentsCount,
|
||||
selectFieldsCount,
|
||||
selectHasUnknownIndices,
|
||||
selectIndices,
|
||||
selectIndicesCount,
|
||||
} from './engine_overview_logic';
|
||||
|
||||
const DEFAULT_VALUES: EngineOverviewValues = {
|
||||
documentsCount: 0,
|
||||
engineData: undefined,
|
||||
engineFieldCapabilitiesApiStatus: Status.IDLE,
|
||||
engineFieldCapabilitiesData: undefined,
|
||||
engineName: '',
|
||||
fieldsCount: 0,
|
||||
hasUnknownIndices: false,
|
||||
indices: [],
|
||||
indicesCount: 0,
|
||||
isLoadingEngine: true,
|
||||
};
|
||||
|
||||
describe('EngineOverviewLogic', () => {
|
||||
const { mount } = new LogicMounter(EngineOverviewLogic);
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.useRealTimers();
|
||||
|
||||
mount();
|
||||
});
|
||||
|
||||
it('has expected default values', () => {
|
||||
expect(EngineOverviewLogic.values).toEqual(DEFAULT_VALUES);
|
||||
});
|
||||
|
||||
describe('listeners', () => {
|
||||
describe('setEngineName', () => {
|
||||
it('refetches the engine field capabilities', () => {
|
||||
jest.spyOn(EngineOverviewLogic.actions, 'fetchEngineFieldCapabilities');
|
||||
|
||||
EngineOverviewLogic.actions.setEngineName('foobar');
|
||||
|
||||
expect(EngineOverviewLogic.actions.fetchEngineFieldCapabilities).toHaveBeenCalledTimes(1);
|
||||
expect(EngineOverviewLogic.actions.fetchEngineFieldCapabilities).toHaveBeenCalledWith({
|
||||
engineName: 'foobar',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('selectors', () => {
|
||||
describe('indices', () => {
|
||||
it('is defined', () => {
|
||||
expect(selectIndices).toBeDefined();
|
||||
});
|
||||
it('returns an empty array before engineData is loaded', () => {
|
||||
expect(selectIndices(undefined)).toEqual([]);
|
||||
});
|
||||
it('returns the array of indices', () => {
|
||||
const indices = [
|
||||
{
|
||||
count: 10,
|
||||
health: 'green',
|
||||
name: 'index-001',
|
||||
},
|
||||
{
|
||||
count: 10,
|
||||
health: 'green',
|
||||
name: 'index-002',
|
||||
},
|
||||
];
|
||||
const engineData = {
|
||||
indices,
|
||||
name: 'foo-engine',
|
||||
updated_at_millis: 2202018295,
|
||||
} as EngineOverviewValues['engineData'];
|
||||
expect(selectIndices(engineData)).toBe(indices);
|
||||
});
|
||||
});
|
||||
describe('indicesCount', () => {
|
||||
it('is defined', () => {
|
||||
expect(selectIndicesCount).toBeDefined();
|
||||
});
|
||||
it('returns the number of indices', () => {
|
||||
const noIndices: EnterpriseSearchEngineIndex[] = [];
|
||||
const oneIndex = [
|
||||
{ count: 23, health: 'unknown', name: 'index-001' },
|
||||
] as EnterpriseSearchEngineIndex[];
|
||||
const twoIndices = [
|
||||
{ count: 23, health: 'unknown', name: 'index-001' },
|
||||
{ count: 92, health: 'unknown', name: 'index-002' },
|
||||
] as EnterpriseSearchEngineIndex[];
|
||||
|
||||
expect(selectIndicesCount(noIndices)).toBe(0);
|
||||
expect(selectIndicesCount(oneIndex)).toBe(1);
|
||||
expect(selectIndicesCount(twoIndices)).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasUnknownIndices', () => {
|
||||
it('is defined', () => {
|
||||
expect(selectHasUnknownIndices).toBeDefined();
|
||||
});
|
||||
describe('no indices', () => {
|
||||
const indices: EnterpriseSearchEngineIndex[] = [];
|
||||
it('returns false', () => {
|
||||
expect(selectHasUnknownIndices(indices)).toBe(false);
|
||||
});
|
||||
});
|
||||
describe('all indices unknown', () => {
|
||||
const indices = [
|
||||
{
|
||||
count: 12,
|
||||
health: 'unknown',
|
||||
name: 'index-001',
|
||||
},
|
||||
{
|
||||
count: 34,
|
||||
health: 'unknown',
|
||||
name: 'index-002',
|
||||
},
|
||||
{
|
||||
count: 56,
|
||||
health: 'unknown',
|
||||
name: 'index-003',
|
||||
},
|
||||
] as EnterpriseSearchEngineIndex[];
|
||||
it('returns true', () => {
|
||||
expect(selectHasUnknownIndices(indices)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('one index unknown', () => {
|
||||
const indices = [
|
||||
{
|
||||
count: 12,
|
||||
health: 'unknown',
|
||||
name: 'index-001',
|
||||
},
|
||||
{
|
||||
count: 34,
|
||||
health: 'yellow',
|
||||
name: 'index-002',
|
||||
},
|
||||
{
|
||||
count: 56,
|
||||
health: 'green',
|
||||
name: 'index-003',
|
||||
},
|
||||
] as EnterpriseSearchEngineIndex[];
|
||||
it('returns true', () => {
|
||||
expect(selectHasUnknownIndices(indices)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('multiple but not all indices unknown', () => {
|
||||
const indices = [
|
||||
{
|
||||
count: 12,
|
||||
health: 'unknown',
|
||||
name: 'index-001',
|
||||
},
|
||||
{
|
||||
count: 34,
|
||||
health: 'yellow',
|
||||
name: 'index-002',
|
||||
},
|
||||
{
|
||||
count: 56,
|
||||
health: 'unknown',
|
||||
name: 'index-003',
|
||||
},
|
||||
] as EnterpriseSearchEngineIndex[];
|
||||
it('returns true', () => {
|
||||
expect(selectHasUnknownIndices(indices)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('no indices unknown', () => {
|
||||
const indices = [
|
||||
{
|
||||
count: 12,
|
||||
health: 'green',
|
||||
name: 'index-001',
|
||||
},
|
||||
{
|
||||
count: 34,
|
||||
health: 'yellow',
|
||||
name: 'index-002',
|
||||
},
|
||||
{
|
||||
count: 56,
|
||||
health: 'green',
|
||||
name: 'index-003',
|
||||
},
|
||||
] as EnterpriseSearchEngineIndex[];
|
||||
it('returns false', () => {
|
||||
expect(selectHasUnknownIndices(indices)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('documentsCount', () => {
|
||||
it('is defined', () => {
|
||||
expect(selectDocumentsCount).toBeDefined();
|
||||
});
|
||||
|
||||
it('returns 0 for no indices', () => {
|
||||
expect(selectDocumentsCount([])).toBe(0);
|
||||
});
|
||||
|
||||
it('returns the `count` for a single index', () => {
|
||||
expect(
|
||||
selectDocumentsCount([
|
||||
{
|
||||
count: 23,
|
||||
health: 'green',
|
||||
name: 'index-001',
|
||||
},
|
||||
] as EnterpriseSearchEngineIndex[])
|
||||
).toBe(23);
|
||||
});
|
||||
|
||||
it('returns the sum of all `count`', () => {
|
||||
expect(
|
||||
selectDocumentsCount([
|
||||
{
|
||||
count: 23,
|
||||
health: 'green',
|
||||
name: 'index-001',
|
||||
},
|
||||
{
|
||||
count: 45,
|
||||
health: 'green',
|
||||
name: 'index-002',
|
||||
},
|
||||
] as EnterpriseSearchEngineIndex[])
|
||||
).toBe(68);
|
||||
});
|
||||
|
||||
it('does not count indices without a `count`', () => {
|
||||
expect(
|
||||
selectDocumentsCount([
|
||||
{
|
||||
count: 23,
|
||||
health: 'green',
|
||||
name: 'index-001',
|
||||
},
|
||||
{
|
||||
count: null,
|
||||
health: 'unknown',
|
||||
name: 'index-002',
|
||||
},
|
||||
{
|
||||
count: 45,
|
||||
health: 'green',
|
||||
name: 'index-002',
|
||||
},
|
||||
] as EnterpriseSearchEngineIndex[])
|
||||
).toBe(68);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fieldsCount', () => {
|
||||
it('is defined', () => {
|
||||
expect(selectFieldsCount).toBeDefined();
|
||||
});
|
||||
it('counts the fields from the field capabilities', () => {
|
||||
const fieldCapabilities = {
|
||||
created: '2023-02-07T19:16:43Z',
|
||||
fields: [
|
||||
{
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: 'integer',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: 'integer',
|
||||
},
|
||||
],
|
||||
name: 'age',
|
||||
type: 'integer',
|
||||
},
|
||||
{
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: 'keyword',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: 'keyword',
|
||||
},
|
||||
],
|
||||
name: 'color',
|
||||
type: 'keyword',
|
||||
},
|
||||
{
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
name: 'name',
|
||||
type: 'text',
|
||||
},
|
||||
] as SchemaField[],
|
||||
name: 'engine-001',
|
||||
updated_at_millis: 2202018295,
|
||||
};
|
||||
expect(selectFieldsCount(fieldCapabilities)).toBe(3);
|
||||
});
|
||||
|
||||
it('excludes metadata fields from the count', () => {
|
||||
const fieldCapabilities = {
|
||||
created: '2023-02-07T19:16:43Z',
|
||||
fields: [
|
||||
{
|
||||
aggregatable: true,
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: 'integer',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: 'integer',
|
||||
},
|
||||
],
|
||||
metadata_field: true,
|
||||
name: '_doc_count',
|
||||
searchable: true,
|
||||
type: 'integer',
|
||||
},
|
||||
{
|
||||
aggregatable: true,
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: '_id',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: '_id',
|
||||
},
|
||||
],
|
||||
metadata_field: true,
|
||||
name: '_id',
|
||||
searchable: true,
|
||||
type: '_id',
|
||||
},
|
||||
{
|
||||
aggregatable: true,
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: '_index',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: '_index',
|
||||
},
|
||||
],
|
||||
metadata_field: true,
|
||||
name: '_index',
|
||||
searchable: true,
|
||||
type: '_index',
|
||||
},
|
||||
{
|
||||
aggregatable: true,
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: '_source',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: '_source',
|
||||
},
|
||||
],
|
||||
metadata_field: true,
|
||||
name: '_source',
|
||||
searchable: true,
|
||||
type: '_source',
|
||||
},
|
||||
{
|
||||
aggregatable: true,
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: '_version',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: '_version',
|
||||
},
|
||||
],
|
||||
metadata_field: true,
|
||||
name: '_version',
|
||||
searchable: true,
|
||||
type: '_version',
|
||||
},
|
||||
{
|
||||
aggregatable: true,
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: 'integer',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: 'integer',
|
||||
},
|
||||
],
|
||||
metadata_field: false,
|
||||
name: 'age',
|
||||
searchable: true,
|
||||
type: 'integer',
|
||||
},
|
||||
{
|
||||
aggregatable: true,
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: 'keyword',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: 'keyword',
|
||||
},
|
||||
],
|
||||
metadata_field: false,
|
||||
name: 'color',
|
||||
searchable: true,
|
||||
type: 'keyword',
|
||||
},
|
||||
{
|
||||
aggregatable: false,
|
||||
indices: [
|
||||
{
|
||||
name: 'index-001',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'index-002',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
metadata_field: false,
|
||||
name: 'name',
|
||||
searchable: true,
|
||||
type: 'text',
|
||||
},
|
||||
] as SchemaField[],
|
||||
name: 'foo-engine',
|
||||
updated_at_millis: 2202018295,
|
||||
};
|
||||
expect(selectFieldsCount(fieldCapabilities)).toBe(3);
|
||||
});
|
||||
|
||||
it('returns 0 when field capability data is not available', () => {
|
||||
expect(selectFieldsCount(undefined)).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { kea, MakeLogicType } from 'kea';
|
||||
|
||||
import { Status } from '../../../../../common/types/api';
|
||||
import { EnterpriseSearchEngineIndex } from '../../../../../common/types/engines';
|
||||
|
||||
import { FetchEngineFieldCapabilitiesApiLogic } from '../../api/engines/fetch_engine_field_capabilities_api_logic';
|
||||
|
||||
import { EngineNameLogic } from './engine_name_logic';
|
||||
import { EngineViewLogic } from './engine_view_logic';
|
||||
|
||||
export interface EngineOverviewActions {
|
||||
fetchEngineFieldCapabilities: typeof FetchEngineFieldCapabilitiesApiLogic.actions.makeRequest;
|
||||
setEngineName: typeof EngineNameLogic.actions.setEngineName;
|
||||
}
|
||||
export interface EngineOverviewValues {
|
||||
documentsCount: number;
|
||||
engineData: typeof EngineViewLogic.values.engineData;
|
||||
engineFieldCapabilitiesApiStatus: typeof FetchEngineFieldCapabilitiesApiLogic.values.status;
|
||||
engineFieldCapabilitiesData: typeof FetchEngineFieldCapabilitiesApiLogic.values.data;
|
||||
engineName: typeof EngineNameLogic.values.engineName;
|
||||
fieldsCount: number;
|
||||
hasUnknownIndices: boolean;
|
||||
indices: EnterpriseSearchEngineIndex[];
|
||||
indicesCount: number;
|
||||
isLoadingEngine: typeof EngineViewLogic.values.isLoadingEngine;
|
||||
}
|
||||
|
||||
export const selectIndices = (engineData: EngineOverviewValues['engineData']) =>
|
||||
engineData?.indices ?? [];
|
||||
|
||||
export const selectIndicesCount = (indices: EngineOverviewValues['indices']) => indices.length;
|
||||
|
||||
export const selectHasUnknownIndices = (indices: EngineOverviewValues['indices']) =>
|
||||
indices.some(({ health }) => health === 'unknown');
|
||||
|
||||
export const selectDocumentsCount = (indices: EngineOverviewValues['indices']) =>
|
||||
indices.reduce((sum, { count }) => sum + count, 0);
|
||||
|
||||
export const selectFieldsCount = (
|
||||
engineFieldCapabilitiesData: EngineOverviewValues['engineFieldCapabilitiesData']
|
||||
) =>
|
||||
engineFieldCapabilitiesData?.fields?.filter(({ metadata_field: isMeta }) => !isMeta).length ?? 0;
|
||||
|
||||
export const EngineOverviewLogic = kea<MakeLogicType<EngineOverviewValues, EngineOverviewActions>>({
|
||||
actions: {},
|
||||
connect: {
|
||||
actions: [
|
||||
EngineNameLogic,
|
||||
['setEngineName'],
|
||||
FetchEngineFieldCapabilitiesApiLogic,
|
||||
['makeRequest as fetchEngineFieldCapabilities'],
|
||||
],
|
||||
values: [
|
||||
EngineNameLogic,
|
||||
['engineName'],
|
||||
EngineViewLogic,
|
||||
['engineData', 'isLoadingEngine'],
|
||||
FetchEngineFieldCapabilitiesApiLogic,
|
||||
['data as engineFieldCapabilitiesData', 'status as engineFieldCapabilitiesApiStatus'],
|
||||
],
|
||||
},
|
||||
events: ({ actions, values }) => ({
|
||||
afterMount: () => {
|
||||
if (values.engineFieldCapabilitiesApiStatus !== Status.SUCCESS && !!values.engineName) {
|
||||
actions.fetchEngineFieldCapabilities({
|
||||
engineName: values.engineName,
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
listeners: ({ actions, values }) => ({
|
||||
setEngineName: () => {
|
||||
const { engineName } = values;
|
||||
actions.fetchEngineFieldCapabilities({ engineName });
|
||||
},
|
||||
}),
|
||||
path: ['enterprise_search', 'content', 'engine_overview_logic'],
|
||||
reducers: {},
|
||||
selectors: ({ selectors }) => ({
|
||||
documentsCount: [() => [selectors.indices], selectDocumentsCount],
|
||||
fieldsCount: [() => [selectors.engineFieldCapabilitiesData], selectFieldsCount],
|
||||
hasUnknownIndices: [() => [selectors.indices], selectHasUnknownIndices],
|
||||
indices: [() => [selectors.engineData], selectIndices],
|
||||
indicesCount: [() => [selectors.indices], selectIndicesCount],
|
||||
}),
|
||||
});
|
|
@ -40,7 +40,7 @@ export const EngineRouter: React.FC = () => {
|
|||
from={ENGINE_PATH}
|
||||
to={generateEncodedPath(ENGINE_TAB_PATH, {
|
||||
engineName,
|
||||
tabId: EngineViewTabs.OVERVIEW,
|
||||
tabId: EngineViewTabs.PREVIEW,
|
||||
})}
|
||||
exact
|
||||
/>
|
||||
|
|
|
@ -23,7 +23,6 @@ import { EnterpriseSearchEnginesPageTemplate } from '../layout/engines_page_temp
|
|||
import { EngineAPI } from './engine_api/engine_api';
|
||||
import { EngineError } from './engine_error';
|
||||
import { EngineIndices } from './engine_indices';
|
||||
import { EngineOverview } from './engine_overview';
|
||||
import { EngineSchema } from './engine_schema';
|
||||
import { EngineSearchPreview } from './engine_search_preview/engine_search_preview';
|
||||
import { EngineViewHeaderActions } from './engine_view_header_actions';
|
||||
|
@ -39,7 +38,7 @@ export const EngineView: React.FC = () => {
|
|||
isDeleteModalVisible,
|
||||
isLoadingEngine,
|
||||
} = useValues(EngineViewLogic);
|
||||
const { tabId = EngineViewTabs.OVERVIEW } = useParams<{
|
||||
const { tabId = EngineViewTabs.PREVIEW } = useParams<{
|
||||
tabId?: string;
|
||||
}>();
|
||||
const { renderHeaderActions } = useValues(KibanaLogic);
|
||||
|
@ -73,17 +72,12 @@ export const EngineView: React.FC = () => {
|
|||
<Switch>
|
||||
<Route
|
||||
exact
|
||||
path={`${ENGINE_PATH}/${EngineViewTabs.OVERVIEW}`}
|
||||
component={EngineOverview}
|
||||
path={`${ENGINE_PATH}/${EngineViewTabs.PREVIEW}`}
|
||||
component={EngineSearchPreview}
|
||||
/>
|
||||
<Route exact path={`${ENGINE_PATH}/${EngineViewTabs.INDICES}`} component={EngineIndices} />
|
||||
<Route exact path={`${ENGINE_PATH}/${EngineViewTabs.SCHEMA}`} component={EngineSchema} />
|
||||
<Route exact path={`${ENGINE_PATH}/${EngineViewTabs.API}`} component={EngineAPI} />
|
||||
<Route
|
||||
exact
|
||||
path={`${ENGINE_PATH}/${EngineViewTabs.PREVIEW}`}
|
||||
component={EngineSearchPreview}
|
||||
/>
|
||||
<Route // TODO: remove this route when all engine view routes are implemented, replace with a 404 route
|
||||
render={() => (
|
||||
<EnterpriseSearchEnginesPageTemplate
|
||||
|
|
|
@ -30,10 +30,9 @@ export const ENGINE_CREATION_PATH = `${ENGINES_PATH}/new`;
|
|||
export const ENGINE_PATH = `${ENGINES_PATH}/:engineName`;
|
||||
export const ENGINE_TAB_PATH = `${ENGINE_PATH}/:tabId`;
|
||||
export enum EngineViewTabs {
|
||||
OVERVIEW = 'overview',
|
||||
PREVIEW = 'preview',
|
||||
INDICES = 'indices',
|
||||
SCHEMA = 'schema',
|
||||
PREVIEW = 'preview',
|
||||
API = 'api',
|
||||
}
|
||||
|
||||
|
|
|
@ -285,9 +285,9 @@ describe('useEnterpriseSearchEngineNav', () => {
|
|||
id: 'engineId',
|
||||
items: [
|
||||
{
|
||||
href: `/app/enterprise_search/content/engines/${engineName}/overview`,
|
||||
id: 'enterpriseSearchEngineOverview',
|
||||
name: 'Overview',
|
||||
href: `/app/enterprise_search/content/engines/${engineName}/preview`,
|
||||
id: 'enterpriseSearchEnginePreview',
|
||||
name: 'Preview',
|
||||
},
|
||||
{
|
||||
href: `/app/enterprise_search/content/engines/${engineName}/indices`,
|
||||
|
@ -299,11 +299,6 @@ describe('useEnterpriseSearchEngineNav', () => {
|
|||
id: 'enterpriseSearchEngineSchema',
|
||||
name: 'Schema',
|
||||
},
|
||||
{
|
||||
href: `/app/enterprise_search/content/engines/${engineName}/preview`,
|
||||
id: 'enterpriseSearchEnginePreview',
|
||||
name: 'Preview',
|
||||
},
|
||||
{
|
||||
href: `/app/enterprise_search/content/engines/${engineName}/api`,
|
||||
id: 'enterpriseSearchEngineAPI',
|
||||
|
|
|
@ -193,13 +193,13 @@ export const useEnterpriseSearchEngineNav = (engineName?: string, isEmptyState?:
|
|||
}),
|
||||
items: [
|
||||
{
|
||||
id: 'enterpriseSearchEngineOverview',
|
||||
name: i18n.translate('xpack.enterpriseSearch.nav.engine.overviewTitle', {
|
||||
defaultMessage: 'Overview',
|
||||
id: 'enterpriseSearchEnginePreview',
|
||||
name: i18n.translate('xpack.enterpriseSearch.nav.engine.previewTitle', {
|
||||
defaultMessage: 'Preview',
|
||||
}),
|
||||
...generateNavLink({
|
||||
shouldNotCreateHref: true,
|
||||
to: `${enginePath}/${EngineViewTabs.OVERVIEW}`,
|
||||
to: `${enginePath}/${EngineViewTabs.PREVIEW}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
|
@ -222,16 +222,6 @@ export const useEnterpriseSearchEngineNav = (engineName?: string, isEmptyState?:
|
|||
to: `${enginePath}/${EngineViewTabs.SCHEMA}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'enterpriseSearchEnginePreview',
|
||||
name: i18n.translate('xpack.enterpriseSearch.nav.engine.previewTitle', {
|
||||
defaultMessage: 'Preview',
|
||||
}),
|
||||
...generateNavLink({
|
||||
shouldNotCreateHref: true,
|
||||
to: `${enginePath}/${EngineViewTabs.PREVIEW}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: 'enterpriseSearchEngineAPI',
|
||||
name: i18n.translate('xpack.enterpriseSearch.nav.engine.apiTitle', {
|
||||
|
|
|
@ -12280,10 +12280,6 @@
|
|||
"xpack.enterpriseSearch.content.engine.indices.removeIndexConfirm.title": "Retirer cet index du moteur",
|
||||
"xpack.enterpriseSearch.content.engine.indices.searchPlaceholder": "Filtrer les index",
|
||||
"xpack.enterpriseSearch.content.engine.indicesSelect.docsLabel": "Documents :",
|
||||
"xpack.enterpriseSearch.content.engine.overview.documentsDescription": "Documents",
|
||||
"xpack.enterpriseSearch.content.engine.overview.fieldsDescription": "Champs",
|
||||
"xpack.enterpriseSearch.content.engine.overview.indicesDescription": "Index",
|
||||
"xpack.enterpriseSearch.content.engine.overview.pageTitle": "Aperçu",
|
||||
"xpack.enterpriseSearch.content.engine.schema.field_name.columnTitle": "Nom du champ",
|
||||
"xpack.enterpriseSearch.content.engine.schema.field_type.columnTitle": "Type du champ",
|
||||
"xpack.enterpriseSearch.content.engine.schema.pageTitle": "Schéma",
|
||||
|
@ -13190,7 +13186,6 @@
|
|||
"xpack.enterpriseSearch.nav.elasticsearchTitle": "Elasticsearch",
|
||||
"xpack.enterpriseSearch.nav.engine.apiTitle": "API",
|
||||
"xpack.enterpriseSearch.nav.engine.indicesTitle": "Index",
|
||||
"xpack.enterpriseSearch.nav.engine.overviewTitle": "Aperçu",
|
||||
"xpack.enterpriseSearch.nav.engine.schemaTitle": "Schéma",
|
||||
"xpack.enterpriseSearch.nav.enterpriseSearchOverviewTitle": "Aperçu",
|
||||
"xpack.enterpriseSearch.nav.searchExperiencesTitle": "Expériences de recherche",
|
||||
|
|
|
@ -12279,10 +12279,6 @@
|
|||
"xpack.enterpriseSearch.content.engine.indices.removeIndexConfirm.title": "このインデックスをエンジンから削除",
|
||||
"xpack.enterpriseSearch.content.engine.indices.searchPlaceholder": "インデックスのフィルター",
|
||||
"xpack.enterpriseSearch.content.engine.indicesSelect.docsLabel": "ドキュメント:",
|
||||
"xpack.enterpriseSearch.content.engine.overview.documentsDescription": "ドキュメント",
|
||||
"xpack.enterpriseSearch.content.engine.overview.fieldsDescription": "フィールド",
|
||||
"xpack.enterpriseSearch.content.engine.overview.indicesDescription": "インデックス",
|
||||
"xpack.enterpriseSearch.content.engine.overview.pageTitle": "概要",
|
||||
"xpack.enterpriseSearch.content.engine.schema.field_name.columnTitle": "フィールド名",
|
||||
"xpack.enterpriseSearch.content.engine.schema.field_type.columnTitle": "フィールド型",
|
||||
"xpack.enterpriseSearch.content.engine.schema.pageTitle": "スキーマ",
|
||||
|
@ -13189,7 +13185,6 @@
|
|||
"xpack.enterpriseSearch.nav.elasticsearchTitle": "Elasticsearch",
|
||||
"xpack.enterpriseSearch.nav.engine.apiTitle": "API",
|
||||
"xpack.enterpriseSearch.nav.engine.indicesTitle": "インデックス",
|
||||
"xpack.enterpriseSearch.nav.engine.overviewTitle": "概要",
|
||||
"xpack.enterpriseSearch.nav.engine.schemaTitle": "スキーマ",
|
||||
"xpack.enterpriseSearch.nav.enterpriseSearchOverviewTitle": "概要",
|
||||
"xpack.enterpriseSearch.nav.searchExperiencesTitle": "検索エクスペリエンス",
|
||||
|
|
|
@ -12280,10 +12280,6 @@
|
|||
"xpack.enterpriseSearch.content.engine.indices.removeIndexConfirm.title": "从引擎中移除此索引",
|
||||
"xpack.enterpriseSearch.content.engine.indices.searchPlaceholder": "筛选索引",
|
||||
"xpack.enterpriseSearch.content.engine.indicesSelect.docsLabel": "文档:",
|
||||
"xpack.enterpriseSearch.content.engine.overview.documentsDescription": "文档",
|
||||
"xpack.enterpriseSearch.content.engine.overview.fieldsDescription": "字段",
|
||||
"xpack.enterpriseSearch.content.engine.overview.indicesDescription": "索引",
|
||||
"xpack.enterpriseSearch.content.engine.overview.pageTitle": "概览",
|
||||
"xpack.enterpriseSearch.content.engine.schema.field_name.columnTitle": "字段名称",
|
||||
"xpack.enterpriseSearch.content.engine.schema.field_type.columnTitle": "字段类型",
|
||||
"xpack.enterpriseSearch.content.engine.schema.pageTitle": "架构",
|
||||
|
@ -13190,7 +13186,6 @@
|
|||
"xpack.enterpriseSearch.nav.elasticsearchTitle": "Elasticsearch",
|
||||
"xpack.enterpriseSearch.nav.engine.apiTitle": "API",
|
||||
"xpack.enterpriseSearch.nav.engine.indicesTitle": "索引",
|
||||
"xpack.enterpriseSearch.nav.engine.overviewTitle": "概览",
|
||||
"xpack.enterpriseSearch.nav.engine.schemaTitle": "架构",
|
||||
"xpack.enterpriseSearch.nav.enterpriseSearchOverviewTitle": "概览",
|
||||
"xpack.enterpriseSearch.nav.searchExperiencesTitle": "搜索体验",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue