From 405fd6d3797c2ddff14df34587bff66f11c6a175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Fri, 29 Nov 2024 13:31:19 +0000 Subject: [PATCH] chore: improve release plan events and add them to event timeline --- .../events/EventTimeline/EventTimeline.tsx | 3 +++ .../EventTimelineEventCircle.tsx | 6 ++++- .../feature-event-formatter-md-events.ts | 18 +++++++++++++ src/lib/types/events.ts | 27 +++++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/events/EventTimeline/EventTimeline.tsx b/frontend/src/component/events/EventTimeline/EventTimeline.tsx index 1e7c55f10df6..5d5b40269bb8 100644 --- a/frontend/src/component/events/EventTimeline/EventTimeline.tsx +++ b/frontend/src/component/events/EventTimeline/EventTimeline.tsx @@ -99,6 +99,9 @@ const RELEVANT_EVENT_TYPES: EventSchemaType[] = [ 'feature-strategy-remove', 'feature-environment-enabled', 'feature-environment-disabled', + 'release-plan-added', + 'release-plan-removed', + 'release-plan-milestone-started', ]; const toISODateString = (date: Date) => date.toISOString().split('T')[0]; diff --git a/frontend/src/component/events/EventTimeline/EventTimelineEventGroup/EventTimelineEventCircle.tsx b/frontend/src/component/events/EventTimeline/EventTimelineEventGroup/EventTimelineEventCircle.tsx index 51be8a841060..42bde842e9e0 100644 --- a/frontend/src/component/events/EventTimeline/EventTimelineEventGroup/EventTimelineEventCircle.tsx +++ b/frontend/src/component/events/EventTimeline/EventTimelineEventGroup/EventTimelineEventCircle.tsx @@ -59,7 +59,11 @@ const getEventIcon = ({ icon, type }: Pick) => { if (type === 'feature-environment-disabled') { return ; } - if (type.startsWith('strategy-') || type.startsWith('feature-strategy-')) { + if ( + type.startsWith('strategy-') || + type.startsWith('feature-strategy-') || + type.startsWith('release-plan-') + ) { return ( = { action: '{{b}}{{user}}{{b}} updated user {{b}}{{event.preData.name}}{{b}}', path: '/admin/users', }, + [RELEASE_PLAN_ADDED]: { + label: 'Release plan added', + action: '{{b}}{{user}}{{b}} added release plan {{b}}{{event.data.name}}{{b}} to {{b}}{{feature}}{{b}} for the {{b}}{{event.environment}}{{b}} environment in project {{b}}{{project}}{{b}}', + path: '/projects/{{event.project}}/features/{{event.featureName}}', + }, + [RELEASE_PLAN_REMOVED]: { + label: 'Release plan removed', + action: '{{b}}{{user}}{{b}} removed release plan {{b}}{{event.preData.name}}{{b}} from {{b}}{{feature}}{{b}} for the {{b}}{{event.environment}}{{b}} environment in project {{b}}{{project}}{{b}}', + path: '/projects/{{event.project}}/features/{{event.featureName}}', + }, + [RELEASE_PLAN_MILESTONE_STARTED]: { + label: 'Release plan milestone started', + action: '{{b}}{{user}}{{b}} started milestone {{b}}{{event.data.milestoneName}}{{b}} in release plan {{b}}{{event.data.name}}{{b}} for {{b}}{{feature}}{{b}} for the {{b}}{{event.environment}}{{b}} environment in project {{b}}{{project}}{{b}}', + path: '/projects/{{event.project}}/features/{{event.featureName}}', + }, }; diff --git a/src/lib/types/events.ts b/src/lib/types/events.ts index e9804baf404f..956f204d3240 100644 --- a/src/lib/types/events.ts +++ b/src/lib/types/events.ts @@ -2067,36 +2067,63 @@ export class ReleasePlanTemplateDeletedEvent extends BaseEvent { } export class ReleasePlanAddedEvent extends BaseEvent { + readonly project: string; + readonly featureName: string; + readonly environment: string; readonly data: any; constructor(eventData: { + project: string; + featureName: string; + environment: string; data: any; auditUser: IAuditUser; }) { super(RELEASE_PLAN_ADDED, eventData.auditUser); + this.project = eventData.project; + this.featureName = eventData.featureName; + this.environment = eventData.environment; this.data = eventData.data; } } export class ReleasePlanRemovedEvent extends BaseEvent { + readonly project: string; + readonly featureName: string; + readonly environment: string; readonly preData: any; constructor(eventData: { + project: string; + featureName: string; + environment: string; preData: any; auditUser: IAuditUser; }) { super(RELEASE_PLAN_REMOVED, eventData.auditUser); + this.project = eventData.project; + this.featureName = eventData.featureName; + this.environment = eventData.environment; this.preData = eventData.preData; } } export class ReleasePlanMilestoneStartedEvent extends BaseEvent { + readonly project: string; + readonly featureName: string; + readonly environment: string; readonly preData: any; readonly data: any; constructor(eventData: { + project: string; + featureName: string; + environment: string; preData: any; data: any; auditUser: IAuditUser; }) { super(RELEASE_PLAN_MILESTONE_STARTED, eventData.auditUser); + this.project = eventData.project; + this.featureName = eventData.featureName; + this.environment = eventData.environment; this.preData = eventData.preData; this.data = eventData.data; }