[8.16] [ResponseOps][Rules]Deprecate `ruleFormV2` flag. (#196507) (#196702)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[ResponseOps][Rules]Deprecate `ruleFormV2` flag.
(#196507)](https://github.com/elastic/kibana/pull/196507)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Antonio","email":"antonio.coelho@elastic.co"},"sourceCommit":{"committedDate":"2024-10-17T13:48:36Z","message":"[ResponseOps][Rules]Deprecate
`ruleFormV2` flag. (#196507)\n\nFixes #196493\r\n\r\n##
Summary\r\n\r\nIn a previous PR the `ruleFormV2` feature flag was
renamed when it\r\nshould have been deprecated. This PR fixes
that.","sha":"7988ced8ea04966a02901e68791eb6f24d6ea40e","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","Feature:Alerting/RulesFramework","backport:prev-minor","v8.16.0"],"title":"[ResponseOps][Rules]Deprecate
`ruleFormV2`
flag.","number":196507,"url":"https://github.com/elastic/kibana/pull/196507","mergeCommit":{"message":"[ResponseOps][Rules]Deprecate
`ruleFormV2` flag. (#196507)\n\nFixes #196493\r\n\r\n##
Summary\r\n\r\nIn a previous PR the `ruleFormV2` feature flag was
renamed when it\r\nshould have been deprecated. This PR fixes
that.","sha":"7988ced8ea04966a02901e68791eb6f24d6ea40e"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196507","number":196507,"mergeCommit":{"message":"[ResponseOps][Rules]Deprecate
`ruleFormV2` flag. (#196507)\n\nFixes #196493\r\n\r\n##
Summary\r\n\r\nIn a previous PR the `ruleFormV2` feature flag was
renamed when it\r\nshould have been deprecated. This PR fixes
that.","sha":"7988ced8ea04966a02901e68791eb6f24d6ea40e"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Antonio <antonio.coelho@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-21 22:34:04 +11:00 committed by GitHub
parent 0f87c3d001
commit 1f26be27af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,6 +24,8 @@ export const allowedExperimentalValues = Object.freeze({
isUsingRuleCreateFlyout: false,
});
const deprecatedExperimentalValues = new Set(['ruleFormV2']);
type ExperimentalConfigKeys = Array<keyof ExperimentalFeatures>;
type Mutable<T> = { -readonly [P in keyof T]: T[P] };
@ -56,7 +58,10 @@ export const parseExperimentalConfigValue = (configValue: string[]): Experimenta
};
export const isValidExperimentalValue = (value: string): boolean => {
return allowedKeys.includes(value as keyof ExperimentalFeatures);
return (
allowedKeys.includes(value as keyof ExperimentalFeatures) ||
deprecatedExperimentalValues.has(value)
);
};
export const getExperimentalAllowedValues = (): string[] => [...allowedKeys];