Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve release plan events and add them to event timeline #8895

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading