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 4 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 @@ -205,6 +205,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 @@ -120,6 +120,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 @@ -255,4 +256,22 @@ describe('Overview - Fix deprecation logs step', () => {
expect(exists('noWarningsCallout')).toBe(true);
});
});

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 } 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 @@ -32,6 +34,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 resolving deprecation issues before upgrading. However, if you need to enable an application to continue to function without making changes, you can include API compatibility headers in your requests. {learnMoreLink}."
jrodewig marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -48,6 +69,11 @@ const i18nTexts = {
};

const FixLogsStep: FunctionComponent = () => {
const {
services: {
core: { docLinks },
},
} = useAppContext();
const state = useDeprecationLogging();

return (
Expand Down Expand Up @@ -89,6 +115,19 @@ const FixLogsStep: FunctionComponent = () => {
</EuiText>
<EuiSpacer size="m" />
<DeprecationsCountCheckpoint />

<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