Skip to content

Commit

Permalink
[ILM] Migrate Delete phase and name field to Form Lib (#82834)
Browse files Browse the repository at this point in the history
* remove use of legacy state system and legacy serialization

* remove legacy min_age input component and re-add missing import

* rename shared -> shared_fields for more clarity

* some more cleanup and fixing regressions on policy name for creating new policy from existing policy

* move extract policy static code to lib folder and remove "policies" dir from services

* fix jest tests and minor policy flyout inconsistency

* remove legacy helper

* fix client integration tests

* fix min for set index priority

* moved save policy function into edit policy section

* remove unused translations

* refactor form files to own edit_policy/form folder

* remove "fix errors" badge to fix UX - users can see errors in line before pressing save so the value of this badge has diminished

* fix i18n after removing phase error badge

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
jloleysens and kibanamachine authored Nov 9, 2020
1 parent d1ef0d6 commit f2f76e1
Show file tree
Hide file tree
Showing 50 changed files with 749 additions and 1,485 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ export const setup = async () => {
setFreeze,
setIndexPriority: setIndexPriority('cold'),
},
delete: {
enable: enable('delete'),
setMinAgeValue: setMinAgeValue('delete'),
setMinAgeUnits: setMinAgeUnits('delete'),
},
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ describe('<EditPolicy />', () => {
expect(testBed.find('snapshotPolicyCombobox').prop('data-currentvalue')).toEqual([
{
label: DELETE_PHASE_POLICY.policy.phases.delete?.actions.wait_for_snapshot?.policy,
value: DELETE_PHASE_POLICY.policy.phases.delete?.actions.wait_for_snapshot?.policy,
},
]);
});
Expand Down Expand Up @@ -412,7 +411,7 @@ describe('<EditPolicy />', () => {
test('wait for snapshot field should delete action if field is empty', async () => {
const { actions } = testBed;

actions.setWaitForSnapshotPolicy('');
await actions.setWaitForSnapshotPolicy('');
await actions.savePolicy();

const expected = {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { PolicyFromES } from '../../../common/types';

export const splitSizeAndUnits = (field: string): { size: string; units: string } => {
let size = '';
let units = '';

const result = /(\d+)(\w+)/.exec(field);
if (result) {
size = result[1];
units = result[2];
}

return {
size,
units,
};
};

export const getPolicyByName = (
policies: PolicyFromES[] | null | undefined,
policyName: string = ''
): PolicyFromES | undefined => {
if (policies && policies.length > 0) {
return policies.find((policy: PolicyFromES) => policy.name === policyName);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
export { ActiveBadge } from './active_badge';
export { ErrableFormRow } from './form_errors';
export { LearnMoreLink } from './learn_more_link';
export { MinAgeInput } from './min_age_input_legacy';
export { OptionalLabel } from './optional_label';
export { PhaseErrorMessage } from './phase_error_message';
export { PolicyJsonFlyout } from './policy_json_flyout';
export { SnapshotPolicies } from './snapshot_policies';
export { DescribedFormField } from './described_form_field';

export * from './phases';

This file was deleted.

This file was deleted.

Loading

0 comments on commit f2f76e1

Please sign in to comment.