mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.16`: - [[Discover][ES|QL] Rename Documents tab to Results (#197833)](https://github.com/elastic/kibana/pull/197833) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Rechkunova","email":"julia.rechkunova@elastic.co"},"sourceCommit":{"committedDate":"2024-10-28T11:45:39Z","message":"[Discover][ES|QL] Rename Documents tab to Results (#197833)\n\n## Summary\r\n\r\nThis PR renames Documents label to Results for ES|QL mode.\r\n\r\n<img width=\"1091\" alt=\"Screenshot 2024-10-25 at 15 44 32\"\r\nsrc=\"https://github.com/user-attachments/assets/8678bb86-7e4b-4341-9bb3-50becced655b\">\r\n<img width=\"1676\" alt=\"Screenshot 2024-10-25 at 15 52 55\"\r\nsrc=\"https://github.com/user-attachments/assets/c79d2ee0-62e1-4506-bcb5-29552287f140\">\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"8a96f69250ffe674c3d2fff340db39f7f8b99652","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","Team:DataDiscovery","v8.16.0","backport:version","v8.17.0"],"title":"[Discover][ES|QL] Rename Documents tab to Results","number":197833,"url":"https://github.com/elastic/kibana/pull/197833","mergeCommit":{"message":"[Discover][ES|QL] Rename Documents tab to Results (#197833)\n\n## Summary\r\n\r\nThis PR renames Documents label to Results for ES|QL mode.\r\n\r\n<img width=\"1091\" alt=\"Screenshot 2024-10-25 at 15 44 32\"\r\nsrc=\"https://github.com/user-attachments/assets/8678bb86-7e4b-4341-9bb3-50becced655b\">\r\n<img width=\"1676\" alt=\"Screenshot 2024-10-25 at 15 52 55\"\r\nsrc=\"https://github.com/user-attachments/assets/c79d2ee0-62e1-4506-bcb5-29552287f140\">\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"8a96f69250ffe674c3d2fff340db39f7f8b99652"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197833","number":197833,"mergeCommit":{"message":"[Discover][ES|QL] Rename Documents tab to Results (#197833)\n\n## Summary\r\n\r\nThis PR renames Documents label to Results for ES|QL mode.\r\n\r\n<img width=\"1091\" alt=\"Screenshot 2024-10-25 at 15 44 32\"\r\nsrc=\"https://github.com/user-attachments/assets/8678bb86-7e4b-4341-9bb3-50becced655b\">\r\n<img width=\"1676\" alt=\"Screenshot 2024-10-25 at 15 52 55\"\r\nsrc=\"https://github.com/user-attachments/assets/c79d2ee0-62e1-4506-bcb5-29552287f140\">\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"8a96f69250ffe674c3d2fff340db39f7f8b99652"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
This commit is contained in:
parent
51da2182b6
commit
33eea1e06a
7 changed files with 44 additions and 18 deletions
|
@ -11,7 +11,19 @@ import React from 'react';
|
|||
import { FormattedMessage, FormattedNumber } from '@kbn/i18n-react';
|
||||
import { EuiText } from '@elastic/eui';
|
||||
|
||||
export const TotalDocuments = ({ totalHitCount }: { totalHitCount: number }) => {
|
||||
export const TotalDocuments = ({
|
||||
totalHitCount,
|
||||
isEsqlMode,
|
||||
}: {
|
||||
totalHitCount: number;
|
||||
isEsqlMode?: boolean;
|
||||
}) => {
|
||||
const totalDocuments = (
|
||||
<strong>
|
||||
<FormattedNumber value={totalHitCount} />
|
||||
</strong>
|
||||
);
|
||||
|
||||
return (
|
||||
<EuiText
|
||||
grow={false}
|
||||
|
@ -19,17 +31,25 @@ export const TotalDocuments = ({ totalHitCount }: { totalHitCount: number }) =>
|
|||
style={{ paddingRight: 2 }}
|
||||
data-test-subj="savedSearchTotalDocuments"
|
||||
>
|
||||
<FormattedMessage
|
||||
id="discover.docTable.totalDocuments"
|
||||
defaultMessage="{totalDocuments} documents"
|
||||
values={{
|
||||
totalDocuments: (
|
||||
<strong>
|
||||
<FormattedNumber value={totalHitCount} />
|
||||
</strong>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
{isEsqlMode ? (
|
||||
<FormattedMessage
|
||||
id="discover.embeddable.totalResults"
|
||||
defaultMessage="{totalDocuments} {totalHitCount, plural, one {result} other {results}}"
|
||||
values={{
|
||||
totalDocuments,
|
||||
totalHitCount,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="discover.embeddable.totalDocuments"
|
||||
defaultMessage="{totalDocuments} {totalHitCount, plural, one {document} other {documents}}"
|
||||
values={{
|
||||
totalDocuments,
|
||||
totalHitCount,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</EuiText>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -94,6 +94,7 @@ describe('Document view mode toggle component', () => {
|
|||
expect(findTestSubject(component, 'dscViewModeDocumentButton').exists()).toBe(true);
|
||||
expect(findTestSubject(component, 'dscViewModePatternAnalysisButton').exists()).toBe(true);
|
||||
expect(findTestSubject(component, 'dscViewModeFieldStatsButton').exists()).toBe(true);
|
||||
expect(findTestSubject(component, 'dscViewModeDocumentButton').text()).toBe('Documents (10)');
|
||||
});
|
||||
|
||||
it('should not render if SHOW_FIELD_STATISTICS is false', async () => {
|
||||
|
@ -114,6 +115,7 @@ describe('Document view mode toggle component', () => {
|
|||
expect(findTestSubject(component, 'dscViewModeDocumentButton').exists()).toBe(true);
|
||||
expect(findTestSubject(component, 'dscViewModePatternAnalysisButton').exists()).toBe(false);
|
||||
expect(findTestSubject(component, 'dscViewModeFieldStatsButton').exists()).toBe(true);
|
||||
expect(findTestSubject(component, 'dscViewModeDocumentButton').text()).toBe('Results (10)');
|
||||
});
|
||||
|
||||
it('should set the view mode to VIEW_MODE.DOCUMENT_LEVEL when dscViewModeDocumentButton is clicked', async () => {
|
||||
|
|
|
@ -130,7 +130,14 @@ export const DocumentViewModeToggle = ({
|
|||
onClick={() => setDiscoverViewMode(VIEW_MODE.DOCUMENT_LEVEL)}
|
||||
data-test-subj="dscViewModeDocumentButton"
|
||||
>
|
||||
<FormattedMessage id="discover.viewModes.document.label" defaultMessage="Documents" />
|
||||
{isEsqlMode ? (
|
||||
<FormattedMessage id="discover.viewModes.esql.label" defaultMessage="Results" />
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="discover.viewModes.document.label"
|
||||
defaultMessage="Documents"
|
||||
/>
|
||||
)}
|
||||
<HitsCounter mode={HitsCounterMode.appended} stateContainer={stateContainer} />
|
||||
</EuiTab>
|
||||
|
||||
|
|
|
@ -85,10 +85,10 @@ export function DiscoverGridEmbeddable(props: DiscoverGridEmbeddableProps) {
|
|||
getRenderCustomToolbarWithElements({
|
||||
leftSide:
|
||||
typeof props.totalHitCount === 'number' ? (
|
||||
<TotalDocuments totalHitCount={props.totalHitCount} />
|
||||
<TotalDocuments totalHitCount={props.totalHitCount} isEsqlMode={props.isPlainRecord} />
|
||||
) : undefined,
|
||||
}),
|
||||
[props.totalHitCount]
|
||||
[props.totalHitCount, props.isPlainRecord]
|
||||
);
|
||||
|
||||
const getCellRenderersAccessor = useProfileAccessor('getCellRenderers');
|
||||
|
|
|
@ -2423,7 +2423,6 @@
|
|||
"discover.docTable.tableRow.toggleRowDetailsButtonAriaLabel": "Afficher/Masquer les détails de la ligne",
|
||||
"discover.docTable.tableRow.viewSingleDocumentLinkText": "Afficher un seul document",
|
||||
"discover.docTable.tableRow.viewSurroundingDocumentsLinkText": "Afficher les documents alentour",
|
||||
"discover.docTable.totalDocuments": "{totalDocuments} documents",
|
||||
"discover.documentsAriaLabel": "Documents",
|
||||
"discover.docViews.table.scoreSortWarningTooltip": "Filtrez sur _score pour pouvoir récupérer les valeurs correspondantes.",
|
||||
"discover.dropZoneTableLabel": "Abandonner la zone pour ajouter un champ en tant que colonne dans la table",
|
||||
|
|
|
@ -2422,7 +2422,6 @@
|
|||
"discover.docTable.tableRow.toggleRowDetailsButtonAriaLabel": "行の詳細を切り替える",
|
||||
"discover.docTable.tableRow.viewSingleDocumentLinkText": "単一のドキュメントを表示",
|
||||
"discover.docTable.tableRow.viewSurroundingDocumentsLinkText": "周りのドキュメントを表示",
|
||||
"discover.docTable.totalDocuments": "{totalDocuments}ドキュメント",
|
||||
"discover.documentsAriaLabel": "ドキュメント",
|
||||
"discover.docViews.table.scoreSortWarningTooltip": "_scoreの値を取得するには、並べ替える必要があります。",
|
||||
"discover.dropZoneTableLabel": "フィールドを列として表に追加するには、ゾーンをドロップします",
|
||||
|
|
|
@ -2424,7 +2424,6 @@
|
|||
"discover.docTable.tableRow.toggleRowDetailsButtonAriaLabel": "切换行详细信息",
|
||||
"discover.docTable.tableRow.viewSingleDocumentLinkText": "查看单个文档",
|
||||
"discover.docTable.tableRow.viewSurroundingDocumentsLinkText": "查看周围文档",
|
||||
"discover.docTable.totalDocuments": "{totalDocuments} 个文档",
|
||||
"discover.documentsAriaLabel": "文档",
|
||||
"discover.docViews.table.scoreSortWarningTooltip": "要检索 _score 的值,必须按其筛选。",
|
||||
"discover.dropZoneTableLabel": "放置区域以将字段作为列添加到表中",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue