Skip to content

Commit

Permalink
chore: improve release plan events and add them to event timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
nunogois committed Nov 29, 2024
1 parent 08eea8e commit 405fd6d
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 405fd6d

Please sign in to comment.