From 722061894d1993daffa4d674c096a136a344c0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20Hu=CC=88bertz?= Date: Fri, 12 Jun 2020 16:20:58 +0200 Subject: [PATCH 1/8] Add data options to all Observability app headers --- .../components/shared/Links/SetupInstructionsLink.tsx | 10 +++++++--- .../plugins/infra/public/pages/logs/page_content.tsx | 7 ++++++- x-pack/plugins/infra/public/pages/metrics/index.tsx | 7 ++++++- x-pack/plugins/uptime/public/pages/page_header.tsx | 5 +++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx index e85605e42981c..a5bcec1501ad3 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/SetupInstructionsLink.tsx @@ -12,10 +12,14 @@ import { useApmPluginContext } from '../../../hooks/useApmPluginContext'; const SETUP_INSTRUCTIONS_LABEL = i18n.translate( 'xpack.apm.setupInstructionsButtonLabel', { - defaultMessage: 'Setup Instructions', + defaultMessage: 'Setup instructions', } ); +const ADD_DATA_LABEL = i18n.translate('xpack.apm.addDataButtonLabel', { + defaultMessage: 'Add data', +}); + // renders a filled button or a link as a kibana link to setup instructions export function SetupInstructionsLink({ buttonFill = false, @@ -30,8 +34,8 @@ export function SetupInstructionsLink({ {SETUP_INSTRUCTIONS_LABEL} ) : ( - - {SETUP_INSTRUCTIONS_LABEL} + + {ADD_DATA_LABEL} )} diff --git a/x-pack/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx index 14c53557ba2c7..e9c18f613e623 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { Route, Switch } from 'react-router-dom'; @@ -88,6 +88,11 @@ export const LogsPageContent: React.FunctionComponent = () => { + + + Add data + + diff --git a/x-pack/plugins/infra/public/pages/metrics/index.tsx b/x-pack/plugins/infra/public/pages/metrics/index.tsx index 35a6cadc786f6..0fc01a17320d0 100644 --- a/x-pack/plugins/infra/public/pages/metrics/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/index.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { Route, RouteComponentProps, Switch } from 'react-router-dom'; -import { EuiErrorBoundary, EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; +import { EuiErrorBoundary, EuiFlexItem, EuiFlexGroup, EuiButtonEmpty } from '@elastic/eui'; import { DocumentTitle } from '../../components/document_title'; import { HelpCenterContent } from '../../components/help_center_content'; import { RoutedTabs } from '../../components/navigation/routed_tabs'; @@ -102,6 +102,11 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => { + + + Add data + + diff --git a/x-pack/plugins/uptime/public/pages/page_header.tsx b/x-pack/plugins/uptime/public/pages/page_header.tsx index d2e1f9036a24a..3ef9dc1c82662 100644 --- a/x-pack/plugins/uptime/public/pages/page_header.tsx +++ b/x-pack/plugins/uptime/public/pages/page_header.tsx @@ -59,6 +59,11 @@ export const PageHeader = React.memo( + + + Add data + + ); From 3583649f8dac933e8f62c0f64cd3907c725a83d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20Hu=CC=88bertz?= Date: Mon, 15 Jun 2020 08:55:11 +0200 Subject: [PATCH 2/8] Updated failing snapshot --- .../__test__/__snapshots__/ServiceOverview.test.tsx.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/apm/public/components/app/ServiceOverview/__test__/__snapshots__/ServiceOverview.test.tsx.snap b/x-pack/plugins/apm/public/components/app/ServiceOverview/__test__/__snapshots__/ServiceOverview.test.tsx.snap index 3e6be107ce3a1..2ebf237e0e327 100644 --- a/x-pack/plugins/apm/public/components/app/ServiceOverview/__test__/__snapshots__/ServiceOverview.test.tsx.snap +++ b/x-pack/plugins/apm/public/components/app/ServiceOverview/__test__/__snapshots__/ServiceOverview.test.tsx.snap @@ -114,7 +114,7 @@ NodeList [ - Setup Instructions + Setup instructions From 0dfc99a85fdabbd0ff9da69d7e7daceecaa1f9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20Hu=CC=88bertz?= Date: Mon, 15 Jun 2020 09:39:40 +0200 Subject: [PATCH 3/8] =?UTF-8?q?Add=20=E2=80=9CAdd=20data=E2=80=9D=20link?= =?UTF-8?q?=20on=20the=20Service=20details?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/app/ServiceDetails/index.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx b/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx index 0dbde5ea86a18..265bd1a401aa4 100644 --- a/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx @@ -4,7 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiTitle, + EuiButtonEmpty, +} from '@elastic/eui'; import React from 'react'; import { ApmHeader } from '../../shared/ApmHeader'; import { ServiceDetailTabs } from './ServiceDetailTabs'; @@ -33,6 +38,8 @@ export function ServiceDetails({ tab }: Props) { const isAlertingAvailable = isAlertingPluginEnabled && (canReadAlerts || canSaveAlerts); + const { core } = useApmPluginContext(); + return (
@@ -53,6 +60,16 @@ export function ServiceDetails({ tab }: Props) { /> )} + + + Add data + + From dcc159c8ca0cf8cd8c6c0f10b3d18275dd4bd333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20Hu=CC=88bertz?= Date: Mon, 15 Jun 2020 10:04:51 +0200 Subject: [PATCH 4/8] Added links and i18n support --- .../public/components/app/ServiceDetails/index.tsx | 7 ++++++- .../infra/public/pages/logs/page_content.tsx | 13 +++++++++++-- x-pack/plugins/infra/public/pages/metrics/index.tsx | 13 +++++++++++-- x-pack/plugins/uptime/public/pages/page_header.tsx | 12 ++++++++++-- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx b/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx index 265bd1a401aa4..2d52ad88d20dc 100644 --- a/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ServiceDetails/index.tsx @@ -11,6 +11,7 @@ import { EuiButtonEmpty, } from '@elastic/eui'; import React from 'react'; +import { i18n } from '@kbn/i18n'; import { ApmHeader } from '../../shared/ApmHeader'; import { ServiceDetailTabs } from './ServiceDetailTabs'; import { ServiceIntegrations } from './ServiceIntegrations'; @@ -40,6 +41,10 @@ export function ServiceDetails({ tab }: Props) { const { core } = useApmPluginContext(); + const ADD_DATA_LABEL = i18n.translate('xpack.apm.addDataButtonLabel', { + defaultMessage: 'Add data', + }); + return (
@@ -67,7 +72,7 @@ export function ServiceDetails({ tab }: Props) { color="primary" iconType="plusInCircle" > - Add data + {ADD_DATA_LABEL} diff --git a/x-pack/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx index e9c18f613e623..57d5de678d0ce 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -32,6 +32,10 @@ export const LogsPageContent: React.FunctionComponent = () => { const { initialize } = useLogSourceContext(); + const ADD_DATA_LABEL = i18n.translate('xpack.logs.addDataButtonLabel', { + defaultMessage: 'Add data', + }); + useMount(() => { initialize(); }); @@ -89,8 +93,13 @@ export const LogsPageContent: React.FunctionComponent = () => { - - Add data + + {ADD_DATA_LABEL} diff --git a/x-pack/plugins/infra/public/pages/metrics/index.tsx b/x-pack/plugins/infra/public/pages/metrics/index.tsx index 0fc01a17320d0..1033e479da78e 100644 --- a/x-pack/plugins/infra/public/pages/metrics/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/index.tsx @@ -32,6 +32,10 @@ import { WaffleFiltersProvider } from './inventory_view/hooks/use_waffle_filters import { InventoryAlertDropdown } from '../../components/alerting/inventory/alert_dropdown'; import { MetricsAlertDropdown } from '../../alerting/metric_threshold/components/alert_dropdown'; +const ADD_DATA_LABEL = i18n.translate('xpack.metrics.addDataButtonLabel', { + defaultMessage: 'Add data', +}); + export const InfrastructurePage = ({ match }: RouteComponentProps) => { const uiCapabilities = useKibana().services.application?.capabilities; @@ -103,8 +107,13 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => { - - Add data + + {ADD_DATA_LABEL} diff --git a/x-pack/plugins/uptime/public/pages/page_header.tsx b/x-pack/plugins/uptime/public/pages/page_header.tsx index 3ef9dc1c82662..b53b39bd54d0f 100644 --- a/x-pack/plugins/uptime/public/pages/page_header.tsx +++ b/x-pack/plugins/uptime/public/pages/page_header.tsx @@ -22,6 +22,10 @@ const SETTINGS_LINK_TEXT = i18n.translate('xpack.uptime.page_header.settingsLink defaultMessage: 'Settings', }); +const ADD_DATA_LABEL = i18n.translate('xpack.uptime.addDataButtonLabel', { + defaultMessage: 'Add data', +}); + const StyledPicker = styled(EuiFlexItem)` &&& { @media only screen and (max-width: 1024px) and (min-width: 868px) { @@ -60,8 +64,12 @@ export const PageHeader = React.memo( - - Add data + + {ADD_DATA_LABEL} From cfecae6687098e024682973a5b12bfdcf82b1024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20Hu=CC=88bertz?= Date: Mon, 15 Jun 2020 16:43:12 +0200 Subject: [PATCH 5/8] Updated links --- .../plugins/infra/public/pages/logs/page_content.tsx | 12 ++++++++---- x-pack/plugins/infra/public/pages/metrics/index.tsx | 6 +++++- x-pack/plugins/uptime/public/pages/page_header.tsx | 5 ++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx index 57d5de678d0ce..9be19473106c8 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -32,9 +32,7 @@ export const LogsPageContent: React.FunctionComponent = () => { const { initialize } = useLogSourceContext(); - const ADD_DATA_LABEL = i18n.translate('xpack.logs.addDataButtonLabel', { - defaultMessage: 'Add data', - }); + const kibana = useKibana(); useMount(() => { initialize(); @@ -94,7 +92,9 @@ export const LogsPageContent: React.FunctionComponent = () => { { const uiCapabilities = useKibana().services.application?.capabilities; + const kibana = useKibana(); + return ( @@ -108,7 +110,9 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => { ) : null; + const kibana = useKibana(); + const extraLinkComponents = !extraLinks ? null : ( @@ -65,7 +68,7 @@ export const PageHeader = React.memo( From d151af7c81008618e9b0ef327a2897006cf445d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20Hu=CC=88bertz?= Date: Tue, 16 Jun 2020 09:48:11 +0200 Subject: [PATCH 6/8] [Uptime] Update snapshot --- .../__snapshots__/page_header.test.tsx.snap | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/x-pack/plugins/uptime/public/pages/__tests__/__snapshots__/page_header.test.tsx.snap b/x-pack/plugins/uptime/public/pages/__tests__/__snapshots__/page_header.test.tsx.snap index ec0ee120b6283..f9927752f520c 100644 --- a/x-pack/plugins/uptime/public/pages/__tests__/__snapshots__/page_header.test.tsx.snap +++ b/x-pack/plugins/uptime/public/pages/__tests__/__snapshots__/page_header.test.tsx.snap @@ -100,6 +100,29 @@ Array [
+
+ +
Date: Tue, 16 Jun 2020 09:53:38 +0200 Subject: [PATCH 7/8] Updating the URLs --- x-pack/plugins/infra/public/pages/logs/page_content.tsx | 4 +--- x-pack/plugins/infra/public/pages/metrics/index.tsx | 2 +- x-pack/plugins/uptime/public/pages/page_header.tsx | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx index 9be19473106c8..f8b974ff99cca 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -92,9 +92,7 @@ export const LogsPageContent: React.FunctionComponent = () => { { From 418c4c431623eb8e29c3d52565f79215ce5815d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20Hu=CC=88bertz?= Date: Tue, 16 Jun 2020 11:41:05 +0200 Subject: [PATCH 8/8] Fixes i18n namespaces --- x-pack/plugins/infra/public/pages/logs/page_content.tsx | 2 +- x-pack/plugins/infra/public/pages/metrics/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx index f8b974ff99cca..78b7f86993cbd 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -136,6 +136,6 @@ const settingsTabTitle = i18n.translate('xpack.infra.logs.index.settingsTabTitle const feedbackLinkUrl = 'https://discuss.elastic.co/c/logs'; -const ADD_DATA_LABEL = i18n.translate('xpack.logs.addDataButtonLabel', { +const ADD_DATA_LABEL = i18n.translate('xpack.infra.logsHeaderAddDataButtonLabel', { defaultMessage: 'Add data', }); diff --git a/x-pack/plugins/infra/public/pages/metrics/index.tsx b/x-pack/plugins/infra/public/pages/metrics/index.tsx index f0c928f215291..05296fbf6b0a3 100644 --- a/x-pack/plugins/infra/public/pages/metrics/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/index.tsx @@ -32,7 +32,7 @@ import { WaffleFiltersProvider } from './inventory_view/hooks/use_waffle_filters import { InventoryAlertDropdown } from '../../components/alerting/inventory/alert_dropdown'; import { MetricsAlertDropdown } from '../../alerting/metric_threshold/components/alert_dropdown'; -const ADD_DATA_LABEL = i18n.translate('xpack.metrics.addDataButtonLabel', { +const ADD_DATA_LABEL = i18n.translate('xpack.infra.metricsHeaderAddDataButtonLabel', { defaultMessage: 'Add data', });