* implement form-level support for using default rollover action
* slight update to copy
* added use default rollover switch and tooltips for detailed copy
* fix legacy integration tests and do not unmount rollover field!!
* remove unused import
* fix client integration tests
* updated form to use new isUsingRollover check
* fix serialization of rollover
* Update x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx
Co-authored-by: Adam Locke <adam.locke@elastic.co>
* Update x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx
Co-authored-by: Adam Locke <adam.locke@elastic.co>
* Update x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx
Co-authored-by: Adam Locke <adam.locke@elastic.co>
Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Adam Locke <adam.locke@elastic.co>
* moved error and loading notices for data allocation field to below description
* removed test code
* expect controls to be showing, only render notice after network request has finished
* added loading spinner for field inputs
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* moved shrink field to shared_fields and added it to the hot phase
* updated test
* update legacy jest test
* removed configuration context for now
* remove unused i18n and remove duplicated isRolloverEnabled check;
* fixed shrink field to use new described field component
* added test for removing shrink field in serialization and re-ordered fields in hot phase advanced
* pivot to different rollover validation mechanism
* implement stakeholder feedback to show forcemerge in hot
* replace ternary with if..else statements
* make rollover validation test more comprehensive
* added fix for serializing replicas and updated validation to correctly check for non negative nr
* added tests and fixed incorrect use of warm phase setting in cold phase
* remove unused import
* clean up use of Boolean and rename nrOfReplicas -> numberOfReplicas
* fix comment
* fix hiding/disabling searchable snapshot field when rollover is disabled
* added test
* fix i18n
* for now, we hide the forcemerge field in hot
* implement copy updates
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* merged toggleable field and described form component and moved toggle to left
* moved all toggles to left, renamed DescribedFormField -> DescribedFormRow and added new ToggleFieldWithDescribedFormRow component
* added new prop fieldNotices to render callouts in correct position on the left
* Added server-side endpoint for getting list of repos
* part one of client side changes: added searchable snapshot field
- added to both hot and cold
- serializing into JSON payload
* make searchable snapshot field toggleable and require value when it is being used
* fix typo in file name and remove whitespace
* added searchable snapshot state context, wip
* finished updating fields to show and hide based on searchable snapshot in the hot phase
* hiding fields when searchable snapshots is enabled in hot
- removed nested EuiFieldRow components in data allocation field
- added SCSS files for data allocation field and searchable
snapshot field
* added translations and a first hot phase serialization test
* appease type check and i18n
* added cloud-specific behaviour for searchable snapshot default inlc. test
* refactor snapshot state -> configuration issues as this a can be re-used for other issues
* added configuration context file
* hide replicas in cold if snapshotting
* updated new field copy
* update test coverage, test for hiding certain fields too
* added license check to client side!
* moved warning to below field again and moved hot phase searchable snapshot notice to right
* make described form field lazy if needed
* render field even when license requirement is not met
* update serializer for removing searchable_snapshot field
* handle 404 from ES when looking up * snapshot repos - we return an empty array
* address license TODO
* added tests for license check and removed license check HoC
* fix legacy jest tests
* added readme about legacy tests
* updated jest tests and fix type issues
* remove unused import
* refactor component names to have "Field" at the end
* refactor searchable snapshot to single interface def and add comment about force_merge_index option
* address stakeholder feebdack and pr comments
* update tests after latest changes
* link to force merge
* Revert "link to force merge"
This reverts commit 6c714fbbac.
* introduce advanced section to hot, warm and cold
* added test for correctly deserializing delete phase, and added fix
* remove unused variable
* moved fields into advanced settings
* move learn more copy below enable toggle
* fix warm phase on rollover default
* remove label space above rollover toggle
* remove unused import
* update test after fixing warm on rollover default
* removed icons in callouts in searchable snapshot field, added ability to control field toggles
* move callouts to description text
* readd warning callouts to the searchable snapshot field
* slight i18n adjustment
* made callout for actions disabled a bit smaller
* fix i18n
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Updated to eui@30.4.1, fixed types and unit tests
* Cleanup some imports
* Fix a text color swap, now back to danger text
* Bump EUI to v30.4.2
* Revert snapshot changes from ownFocus modification
* Clean up alert flyout test actions to better represent user actions
* Upgrade EUI to 30.5.1
* More accurate test interaction
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* added test for correctly deserializing delete phase, and added fix
* clarify test comment
* fix serialization of hot phase to include delete action
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* fix ilm policy deserialization
* reorder expected jest object to match actual
* fix removal of wait for snapshot if it is not on the form
* add client integration test for policy serialization of unknown fields
* save on a few chars
* added unit test for deserializer and serializer
* Implement feedback
- move serializer function around a little bit
- move serialize migrate and allocate function out of serializer
file
* Updated serialization unit test coverage
- removed the "forcemergeEnabled" meta field that was not being
used
- added test cases for deleting of values from policies
* fixed minor issue in how serialization tests are being set up
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Jest tests are currently organized into main configuration files (src/dev/jest/config.js and x-pack/dev-tools/jest/create_jest_config.js). Both of these are similar, but very slightly due to previously being in separate repositories. This change consolidates the scripts referenced in those configs and moves them to the `@kbn/test` project.
OSS contained an alias for `test_utils`. Those aliases have been removed in favor of importing these utilities from `@kbn/test/jest`
Blocker to #72569
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
* Fix edit policy page navigation
* Fix edit policy page navigation
* Add links to PR for explanation
* Added more tests and linked to a github issue about navigation issues
* Fix decoding function for undefined values
* Fix type check issues
* Renamed dollar sign to percent sign, added a method for (double) encoded paths and better description in test names
* Deleted Index Management from required bundles in ILM
* Fixed merge conflicts
* Revert "Deleted Index Management from required bundles in ILM"
This reverts commit 5a735dfe
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* 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>
* Add ILM url generator and use in IM for cross linking to policy edit page
* Fix policy name in the link
* Add review suggestions
* Fix import
* Fix eslint error
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* use form lib fields and start updating deserializer
* delete legacy data tier allocation field
* finished deserialization
* delete legacy serialization, validation and deserialization
* fix type issue and remove propertyOf for now
* fix legacy tests and create another number validator
* added serialization test coverage
* fix https://github.com/elastic/kibana/issues/81697
* clean up remaining legacy tests and slight update to existing test
* remove legacy unused components
* fix copy to be clearer for more scenarios
* remove remaining coldphase interface use and clean up unused i18n
* update default index priority for cold phase
* updated cold phase index priority to 0
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Add uri decode to es_ui_shared and fix data stream issue with % name
* Add a test for data streams tab opened for name with a dollar sign
* Import uri decode function from es_ui_shared and fix navigation issues for filters
* Add tests for data streams with special characters in name
* Revert react router navigate changes (is done in a separate PR)
* Reverting changes to dataManagement es client and get data stream api route
* Fix data stream name filter when activated from a url parameter
* Clean up for better consistency and fixes after
https://github.com/elastic/kibana/pull/81664
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* migrate all fields on warm phase except, data alloc, replicas and shrink
* introduce edit policy context to share original policy and migrate shrink and replicas fields
* Refactored biggest field; data allocation
Copied the entire field for now duplicating all of the components
* remove unused import
* complete migration of new serialization
* Remove last vestiges of legacy warm phase
- also removed policy serialization tests for warm phase
* fix existing test coverage and remove use of "none" for node attribute
* added policy serialization tests
* remove unused translations
* Fix use of useFormData after update
- also minor refactor to use useCallback in policy flyout now
that getFormData changes when the form data changes.
* fix import path
* simplify serialization snapshot tests
* type phases: string -> phases: Phases
* Addressed some PR review items
- refactor toggle click to take a boolean arg
- refactor selection options in data tier component to use a func
to get select options.
* updated data tier callout logic after new changes
* getPolicy -> updatePolicy
Also rather deconstruct the validate fn from the form object
* fix detection of migrate false and refactor serialization to pure function
* fix type issue
* fix for correctly detecting policy data tier type
- with jest tests see origin here:
https://github.com/elastic/kibana/pull/81642
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Update show/hide data tier logic
only show data tier options on cloud if the cluster is not using
the deprecated node.data config and there is a data_* role
present. this will likely be a role like data_content which will
ensure that the cluster is configured with the new data tier
roles.
* refactor node role types for clarity
* added comment
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Upgraded eui to v29.5.0; snapshot updates
* Cleaned up some types
* addresses feedback on types change
* Update EuiIcon snapshots in jest integration tests
* Updated snapshot from rebasing on master
* wip
* added missing shared_imports file to index
* initial migration of hot phase to form lib
- tests are now broken
- need to break up the hot_phase file in to meaningful parts
- duplicated set_priority and forcemerge components
* Big refactor
- moved a lot of files around
- removed the need for the state to track whether rollover is set
* Integrate form lib serialization with existing serialization
- refactor serializePolicy -> legacySerializePolicy
- updated serialization of form lib to factor in pre-existing
policy values. These should be interacted with in a non-lossy
way.
* wip on fixing jest tests and some other refactors
* fix jest tests and other refactors
* delete existing hot phase serialization and tests
* beginning of serializer test for hot phase
* added serialization tests for form lib components
* fix some i18n issues
* fixed delete phase integration test
* move hot phase serialization test to pre-existing test location
* fix another jest test issue
* fix ui metric tracking for setting input priority in hot phase
* refactor use rollover switch to form lib component and update validation for number segments in force merge
* readded missing validation 🤦🏼♂️
* fix type check issues and setting of rollover enabled 🙄
* migrate all form lib components to spreading all rest props in EuiFormRow
* added comment to test helper function
* refactor test helper setPhaseIndexPriorityFormLib -> setPhaseIndexPriority
* refactor to use form schema
* Removed use of UseMultiFields component
- also fix missing "key" on react component in unrelated file
- fixed ordering of JSON in test file
- also removed default value from form schema so that when a
value is not set for max size, max docs or max age it will
remain unset in future policies
* update json flyout behaviour
* fix json policy serialization
* Fix type and i18n issues
* do not use form.subscribe
* add missing key value in cells
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [ILM] Add esErrorHandler for the new es js client
* [ILM] Fix function call params
* Rename function
* Rename function
* Rename function
* [ILM] Change import of handleEsError to lib dependency
* [ILM] Add comments about legacy and new es js client
* [ILM] Add type casting for ResponseError
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* added cloud cold tier specific call out, probably wip
* added jest test
* rephrase copy
* Added logic for showing/hiding data tier allocation option
- Added server-side test for detecting legacy config
- Added client-side test for asserting on cloud data tier option
is hidden
* added test for not-on-cloud case
* Refactored logic for rendering data allocation notices
Also updated a comment.
* paraphrashing of Adams copy recommendation
* Fix comment
* address pr feedback
* clarify slight hack comment
* complete refactor of new flag for tests
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* [ILM] Replace legacy ES client with the new client
* [ILM] Fix type check errors
* [ILM] Fix api integration test
* [ILM] Update error handling and integration test for the new client
* [ILM] Fix api integration test
* [ILM] Fix api integration test
* [ILM] Add a todo comment for Index Management plugin extension
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
* Refactor allocation notices for tier preferences
- also removed the lingering "data_frozen" node role
* added some test coverage
* Implement copy feedback
* Minor refactors based on PR feedback
* expanded README.md with section on testing cluster state notices
* Updated copy to reference policy and updated freeze description
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* added comment about importing lodash library
* fixed space with prefer
* cleaned up extra space and removed comments for lodash/fp
* took out the comment in server files
* Remove newlines
Co-authored-by: Nathan L Smith <smith@nlsmith.com>
* [ILM] Add index templates to "add policy" modal in policies table
* [ILM] Change select to a combobox in 'add policy' modal in policies table
* [ILM] Add not found message to "add policy to template" modal
* [ILM] Fix api integration test
* [ILM] Fix type check error
* [ILM] Add PR review suggestions
* [ILM] Fix type check error
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* wip
* Revert "wip"
This reverts commit 54b6f7ff3ec8b0f57b150ab2276d617686da9fb5.
* Revert "Revert "wip""
This reverts commit 63868b44ec60d7431c3a0189b16aeece1db2d38e.
* Refactor to using EUI button group component
- also moved node attr and node allocation component to inside
new folder that contains all allocation components.
- only focussed on updating warm phase for now
* WIP: moved form UX more in line with EUI
- The described form group now has a switch for showing
controls on the left.
- Refactored DataTierAllocation to CustomDataTierAllocation
- Removed 'node-roles' option
- Updated copy
- Moved JSX around a bit in the edit policy section to make logic
simpler
* Refactor UI to reflect custom-ness of "Custom" and "None" options
- Still only implemented for warm, cold and frozen are still
under way
* server side changes for getting node data
* double opt-in
* Refactored data tier allocation type
- Made types more explicit 'default', 'custom' and 'none'
- Fixed issue introduced by use useCallback on state setter -
need to use the function setter pattern to not have stale data
being set.
* Some refacoring, but main point is to add warning detection for
node roles.
- Refactored way we get node data to a provider component so that
phases still have flexibility in how they render. Currently
this also means that we fetch node stats data for each phase
we render
- Created a callout for when there is no node role to which data
can be allocated for the default setting
- Also updated the behaviour to render the entire form even when
we cannot fetch node data for some reason. It is not ideal to
not have node data, but we should not block the entire form.
* fix i18n
* fix type issue with deafult policies missing allocation type
* remove "undefined" as option for setting phase data
* Create referentially stable data setter for all phases - prevent infini-update
* fix type issue
* refactor data -> nodesData
* refactor cold phase for data tiers
* refactor frozen phase for data tiers
* fixed existing tests for warm section
* restored existing test coverage for cold phase and added test coverage for frozen
* fix api integration test
* remove unused translations
* slight UX update to turning on custom attribute allocation
* added scss file for data tier advanced section and other style
updates
* added tests for new warning
* fix types
* added correct copy for cold and frozen phases
* fix types and i18n
* implement copy feedback
* added spacer after the enable data tier allocation switch
* refactor to super select
* fix replicas copy
* update phase serialization for cold and frozen
* Refactor so that logic determining warnings lives together
- also factor out the warning of the node allocation component
- revisit copy for the allocation warning
* tier -> phase
* Added some much needed policy serialization test coverage
- also factored out policy allocation action serialization
* fix import paths and added required file header
* fix existing test coverage
* refine copy for data tier allocation recommended option
* fix showing warning for no node attrs
* fix inverted warning logic 🤦🏼♂️
* fix typing
* implement CJs copy feedback
* fix i18n
* remove unused or invalid translations
* provide ability to not alter original policy
* do not alter the original policy in the serilalization process
* fix jest tests
* Remove duplicate type and refactor NodeRole to NodeDataRole
Also deleted unused component "AdvancedSection" for now
* added comment to "false" typing
* revised and refactored copy based on feedback
* address copy feedback
* update kibana schema to allow migrate: { enabled: false }
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* ILM public side changes to support frozen phase
This is a very faithful duplication of the cold phase. We are
also excluding the snapshot action as well as the unfollow action
as these are features that require higher than basic license
privilege.
* added "frozen" to the server side schema
* add frozen phases component
* fix i18n and update jest tests
* Slight restructuring to phase types and fix copy paste issues.
- also fixed TS error introduced after TS v4 upgrade (delete)
* fix hot phase type and remove type constraint from error messages
* update validation logic
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>