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(); diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index d49cdbc55fad7..2c70715cab02b 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -8181,11 +8181,9 @@ "xpack.indexLifecycleMgmt.editPolicy.creationNanoSecondsOptionLabel": "インデックスの作成からの経過時間(ナノ秒)", "xpack.indexLifecycleMgmt.editPolicy.creationSecondsOptionLabel": "インデックスの作成からの経過時間(秒)", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.activateWarmPhaseSwitchLabel": "削除フェーズを有効にする", - "xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyMessage": "既存のスナップショットポリシーの名前を入力するか、この名前で新しいポリシーを作成します。", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyTitle": "ポリシー名が見つかりません", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.deletePhaseDescriptionText": "今後インデックスは必要ありません。 いつ安全に削除できるかを定義できます。", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.deletePhaseLabel": "削除フェーズ", - "xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedMessage": "スナップショットライフサイクルポリシーを作成して、クラスタースナップショットの作成と削除を自動化します。", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedTitle": "スナップショットポリシーが見つかりません", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesLoadedMessage": "このフィールドを更新し、既存のスナップショットポリシーの名前を入力します。", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesLoadedTitle": "既存のポリシーを読み込めません", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 5fcd7e9e2e455..f5c7958ba8ec5 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -8183,11 +8183,9 @@ "xpack.indexLifecycleMgmt.editPolicy.creationNanoSecondsOptionLabel": "纳秒(自索引创建)", "xpack.indexLifecycleMgmt.editPolicy.creationSecondsOptionLabel": "秒(自索引创建)", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.activateWarmPhaseSwitchLabel": "激活删除阶段", - "xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyMessage": "输入现有快照策略的名称或使用此名称创建新策略。", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.customPolicyTitle": "未找到策略名称", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.deletePhaseDescriptionText": "您不再需要自己的索引。 您可以定义安全删除它的时间。", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.deletePhaseLabel": "删除阶段", - "xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedMessage": "创建快照生命周期策略,以自动集群快照的创建和删除。", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesCreatedTitle": "找不到快照策略", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesLoadedMessage": "刷新此字段并输入现有快照策略的名称。", "xpack.indexLifecycleMgmt.editPolicy.deletePhase.noPoliciesLoadedTitle": "无法加载现有策略",