Skip to content

Commit

Permalink
chore: improve release plan events and add them to event timeline (#8895
Browse files Browse the repository at this point in the history
)

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)
  • Loading branch information
nunogois authored Dec 2, 2024
1 parent 772f9f4 commit c6668b4
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
3 changes: 3 additions & 0 deletions frontend/src/component/events/EventTimeline/EventTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ const getEventIcon = ({ icon, type }: Pick<TimelineEvent, 'icon' | 'type'>) => {
if (type === 'feature-environment-disabled') {
return <ToggleOffIcon />;
}
if (type.startsWith('strategy-') || type.startsWith('feature-strategy-')) {
if (
type.startsWith('strategy-') ||
type.startsWith('feature-strategy-') ||
type.startsWith('release-plan-')
) {
return (
<ExtensionOutlinedIcon
sx={{ marginTop: '-2px', marginRight: '-2px' }}
Expand Down
18 changes: 18 additions & 0 deletions src/lib/addons/feature-event-formatter-md-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ import {
CHANGE_REQUEST_SCHEDULE_SUSPENDED,
FEATURE_COMPLETED,
PROJECT_ARCHIVED,
RELEASE_PLAN_ADDED,
RELEASE_PLAN_REMOVED,
RELEASE_PLAN_MILESTONE_STARTED,
} from '../types';

interface IEventData {
Expand Down Expand Up @@ -362,4 +365,19 @@ export const EVENT_MAP: Record<string, IEventData> = {
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}}',
},
};
27 changes: 27 additions & 0 deletions src/lib/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c6668b4

Please sign in to comment.