From c59320c7dd8ca8828d7ae80627dbfeb284d61e5d Mon Sep 17 00:00:00 2001
From: Shahzad
Date: Sat, 18 Apr 2020 13:41:11 +0200
Subject: [PATCH] =?UTF-8?q?[Uptime]=20Refresh=20index=20and=20also=20show?=
=?UTF-8?q?=20more=20info=20to=20user=20regardi=E2=80=A6=20(#62606)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Refresh index and also show more info to user
* updated type
* updated type
* updated test
* updated formatting
* update text
* updated types
* updated translation
* update
* fixed types
* updated code
* fixed types
Co-authored-by: Elastic Machine
---
.../connected/empty_state/empty_state.tsx | 22 +-
.../__snapshots__/data_missing.test.tsx.snap | 52 -
.../data_or_index_missing.test.tsx.snap | 92 +
.../__snapshots__/empty_state.test.tsx.snap | 1542 +++++++++++------
.../__tests__/data_missing.test.tsx | 16 -
.../__tests__/data_or_index_missing.test.tsx | 24 +
.../__tests__/empty_state.test.tsx | 14 +-
.../functional/empty_state/data_missing.tsx | 64 -
.../empty_state/data_or_index_missing.tsx | 86 +
.../functional/empty_state/empty_index.tsx | 67 -
.../functional/empty_state/empty_state.tsx | 34 +-
.../uptime/public/pages/page_header.tsx | 9 +-
.../plugins/uptime/public/pages/settings.tsx | 2 +-
.../public/state/actions/dynamic_settings.ts | 3 +-
.../public/state/api/dynamic_settings.ts | 13 +-
.../public/state/effects/dynamic_settings.ts | 6 +-
.../translations/translations/ja-JP.json | 5 -
.../translations/translations/zh-CN.json | 5 -
18 files changed, 1277 insertions(+), 779 deletions(-)
delete mode 100644 x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/data_missing.test.tsx.snap
create mode 100644 x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap
delete mode 100644 x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/data_missing.test.tsx
create mode 100644 x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/data_or_index_missing.test.tsx
delete mode 100644 x-pack/legacy/plugins/uptime/public/components/functional/empty_state/data_missing.tsx
create mode 100644 x-pack/legacy/plugins/uptime/public/components/functional/empty_state/data_or_index_missing.tsx
delete mode 100644 x-pack/legacy/plugins/uptime/public/components/functional/empty_state/empty_index.tsx
diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/empty_state/empty_state.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/empty_state/empty_state.tsx
index 55c92e70b6066..b0868af70480a 100644
--- a/x-pack/legacy/plugins/uptime/public/components/connected/empty_state/empty_state.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/connected/empty_state/empty_state.tsx
@@ -7,26 +7,44 @@
import React, { useContext, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { indexStatusAction } from '../../../state/actions';
-import { indexStatusSelector } from '../../../state/selectors';
+import { indexStatusSelector, selectDynamicSettings } from '../../../state/selectors';
import { EmptyStateComponent } from '../../functional/empty_state/empty_state';
import { UptimeRefreshContext } from '../../../contexts';
+import { getDynamicSettings } from '../../../state/actions/dynamic_settings';
export const EmptyState: React.FC = ({ children }) => {
const { data, loading, error } = useSelector(indexStatusSelector);
const { lastRefresh } = useContext(UptimeRefreshContext);
+ const { settings } = useSelector(selectDynamicSettings);
+
+ const heartbeatIndices = settings?.heartbeatIndices || '';
+
const dispatch = useDispatch();
useEffect(() => {
- dispatch(indexStatusAction.get());
+ if (!data || data?.docCount === 0 || data?.indexExists === false) {
+ dispatch(indexStatusAction.get());
+ }
+ // Don't add data , it will create endless loop
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [dispatch, lastRefresh]);
+ useEffect(() => {
+ dispatch(indexStatusAction.get());
+ }, [dispatch, heartbeatIndices]);
+
+ useEffect(() => {
+ dispatch(getDynamicSettings());
+ }, [dispatch]);
+
return (
);
};
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/data_missing.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/data_missing.test.tsx.snap
deleted file mode 100644
index 2182bfb4e656c..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/data_missing.test.tsx.snap
+++ /dev/null
@@ -1,52 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`DataMissing component renders basePath and headingMessage 1`] = `
-
-
-
-
-
-
-
- ,
- }
- }
- />
-
- }
- iconType="uptimeApp"
- title={
-
-
- bar
-
-
- }
- />
-
-
-
-`;
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap
new file mode 100644
index 0000000000000..25ac5a1f0974e
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap
@@ -0,0 +1,92 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`DataOrIndexMissing component renders headingMessage 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+ body={
+
+
+
+
+
+
+
+
+ }
+ iconType="logoUptime"
+ title={
+
+
+
+ heartbeat-*
+ ,
+ }
+ }
+ />
+
+
+ }
+ />
+
+
+
+`;
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/empty_state.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/empty_state.test.tsx.snap
index 2d45bbd18a60c..d0e7af24e1c1b 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/empty_state.test.tsx.snap
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/__snapshots__/empty_state.test.tsx.snap
@@ -1,7 +1,39 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EmptyState component does not render empty state with appropriate base path and no docs 1`] = `
-
-
- ,
+ }
+ }
+ />
+ }
>
-
-
-
-
-
-
-
-
-
-
-
- ,
- }
- }
- />
-
- }
- iconType="uptimeApp"
- title={
-
-
- No uptime data found
-
-
- }
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+ }
+ body={
+
+
+
+
+
+
+
+
+ }
+ iconType="logoUptime"
+ title={
+
+
+ ,
+ }
+ }
+ />
+
+
+ }
>
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
- No uptime data found
-
+
+ ,
+ }
+ }
+ >
+ No uptime data found in index
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+ If you have not setup heartbeat yet, you can setup heartbeat to start monitoring your services.
+
+
+
+
+ If you have setup heartbeat and confirmed data is being sent to Elasticsearch, update your index pattern settings and insure they are aligned with your Heartbeat config.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+ Update index pattern settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`;
exports[`EmptyState component doesn't render child components when count is falsy 1`] = `
-
-
-
-
-
-
-
- Loading…
-
-
-
- }
- >
-
+
+
+
+
+
+
+ Loading…
+
+
+
+ }
>
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
- Loading…
-
-
-
-
-
-
-
-
-
-
+
+ Loading…
+
+
+
+
+
+
+
+
+
+
+
`;
exports[`EmptyState component notifies when index does not exist 1`] = `
-
-
- ,
+ }
+ }
+ />
+ }
>
-
-
-
-
-
-
-
-
-
-
-
- ,
- }
- }
- />
-
- }
- iconType="uptimeApp"
- title={
-
-
- Uptime index not found
-
-
- }
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+ }
+ body={
+
+
+
+
+
+
+
+
+ }
+ iconType="logoUptime"
+ title={
+
+
+ ,
+ }
+ }
+ />
+
+
+ }
>
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
- Uptime index not found
-
+
+ ,
+ }
+ }
+ >
+ No indices found matching pattern
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+ If you have not setup heartbeat yet, you can setup heartbeat to start monitoring your services.
+
+
+
+
+ If you have setup heartbeat and confirmed data is being sent to Elasticsearch, update your index pattern settings and insure they are aligned with your Heartbeat config.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+ Update index pattern settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`;
exports[`EmptyState component renders child components when count is truthy 1`] = `
-
-
- Foo
-
-
- Bar
-
-
- Baz
-
-
+
+
+
+ Foo
+
+
+ Bar
+
+
+ Baz
+
+
+
`;
exports[`EmptyState component renders error message when an error occurs 1`] = `
-
-
-
-
-
-
-
-
-
-
- There was an error fetching your data.
-
-
- }
- iconColor="subdued"
- iconType="securityApp"
- title={
-
-
- Error
-
-
- }
+
+
+
-
+
+ There was an error fetching your data.
+
+
+ }
+ iconColor="subdued"
+ iconType="securityApp"
+ title={
+
+
+ Error
+
+
+ }
>
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
- Error
-
+
+ Error
+
+
-
-
-
-
-
-
-
+
+
+
- There was an error fetching your data.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ There was an error fetching your data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`;
exports[`EmptyState component renders loading state if no errors or doc count 1`] = `
-
-
-
-
-
-
-
- Loading…
-
-
-
- }
- >
-
+
+
+
+
+
+
+ Loading…
+
+
+
+ }
>
-
-
-
-
-
-
-
-
-
-
-
+
+
-
- Loading…
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Loading…
+
+
+
+
+
+
+
+
+
+
+
`;
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/data_missing.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/data_missing.test.tsx
deleted file mode 100644
index 8605d2966aaae..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/data_missing.test.tsx
+++ /dev/null
@@ -1,16 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import { shallowWithIntl } from 'test_utils/enzyme_helpers';
-import React from 'react';
-import { DataMissing } from '../data_missing';
-
-describe('DataMissing component', () => {
- it('renders basePath and headingMessage', () => {
- const component = shallowWithIntl( );
- expect(component).toMatchSnapshot();
- });
-});
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/data_or_index_missing.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/data_or_index_missing.test.tsx
new file mode 100644
index 0000000000000..333802962fd3e
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/data_or_index_missing.test.tsx
@@ -0,0 +1,24 @@
+/*
+ * 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 { shallowWithIntl } from 'test_utils/enzyme_helpers';
+import { FormattedMessage } from '@kbn/i18n/react';
+import { DataOrIndexMissing } from '../data_or_index_missing';
+
+describe('DataOrIndexMissing component', () => {
+ it('renders headingMessage', () => {
+ const headingMessage = (
+ heartbeat-* }}
+ />
+ );
+ const component = shallowWithIntl( );
+ expect(component).toMatchSnapshot();
+ });
+});
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/empty_state.test.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/empty_state.test.tsx
index a74ad543c3318..acfe2ada5b68d 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/empty_state.test.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/__tests__/empty_state.test.tsx
@@ -5,11 +5,11 @@
*/
import React from 'react';
-import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { EmptyStateComponent } from '../empty_state';
import { StatesIndexStatus } from '../../../../../common/runtime_types';
import { IHttpFetchError } from '../../../../../../../../../target/types/core/public/http';
import { HttpFetchError } from '../../../../../../../../../src/core/public/http/http_fetch_error';
+import { mountWithRouter, shallowWithRouter } from '../../../../lib';
describe('EmptyState component', () => {
let statesIndexStatus: StatesIndexStatus;
@@ -22,7 +22,7 @@ describe('EmptyState component', () => {
});
it('renders child components when count is truthy', () => {
- const component = shallowWithIntl(
+ const component = shallowWithRouter(
Foo
Bar
@@ -33,7 +33,7 @@ describe('EmptyState component', () => {
});
it(`doesn't render child components when count is falsy`, () => {
- const component = mountWithIntl(
+ const component = mountWithRouter(
Shouldn't be rendered
@@ -45,7 +45,7 @@ describe('EmptyState component', () => {
const errors: IHttpFetchError[] = [
new HttpFetchError('There was an error fetching your data.', 'error', {} as any),
];
- const component = mountWithIntl(
+ const component = mountWithRouter(
Shouldn't appear...
@@ -54,7 +54,7 @@ describe('EmptyState component', () => {
});
it('renders loading state if no errors or doc count', () => {
- const component = mountWithIntl(
+ const component = mountWithRouter(
Should appear even while loading...
@@ -67,7 +67,7 @@ describe('EmptyState component', () => {
docCount: 0,
indexExists: true,
};
- const component = mountWithIntl(
+ const component = mountWithRouter(
If this is in the snapshot the test should fail
@@ -77,7 +77,7 @@ describe('EmptyState component', () => {
it('notifies when index does not exist', () => {
statesIndexStatus.indexExists = false;
- const component = mountWithIntl(
+ const component = mountWithRouter(
This text should not render
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/data_missing.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/data_missing.tsx
deleted file mode 100644
index 337c08774e8e8..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/data_missing.tsx
+++ /dev/null
@@ -1,64 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import {
- EuiFlexGroup,
- EuiEmptyPrompt,
- EuiFlexItem,
- EuiSpacer,
- EuiPanel,
- EuiTitle,
- EuiLink,
-} from '@elastic/eui';
-import { FormattedMessage } from '@kbn/i18n/react';
-import React, { useContext } from 'react';
-import { UptimeSettingsContext } from '../../../contexts';
-
-interface DataMissingProps {
- headingMessage: string;
-}
-
-export const DataMissing = ({ headingMessage }: DataMissingProps) => {
- const { basePath } = useContext(UptimeSettingsContext);
- return (
-
-
-
-
-
- {headingMessage}
-
- }
- body={
-
-
-
-
- ),
- }}
- />
-
- }
- />
-
-
-
- );
-};
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/data_or_index_missing.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/data_or_index_missing.tsx
new file mode 100644
index 0000000000000..88c0920138f68
--- /dev/null
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/data_or_index_missing.tsx
@@ -0,0 +1,86 @@
+/*
+ * 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 {
+ EuiFlexGroup,
+ EuiEmptyPrompt,
+ EuiFlexItem,
+ EuiSpacer,
+ EuiPanel,
+ EuiTitle,
+ EuiButton,
+} from '@elastic/eui';
+import { FormattedMessage } from '@kbn/i18n/react';
+import React, { useContext } from 'react';
+import { UptimeSettingsContext } from '../../../contexts';
+import { DynamicSettings } from '../../../../common/runtime_types';
+
+interface DataMissingProps {
+ headingMessage: JSX.Element;
+ settings?: DynamicSettings;
+}
+
+export const DataOrIndexMissing = ({ headingMessage, settings }: DataMissingProps) => {
+ const { basePath } = useContext(UptimeSettingsContext);
+ return (
+
+
+
+
+
+ {headingMessage}
+
+ }
+ body={
+ <>
+
+
+
+
+
+
+ >
+ }
+ actions={
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+ />
+
+
+
+ );
+};
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/empty_index.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/empty_index.tsx
deleted file mode 100644
index 0141198ec15e0..0000000000000
--- a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/empty_index.tsx
+++ /dev/null
@@ -1,67 +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;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-import {
- EuiEmptyPrompt,
- EuiFlexGroup,
- EuiFlexItem,
- EuiLink,
- EuiPanel,
- EuiSpacer,
- EuiTitle,
-} from '@elastic/eui';
-import { FormattedMessage } from '@kbn/i18n/react';
-import React, { Fragment } from 'react';
-
-interface EmptyIndexProps {
- basePath: string;
-}
-
-export const EmptyIndex = ({ basePath }: EmptyIndexProps) => (
-
-
-
-
-
-
-
-
-
- }
- body={
-
-
-
-
-
- ),
- }}
- />
-
-
- }
- />
-
-
-
-);
diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/empty_state.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/empty_state.tsx
index ae6a1b892bc99..651103a34bf21 100644
--- a/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/empty_state.tsx
+++ b/x-pack/legacy/plugins/uptime/public/components/functional/empty_state/empty_state.tsx
@@ -5,11 +5,11 @@
*/
import React, { Fragment } from 'react';
-import { i18n } from '@kbn/i18n';
+import { FormattedMessage } from '@kbn/i18n/react';
import { EmptyStateError } from './empty_state_error';
import { EmptyStateLoading } from './empty_state_loading';
-import { DataMissing } from './data_missing';
-import { StatesIndexStatus } from '../../../../common/runtime_types';
+import { DataOrIndexMissing } from './data_or_index_missing';
+import { DynamicSettings, StatesIndexStatus } from '../../../../common/runtime_types';
import { IHttpFetchError } from '../../../../../../../../target/types/core/public/http';
interface EmptyStateProps {
@@ -17,6 +17,7 @@ interface EmptyStateProps {
statesIndexStatus: StatesIndexStatus | null;
loading: boolean;
errors?: IHttpFetchError[];
+ settings?: DynamicSettings;
}
export const EmptyStateComponent = ({
@@ -24,6 +25,7 @@ export const EmptyStateComponent = ({
statesIndexStatus,
loading,
errors,
+ settings,
}: EmptyStateProps) => {
if (errors?.length) {
return ;
@@ -32,18 +34,28 @@ export const EmptyStateComponent = ({
const { indexExists, docCount } = statesIndexStatus;
if (!indexExists) {
return (
- {settings?.heartbeatIndices} }}
+ />
+ }
/>
);
} else if (indexExists && docCount === 0) {
return (
- {settings?.heartbeatIndices} }}
+ />
+ }
/>
);
}
diff --git a/x-pack/legacy/plugins/uptime/public/pages/page_header.tsx b/x-pack/legacy/plugins/uptime/public/pages/page_header.tsx
index 821a70c85dc7c..49e6ddb56602c 100644
--- a/x-pack/legacy/plugins/uptime/public/pages/page_header.tsx
+++ b/x-pack/legacy/plugins/uptime/public/pages/page_header.tsx
@@ -17,7 +17,9 @@ interface PageHeaderProps {
extraLinks?: boolean;
datePicker?: boolean;
}
-
+const SETTINGS_LINK_TEXT = i18n.translate('xpack.uptime.page_header.settingsLink', {
+ defaultMessage: 'Settings',
+});
export const PageHeader = React.memo(
({ headingText, extraLinks = false, datePicker = true }: PageHeaderProps) => {
const datePickerComponent = datePicker ? (
@@ -26,9 +28,6 @@ export const PageHeader = React.memo(
) : null;
- const settingsLinkText = i18n.translate('xpack.uptime.page_header.settingsLink', {
- defaultMessage: 'Settings',
- });
const extraLinkComponents = !extraLinks ? null : (
@@ -37,7 +36,7 @@ export const PageHeader = React.memo(
- {settingsLinkText}
+ {SETTINGS_LINK_TEXT}
diff --git a/x-pack/legacy/plugins/uptime/public/pages/settings.tsx b/x-pack/legacy/plugins/uptime/public/pages/settings.tsx
index 049dffecd3f2e..6defb96e0da3d 100644
--- a/x-pack/legacy/plugins/uptime/public/pages/settings.tsx
+++ b/x-pack/legacy/plugins/uptime/public/pages/settings.tsx
@@ -67,7 +67,7 @@ export const SettingsPage = () => {
const dispatch = useDispatch();
useEffect(() => {
- dispatch(getDynamicSettings({}));
+ dispatch(getDynamicSettings());
}, [dispatch]);
const [formFields, setFormFields] = useState(dss.settings || null);
diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/dynamic_settings.ts b/x-pack/legacy/plugins/uptime/public/state/actions/dynamic_settings.ts
index d78c725c4b599..3dbb1aa234621 100644
--- a/x-pack/legacy/plugins/uptime/public/state/actions/dynamic_settings.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/actions/dynamic_settings.ts
@@ -6,7 +6,7 @@
import { createAction } from 'redux-actions';
import { DynamicSettings } from '../../../common/runtime_types';
-export const getDynamicSettings = createAction<{}>('GET_DYNAMIC_SETTINGS');
+export const getDynamicSettings = createAction('GET_DYNAMIC_SETTINGS');
export const getDynamicSettingsSuccess = createAction(
'GET_DYNAMIC_SETTINGS_SUCCESS'
);
@@ -17,4 +17,3 @@ export const setDynamicSettingsSuccess = createAction(
'SET_DYNAMIC_SETTINGS_SUCCESS'
);
export const setDynamicSettingsFail = createAction('SET_DYNAMIC_SETTINGS_FAIL');
-export const acknowledgeSetDynamicSettings = createAction<{}>('ACKNOWLEDGE_SET_DYNAMIC_SETTINGS');
diff --git a/x-pack/legacy/plugins/uptime/public/state/api/dynamic_settings.ts b/x-pack/legacy/plugins/uptime/public/state/api/dynamic_settings.ts
index 8ade2aa4595dc..e52e40c53513c 100644
--- a/x-pack/legacy/plugins/uptime/public/state/api/dynamic_settings.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/api/dynamic_settings.ts
@@ -14,22 +14,15 @@ import { apiService } from './utils';
const apiPath = '/api/uptime/dynamic_settings';
-interface BaseApiRequest {
- basePath: string;
-}
-
-type SaveApiRequest = BaseApiRequest & {
+interface SaveApiRequest {
settings: DynamicSettings;
-};
+}
-export const getDynamicSettings = async ({
- basePath,
-}: BaseApiRequest): Promise => {
+export const getDynamicSettings = async (): Promise => {
return await apiService.get(apiPath, undefined, DynamicSettingsType);
};
export const setDynamicSettings = async ({
- basePath,
settings,
}: SaveApiRequest): Promise => {
return await apiService.post(apiPath, settings, DynamicSettingsSaveType);
diff --git a/x-pack/legacy/plugins/uptime/public/state/effects/dynamic_settings.ts b/x-pack/legacy/plugins/uptime/public/state/effects/dynamic_settings.ts
index 9bc8bd95be68c..bee92813aa1f0 100644
--- a/x-pack/legacy/plugins/uptime/public/state/effects/dynamic_settings.ts
+++ b/x-pack/legacy/plugins/uptime/public/state/effects/dynamic_settings.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { takeLatest, put, call, select } from 'redux-saga/effects';
+import { takeLatest, put, call } from 'redux-saga/effects';
import { Action } from 'redux-actions';
import { i18n } from '@kbn/i18n';
import { fetchEffectFactory } from './fetch_effect';
@@ -21,7 +21,6 @@ import {
setDynamicSettings as setDynamicSettingsAPI,
} from '../api';
import { DynamicSettings } from '../../../common/runtime_types';
-import { getBasePath } from '../selectors';
import { kibanaService } from '../kibana_service';
export function* fetchDynamicSettingsEffect() {
@@ -46,8 +45,7 @@ export function* setDynamicSettingsEffect() {
});
return;
}
- const basePath = yield select(getBasePath);
- yield call(setDynamicSettingsAPI, { settings: action.payload, basePath });
+ yield call(setDynamicSettingsAPI, { settings: action.payload });
yield put(setDynamicSettingsSuccess(action.payload));
kibanaService.core.notifications.toasts.addSuccess('Settings saved!');
} catch (err) {
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index 4e6e74aabc7e4..63d6850c0d0d7 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -16231,12 +16231,7 @@
"xpack.uptime.components.embeddables.embeddedMap.embeddablePanelTitle": "オブザーバー位置情報マップを監視",
"xpack.uptime.durationChart.emptyPrompt.description": "このモニターは選択された時間範囲で一度も {emphasizedText} していません。",
"xpack.uptime.durationChart.emptyPrompt.title": "利用可能な期間データがありません",
- "xpack.uptime.emptyState.configureHeartbeatLinkText": "Heartbeat を構成",
- "xpack.uptime.emptyState.configureHeartbeatToGetStartedMessage": "アップタイムデータの収集を開始するには {configureHeartbeatLink}。",
"xpack.uptime.emptyState.loadingMessage": "読み込み中…",
- "xpack.uptime.emptyState.noDataMessage": "アップタイムデータが見つかりませんでした",
- "xpack.uptime.emptyState.noDataTitle": "利用可能なアップタイムデータがありません",
- "xpack.uptime.emptyState.noIndexTitle": "アップタイムインデックスが見つかりません",
"xpack.uptime.emptyStateError.notAuthorized": "アップタイムデータの表示が承認されていません。システム管理者にお問い合わせください。",
"xpack.uptime.emptyStateError.notFoundPage": "ページが見つかりません",
"xpack.uptime.emptyStateError.title": "エラー",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 70ec0ef2b0dac..59b9aeb54c695 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -16236,12 +16236,7 @@
"xpack.uptime.components.embeddables.embeddedMap.embeddablePanelTitle": "监测观察者位置地图",
"xpack.uptime.durationChart.emptyPrompt.description": "在选定时间范围内此监测从未{emphasizedText}。",
"xpack.uptime.durationChart.emptyPrompt.title": "没有持续时间数据",
- "xpack.uptime.emptyState.configureHeartbeatLinkText": "配置 Heartbeat",
- "xpack.uptime.emptyState.configureHeartbeatToGetStartedMessage": "{configureHeartbeatLink}以开始收集运行时间数据。",
"xpack.uptime.emptyState.loadingMessage": "正在加载……",
- "xpack.uptime.emptyState.noDataMessage": "未找到任何运行时间数据",
- "xpack.uptime.emptyState.noDataTitle": "没有可用的运行时间数据",
- "xpack.uptime.emptyState.noIndexTitle": "找不到运行时间索引",
"xpack.uptime.emptyStateError.notAuthorized": "您无权查看 Uptime 数据,请联系系统管理员。",
"xpack.uptime.emptyStateError.notFoundPage": "未找到页面",
"xpack.uptime.emptyStateError.title": "错误",