forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ILM] Surfacing policy error state (elastic#89701)
* added policy top-level callout for error state * added form errors context. errors are sorted by their field path into phases * added data test subject attributes and prevent setErrors from getting called if component is not mounted * update copy * refactored errors context and optimised setting of context value. Also added test for various form error notifications across the collapsed phases * add test for non-phase specific policy validation error * Remove unused import * refactor how errors are listened to, use the new "onError" callback Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
7d36576
commit c64147d
Showing
28 changed files
with
497 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
...x_lifecycle_management/public/application/sections/edit_policy/components/form_errors.tsx
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...cle_management/public/application/sections/edit_policy/components/form_errors_callout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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 React, { FunctionComponent } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiCallOut, EuiSpacer } from '@elastic/eui'; | ||
|
||
import { useFormErrorsContext } from '../form'; | ||
|
||
const i18nTexts = { | ||
callout: { | ||
title: i18n.translate('xpack.indexLifecycleMgmt.policyErrorCalloutTitle', { | ||
defaultMessage: 'This policy contains errors', | ||
}), | ||
body: i18n.translate('xpack.indexLifecycleMgmt.policyErrorCalloutDescription', { | ||
defaultMessage: 'Please fix all errors before saving the policy.', | ||
}), | ||
}, | ||
}; | ||
|
||
export const FormErrorsCallout: FunctionComponent = () => { | ||
const { | ||
errors: { hasErrors }, | ||
} = useFormErrorsContext(); | ||
|
||
if (!hasErrors) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<EuiCallOut | ||
data-test-subj="policyFormErrorsCallout" | ||
color="danger" | ||
title={i18nTexts.callout.title} | ||
> | ||
{i18nTexts.callout.body} | ||
</EuiCallOut> | ||
<EuiSpacer /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...cycle_management/public/application/sections/edit_policy/components/phases/phase/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export { Phase } from './phase'; |
Oops, something went wrong.