-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[App Search] Engine overview layout stub #83504
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fa9d12c
Set up Overview file
cee-chen 7ac0e3b
Finish Overview page logic, stub out empty/metric views
cee-chen 0d71c73
Stub in basic empty engine overview
cee-chen 1097787
Stub out EngineOverviewMetrics and unavailable empty prompt
cee-chen 2be4c35
Stub out EngineOverMetrics components (stats, charts, logs)
cee-chen 2fca086
[Refactor] Pull out some document creation i18n strings to constants
cee-chen 4cd44f9
Merge branch 'master' into engine-overview
cee-chen 5e945c3
PR feedback: Drop the regex
cee-chen 4d4747c
PR feedback: RecentLogs -> RecentApiLogs
cee-chen 9bc3780
PR feedback: Copy
cee-chen cc01d6b
PR feedback: Copy, sentence-casing
cee-chen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...lugins/enterprise_search/public/applications/app_search/components/analytics/constants.ts
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,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const TOTAL_DOCUMENTS = i18n.translate( | ||
'xpack.enterpriseSearch.appSearch.engine.analytics.totalDocuments', | ||
{ defaultMessage: 'Total documents' } | ||
); | ||
|
||
export const TOTAL_API_OPERATIONS = i18n.translate( | ||
'xpack.enterpriseSearch.appSearch.engine.analytics.totalApiOperations', | ||
{ defaultMessage: 'Total API operations' } | ||
); | ||
|
||
export const TOTAL_QUERIES = i18n.translate( | ||
'xpack.enterpriseSearch.appSearch.engine.analytics.totalQueries', | ||
{ defaultMessage: 'Total queries' } | ||
); | ||
|
||
export const TOTAL_CLICKS = i18n.translate( | ||
'xpack.enterpriseSearch.appSearch.engine.analytics.totalClicks', | ||
{ defaultMessage: 'Total clicks' } | ||
); | ||
12 changes: 12 additions & 0 deletions
12
...plugins/enterprise_search/public/applications/app_search/components/api_logs/constants.ts
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,12 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const RECENT_API_EVENTS = i18n.translate( | ||
'xpack.enterpriseSearch.appSearch.engine.apiLogs.recent', | ||
{ defaultMessage: 'Recent API events' } | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above, this title is also used in the API Logs view |
54 changes: 54 additions & 0 deletions
54
...terprise_search/public/applications/app_search/components/document_creation/constants.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,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { EuiCode, EuiLink } from '@elastic/eui'; | ||
|
||
import { DOCS_PREFIX } from '../../routes'; | ||
|
||
export const DOCUMENT_CREATION_DESCRIPTION = ( | ||
<FormattedMessage | ||
cee-chen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
id="xpack.enterpriseSearch.appSearch.engine.documentCreation.description" | ||
defaultMessage="There are three ways to send documents to your engine for indexing. You can paste raw JSON, upload a {jsonCode} file, or {postCode} to the {documentsApiLink} endpoint. Click on your choice below or see {apiStrong}." | ||
values={{ | ||
jsonCode: <EuiCode>.json</EuiCode>, | ||
postCode: <EuiCode>POST</EuiCode>, | ||
documentsApiLink: ( | ||
<EuiLink target="_blank" href={`${DOCS_PREFIX}/indexing-documents-guide.html`}> | ||
documents API | ||
</EuiLink> | ||
), | ||
apiStrong: <strong>Indexing by API</strong>, | ||
}} | ||
/> | ||
); | ||
|
||
export const DOCUMENT_API_INDEXING_TITLE = i18n.translate( | ||
'xpack.enterpriseSearch.appSearch.engine.documentCreation.api.title', | ||
{ defaultMessage: 'Indexing by API' } | ||
); | ||
|
||
export const DOCUMENT_API_INDEXING_DESCRIPTION = ( | ||
<FormattedMessage | ||
id="xpack.enterpriseSearch.appSearch.engine.documentCreation.api.description" | ||
defaultMessage="The {documentsApiLink} can be used to add new documents to your engine, update documents, retrieve documents by id, and delete documents. There are a variety of {clientLibrariesLink} to help you get started." | ||
values={{ | ||
documentsApiLink: ( | ||
<EuiLink target="_blank" href={`${DOCS_PREFIX}/indexing-documents-guide.html`}> | ||
documents API | ||
</EuiLink> | ||
), | ||
clientLibrariesLink: ( | ||
<EuiLink target="_blank" href={`${DOCS_PREFIX}/api-clients.html`}> | ||
client libraries | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
); |
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
10 changes: 10 additions & 0 deletions
10
...rise_search/public/applications/app_search/components/engine_overview/components/index.ts
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,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export { UnavailablePrompt } from './unavailable_prompt'; | ||
export { TotalStats } from './total_stats'; | ||
export { TotalCharts } from './total_charts'; | ||
export { RecentApiLogs } from './recent_api_logs'; |
32 changes: 32 additions & 0 deletions
32
...ic/applications/app_search/components/engine_overview/components/recent_api_logs.test.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,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { setMockValues } from '../../../../__mocks__/kea.mock'; | ||
|
||
import React from 'react'; | ||
import { shallow, ShallowWrapper } from 'enzyme'; | ||
|
||
import { EuiButton } from '../../../../shared/react_router_helpers'; | ||
|
||
import { RecentApiLogs } from './recent_api_logs'; | ||
|
||
describe('RecentApiLogs', () => { | ||
let wrapper: ShallowWrapper; | ||
|
||
beforeAll(() => { | ||
jest.clearAllMocks(); | ||
setMockValues({ | ||
engineName: 'some-engine', | ||
}); | ||
wrapper = shallow(<RecentApiLogs />); | ||
}); | ||
|
||
it('renders the recent API logs table', () => { | ||
expect(wrapper.find('h2').text()).toEqual('Recent API events'); | ||
expect(wrapper.find(EuiButton).prop('to')).toEqual('/engines/some-engine/api-logs'); | ||
// TODO: expect(wrapper.find(ApiLogsTable)).toHaveLength(1) | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
.../public/applications/app_search/components/engine_overview/components/recent_api_logs.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,50 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { useValues } from 'kea'; | ||
|
||
import { | ||
EuiPageContent, | ||
EuiPageContentHeader, | ||
EuiPageContentHeaderSection, | ||
EuiPageContentBody, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
|
||
import { EuiButton } from '../../../../shared/react_router_helpers'; | ||
|
||
import { ENGINE_API_LOGS_PATH, getEngineRoute } from '../../../routes'; | ||
import { RECENT_API_EVENTS } from '../../api_logs/constants'; | ||
import { VIEW_API_LOGS } from '../constants'; | ||
|
||
import { EngineLogic } from '../../engine'; | ||
|
||
export const RecentApiLogs: React.FC = () => { | ||
const { engineName } = useValues(EngineLogic); | ||
const engineRoute = getEngineRoute(engineName); | ||
|
||
return ( | ||
<EuiPageContent> | ||
<EuiPageContentHeader responsive={false}> | ||
<EuiPageContentHeaderSection> | ||
<EuiTitle size="xs"> | ||
<h2>{RECENT_API_EVENTS}</h2> | ||
</EuiTitle> | ||
</EuiPageContentHeaderSection> | ||
<EuiPageContentHeaderSection> | ||
<EuiButton to={engineRoute + ENGINE_API_LOGS_PATH} size="s"> | ||
{VIEW_API_LOGS} | ||
</EuiButton> | ||
</EuiPageContentHeaderSection> | ||
</EuiPageContentHeader> | ||
<EuiPageContentBody> | ||
TODO: API Logs Table | ||
{/* <ApiLogsTable hidePagination={true} /> */} | ||
</EuiPageContentBody> | ||
</EuiPageContent> | ||
); | ||
}; |
46 changes: 46 additions & 0 deletions
46
...ublic/applications/app_search/components/engine_overview/components/total_charts.test.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,46 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { setMockValues } from '../../../../__mocks__/kea.mock'; | ||
|
||
import React from 'react'; | ||
import { shallow, ShallowWrapper } from 'enzyme'; | ||
|
||
import { EuiButton } from '../../../../shared/react_router_helpers'; | ||
|
||
import { TotalCharts } from './total_charts'; | ||
|
||
describe('TotalCharts', () => { | ||
let wrapper: ShallowWrapper; | ||
|
||
beforeAll(() => { | ||
jest.clearAllMocks(); | ||
setMockValues({ | ||
engineName: 'some-engine', | ||
startDate: '1970-01-01', | ||
endDate: '1970-01-08', | ||
queriesPerDay: [0, 1, 2, 3, 5, 10, 50], | ||
operationsPerDay: [0, 0, 0, 0, 0, 0, 0], | ||
}); | ||
wrapper = shallow(<TotalCharts />); | ||
}); | ||
|
||
it('renders the total queries chart', () => { | ||
const chart = wrapper.find('[data-test-subj="TotalQueriesChart"]'); | ||
|
||
expect(chart.find('h2').text()).toEqual('Total queries'); | ||
expect(chart.find(EuiButton).prop('to')).toEqual('/engines/some-engine/analytics'); | ||
// TODO: find chart component | ||
}); | ||
|
||
it('renders the total API operations chart', () => { | ||
const chart = wrapper.find('[data-test-subj="TotalApiOperationsChart"]'); | ||
|
||
expect(chart.find('h2').text()).toEqual('Total API operations'); | ||
expect(chart.find(EuiButton).prop('to')).toEqual('/engines/some-engine/api-logs'); | ||
// TODO: find chart component | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These constants are also used in the Analytics view so I figured I'd do myself a favor and start a constants file early.