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

[Upgrade Assistant] Add note about compatibility headers #110469

Merged
merged 8 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 1 addition & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export class DocLinksService {
deprecationLogging: `${ELASTICSEARCH_DOCS}logging.html#deprecation-logging`,
setupUpgrade: `${ELASTICSEARCH_DOCS}setup-upgrade.html`,
releaseHighlights: `${ELASTICSEARCH_DOCS}release-highlights.html`,
apiCompatibilityHeader: `${ELASTICSEARCH_DOCS}api-conventions.html#api-compatibility`,
},
siem: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/index.html`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ describe('Overview - Fix deprecation logs step', () => {

expect(exists('externalLinksTitle')).toBe(false);
expect(exists('deprecationsCountTitle')).toBe(false);
expect(exists('apiCompatibilityNoteTitle')).toBe(false);
});
});

Expand Down Expand Up @@ -370,4 +371,22 @@ describe('Overview - Fix deprecation logs step', () => {
});
});
});

describe('Step 4 - API compatibility header', () => {
beforeEach(async () => {
httpRequestsMockHelpers.setLoadDeprecationLoggingResponse(getLoggingResponse(true));
});

test('It shows copy with compatibility api header advice', async () => {
await act(async () => {
testBed = await setupOverviewPage();
});

const { exists, component } = testBed;

component.update();

expect(exists('apiCompatibilityNoteTitle')).toBe(true);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import React, { FunctionComponent, useState, useEffect } from 'react';

import { i18n } from '@kbn/i18n';
import { EuiText, EuiSpacer, EuiPanel, EuiCallOut } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiText, EuiSpacer, EuiPanel, EuiLink, EuiCallOut } from '@elastic/eui';
import type { EuiStepProps } from '@elastic/eui/src/components/steps/step';

import { useAppContext } from '../../../app_context';
import { ExternalLinks } from './external_links';
import { DeprecationsCountCheckpoint } from './deprecations_count_checkpoint';
import { useDeprecationLogging } from './use_deprecation_logging';
Expand All @@ -34,6 +36,25 @@ const i18nTexts = {
defaultMessage: 'Resolve deprecation issues and verify your changes',
}
),
apiCompatibilityNoteTitle: i18n.translate(
'xpack.upgradeAssistant.overview.apiCompatibilityNoteTitle',
{
defaultMessage: 'Apply API compatibility headers (optional)',
}
),
apiCompatibilityNoteBody: (docLink: string) => (
<FormattedMessage
id="xpack.upgradeAssistant.overview.apiCompatibilityNoteBody"
defaultMessage="We recommend you resolve all deprecation issues before upgrading. However, it can be challenging to ensure all requests are fixed. For additional safety, include API version compatibility headers in your requests. {learnMoreLink}."
values={{
learnMoreLink: (
<EuiLink href={docLink} target="_blank">
Learn more
sabarasaba marked this conversation as resolved.
Show resolved Hide resolved
</EuiLink>
),
}}
/>
),
onlyLogWritingEnabledTitle: i18n.translate(
'xpack.upgradeAssistant.overview.deprecationLogs.deprecationWarningTitle',
{
Expand All @@ -55,6 +76,11 @@ interface Props {

const FixLogsStep: FunctionComponent<Props> = ({ setIsComplete }) => {
const state = useDeprecationLogging();
const {
services: {
core: { docLinks },
},
} = useAppContext();
const [checkpoint, setCheckpoint] = useState(loadLogsCheckpoint());

useEffect(() => {
Expand Down Expand Up @@ -113,6 +139,19 @@ const FixLogsStep: FunctionComponent<Props> = ({ setIsComplete }) => {
setCheckpoint={setCheckpoint}
setHasNoDeprecationLogs={setIsComplete}
/>

<EuiSpacer size="xl" />
<EuiText data-test-subj="apiCompatibilityNoteTitle">
<h4>{i18nTexts.apiCompatibilityNoteTitle}</h4>
</EuiText>
<EuiSpacer size="m" />
<EuiText>
<p>
{i18nTexts.apiCompatibilityNoteBody(
docLinks.links.elasticsearch.apiCompatibilityHeader
)}
</p>
</EuiText>
</>
)}
</>
Expand Down