mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-08 01:15:49 +02: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:
parent
7a3d2d6d87
commit
de34497478
@ -87,11 +87,13 @@ export const ProjectActionsActionItem = ({
|
|||||||
...action,
|
...action,
|
||||||
error: undefined,
|
error: undefined,
|
||||||
});
|
});
|
||||||
if (
|
|
||||||
actionDefinition?.required.some(
|
const requiredParameters =
|
||||||
(required) => !executionParams[required],
|
actionDefinition?.parameters
|
||||||
)
|
.filter(({ optional }) => !optional)
|
||||||
) {
|
.map(({ name }) => name) || [];
|
||||||
|
|
||||||
|
if (requiredParameters.some((required) => !executionParams[required])) {
|
||||||
stateChanged({
|
stateChanged({
|
||||||
...action,
|
...action,
|
||||||
error: 'Please fill all required fields.',
|
error: 'Please fill all required fields.',
|
||||||
|
@ -9,8 +9,6 @@ export type ActionDefinition = {
|
|||||||
category?: string;
|
category?: string;
|
||||||
permissions: string[];
|
permissions: string[];
|
||||||
parameters: ActionDefinitionParameter[];
|
parameters: ActionDefinitionParameter[];
|
||||||
// TODO: Remove this in favor of parameters (filter by !optional)
|
|
||||||
required: string[];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ACTIONS = new Map<string, ActionDefinition>([
|
export const ACTIONS = new Map<string, ActionDefinition>([
|
||||||
@ -22,7 +20,6 @@ export const ACTIONS = new Map<string, ActionDefinition>([
|
|||||||
category: 'Feature toggles',
|
category: 'Feature toggles',
|
||||||
permissions: ['UPDATE_FEATURE_ENVIRONMENT'],
|
permissions: ['UPDATE_FEATURE_ENVIRONMENT'],
|
||||||
parameters: toggleFeatureParameters,
|
parameters: toggleFeatureParameters,
|
||||||
required: ['project', 'environment', 'featureName'],
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -34,7 +31,6 @@ export const ACTIONS = new Map<string, ActionDefinition>([
|
|||||||
category: 'Feature toggles',
|
category: 'Feature toggles',
|
||||||
permissions: ['UPDATE_FEATURE_ENVIRONMENT'],
|
permissions: ['UPDATE_FEATURE_ENVIRONMENT'],
|
||||||
parameters: toggleFeatureParameters,
|
parameters: toggleFeatureParameters,
|
||||||
required: ['project', 'environment', 'featureName'],
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
Loading…
Reference in New Issue
Block a user