Skip to content
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

[Discover] Add documentation links for Document Explorer #127971

Merged
merged 4 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
discover: {
guide: `${KIBANA_DOCS}discover.html`,
fieldStatistics: `${KIBANA_DOCS}show-field-statistics.html`,
documentExplorer: `${KIBANA_DOCS}document-explorer.html`,
},
filebeat: {
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { DiscoverServices } from '../../../../build_services';

const defaultServices = {
addBasePath: () => '',
docLinks: { links: { discover: { documentExplorer: '' } } },
capabilities: { advancedSettings: { save: true } },
storage: new LocalStorageMock({ [CALLOUT_STATE_KEY]: false }),
} as unknown as DiscoverServices;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ import React, { useCallback, useState } from 'react';
import './document_explorer_callout.scss';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiButton, EuiButtonIcon, EuiCallOut, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import {
EuiButton,
EuiButtonIcon,
EuiCallOut,
EuiFlexGroup,
EuiFlexItem,
EuiLink,
} from '@elastic/eui';
import { useDiscoverServices } from '../../../../utils/use_discover_services';
import { DOC_TABLE_LEGACY } from '../../../../../common';
import { Storage } from '../../../../../../kibana_utils/public';
Expand All @@ -26,7 +33,7 @@ const updateStoredCalloutState = (newState: boolean, storage: Storage) => {
};

export const DocumentExplorerCallout = () => {
const { storage, capabilities, addBasePath } = useDiscoverServices();
const { storage, capabilities, docLinks, addBasePath } = useDiscoverServices();
const [calloutClosed, setCalloutClosed] = useState(getStoredCalloutState(storage));

const onCloseCallout = useCallback(() => {
Expand All @@ -50,18 +57,33 @@ export const DocumentExplorerCallout = () => {
defaultMessage="Quickly sort, select, and compare data, resize columns, and view documents in fullscreen with the Document Explorer."
/>
</p>
<p>
<EuiButton
iconType="tableDensityNormal"
size="s"
href={addBasePath(`/app/management/kibana/settings?query=${DOC_TABLE_LEGACY}`)}
>
<FormattedMessage
id="discover.docExplorerCallout.tryDocumentExplorer"
defaultMessage="Try Document Explorer"
/>
</EuiButton>
</p>
<EuiFlexGroup
justifyContent="flexStart"
alignItems="center"
responsive={false}
gutterSize="s"
>
<EuiFlexItem grow={false}>
<EuiButton
iconType="tableDensityNormal"
size="s"
href={addBasePath(`/app/management/kibana/settings?query=${DOC_TABLE_LEGACY}`)}
>
<FormattedMessage
id="discover.docExplorerCallout.tryDocumentExplorer"
defaultMessage="Try Document Explorer"
/>
</EuiButton>
</EuiFlexItem>
<EuiFlexItem>
<EuiLink href={docLinks.links.discover.documentExplorer}>
<FormattedMessage
id="discover.docExplorerCallout.learnMore"
defaultMessage="Learn more"
/>
</EuiLink>
</EuiFlexItem>
</EuiFlexGroup>
</EuiCallOut>
);
};
Expand Down
11 changes: 10 additions & 1 deletion src/plugins/discover/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,17 @@ export const getUiSettings: (docLinks: DocLinksServiceSetup) => Record<string, U
value: false,
description: i18n.translate('discover.advancedSettings.disableDocumentExplorerDescription', {
defaultMessage:
'To use the new Document Explorer instead of the classic view, turn off this option. ' +
'To use the new {documentExplorerDocs} instead of the classic view, turn off this option. ' +
'The Document Explorer offers better data sorting, resizable columns, and a full screen view.',
values: {
documentExplorerDocs:
`<a href=${docLinks.links.discover.documentExplorer}
target="_blank" rel="noopener">` +
i18n.translate('discover.advancedSettings.documentExplorerLinkText', {
defaultMessage: 'Document Explorer',
}) +
'</a>',
},
}),
category: ['discover'],
schema: schema.boolean(),
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,6 @@
"discover.advancedSettings.defaultColumnsText": "デフォルトでDiscoverアプリに表示される列。空の場合、ドキュメントの概要が表示されます。",
"discover.advancedSettings.defaultColumnsTitle": "デフォルトの列",
"discover.advancedSettings.disableDocumentExplorer": "ドキュメントエクスプローラーまたはクラシックビュー",
"discover.advancedSettings.disableDocumentExplorerDescription": "クラシックビューではなく、ドキュメントエクスプローラーを使用するには、このオプションをオフにします。ドキュメントエクスプローラーでは、データの並べ替え、列のサイズ変更、全画面表示といった優れた機能を使用できます。",
"discover.advancedSettings.discover.fieldStatisticsLinkText": "フィールド統計情報ビュー",
"discover.advancedSettings.discover.modifyColumnsOnSwitchText": "新しいデータビューで使用できない列を削除します。",
"discover.advancedSettings.discover.modifyColumnsOnSwitchTitle": "データビューを変更するときに列を修正",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2662,7 +2662,6 @@
"discover.advancedSettings.defaultColumnsText": "Discover 应用中默认显示的列。如果为空,将显示文档摘要。",
"discover.advancedSettings.defaultColumnsTitle": "默认列",
"discover.advancedSettings.disableDocumentExplorer": "Document Explorer 或经典视图",
"discover.advancedSettings.disableDocumentExplorerDescription": "要使用新的 Document Explorer,而非经典视图,请关闭此选项。Document Explorer 提供了更合理的数据排序、可调整大小的列和全屏视图。",
"discover.advancedSettings.discover.fieldStatisticsLinkText": "字段统计信息视图",
"discover.advancedSettings.discover.modifyColumnsOnSwitchText": "移除新数据视图中不存在的列。",
"discover.advancedSettings.discover.modifyColumnsOnSwitchTitle": "在更改数据视图时修改列",
Expand Down