Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
9e6f54e
start working on new UI pieces and copy
sabarasaba Jul 22, 2021
5e3c775
start working on logstream implementation
sabarasaba Jul 22, 2021
10c2476
start working on new toggle
sabarasaba Jul 26, 2021
7d0c37f
create collapsible component and implement
sabarasaba Jul 26, 2021
e577375
Small tweaks
sabarasaba Jul 28, 2021
28773ac
Remove latest minor banner
sabarasaba Jul 29, 2021
9b2061c
Convert panels into clickeable cards
sabarasaba Jul 29, 2021
24e92f8
Fix error layout for cards
sabarasaba Jul 30, 2021
49d9d13
Add doc links and cap maxWidth of content
sabarasaba Jul 30, 2021
d261646
Conditionally render copy and cta's if we're on cloud
sabarasaba Jul 30, 2021
c73c01e
Add new UI states to toggle
sabarasaba Aug 3, 2021
a4241c1
Refactor folder structure and extract things into their own components
sabarasaba Aug 3, 2021
763d747
Refactor page description
sabarasaba Aug 3, 2021
07b044a
Toggle should set both settings, and show callout with warning if onl…
sabarasaba Aug 4, 2021
ac00180
Add cloud url link to cta
sabarasaba Aug 4, 2021
ceb4cb0
Both settings should be persistent
sabarasaba Aug 5, 2021
15e9d6d
Fix hardcoded strings
sabarasaba Aug 5, 2021
06695db
Use RedirectAppLinks so we dont do a full reload of the app when
sabarasaba Aug 6, 2021
cdb6ee8
refactor props and hardcoded strings
sabarasaba Aug 6, 2021
32cacf2
Finish up working on discover deep link
sabarasaba Aug 6, 2021
8506d4b
Fix link to observability app
sabarasaba Aug 6, 2021
99c1ad5
Refactor hardcoded ids into constants file
sabarasaba Aug 6, 2021
c92ab2c
Use history hook instead of passing history everywhere
sabarasaba Aug 6, 2021
613c4b1
Change copy to comply with latest copy changes
sabarasaba Aug 6, 2021
b7caddd
Fix toggle label also
sabarasaba Aug 6, 2021
f7d4d27
refactor fetcher into its own hook
sabarasaba Aug 6, 2021
9063ba3
Add error and loading states
sabarasaba Aug 9, 2021
359a8bb
Fix jumpy container when toggling switch
sabarasaba Aug 9, 2021
de844e2
small refactor and replace hardcoded strings
sabarasaba Aug 9, 2021
ab2f2b6
Should also set transient setting when toggling
sabarasaba Aug 9, 2021
d351947
Set time limit to 7d
sabarasaba Aug 9, 2021
4fada95
remove css hacks
sabarasaba Aug 9, 2021
6dac6d6
Change duped i18 string
sabarasaba Aug 9, 2021
177273b
Fix backend tests
sabarasaba Aug 9, 2021
cb7ca37
Fix duped i18n keys
sabarasaba Aug 9, 2021
2b09eb9
Fix html validation errors
sabarasaba Aug 9, 2021
b752d17
Add back css hack for demo purposes, also make links open in a new tab
sabarasaba Aug 9, 2021
2b86a3f
Convert collapsible into a controlled component
sabarasaba Aug 9, 2021
37b06a5
Fix small bug when toggling switch with expanded state
sabarasaba Aug 10, 2021
9d0a5f7
wip: start writting tests
sabarasaba Aug 10, 2021
7ba27b5
Remove logstream implementation
sabarasaba Aug 11, 2021
276ccba
Finish off link boxes and copy changes
sabarasaba Aug 11, 2021
a6b703d
Show/hide deprecation warnings based on counts
sabarasaba Aug 11, 2021
652affd
Refactor no warnings into a new component
sabarasaba Aug 11, 2021
8999504
Rename NoWarnings to NoDeprecations
sabarasaba Aug 11, 2021
b870116
update i18n strings
sabarasaba Aug 11, 2021
7f62065
Fix spacing between links
sabarasaba Aug 11, 2021
9fc0c69
fix i18n strings
sabarasaba Aug 11, 2021
c9472ab
Remove no longer needed callout and refactor stuff a bit
sabarasaba Aug 12, 2021
5412920
Refactor file structure and rename components
sabarasaba Aug 12, 2021
a671453
Apply upper limits to deprecation counts
sabarasaba Aug 12, 2021
cc0db5d
Add tests for review step
sabarasaba Aug 12, 2021
d8b6ea1
Finish adding cit's for all other components
sabarasaba Aug 12, 2021
4e32f55
Add back warning callout and fix all broken tests
sabarasaba Aug 12, 2021
79f1746
Fix wrong css imports
sabarasaba Aug 13, 2021
990fca9
Remove unused dep
sabarasaba Aug 13, 2021
3d1ef3e
Fix TS errors and tests
sabarasaba Aug 13, 2021
525e8d3
Fix last few ts errors
sabarasaba Aug 13, 2021
3ef3f67
rename doc link
sabarasaba Aug 14, 2021
d8a36e6
Address first part of CR
sabarasaba Aug 15, 2021
42de63d
Start renaming files and methods
sabarasaba Aug 16, 2021
85bd072
refactor function names
sabarasaba Aug 16, 2021
8161f9f
Finish off renaming all variables and methods
sabarasaba Aug 16, 2021
72ee24e
Rename identify_step to fix_deprecation_logs_step
sabarasaba Aug 16, 2021
8e2b11a
Fix wrong import path
sabarasaba Aug 16, 2021
6f1074f
Address first part of CR
sabarasaba Aug 17, 2021
6a8ed53
Rename review_step to review_logs_step
sabarasaba Aug 17, 2021
b66710b
Last CR changes
sabarasaba Aug 17, 2021
af6dea0
Remove unused translations
sabarasaba Aug 17, 2021
bf3f1bb
Fix type import
sabarasaba Aug 17, 2021
81d6aee
Small CR changes
sabarasaba Aug 17, 2021
3a28ace
Add a bit more spacing around toggle
sabarasaba Aug 17, 2021
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 @@ -54,10 +54,10 @@ export const setup = async (overrides?: Record<string, unknown>): Promise<Overvi

export type OverviewTestSubjects =
| 'esStatsPanel'
| 'esStatsPanel.totalDeprecations'
| 'esStatsPanel.warningDeprecations'
| 'esStatsPanel.criticalDeprecations'
| 'kibanaStatsPanel'
| 'kibanaStatsPanel.totalDeprecations'
| 'kibanaStatsPanel.warningDeprecations'
| 'kibanaStatsPanel.criticalDeprecations'
| 'deprecationLoggingFormRow'
| 'esRequestErrorIconTip'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ export const kibanaDeprecations: DomainDeprecationDetails[] = [
message:
'Disabling the Spaces plugin (xpack.spaces.enabled) will not be supported in the next major version (8.0)',
},
{
correctiveActions: { manualSteps: ['test-step'] },
domainId: 'xpack.spaces',
level: 'warning',
message: 'Sample warning deprecation',
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Overview - Fix deprecated settings step', () => {
const { exists, find } = testBed;

expect(exists('esStatsPanel')).toBe(true);
expect(find('esStatsPanel.totalDeprecations').text()).toContain('2');
expect(find('esStatsPanel.warningDeprecations').text()).toContain('1');
expect(find('esStatsPanel.criticalDeprecations').text()).toContain('1');
});

Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Overview - Fix deprecated settings step', () => {
expect(exists('noDeprecationsLabel')).toBe(true);
});

test('Has a link for viewing deprecations', () => {
test('Stats panel navigates to deprecations list if clicked', () => {
const { component, exists, find } = testBed;

component.update();
Expand Down Expand Up @@ -181,7 +181,7 @@ describe('Overview - Fix deprecated settings step', () => {
const { exists, find } = testBed;

expect(exists('kibanaStatsPanel')).toBe(true);
expect(find('kibanaStatsPanel.totalDeprecations').text()).toContain('1');
expect(find('kibanaStatsPanel.warningDeprecations').text()).toContain('1');
expect(find('kibanaStatsPanel.criticalDeprecations').text()).toContain('1');
});

Expand Down Expand Up @@ -217,9 +217,11 @@ describe('Overview - Fix deprecated settings step', () => {
const { exists } = testBed;

expect(exists('noDeprecationsLabel')).toBe(true);
expect(exists('kibanaStatsPanel.warningDeprecations')).toBe(false);
expect(exists('kibanaStatsPanel.criticalDeprecations')).toBe(false);
});

test('Has a link for viewing deprecations', () => {
test('Stats panel navigates to deprecations list if clicked', () => {
const { component, exists, find } = testBed;

component.update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
EuiLoadingSpinner,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { ResponseError } from '../../../../lib/api';
import { DeprecationLoggingPreviewProps } from '../../../types';
Expand Down Expand Up @@ -49,6 +48,9 @@ const i18nTexts = {
buttonLabel: i18n.translate('xpack.upgradeAssistant.overview.deprecationLogs.buttonLabel', {
defaultMessage: 'Enable deprecation logging and indexing',
}),
loadingLogsLabel: i18n.translate('xpack.upgradeAssistant.overview.loadingLogsLabel', {
defaultMessage: 'Loading log collection state…',
}),
};

const ErrorDetailsLink = ({ error }: { error: ResponseError }) => {
Expand Down Expand Up @@ -90,12 +92,7 @@ export const DeprecationLoggingToggle: FunctionComponent<DeprecationLoggingPrevi
<EuiFlexItem grow={false} className="upgLoadingItem">
<EuiLoadingSpinner size="m" />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<FormattedMessage
id="xpack.upgradeAssistant.overview.loadingLogsLabel"
defaultMessage="Loading log collection state..."
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>{i18nTexts.loadingLogsLabel}</EuiFlexItem>
</EuiFlexGroup>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const DiscoverAppLink: FunctionComponent = () => {
<EuiLink href={discoveryUrl} target="_blank" data-test-subj="viewDiscoverLogs">
<FormattedMessage
id="xpack.upgradeAssistant.overview.viewDiscoverResultsAction"
defaultMessage="Analyse logs in Discover"
defaultMessage="Analyze logs in Discover"
/>
</EuiLink>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ export const useDeprecationLogging = (): DeprecationLoggingPreviewProps => {

useEffect(() => {
if (!isLoading && data) {
const { isDeprecationLogIndexingEnabled: isEnabled, isDeprecationLoggingEnabled } = data;
setIsDeprecationLogIndexingEnabled(isEnabled);
const {
isDeprecationLogIndexingEnabled: isIndexingEnabled,
isDeprecationLoggingEnabled,
} = data;
setIsDeprecationLogIndexingEnabled(isIndexingEnabled);

if (!isEnabled && isDeprecationLoggingEnabled) {
if (!isIndexingEnabled && isDeprecationLoggingEnabled) {
setOnlyDeprecationLogWritingEnabled(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import 'stats_panel';
@import 'no_deprecations/no_deprecations';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Used by both es_stats and kibana_stats panel for having the EuiPopover Icon
// for errors shown next to the title without having to resort to wrapping everything
// with EuiFlexGroups.
.upgWarningIcon {
margin-left: $euiSizeS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const i18nTexts = {
statsTitle: i18n.translate('xpack.upgradeAssistant.esDeprecationStats.statsTitle', {
defaultMessage: 'Elasticsearch',
}),
totalDeprecationsTitle: i18n.translate(
warningDeprecationsTitle: i18n.translate(
'xpack.upgradeAssistant.esDeprecationStats.warningDeprecationsTitle',
{
defaultMessage: 'Warning',
Expand All @@ -50,7 +50,7 @@ const i18nTexts = {
criticalDeprecations,
},
}),
getTotalDeprecationsMessage: (clusterCount: number, indexCount: number) =>
getWarningDeprecationMessage: (clusterCount: number, indexCount: number) =>
i18n.translate('xpack.upgradeAssistant.esDeprecationStats.totalDeprecationsTooltip', {
defaultMessage:
'This cluster is using {clusterCount} deprecated cluster settings and {indexCount} deprecated index settings',
Expand All @@ -68,11 +68,14 @@ export const ESDeprecationStats: FunctionComponent = () => {
const { data: esDeprecations, isLoading, error } = api.useLoadUpgradeStatus();

const allDeprecations = esDeprecations?.cluster?.concat(esDeprecations?.indices) ?? [];
const warningDeprecations = allDeprecations.filter(
(deprecation) => deprecation.level === 'warning'
);
const criticalDeprecations = allDeprecations.filter(
(deprecation) => deprecation.level === 'critical'
);

const hasWarnings = allDeprecations.length > 0;
const hasWarnings = warningDeprecations.length > 0;
const hasCritical = criticalDeprecations.length > 0;
const hasNoDeprecations = !isLoading && !error && !hasWarnings && !hasCritical;
const shouldRenderStat = (forSection: boolean) => error || isLoading || forSection;
Expand Down Expand Up @@ -123,18 +126,18 @@ export const ESDeprecationStats: FunctionComponent = () => {
{shouldRenderStat(hasWarnings) && (
<EuiFlexItem>
<EuiStat
data-test-subj="totalDeprecations"
title={error ? '--' : getDeprecationsUpperLimit(allDeprecations.length)}
data-test-subj="warningDeprecations"
title={error ? '--' : getDeprecationsUpperLimit(warningDeprecations.length)}
titleElement="span"
description={i18nTexts.totalDeprecationsTitle}
description={i18nTexts.warningDeprecationsTitle}
isLoading={isLoading}
>
{!error && (
<EuiScreenReaderOnly>
<p>
{isLoading
? i18nTexts.loadingText
: i18nTexts.getTotalDeprecationsMessage(
: i18nTexts.getWarningDeprecationMessage(
esDeprecations?.cluster.length ?? 0,
esDeprecations?.indices.length ?? 0
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ export const EsStatsErrors: React.FunctionComponent<Props> = ({ error }) => {
);
}

return <span style={{ marginLeft: 8 }}>{iconContent}</span>;
return <span className="upgWarningIcon">{iconContent}</span>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const i18nTexts = {
statsTitle: i18n.translate('xpack.upgradeAssistant.kibanaDeprecationStats.statsTitle', {
defaultMessage: 'Kibana',
}),
totalDeprecationsTitle: i18n.translate(
warningDeprecationsTitle: i18n.translate(
'xpack.upgradeAssistant.kibanaDeprecationStats.warningDeprecationsTitle',
{
defaultMessage: 'Warning',
Expand All @@ -52,16 +52,18 @@ const i18nTexts = {
}),
getCriticalDeprecationsMessage: (criticalDeprecations: number) =>
i18n.translate('xpack.upgradeAssistant.kibanaDeprecationStats.criticalDeprecationsLabel', {
defaultMessage: 'Kibana has {criticalDeprecations} critical deprecations',
defaultMessage:
'Kibana has {criticalDeprecations} critical {criticalDeprecations, plural, one {deprecation} other {deprecations}}',
values: {
criticalDeprecations,
},
}),
getTotalDeprecationsMessage: (totalDeprecations: number) =>
i18n.translate('xpack.upgradeAssistant.kibanaDeprecationStats.totalDeprecationsLabel', {
defaultMessage: 'Kibana has {totalDeprecations} total deprecations',
getWarningDeprecationsMessage: (warningDeprecations: number) =>
i18n.translate('xpack.upgradeAssistant.kibanaDeprecationStats.getWarningDeprecationsMessage', {
defaultMessage:
'Kibana has {warningDeprecations} warning {warningDeprecations, plural, one {deprecation} other {deprecations}}',
values: {
totalDeprecations,
warningDeprecations,
},
}),
};
Expand Down Expand Up @@ -93,12 +95,13 @@ export const KibanaDeprecationStats: FunctionComponent = () => {
getAllDeprecations();
}, [deprecations]);

const warningDeprecationsCount = kibanaDeprecations?.length ?? 0;
const warningDeprecationsCount =
kibanaDeprecations?.filter((deprecation) => deprecation.level === 'warning')?.length ?? 0;
const criticalDeprecationsCount =
kibanaDeprecations?.filter((deprecation) => deprecation.level === 'critical')?.length ?? 0;

const hasWarnings = criticalDeprecationsCount > 0;
const hasCritical = warningDeprecationsCount > 0;
const hasCritical = criticalDeprecationsCount > 0;
const hasWarnings = warningDeprecationsCount > 0;
const hasNoDeprecations = !isLoading && !error && !hasWarnings && !hasCritical;
const shouldRenderStat = (forSection: boolean) => error || isLoading || forSection;

Expand All @@ -110,15 +113,17 @@ export const KibanaDeprecationStats: FunctionComponent = () => {
<>
{i18nTexts.statsTitle}
{error && (
<EuiIconTip
type="alert"
color="danger"
size="l"
content={i18nTexts.loadingError}
iconProps={{
'data-test-subj': 'kibanaRequestErrorIconTip',
}}
/>
<span className="upgWarningIcon">
<EuiIconTip
type="alert"
color="danger"
size="m"
content={i18nTexts.loadingError}
iconProps={{
'data-test-subj': 'kibanaRequestErrorIconTip',
}}
/>
</span>
)}
</>
}
Expand Down Expand Up @@ -160,18 +165,18 @@ export const KibanaDeprecationStats: FunctionComponent = () => {
{shouldRenderStat(hasWarnings) && (
<EuiFlexItem>
<EuiStat
data-test-subj="totalDeprecations"
data-test-subj="warningDeprecations"
title={error ? '--' : getDeprecationsUpperLimit(warningDeprecationsCount)}
titleElement="span"
description={i18nTexts.totalDeprecationsTitle}
description={i18nTexts.warningDeprecationsTitle}
isLoading={isLoading}
>
{!error && (
<EuiScreenReaderOnly>
<p>
{isLoading
? i18nTexts.loadingText
: i18nTexts.getTotalDeprecationsMessage(warningDeprecationsCount)}
: i18nTexts.getWarningDeprecationsMessage(warningDeprecationsCount)}
</p>
</EuiScreenReaderOnly>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import {
EuiFlexGroup,
EuiSpacer,
EuiButton,
EuiIcon,
EuiLink,
EuiButtonEmpty,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import type { EuiStepProps } from '@elastic/eui/src/components/steps/step';
import type { DocLinksStart } from 'src/core/public';
import { useKibana } from '../../../../shared_imports';
Expand All @@ -42,6 +40,12 @@ const i18nTexts = {
upgradeStepLink: i18n.translate('xpack.upgradeAssistant.overview.upgradeStepLink', {
defaultMessage: 'Learn more',
}),
upgradeStepCloudLink: i18n.translate('xpack.upgradeAssistant.overview.upgradeStepCloudLink', {
defaultMessage: 'Upgrade on Cloud',
}),
upgradeGuideLink: i18n.translate('xpack.upgradeAssistant.overview.upgradeGuideLink', {
defaultMessage: 'View upgrade guide',
}),
};

const UpgradeStep = ({ docLinks }: { docLinks: DocLinksStart }) => {
Expand All @@ -54,31 +58,29 @@ const UpgradeStep = ({ docLinks }: { docLinks: DocLinksStart }) => {

if (isCloudEnabled) {
callToAction = (
<EuiFlexGroup alignItems="center">
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiButton
href={cloudDeploymentUrl}
target="_blank"
data-test-subj="upgradeSetupCloudLink"
iconSide="right"
iconType="popout"
>
<FormattedMessage
id="xpack.upgradeAssistant.overview.upgradeStepCloudLink"
defaultMessage="Upgrade on Cloud"
/>
{i18nTexts.upgradeStepCloudLink}
</EuiButton>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiLink
<EuiButtonEmpty
href={docLinks.links.elasticsearch.setupUpgrade}
target="_blank"
data-test-subj="upgradeSetupDocsLink"
iconSide="right"
iconType="popout"
>
<FormattedMessage
id="xpack.upgradeAssistant.overview.upgradeGuideLink"
defaultMessage="View upgrade guide"
/>
</EuiLink>
{i18nTexts.upgradeGuideLink}
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
);
Expand All @@ -88,9 +90,10 @@ const UpgradeStep = ({ docLinks }: { docLinks: DocLinksStart }) => {
href={docLinks.links.elasticsearch.setupUpgrade}
target="_blank"
data-test-subj="upgradeSetupDocsLink"
iconSide="right"
iconType="popout"
>
{i18nTexts.upgradeStepLink}
<EuiIcon type="popout" size="s" style={{ marginLeft: 4 }} />
</EuiButton>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ describe('Upgrade Assistant Usage Collector', () => {
body: {
persistent: {},
transient: {
logger: {
deprecation: 'WARN',
},
cluster: {
deprecation_indexing: {
enabled: 'true',
Expand Down
Loading