Skip to content

Commit

Permalink
[Upgrade Assistant] Add note about compatibility headers (elastic#110469
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sabarasaba committed Oct 26, 2021
1 parent 123cf5f commit 8843f2d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ export class DocLinksService {
shardAllocationSettings: `${ELASTICSEARCH_DOCS}modules-cluster.html#cluster-shard-allocation-settings`,
transportSettings: `${ELASTICSEARCH_DOCS}modules-network.html#common-network-settings`,
typesRemoval: `${ELASTICSEARCH_DOCS}removal-of-types.html`,
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: `${SECURITY_SOLUTION_DOCS}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,28 @@ 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">
<FormattedMessage
id="xpack.upgradeAssistant.overview.apiCompatibilityNoteLink"
defaultMessage="Learn more"
/>
</EuiLink>
),
}}
/>
),
onlyLogWritingEnabledTitle: i18n.translate(
'xpack.upgradeAssistant.overview.deprecationLogs.deprecationWarningTitle',
{
Expand All @@ -55,6 +79,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 +142,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

0 comments on commit 8843f2d

Please sign in to comment.