-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Align code between branches #91862
Changes from all commits
2e4163d
2e2e92f
bc7ec3b
4556e74
bde335f
ccecb36
04ce802
eac1feb
b948291
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import SemVer from 'semver/classes/semver'; | ||
|
||
/* | ||
* These constants are used only in tests to add conditional logic based on Kibana version | ||
* On master, the version should represent the next major version (e.g., master --> 8.0.0) | ||
* The release branch should match the release version (e.g., 7.x --> 7.0.0) | ||
*/ | ||
export const mockKibanaVersion = '8.0.0'; | ||
export const mockKibanaSemverVersion = new SemVer(mockKibanaVersion); |
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ import React, { useState } from 'react'; | |
import { | ||
EuiButton, | ||
EuiButtonEmpty, | ||
EuiCode, | ||
EuiCallOut, | ||
EuiCheckbox, | ||
EuiFlexGroup, | ||
|
@@ -100,9 +101,9 @@ export const WarningsFlyoutStep: React.FunctionComponent<WarningsConfirmationFly | |
})); | ||
}; | ||
|
||
const { docLinks } = useAppContext(); | ||
const { ELASTIC_WEBSITE_URL } = docLinks; | ||
const observabilityDocBasePath = `${ELASTIC_WEBSITE_URL}guide/en/observability`; | ||
const { docLinks, kibanaVersionInfo } = useAppContext(); | ||
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks; | ||
const esDocBasePath = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference`; | ||
|
||
return ( | ||
<> | ||
|
@@ -128,25 +129,31 @@ export const WarningsFlyoutStep: React.FunctionComponent<WarningsConfirmationFly | |
|
||
<EuiSpacer /> | ||
|
||
{warnings.includes(ReindexWarning.apmReindex) && ( | ||
{kibanaVersionInfo.currentMajor === 7 && warnings.includes(ReindexWarning.customTypeName) && ( | ||
<WarningCheckbox | ||
checkedIds={checkedIds} | ||
onChange={onChange} | ||
warning={ReindexWarning.apmReindex} | ||
warning={ReindexWarning.customTypeName} | ||
label={ | ||
<FormattedMessage | ||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.apmReindexWarningTitle" | ||
defaultMessage="This index will be converted to ECS format" | ||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.customTypeNameWarningTitle" | ||
defaultMessage="Mapping type will be changed to {defaultType}" | ||
values={{ | ||
defaultType: <EuiCode>_doc</EuiCode>, | ||
}} | ||
/> | ||
} | ||
description={ | ||
<FormattedMessage | ||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.apmReindexWarningDetail" | ||
defaultMessage="Starting in version 7.0.0, APM data will be represented in the Elastic Common Schema. | ||
Historical APM data will not visible until it's reindexed." | ||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.customTypeNameWarningDetail" | ||
defaultMessage="Mapping types are no longer supported in 8.0. This index mapping does not use the | ||
default type name, {defaultType}. Ensure no application code or scripts rely on a different type." | ||
values={{ | ||
defaultType: <EuiCode>_doc</EuiCode>, | ||
}} | ||
Comment on lines
+148
to
+153
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. Is this new copy? If it is, it looks good to me, but it could be worth pulling in someone from esdocs@ too! 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. It's slightly modified from 7.x 😄. I'm going to hold off on a copy review for now, as I think this UI will change as part of the redesign. |
||
/> | ||
} | ||
documentationUrl={`${observabilityDocBasePath}/master/whats-new.html`} | ||
documentationUrl={`${esDocBasePath}/${DOC_LINK_VERSION}/removal-of-types.html`} | ||
/> | ||
)} | ||
</EuiFlyoutBody> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,10 @@ | |
* 2.0. | ||
*/ | ||
|
||
import { mockKibanaSemverVersion, mockKibanaVersion } from '../../../common/constants'; | ||
import { ReindexWarning } from '../../../common/types'; | ||
import { versionService } from '../version'; | ||
import { MOCK_VERSION_STRING, getMockVersionInfo } from '../__fixtures__/version'; | ||
import { getMockVersionInfo } from '../__fixtures__/version'; | ||
|
||
import { | ||
generateNewIndexName, | ||
|
@@ -123,7 +125,7 @@ describe('transformFlatSettings', () => { | |
|
||
describe('sourceNameForIndex', () => { | ||
beforeEach(() => { | ||
versionService.setup(MOCK_VERSION_STRING); | ||
versionService.setup(mockKibanaVersion); | ||
}); | ||
|
||
it('parses internal indices', () => { | ||
|
@@ -144,7 +146,7 @@ describe('sourceNameForIndex', () => { | |
|
||
describe('generateNewIndexName', () => { | ||
beforeEach(() => { | ||
versionService.setup(MOCK_VERSION_STRING); | ||
versionService.setup(mockKibanaVersion); | ||
}); | ||
|
||
it('parses internal indices', () => { | ||
|
@@ -177,4 +179,26 @@ describe('getReindexWarnings', () => { | |
}) | ||
).toEqual([]); | ||
}); | ||
|
||
if (mockKibanaSemverVersion.major === 7) { | ||
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. Not sure how the test harness is being set up, but it could be a better pattern to create a nested |
||
describe('customTypeName warning', () => { | ||
it('returns customTypeName for non-_doc mapping types', () => { | ||
expect( | ||
getReindexWarnings({ | ||
settings: {}, | ||
mappings: { doc: {} }, | ||
}) | ||
).toEqual([ReindexWarning.customTypeName]); | ||
}); | ||
|
||
it('does not return customTypeName for _doc mapping types', () => { | ||
expect( | ||
getReindexWarnings({ | ||
settings: {}, | ||
mappings: { _doc: {} }, | ||
}) | ||
).toEqual([]); | ||
}); | ||
}); | ||
} | ||
}); |
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.
Does this help with bundle size? Just curious☺️
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.
Good question! I think I copied this from elsewhere in Kibana 😅 . I'd have to go back and compare to see how it affects the bundle size.