1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: adjust feature-variant-updated event

This commit is contained in:
Ivar Conradi Østhus 2021-12-17 04:30:39 +01:00
parent 0927b1d8ba
commit 8d8d48026d
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09
6 changed files with 17 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import {
FEATURE_STRATEGY_ADD, FEATURE_STRATEGY_ADD,
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
FEATURE_VARIANTS_UPDATED,
} from '../types/events'; } from '../types/events';
import { IAddonDefinition } from '../types/model'; import { IAddonDefinition } from '../types/model';
@ -54,6 +55,7 @@ const dataDogDefinition: IAddonDefinition = {
FEATURE_STRATEGY_ADD, FEATURE_STRATEGY_ADD,
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
FEATURE_VARIANTS_UPDATED,
], ],
tagTypes: [ tagTypes: [
{ {

View File

@ -13,6 +13,7 @@ import {
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
IEvent, IEvent,
FEATURE_VARIANTS_UPDATED,
} from '../types/events'; } from '../types/events';
export interface FeatureEventFormatter { export interface FeatureEventFormatter {
@ -108,6 +109,8 @@ export class FeatureEventFormatterMd implements FeatureEventFormatter {
return 'created'; return 'created';
case FEATURE_UPDATED: case FEATURE_UPDATED:
return 'updated'; return 'updated';
case FEATURE_VARIANTS_UPDATED:
return 'updated variants for';
default: default:
return type; return type;
} }

View File

@ -12,6 +12,7 @@ import {
FEATURE_STRATEGY_ADD, FEATURE_STRATEGY_ADD,
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
FEATURE_VARIANTS_UPDATED,
} from '../types/events'; } from '../types/events';
import { IAddonDefinition } from '../types/model'; import { IAddonDefinition } from '../types/model';
@ -71,6 +72,7 @@ const slackDefinition: IAddonDefinition = {
FEATURE_STRATEGY_UPDATE, FEATURE_STRATEGY_UPDATE,
FEATURE_STRATEGY_ADD, FEATURE_STRATEGY_ADD,
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_VARIANTS_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
], ],
tagTypes: [ tagTypes: [

View File

@ -12,6 +12,7 @@ import {
FEATURE_STRATEGY_ADD, FEATURE_STRATEGY_ADD,
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
FEATURE_VARIANTS_UPDATED,
} from '../types/events'; } from '../types/events';
import { IAddonDefinition } from '../types/model'; import { IAddonDefinition } from '../types/model';
@ -42,6 +43,7 @@ const teamsDefinition: IAddonDefinition = {
FEATURE_STRATEGY_UPDATE, FEATURE_STRATEGY_UPDATE,
FEATURE_STRATEGY_ADD, FEATURE_STRATEGY_ADD,
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_VARIANTS_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
], ],
}; };

View File

@ -4,6 +4,7 @@ import {
FEATURE_ENVIRONMENT_DISABLED, FEATURE_ENVIRONMENT_DISABLED,
FEATURE_ENVIRONMENT_ENABLED, FEATURE_ENVIRONMENT_ENABLED,
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_VARIANTS_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
FEATURE_REVIVED, FEATURE_REVIVED,
FEATURE_STALE_OFF, FEATURE_STALE_OFF,
@ -70,6 +71,7 @@ const webhookDefinition: IAddonDefinition = {
FEATURE_STRATEGY_UPDATE, FEATURE_STRATEGY_UPDATE,
FEATURE_STRATEGY_ADD, FEATURE_STRATEGY_ADD,
FEATURE_METADATA_UPDATED, FEATURE_METADATA_UPDATED,
FEATURE_VARIANTS_UPDATED,
FEATURE_PROJECT_CHANGE, FEATURE_PROJECT_CHANGE,
], ],
}; };

View File

@ -146,23 +146,23 @@ export class FeatureVariantEvent extends BaseEvent {
readonly featureName: string; readonly featureName: string;
readonly data: { readonly data: { variants: IVariant[] };
oldVariants: IVariant[];
newVariants: IVariant[]; readonly preData: { variants: IVariant[] };
};
constructor(p: { constructor(p: {
project: string; project: string;
featureName: string; featureName: string;
createdBy: string; createdBy: string;
tags: ITag[]; tags: ITag[];
oldVariants: IVariant[];
newVariants: IVariant[]; newVariants: IVariant[];
oldVariants: IVariant[];
}) { }) {
super(FEATURE_VARIANTS_UPDATED, p.createdBy, p.tags); super(FEATURE_VARIANTS_UPDATED, p.createdBy, p.tags);
this.project = p.project; this.project = p.project;
this.featureName = p.featureName; this.featureName = p.featureName;
this.data = { oldVariants: p.oldVariants, newVariants: p.newVariants }; this.data = { variants: p.newVariants };
this.preData = { variants: p.oldVariants };
} }
} }