Skip to content

Commit

Permalink
[Upgrade Assistant] Remove Fix manually heading when there are no man…
Browse files Browse the repository at this point in the history
…ual steps
  • Loading branch information
sabarasaba committed Oct 20, 2021
1 parent 8f97cd0 commit 02c36f7
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ const kibanaDeprecations: DomainDeprecationDetails[] = [
message: 'Test deprecation message 2',
deprecationType: 'feature',
},
{
correctiveActions: {
// Has no manual steps.
manualSteps: [],
},
domainId: 'test_domain_3',
level: 'warning',
title: 'Test deprecation title 3',
message: 'Test deprecation message 3',
deprecationType: 'feature',
},
];

const setLoadDeprecations = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ describe('Kibana deprecation details flyout', () => {
expect(find('kibanaDeprecationDetails.flyoutTitle').text()).toBe(manualDeprecation.title);
expect(find('manualStepsListItem').length).toBe(3);
});

test(`doesn't show corrective actions title and steps if there aren't any`, async () => {
const { find, exists, actions } = testBed;
const manualDeprecation = mockedKibanaDeprecations[2];

await actions.table.clickDeprecationAt(2);

expect(exists('kibanaDeprecationDetails')).toBe(true);
expect(exists('kibanaDeprecationDetails.manualStepsTitle')).toBe(false);
expect(exists('manualStepsListItem')).toBe(false);
expect(find('kibanaDeprecationDetails.flyoutTitle').text()).toBe(manualDeprecation.title);
});
});

describe('Deprecation with automatic resolution', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Overview - Fix deprecation issues step - Kibana deprecations', () => {

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

test('panel links to Kibana deprecations page', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,31 +192,33 @@ export const DeprecationDetailsFlyout = ({
</>
)}

<EuiTitle size="s">
<h3>{i18nTexts.manualFixTitle}</h3>
</EuiTitle>

<EuiSpacer size="s" />

<EuiText>
{correctiveActions.manualSteps.length === 1 ? (
<p data-test-subj="manualStep" className="eui-textBreakWord">
{correctiveActions.manualSteps[0]}
</p>
) : (
<ol data-test-subj="manualStepsList">
{correctiveActions.manualSteps.map((step, stepIndex) => (
<li
data-test-subj="manualStepsListItem"
key={`step-${stepIndex}`}
className="upgResolveStep eui-textBreakWord"
>
{step}
</li>
))}
</ol>
)}
</EuiText>
{correctiveActions.manualSteps.length > 0 && (
<>
<EuiTitle size="s" data-test-subj="manualStepsTitle">
<h3>{i18nTexts.manualFixTitle}</h3>
</EuiTitle>
<EuiSpacer size="s" />
<EuiText>
{correctiveActions.manualSteps.length === 1 ? (
<p data-test-subj="manualStep" className="eui-textBreakWord">
{correctiveActions.manualSteps[0]}
</p>
) : (
<ol data-test-subj="manualStepsList">
{correctiveActions.manualSteps.map((step, stepIndex) => (
<li
data-test-subj="manualStepsListItem"
key={`step-${stepIndex}`}
className="upgResolveStep eui-textBreakWord"
>
{step}
</li>
))}
</ol>
)}
</EuiText>
</>
)}
</div>
)}
</EuiFlyoutBody>
Expand Down

0 comments on commit 02c36f7

Please sign in to comment.