Skip to content

Commit b052818

Browse files
authored
[feat] Update event status 'Detected' (#210)
1 parent 6a68a12 commit b052818

6 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/Components/Event/Enums.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ export function IsIncident(type: EventType): boolean {
6464
/**
6565
* @author Aloento
6666
* @since 1.0.0
67-
* @version 0.2.0
67+
* @version 0.2.1
6868
*/
6969
export enum EventStatus {
70+
Detected = "Detected",
7071
Analysing = "Analysing",
7172
Fixing = "Fixing",
7273
Observing = "Observing",
@@ -86,16 +87,16 @@ export enum EventStatus {
8687
/**
8788
* @author Aloento
8889
* @since 1.1.0
89-
* @version 0.1.0
90+
* @version 0.1.1
9091
*/
9192
export function GetStatusList(type: EventType): EventStatus[] {
9293
switch (type) {
9394
case EventType.Maintenance:
94-
return Object.values(EventStatus).slice(4, 9);
95+
return Object.values(EventStatus).slice(5, 10);
9596
case EventType.Information:
9697
return [EventStatus.Planned, EventStatus.Active, EventStatus.Completed, EventStatus.Cancelled];
9798
default:
98-
return Object.values(EventStatus).slice(0, 4);
99+
return Object.values(EventStatus).slice(0, 5);
99100
}
100101
}
101102

@@ -115,6 +116,8 @@ export function IsOpenStatus(status: EventStatus): boolean {
115116
*/
116117
export function GetStatusString(status: EventStatus): string {
117118
switch (status) {
119+
case EventStatus.Detected:
120+
return StatusEnum.Detected;
118121
case EventStatus.Analysing:
119122
return StatusEnum.Analysing;
120123
case EventStatus.Fixing:

src/Components/Event/useEditForm.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export function useEditForm(event: Models.IEvent) {
175175
if (![setTitle(), setType(), setUpdate(), setStatus(), setStart(), setEnd(), setUpdateAt()].every(Boolean)) {
176176
throw new Error("Validation failed.");
177177
}
178+
178179
const url = process.env.SD_BACKEND_URL!;
179180

180181
const body: Record<string, any> = {

src/Components/History/EventItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export function EventItem({ Prev, Curr }: IEventItem) {
6767
let color: any;
6868

6969
switch (Curr.Status) {
70+
case EventStatus.Detected:
7071
case EventStatus.Analysing:
7172
color = "red";
7273
break;

src/Components/New/useNewForm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function useNewForm() {
155155
}
156156

157157
const status = IsIncident(type)
158-
? EventStatus.Analysing : EventStatus.Planned
158+
? EventStatus.Detected : EventStatus.Planned
159159

160160
const event: Models.IEvent = {
161161
Id: Math.max(...DB.Events.map(event => event.Id), 0) + 1,

src/Services/Status.Entities.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ interface UpdateEntityV2 {
4848
/**
4949
* @author Aloento
5050
* @since 1.0.0
51-
* @version 0.2.0
51+
* @version 0.2.1
5252
*/
5353
export const enum StatusEnum {
5454
Analyzing = "analyzing",
5555
Analysing = "analysing",
56+
Detected = "detected",
5657
Changed = "changed",
5758
ImpactChanged = "impact changed",
5859
Completed = "completed",

src/Services/Status.Trans.V2.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export function TransformerV2({ Components, Events }: { Components: StatusEntity
137137
Title: event.title,
138138
Start: dayjs(event.start_date).toDate(),
139139
Type: type,
140-
Status: IsIncident(type) ? EventStatus.Analysing : EventStatus.Planned,
140+
Status: IsIncident(type) ? EventStatus.Detected : EventStatus.Planned,
141141
Histories: new Set(),
142142
RegionServices: new Set(),
143143
Description: event.description
@@ -177,6 +177,8 @@ export function TransformerV2({ Components, Events }: { Components: StatusEntity
177177
case StatusEnum.Analyzing:
178178
case StatusEnum.Analysing:
179179
return EventStatus.Analysing;
180+
case StatusEnum.Detected:
181+
return EventStatus.Detected;
180182
case StatusEnum.Reopened:
181183
return EventStatus.Reopened;
182184
case StatusEnum.Fixing:

0 commit comments

Comments
 (0)