1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/frontend/src/interfaces/strategy.ts

61 lines
1.2 KiB
TypeScript
Raw Normal View History

import { Operator } from 'constants/operators';
Feat/environment strategies (#339) * feat: strategies list * feat: dnd * fix: resolve reference issues * feat: configure strategy wip * feat: rearrange list * feat: add debounce and execution plan * feat: add separator * feat: update strategy * fix: feature strategy accordion key * fix: localize parameter update logic * feat: ts conversion * fix: perf issues * feat: production guard * fix: clean up environment list * fix: implement markup hooks for environment list * feat: wip constraints * fix: handle nested data structure reference issue * fix: clone deep on child props * fix: remove constraints check * fix: revert to strategies length * fix: refactor useFeature * feat: cache revalidation * fix: set correct starting tab * fix: reset params on adding new strategy * fix: refactor to use useSWR instead of local cache * fix: check dirty directly from new params * fix: dialogue ts * fix: Clean-up typescript warnings * fix: some more typescript nits * feat: strategy execution * feat: strategy execution for environment * fix: refactor execution separator * fix: remove unused property * fix: add header * fix: 0 value for rollout * fix: update snapshots * fix: remove empty deps * fix: use constant for env type * fix: use default for useFeatureStrategy * fix: update snapshot * Update src/component/feature/FeatureView2/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironmentList/useDeleteStrategyMarkup.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/FeatureView2/FeatureStrategies/FeatureStrategyExecution/FeatureStrategyExecution.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/strategy/EditStrategyModal/general-strategy.jsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: UnleashTeam <79193084+UnleashTeam@users.noreply.github.com>
2021-09-27 13:35:32 +02:00
export interface IFeatureStrategy {
id: string;
feat: add segments (#780) * feat: create segmentation structure and list * feat: remove unused deps and change route * feat: change header style and add renderNoSegments * fix: style table header * feat: create useSegments hook * feat: add segmentApi hook * feat: create segment * fix: errors * feat: add contextfields list * fix: remove user from create segment api * feat: add form structure * feat: add SegmentFormStepOne * fix: tests and routes * feat: add constraint view * feat: UI to match the sketch * feat: add constraint on context select * fix: duplication * fix adding constraints Co-authored-by: olav <mail@olav.io> * fix: input date not showing up in constraint view Co-authored-by: olav <mail@olav.io> * fix: minor bugs Co-authored-by: olav <mail@olav.io> * fix: create context modal in segment page Co-authored-by: olav <mail@olav.io> * fix: validate constraint before create segment Co-authored-by: olav <mail@olav.io> * feat: create useSegment hook Co-authored-by: olav <mail@olav.io> * feat: create edit component Co-authored-by: olav <mail@olav.io> * refactor: move constraint validation endpoint * refactor: add missing route snapshot * refactor: fix segment constraints unsaved/editing state * refactor: remove create segment from mobile header menu * refactor: update segments form description * refactor: extract SegmentFormStepList component * refactor: add an optional FormTemplate docs link label * refactor: fix update segment payload * feat: finish edit component Co-authored-by: olav <mail@olav.io> * refactor: move step list above segment form * fix: update PR based on feedback Co-authored-by: olav <mail@olav.io> * refactor: fix constraint validation endpoint path * refactor: improve constraint state field name * refactor: extract AutocompleteBox component * feat: add strategy segment selection * refactor: add strategy segment previews * refactor: fix double section separator line * feat: disable deleting a usable segment * refactor: warn about segments without constraints * refactor: update text in delete segment dialogue * refactur: improve arg names * refactor: improve index var name * refactor: clarify steps list logic * refactor: use a required prop for the segment name * refactor: use ConditionallyRender for segment deletion * refactor: fix segments refetch * refactor: improve CreateUnleashContext component names * refactor: adjust segment form styles * refactor: adjust text * refactor: fix info icon tooltip hover target * refactor: add missing aria attrs to preview button * refactor: add strat name to delete segment modal * refactor: fix segment chip text alighment * refactor: use bulk endpoint for strategy segments * refactor: fix imports after merge Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com> Co-authored-by: olav <mail@olav.io>
2022-03-29 09:30:57 +02:00
strategyName?: string;
name: string;
Feat/environment strategies (#339) * feat: strategies list * feat: dnd * fix: resolve reference issues * feat: configure strategy wip * feat: rearrange list * feat: add debounce and execution plan * feat: add separator * feat: update strategy * fix: feature strategy accordion key * fix: localize parameter update logic * feat: ts conversion * fix: perf issues * feat: production guard * fix: clean up environment list * fix: implement markup hooks for environment list * feat: wip constraints * fix: handle nested data structure reference issue * fix: clone deep on child props * fix: remove constraints check * fix: revert to strategies length * fix: refactor useFeature * feat: cache revalidation * fix: set correct starting tab * fix: reset params on adding new strategy * fix: refactor to use useSWR instead of local cache * fix: check dirty directly from new params * fix: dialogue ts * fix: Clean-up typescript warnings * fix: some more typescript nits * feat: strategy execution * feat: strategy execution for environment * fix: refactor execution separator * fix: remove unused property * fix: add header * fix: 0 value for rollout * fix: update snapshots * fix: remove empty deps * fix: use constant for env type * fix: use default for useFeatureStrategy * fix: update snapshot * Update src/component/feature/FeatureView2/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironmentList/useDeleteStrategyMarkup.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/FeatureView2/FeatureStrategies/FeatureStrategyExecution/FeatureStrategyExecution.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/strategy/EditStrategyModal/general-strategy.jsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: UnleashTeam <79193084+UnleashTeam@users.noreply.github.com>
2021-09-27 13:35:32 +02:00
constraints: IConstraint[];
parameters: IFeatureStrategyParameters;
feat: add segments (#780) * feat: create segmentation structure and list * feat: remove unused deps and change route * feat: change header style and add renderNoSegments * fix: style table header * feat: create useSegments hook * feat: add segmentApi hook * feat: create segment * fix: errors * feat: add contextfields list * fix: remove user from create segment api * feat: add form structure * feat: add SegmentFormStepOne * fix: tests and routes * feat: add constraint view * feat: UI to match the sketch * feat: add constraint on context select * fix: duplication * fix adding constraints Co-authored-by: olav <mail@olav.io> * fix: input date not showing up in constraint view Co-authored-by: olav <mail@olav.io> * fix: minor bugs Co-authored-by: olav <mail@olav.io> * fix: create context modal in segment page Co-authored-by: olav <mail@olav.io> * fix: validate constraint before create segment Co-authored-by: olav <mail@olav.io> * feat: create useSegment hook Co-authored-by: olav <mail@olav.io> * feat: create edit component Co-authored-by: olav <mail@olav.io> * refactor: move constraint validation endpoint * refactor: add missing route snapshot * refactor: fix segment constraints unsaved/editing state * refactor: remove create segment from mobile header menu * refactor: update segments form description * refactor: extract SegmentFormStepList component * refactor: add an optional FormTemplate docs link label * refactor: fix update segment payload * feat: finish edit component Co-authored-by: olav <mail@olav.io> * refactor: move step list above segment form * fix: update PR based on feedback Co-authored-by: olav <mail@olav.io> * refactor: fix constraint validation endpoint path * refactor: improve constraint state field name * refactor: extract AutocompleteBox component * feat: add strategy segment selection * refactor: add strategy segment previews * refactor: fix double section separator line * feat: disable deleting a usable segment * refactor: warn about segments without constraints * refactor: update text in delete segment dialogue * refactur: improve arg names * refactor: improve index var name * refactor: clarify steps list logic * refactor: use a required prop for the segment name * refactor: use ConditionallyRender for segment deletion * refactor: fix segments refetch * refactor: improve CreateUnleashContext component names * refactor: adjust segment form styles * refactor: adjust text * refactor: fix info icon tooltip hover target * refactor: add missing aria attrs to preview button * refactor: add strat name to delete segment modal * refactor: fix segment chip text alighment * refactor: use bulk endpoint for strategy segments * refactor: fix imports after merge Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com> Co-authored-by: olav <mail@olav.io>
2022-03-29 09:30:57 +02:00
featureName?: string;
projectId?: string;
environment?: string;
}
export interface IFeatureStrategyParameters {
[key: string]: string | number | undefined;
}
export interface IFeatureStrategyPayload {
id?: string;
name?: string;
constraints: IConstraint[];
parameters: IFeatureStrategyParameters;
copyOf?: string;
}
Feat/environment strategies (#339) * feat: strategies list * feat: dnd * fix: resolve reference issues * feat: configure strategy wip * feat: rearrange list * feat: add debounce and execution plan * feat: add separator * feat: update strategy * fix: feature strategy accordion key * fix: localize parameter update logic * feat: ts conversion * fix: perf issues * feat: production guard * fix: clean up environment list * fix: implement markup hooks for environment list * feat: wip constraints * fix: handle nested data structure reference issue * fix: clone deep on child props * fix: remove constraints check * fix: revert to strategies length * fix: refactor useFeature * feat: cache revalidation * fix: set correct starting tab * fix: reset params on adding new strategy * fix: refactor to use useSWR instead of local cache * fix: check dirty directly from new params * fix: dialogue ts * fix: Clean-up typescript warnings * fix: some more typescript nits * feat: strategy execution * feat: strategy execution for environment * fix: refactor execution separator * fix: remove unused property * fix: add header * fix: 0 value for rollout * fix: update snapshots * fix: remove empty deps * fix: use constant for env type * fix: use default for useFeatureStrategy * fix: update snapshot * Update src/component/feature/FeatureView2/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironmentList/useDeleteStrategyMarkup.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/FeatureView2/FeatureStrategies/FeatureStrategyExecution/FeatureStrategyExecution.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/strategy/EditStrategyModal/general-strategy.jsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: UnleashTeam <79193084+UnleashTeam@users.noreply.github.com>
2021-09-27 13:35:32 +02:00
export interface IStrategy {
name: string;
displayName: string;
editable: boolean;
deprecated: boolean;
description: string;
parameters: IStrategyParameter[];
Feat/environment strategies (#339) * feat: strategies list * feat: dnd * fix: resolve reference issues * feat: configure strategy wip * feat: rearrange list * feat: add debounce and execution plan * feat: add separator * feat: update strategy * fix: feature strategy accordion key * fix: localize parameter update logic * feat: ts conversion * fix: perf issues * feat: production guard * fix: clean up environment list * fix: implement markup hooks for environment list * feat: wip constraints * fix: handle nested data structure reference issue * fix: clone deep on child props * fix: remove constraints check * fix: revert to strategies length * fix: refactor useFeature * feat: cache revalidation * fix: set correct starting tab * fix: reset params on adding new strategy * fix: refactor to use useSWR instead of local cache * fix: check dirty directly from new params * fix: dialogue ts * fix: Clean-up typescript warnings * fix: some more typescript nits * feat: strategy execution * feat: strategy execution for environment * fix: refactor execution separator * fix: remove unused property * fix: add header * fix: 0 value for rollout * fix: update snapshots * fix: remove empty deps * fix: use constant for env type * fix: use default for useFeatureStrategy * fix: update snapshot * Update src/component/feature/FeatureView2/FeatureStrategies/FeatureStrategiesEnvironments/FeatureStrategiesEnvironmentList/useDeleteStrategyMarkup.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/FeatureView2/FeatureStrategies/FeatureStrategyExecution/FeatureStrategyExecution.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/strategy/EditStrategyModal/general-strategy.jsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: UnleashTeam <79193084+UnleashTeam@users.noreply.github.com>
2021-09-27 13:35:32 +02:00
}
export interface IStrategyParameter {
Feat/custom strategy screen (#722) * feat: setup new screen structure * refactor: strategyParameter * feat: add strategy input errors for required fields * feat: add create strategy to routes * feat: add EditStrategy component * feat: edit strategy view and EditStrategy component * feat: update EditStrategy component * test: update snapshots * fix: styles * test: update snapshots * refactor: rename StrategyForm and fix ts errors * test: update snapshots * fix: remove test route * fix: update PR based on feedback * fix: update PR based on feedback * refactor: restore feature settings (#712) * refactor: resotre feature settings * fix: update PR based on feedback * feat: add feature information in Metadata container * fix: update PR based on feedback * fix: update PR based on feedback Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> * chore(deps): update dependency @types/react-dom to v17.0.13 * refactor: expect existing TS errors (#767) * refactor: expect existing TS errors * refactor: fail build on new TS errors * fix: styles * refactor: rename StrategyForm and fix ts errors * fix: update PR based on feedback * fix: cleaning up * fix: remove errors and warnings * fix: remove ts-expect-error and fix errors * fix: ts errors * Update src/component/strategies/StrategyView/StrategyView.tsx * Update src/component/strategies/StrategyView/StrategyView.tsx Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: olav <mail@olav.io>
2022-03-04 23:39:41 +01:00
name: string;
description: string;
required: boolean;
type: string;
}
export interface IStrategyPayload {
Feat/custom strategy screen (#722) * feat: setup new screen structure * refactor: strategyParameter * feat: add strategy input errors for required fields * feat: add create strategy to routes * feat: add EditStrategy component * feat: edit strategy view and EditStrategy component * feat: update EditStrategy component * test: update snapshots * fix: styles * test: update snapshots * refactor: rename StrategyForm and fix ts errors * test: update snapshots * fix: remove test route * fix: update PR based on feedback * fix: update PR based on feedback * refactor: restore feature settings (#712) * refactor: resotre feature settings * fix: update PR based on feedback * feat: add feature information in Metadata container * fix: update PR based on feedback * fix: update PR based on feedback Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> * chore(deps): update dependency @types/react-dom to v17.0.13 * refactor: expect existing TS errors (#767) * refactor: expect existing TS errors * refactor: fail build on new TS errors * fix: styles * refactor: rename StrategyForm and fix ts errors * fix: update PR based on feedback * fix: cleaning up * fix: remove errors and warnings * fix: remove ts-expect-error and fix errors * fix: ts errors * Update src/component/strategies/StrategyView/StrategyView.tsx * Update src/component/strategies/StrategyView/StrategyView.tsx Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: olav <mail@olav.io>
2022-03-04 23:39:41 +01:00
name: string;
description: string;
parameters: IStrategyParameter[];
Feat/custom strategy screen (#722) * feat: setup new screen structure * refactor: strategyParameter * feat: add strategy input errors for required fields * feat: add create strategy to routes * feat: add EditStrategy component * feat: edit strategy view and EditStrategy component * feat: update EditStrategy component * test: update snapshots * fix: styles * test: update snapshots * refactor: rename StrategyForm and fix ts errors * test: update snapshots * fix: remove test route * fix: update PR based on feedback * fix: update PR based on feedback * refactor: restore feature settings (#712) * refactor: resotre feature settings * fix: update PR based on feedback * feat: add feature information in Metadata container * fix: update PR based on feedback * fix: update PR based on feedback Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> * chore(deps): update dependency @types/react-dom to v17.0.13 * refactor: expect existing TS errors (#767) * refactor: expect existing TS errors * refactor: fail build on new TS errors * fix: styles * refactor: rename StrategyForm and fix ts errors * fix: update PR based on feedback * fix: cleaning up * fix: remove errors and warnings * fix: remove ts-expect-error and fix errors * fix: ts errors * Update src/component/strategies/StrategyView/StrategyView.tsx * Update src/component/strategies/StrategyView/StrategyView.tsx Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: olav <mail@olav.io>
2022-03-04 23:39:41 +01:00
}
export interface IConstraint {
inverted?: boolean;
values?: string[];
value?: string;
caseInsensitive?: boolean;
operator: Operator;
contextName: string;
Feat/custom strategy screen (#722) * feat: setup new screen structure * refactor: strategyParameter * feat: add strategy input errors for required fields * feat: add create strategy to routes * feat: add EditStrategy component * feat: edit strategy view and EditStrategy component * feat: update EditStrategy component * test: update snapshots * fix: styles * test: update snapshots * refactor: rename StrategyForm and fix ts errors * test: update snapshots * fix: remove test route * fix: update PR based on feedback * fix: update PR based on feedback * refactor: restore feature settings (#712) * refactor: resotre feature settings * fix: update PR based on feedback * feat: add feature information in Metadata container * fix: update PR based on feedback * fix: update PR based on feedback Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> * chore(deps): update dependency @types/react-dom to v17.0.13 * refactor: expect existing TS errors (#767) * refactor: expect existing TS errors * refactor: fail build on new TS errors * fix: styles * refactor: rename StrategyForm and fix ts errors * fix: update PR based on feedback * fix: cleaning up * fix: remove errors and warnings * fix: remove ts-expect-error and fix errors * fix: ts errors * Update src/component/strategies/StrategyView/StrategyView.tsx * Update src/component/strategies/StrategyView/StrategyView.tsx Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: olav <mail@olav.io>
2022-03-04 23:39:41 +01:00
}
export interface IFeatureStrategySortOrder {
id: string;
sortOrder: number;
}