diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx
index cba496ee0f212..ebe1c12e2a079 100644
--- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx
+++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx
@@ -40,6 +40,9 @@ const testBedConfig: TestBedConfig = {
initialEntries: [`/policies/edit/${POLICY_NAME}`],
componentRoutePath: `/policies/edit/:policyName`,
},
+ defaultProps: {
+ getUrlForApp: () => {},
+ },
};
const initTestBed = registerTestBed(EditPolicy, testBedConfig);
diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js b/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js
index c249a45fe8ed2..943f663a025d8 100644
--- a/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js
+++ b/x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js
@@ -120,7 +120,7 @@ describe('edit policy', () => {
store = indexLifecycleManagementStore();
component = (
-
+ {}} />
);
store.dispatch(fetchedPolicies(policies));
@@ -155,7 +155,7 @@ describe('edit policy', () => {
test('should show error when trying to save as new policy but using the same name', () => {
component = (
-
+ {}} />
);
const rendered = mountWithIntl(component);
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/app.tsx b/x-pack/plugins/index_lifecycle_management/public/application/app.tsx
index 11cd5d181f4ad..14b0e72317c66 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/app.tsx
+++ b/x-pack/plugins/index_lifecycle_management/public/application/app.tsx
@@ -17,9 +17,11 @@ import { trackUiMetric } from './services/ui_metric';
export const App = ({
history,
navigateToApp,
+ getUrlForApp,
}: {
history: ScopedHistory;
navigateToApp: ApplicationStart['navigateToApp'];
+ getUrlForApp: ApplicationStart['getUrlForApp'];
}) => {
useEffect(() => trackUiMetric(METRIC_TYPE.LOADED, UIM_APP_LOAD), []);
@@ -32,7 +34,10 @@ export const App = ({
path={`/policies`}
render={(props) => }
/>
-
+ }
+ />
);
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/index.tsx b/x-pack/plugins/index_lifecycle_management/public/application/index.tsx
index eddbb5528ad84..31a9abdc7145e 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/index.tsx
+++ b/x-pack/plugins/index_lifecycle_management/public/application/index.tsx
@@ -17,12 +17,13 @@ export const renderApp = (
element: Element,
I18nContext: I18nStart['Context'],
history: ScopedHistory,
- navigateToApp: ApplicationStart['navigateToApp']
+ navigateToApp: ApplicationStart['navigateToApp'],
+ getUrlForApp: ApplicationStart['getUrlForApp']
): UnmountCallback => {
render(
-
+
,
element
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js
index 34d1c0f8de216..2b12eec953e11 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js
@@ -123,6 +123,7 @@ export class DeletePhase extends PureComponent {
setPhaseData(PHASE_WAIT_FOR_SNAPSHOT_POLICY, value)}
+ getUrlForApp={this.props.getUrlForApp}
/>
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/snapshot_policies/snapshot_policies.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/snapshot_policies/snapshot_policies.tsx
index a1304d9fb0125..76115fd914b01 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/snapshot_policies/snapshot_policies.tsx
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/snapshot_policies/snapshot_policies.tsx
@@ -8,12 +8,14 @@ import React, { Fragment } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
+import { ApplicationStart } from 'kibana/public';
import {
EuiButtonIcon,
EuiCallOut,
EuiComboBox,
EuiComboBoxOptionOption,
+ EuiLink,
EuiSpacer,
} from '@elastic/eui';
@@ -22,8 +24,13 @@ import { useLoadSnapshotPolicies } from '../../../../services/api';
interface Props {
value: string;
onChange: (value: string) => void;
+ getUrlForApp: ApplicationStart['getUrlForApp'];
}
-export const SnapshotPolicies: React.FunctionComponent = ({ value, onChange }) => {
+export const SnapshotPolicies: React.FunctionComponent = ({
+ value,
+ onChange,
+ getUrlForApp,
+}) => {
const { error, isLoading, data, sendRequest } = useLoadSnapshotPolicies();
const policies = data.map((name: string) => ({
@@ -43,6 +50,12 @@ export const SnapshotPolicies: React.FunctionComponent = ({ value, onChan
onChange(newValue);
};
+ const getUrlForSnapshotPolicyWizard = () => {
+ return getUrlForApp('management', {
+ path: `data/snapshot_restore/add_policy`,
+ });
+ };
+
let calloutContent;
if (error) {
calloutContent = (
@@ -50,7 +63,6 @@ export const SnapshotPolicies: React.FunctionComponent = ({ value, onChan
= ({ value, onChan
>
+ {i18n.translate(
+ 'xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedLink',
+ {
+ defaultMessage: 'Create a snapshot lifecycle policy',
+ }
+ )}
+
+ ),
+ }}
/>
@@ -110,7 +134,6 @@ export const SnapshotPolicies: React.FunctionComponent = ({ value, onChan
= ({ value, onChan
>
+ {i18n.translate(
+ 'xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyLink',
+ {
+ defaultMessage: 'create a new policy',
+ }
+ )}
+
+ ),
+ }}
/>
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js
index 998143929afef..04ee2391f0d20 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.js
@@ -308,6 +308,7 @@ export class EditPolicy extends Component {
diff --git a/x-pack/plugins/index_lifecycle_management/public/plugin.tsx b/x-pack/plugins/index_lifecycle_management/public/plugin.tsx
index 1d26aa53752a9..0ca62c10f55f3 100644
--- a/x-pack/plugins/index_lifecycle_management/public/plugin.tsx
+++ b/x-pack/plugins/index_lifecycle_management/public/plugin.tsx
@@ -47,7 +47,7 @@ export class IndexLifecycleManagementPlugin {
chrome: { docTitle },
i18n: { Context: I18nContext },
docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION },
- application: { navigateToApp },
+ application: { navigateToApp, getUrlForApp },
} = coreStart;
docTitle.change(PLUGIN.TITLE);
@@ -58,7 +58,14 @@ export class IndexLifecycleManagementPlugin {
);
const { renderApp } = await import('./application');
- const unmountAppCallback = renderApp(element, I18nContext, history, navigateToApp);
+
+ const unmountAppCallback = renderApp(
+ element,
+ I18nContext,
+ history,
+ navigateToApp,
+ getUrlForApp
+ );
return () => {
docTitle.reset();