Skip to content
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

[8.x] [Index Management] Fix ILM policy link trigger an SPA friendly navigation (#199252) #201271

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ describe('Data Streams tab', () => {

const { actions, findDetailPanelIlmPolicyLink } = testBed;
await actions.clickNameAt(0);
expect(findDetailPanelIlmPolicyLink().prop('href')).toBe('/test/my_ilm_policy');
expect(findDetailPanelIlmPolicyLink().prop('data-href')).toBe('/test/my_ilm_policy');
});

test('with an ILM url locator and no ILM policy', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const DataStreamDetailPanel: React.FunctionComponent<Props> = ({
const { error, data: dataStream, isLoading } = useLoadDataStream(dataStreamName);

const ilmPolicyLink = useIlmLocator(ILM_PAGES_POLICY_EDIT, dataStream?.ilmPolicyName);
const { history, config } = useAppContext();
const { history, config, core } = useAppContext();
let indicesLink;

let content;
Expand Down Expand Up @@ -193,7 +193,11 @@ export const DataStreamDetailPanel: React.FunctionComponent<Props> = ({
>
<>
{ilmPolicyLink ? (
<EuiLink data-test-subj={'ilmPolicyLink'} href={ilmPolicyLink}>
<EuiLink
data-test-subj={'ilmPolicyLink'}
data-href={ilmPolicyLink}
onClick={() => core.application.navigateToUrl(ilmPolicyLink)}
>
<EuiTextColor color="subdued">{ilmPolicyName}</EuiTextColor>
</EuiLink>
) : (
Expand All @@ -204,7 +208,11 @@ export const DataStreamDetailPanel: React.FunctionComponent<Props> = ({
) : (
<>
{ilmPolicyLink ? (
<EuiLink data-test-subj={'ilmPolicyLink'} href={ilmPolicyLink}>
<EuiLink
data-test-subj={'ilmPolicyLink'}
data-href={ilmPolicyLink}
onClick={() => core.application.navigateToUrl(ilmPolicyLink)}
>
{ilmPolicyName}
</EuiLink>
) : (
Expand Down Expand Up @@ -429,7 +437,7 @@ export const DataStreamDetailPanel: React.FunctionComponent<Props> = ({
defaultMessage="To edit data retention for this data stream, you must edit its associated {link}."
values={{
link: (
<EuiLink href={ilmPolicyLink}>
<EuiLink onClick={() => core.application.navigateToUrl(ilmPolicyLink)}>
<FormattedMessage
id="xpack.idxMgmt.dataStreamsDetailsPanel.editDataRetentionModal.fullyManagedByILMButtonLabel"
defaultMessage="ILM policy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ const MixedIndicesCallout = ({
dataStreamName,
history,
}: MixedIndicesCalloutProps) => {
const { core } = useAppContext();

return (
<EuiCallOut
title={i18n.translate(
Expand All @@ -177,7 +179,10 @@ const MixedIndicesCallout = ({
defaultMessage="One or more indices are managed by an ILM policy ({viewAllIndicesLink}). Updating data retention for this data stream won't affect these indices. Instead you will have to update the {ilmPolicyLink} policy."
values={{
ilmPolicyLink: (
<EuiLink data-test-subj="viewIlmPolicyLink" href={ilmPolicyLink}>
<EuiLink
data-test-subj="viewIlmPolicyLink"
onClick={() => core.application.navigateToUrl(ilmPolicyLink)}
>
{ilmPolicyName}
</EuiLink>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const TabSummary: React.FunctionComponent<Props> = ({ templateDetails })

const numIndexPatterns = indexPatterns.length;

const { history } = useAppContext();
const { history, core } = useAppContext();
const ilmPolicyLink = useIlmLocator(ILM_PAGES_POLICY_EDIT, ilmPolicy?.name);

return (
Expand Down Expand Up @@ -171,7 +171,9 @@ export const TabSummary: React.FunctionComponent<Props> = ({ templateDetails })
</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
{ilmPolicy?.name && ilmPolicyLink ? (
<EuiLink href={ilmPolicyLink}>{ilmPolicy!.name}</EuiLink>
<EuiLink onClick={() => core.application.navigateToUrl(ilmPolicyLink)}>
{ilmPolicy!.name}
</EuiLink>
) : (
ilmPolicy?.name || i18nTexts.none
)}
Expand Down