Skip to content

Commit 9342150

Browse files
committed
Phases redesign
1 parent f3a9c76 commit 9342150

33 files changed

Lines changed: 593 additions & 313 deletions

File tree

x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,27 @@ export const setup = async (arg?: { appServicesContext: Partial<AppServicesConte
248248
};
249249
};
250250

251+
const createToggleDeletePhaseActions = () => {
252+
const enablePhase = async () => {
253+
await act(async () => {
254+
find('enableDeletePhaseLink').simulate('click');
255+
});
256+
component.update();
257+
};
258+
259+
const disablePhase = async () => {
260+
await act(async () => {
261+
find('disableDeletePhaseButton').simulate('click');
262+
});
263+
component.update();
264+
};
265+
266+
return {
267+
enablePhase,
268+
disablePhase,
269+
};
270+
};
271+
251272
return {
252273
...testBed,
253274
actions: {
@@ -303,7 +324,7 @@ export const setup = async (arg?: { appServicesContext: Partial<AppServicesConte
303324
...createSearchableSnapshotActions('cold'),
304325
},
305326
delete: {
306-
enable: enable('delete'),
327+
...createToggleDeletePhaseActions(),
307328
setMinAgeValue: setMinAgeValue('delete'),
308329
setMinAgeUnits: setMinAgeUnits('delete'),
309330
},

x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('<EditPolicy />', () => {
6161
// Set max docs to test whether we keep the unknown fields in that object after serializing
6262
await actions.hot.setMaxDocs('1000');
6363
// Remove the delete phase to ensure that we also correctly remove data
64-
await actions.delete.enable(false);
64+
await actions.delete.disablePhase();
6565
await actions.savePolicy();
6666

6767
const latestRequest = server.requests[server.requests.length - 1];
@@ -839,7 +839,7 @@ describe('<EditPolicy />', () => {
839839
expect(actions.timeline.hasColdPhase()).toBe(true);
840840
expect(actions.timeline.hasDeletePhase()).toBe(false);
841841

842-
await actions.delete.enable(true);
842+
await actions.delete.enablePhase();
843843
expect(actions.timeline.hasHotPhase()).toBe(true);
844844
expect(actions.timeline.hasWarmPhase()).toBe(true);
845845
expect(actions.timeline.hasColdPhase()).toBe(true);

x-pack/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ const activatePhase = async (rendered: ReactWrapper, phase: string) => {
9999
});
100100
rendered.update();
101101
};
102+
const activateDeletePhase = async (rendered: ReactWrapper) => {
103+
const testSubject = `enableDeletePhaseLink`;
104+
await act(async () => {
105+
await findTestSubject(rendered, testSubject).simulate('click');
106+
});
107+
rendered.update();
108+
};
102109
const openNodeAttributesSection = async (rendered: ReactWrapper, phase: string) => {
103110
const getControls = () => findTestSubject(rendered, `${phase}-dataTierAllocationControls`);
104111
await act(async () => {
@@ -813,7 +820,7 @@ describe('edit policy', () => {
813820
const rendered = mountWithIntl(component);
814821
await noRollover(rendered);
815822
await setPolicyName(rendered, 'mypolicy');
816-
await activatePhase(rendered, 'delete');
823+
await activateDeletePhase(rendered);
817824
await setPhaseAfter(rendered, 'delete', '0');
818825
waitForFormLibValidation(rendered);
819826
expectedErrorMessages(rendered, []);
@@ -822,7 +829,7 @@ describe('edit policy', () => {
822829
const rendered = mountWithIntl(component);
823830
await noRollover(rendered);
824831
await setPolicyName(rendered, 'mypolicy');
825-
await activatePhase(rendered, 'delete');
832+
await activateDeletePhase(rendered);
826833
await setPhaseAfter(rendered, 'delete', '-1');
827834
waitForFormLibValidation(rendered);
828835
expectedErrorMessages(rendered, [i18nTexts.editPolicy.errors.nonNegativeNumberRequired]);

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/active_badge.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/active_highlight/active_highlight.scss

Lines changed: 0 additions & 16 deletions
This file was deleted.

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
* 2.0.
66
*/
77

8-
export { ActiveBadge } from './active_badge';
98
export { LearnMoreLink } from './learn_more_link';
109
export { OptionalLabel } from './optional_label';
1110
export { PolicyJsonFlyout } from './policy_json_flyout';
1211
export { DescribedFormRow, ToggleFieldWithDescribedFormRow } from './described_form_row';
1312
export { FieldLoadingError } from './field_loading_error';
14-
export { ActiveHighlight } from './active_highlight';
1513
export { Timeline } from './timeline';
1614
export { FormErrorsCallout } from './form_errors_callout';
17-
15+
export { PhaseFooter } from './phase_footer';
1816
export * from './phases';

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/active_highlight/index.ts renamed to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/infinity_icon/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
* 2.0.
66
*/
77

8-
export { ActiveHighlight } from './active_highlight';
8+
export { InfinityIcon } from './infinity_icon';

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/infinity_icon.svg.tsx renamed to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/infinity_icon/infinity_icon.svg.tsx

File renamed without changes.

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/active_highlight/active_highlight.tsx renamed to x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/infinity_icon/infinity_icon.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66
*/
77

88
import React, { FunctionComponent } from 'react';
9+
import { EuiIcon, EuiIconProps } from '@elastic/eui';
10+
import { InfinityIconSvg } from './infinity_icon.svg';
911

10-
import './active_highlight.scss';
11-
12-
interface Props {
13-
phase: 'hot' | 'warm' | 'cold';
14-
enabled: boolean;
15-
}
16-
export const ActiveHighlight: FunctionComponent<Props> = ({ phase, enabled }) => {
17-
return <div className={`ilmActivePhaseHighlight ${phase}Phase ${enabled ? 'active' : ''} `} />;
18-
};
12+
export const InfinityIcon: FunctionComponent<Omit<EuiIconProps, 'type'>> = (props) => (
13+
<EuiIcon type={InfinityIconSvg} {...props} />
14+
);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
export { PhaseFooter } from './phase_footer';

0 commit comments

Comments
 (0)