-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Migrate ILM to ManagementPageLayout #100838
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ import React from 'react'; | |
import { render, unmountComponentAtNode } from 'react-dom'; | ||
import { I18nStart, ScopedHistory, ApplicationStart } from 'kibana/public'; | ||
import { UnmountCallback } from 'src/core/public'; | ||
|
||
import type { ManagementAppMountParams } from '../../../../../src/plugins/management/public'; | ||
import { CloudSetup } from '../../../cloud/public'; | ||
import { ILicense } from '../../../licensing/public'; | ||
|
||
|
@@ -26,11 +28,12 @@ export const renderApp = ( | |
getUrlForApp: ApplicationStart['getUrlForApp'], | ||
breadcrumbService: BreadcrumbService, | ||
license: ILicense, | ||
managementPageLayout: ManagementAppMountParams['managementPageLayout'], | ||
cloud?: CloudSetup | ||
): UnmountCallback => { | ||
render( | ||
<I18nContext> | ||
<KibanaContextProvider services={{ cloud, breadcrumbService, license }}> | ||
<KibanaContextProvider services={{ cloud, breadcrumbService, license, managementPageLayout }}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Step 2: Use |
||
<AppWithRouter | ||
history={history} | ||
navigateToApp={navigateToApp} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ export const EditPolicy: React.FunctionComponent<Props & RouteComponentProps<Rou | |
history, | ||
}) => { | ||
const { | ||
services: { breadcrumbService, license }, | ||
services: { breadcrumbService, license, managementPageLayout: ManagementPageLayout }, | ||
} = useKibana(); | ||
const { error, isLoading, data: policies, resendRequest } = useLoadPoliciesList(false); | ||
|
||
|
@@ -52,43 +52,48 @@ export const EditPolicy: React.FunctionComponent<Props & RouteComponentProps<Rou | |
|
||
if (isLoading) { | ||
return ( | ||
<EuiEmptyPrompt | ||
title={<EuiLoadingSpinner size="xl" />} | ||
body={ | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.policiesLoading" | ||
defaultMessage="Loading policies..." | ||
/> | ||
} | ||
/> | ||
<ManagementPageLayout isEmptyState={true}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When using the We could try following a similar approach to what the observability team did, which is instead of using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sabarasaba Great call! @cchaos This seems like a design problem. Do you have any suggestions on the best way to solve this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +++ Yes, don't use the |
||
<EuiEmptyPrompt | ||
title={<EuiLoadingSpinner size="xl" />} | ||
body={ | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.policiesLoading" | ||
defaultMessage="Loading policies..." | ||
/> | ||
} | ||
/> | ||
</ManagementPageLayout> | ||
); | ||
} | ||
|
||
if (error || !policies) { | ||
const { statusCode, message } = error ? error : { statusCode: '', message: '' }; | ||
return ( | ||
<EuiEmptyPrompt | ||
title={ | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesLoadingFailedTitle" | ||
defaultMessage="Unable to load existing lifecycle policies" | ||
/> | ||
</h2> | ||
} | ||
body={ | ||
<p> | ||
{message} ({statusCode}) | ||
</p> | ||
} | ||
actions={ | ||
<EuiButton onClick={resendRequest} iconType="refresh" color="danger"> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesReloadButton" | ||
defaultMessage="Try again" | ||
/> | ||
</EuiButton> | ||
} | ||
/> | ||
<ManagementPageLayout isEmptyState={true}> | ||
<EuiEmptyPrompt | ||
title={ | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesLoadingFailedTitle" | ||
defaultMessage="Unable to load existing lifecycle policies" | ||
/> | ||
</h2> | ||
} | ||
body={ | ||
<p> | ||
{message} ({statusCode}) | ||
</p> | ||
} | ||
actions={ | ||
<EuiButton onClick={resendRequest} iconType="refresh" color="danger"> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesReloadButton" | ||
defaultMessage="Try again" | ||
/> | ||
</EuiButton> | ||
} | ||
/> | ||
</ManagementPageLayout> | ||
); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step 4: Update Jest tests to set up testbed by stubbing the injected
managementPageLayout
withKibanaPageTemplate
.