mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
bddc508582
https://linear.app/unleash/issue/2-1952/adapt-actions-form-ui-to-unleash-constraint-operators Implements the new action filters UI, now powered by constraint operators. This PR goes through some effort to not touch existing components too much, especially since they are critical for activation strategies. Instead, the new feature tries to adapt to the existing components and styling them appropriately, while still re-using them. We can refactor this at a later stage if needed. This UI will face some more drastic changes in the near future due to the feature rename, so I wanted to keep this PR mostly scoped to the constraint operators before proceeding with more changes. ![image](https://github.com/Unleash/unleash/assets/14320932/f4bef4e0-33bd-463c-a252-e1cc0c22e843) ![image](https://github.com/Unleash/unleash/assets/14320932/192a3bd4-f11d-4619-b826-bbf5df80050c) ![image](https://github.com/Unleash/unleash/assets/14320932/fcfc0239-a28f-446d-a901-2e73f0add1a2) As always, did some manual tests and it seems to be working great!
70 lines
1.5 KiB
TypeScript
70 lines
1.5 KiB
TypeScript
import { IConstraint } from './strategy';
|
|
|
|
export interface IActionSet {
|
|
id: number;
|
|
enabled: boolean;
|
|
name: string;
|
|
project: string;
|
|
actorId: number;
|
|
match: IMatch;
|
|
actions: IAction[];
|
|
createdAt: string;
|
|
createdByUserId: number;
|
|
}
|
|
|
|
type MatchSource = 'incoming-webhook';
|
|
|
|
export type ParameterMatch = Pick<
|
|
IConstraint,
|
|
'inverted' | 'operator' | 'caseInsensitive' | 'value' | 'values'
|
|
>;
|
|
|
|
export interface IMatch {
|
|
source: MatchSource;
|
|
sourceId: number;
|
|
payload: Record<string, ParameterMatch>;
|
|
}
|
|
|
|
export interface IAction {
|
|
id: number;
|
|
action: string;
|
|
sortOrder: number;
|
|
executionParams: Record<string, unknown>;
|
|
createdAt: string;
|
|
createdByUserId: number;
|
|
}
|
|
|
|
export type ObservableEventSource = 'incoming-webhook';
|
|
|
|
export interface IObservableEvent {
|
|
id: number;
|
|
source: ObservableEventSource;
|
|
sourceId: number;
|
|
createdAt: string;
|
|
createdByIncomingWebhookTokenId: number;
|
|
payload: Record<string, unknown>;
|
|
}
|
|
|
|
type ActionSetState = 'started' | 'success' | 'failed';
|
|
|
|
type ActionState = ActionSetState | 'not started';
|
|
|
|
export interface IActionEvent extends IAction {
|
|
state: ActionState;
|
|
details?: string;
|
|
}
|
|
|
|
interface IActionSetEventActionSet extends IActionSet {
|
|
actions: IActionEvent[];
|
|
}
|
|
|
|
export interface IActionSetEvent {
|
|
id: number;
|
|
actionSetId: number;
|
|
observableEventId: number;
|
|
createdAt: string;
|
|
state: ActionSetState;
|
|
observableEvent: IObservableEvent;
|
|
actionSet: IActionSetEventActionSet;
|
|
}
|