1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

chore: drop action definition required (#6567)

https://linear.app/unleash/issue/2-2046/implement-dynamic-action-parameters

Follow up to https://github.com/Unleash/unleash/pull/6554

Cleans up the `required` property in action definitions after adapting
to using the `parameters` property instead.
This commit is contained in:
Nuno Góis 2024-03-14 16:32:14 +00:00 committed by GitHub
parent 7a3d2d6d87
commit de34497478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 9 deletions

View File

@ -87,11 +87,13 @@ export const ProjectActionsActionItem = ({
...action,
error: undefined,
});
if (
actionDefinition?.required.some(
(required) => !executionParams[required],
)
) {
const requiredParameters =
actionDefinition?.parameters
.filter(({ optional }) => !optional)
.map(({ name }) => name) || [];
if (requiredParameters.some((required) => !executionParams[required])) {
stateChanged({
...action,
error: 'Please fill all required fields.',

View File

@ -9,8 +9,6 @@ export type ActionDefinition = {
category?: string;
permissions: string[];
parameters: ActionDefinitionParameter[];
// TODO: Remove this in favor of parameters (filter by !optional)
required: string[];
};
export const ACTIONS = new Map<string, ActionDefinition>([
@ -22,7 +20,6 @@ export const ACTIONS = new Map<string, ActionDefinition>([
category: 'Feature toggles',
permissions: ['UPDATE_FEATURE_ENVIRONMENT'],
parameters: toggleFeatureParameters,
required: ['project', 'environment', 'featureName'],
},
],
[
@ -34,7 +31,6 @@ export const ACTIONS = new Map<string, ActionDefinition>([
category: 'Feature toggles',
permissions: ['UPDATE_FEATURE_ENVIRONMENT'],
parameters: toggleFeatureParameters,
required: ['project', 'environment', 'featureName'],
},
],
]);