From c6668b411b6c36ee3c23427fa1a47d6e0ef2d4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Mon, 2 Dec 2024 12:35:48 +0000 Subject: [PATCH] chore: improve release plan events and add them to event timeline (#8895) https://linear.app/unleash/issue/2-3043/improve-release-plan-events-and-add-them-to-the-event-timeline Improves release plan events and adds them to the event timeline. This will break the events in Enterprise but that's okay, we can follow up with the Enterprise PR to fix them. ![image](https://github.com/user-attachments/assets/862818a5-d9bf-4006-beca-786fd6265759) --- .../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; }