@@ -3,20 +3,21 @@ import { StatusEnum } from "~/Services/Status.Entities";
3
3
/**
4
4
* @author Aloento
5
5
* @since 1.0.0
6
- * @version 0.1 .0
6
+ * @version 0.2 .0
7
7
*/
8
8
export enum EventType {
9
9
Operational = "Operational" ,
10
10
Maintenance = "Maintenance" ,
11
11
Minor = "Minor Incident" ,
12
12
Major = "Major Incident" ,
13
13
Outage = "Service Outage" ,
14
+ Information = "Information" ,
14
15
}
15
16
16
17
/**
17
18
* @author Aloento
18
19
* @since 1.0.0
19
- * @version 0.1 .0
20
+ * @version 0.2 .0
20
21
*/
21
22
export function GetEventType ( impact : number ) : EventType {
22
23
switch ( impact ) {
@@ -26,15 +27,17 @@ export function GetEventType(impact: number): EventType {
26
27
return EventType . Minor ;
27
28
case 2 :
28
29
return EventType . Major ;
29
- default :
30
+ case 3 :
30
31
return EventType . Outage ;
32
+ default :
33
+ return EventType . Information ;
31
34
}
32
35
}
33
36
34
37
/**
35
38
* @author Aloento
36
39
* @since 1.0.0
37
- * @version 0.1 .0
40
+ * @version 0.2 .0
38
41
*/
39
42
export function GetEventImpact ( type : EventType ) : number {
40
43
switch ( type ) {
@@ -44,16 +47,27 @@ export function GetEventImpact(type: EventType): number {
44
47
return 1 ;
45
48
case EventType . Major :
46
49
return 2 ;
47
- default :
50
+ case EventType . Outage :
48
51
return 3 ;
52
+ default :
53
+ return 4 ;
49
54
}
50
55
}
51
56
52
57
/**
53
58
* @author Aloento
54
- * @since 1.0 .0
59
+ * @since 1.1 .0
55
60
* @version 0.1.0
56
61
*/
62
+ export function IsIncident ( type : EventType ) : boolean {
63
+ return [ EventType . Minor , EventType . Major , EventType . Outage ] . includes ( type ) ;
64
+ }
65
+
66
+ /**
67
+ * @author Aloento
68
+ * @since 1.0.0
69
+ * @version 0.2.0
70
+ */
57
71
export enum EventStatus {
58
72
Analysing = "Analysing" ,
59
73
Fixing = "Fixing" ,
@@ -70,6 +84,22 @@ export enum EventStatus {
70
84
Changed = "Changed" ,
71
85
}
72
86
87
+ /**
88
+ * @author Aloento
89
+ * @since 1.1.0
90
+ * @version 0.1.0
91
+ */
92
+ export function GetStatusList ( type : EventType ) : EventStatus [ ] {
93
+ switch ( type ) {
94
+ case EventType . Maintenance :
95
+ return Object . values ( EventStatus ) . slice ( 4 , 9 ) ;
96
+ case EventType . Information :
97
+ return [ EventStatus . Planned , EventStatus . Completed , EventStatus . Cancelled ] ;
98
+ default :
99
+ return Object . values ( EventStatus ) . slice ( 0 , 4 ) ;
100
+ }
101
+ }
102
+
73
103
/**
74
104
* @author Aloento
75
105
* @since 1.0.0
@@ -82,7 +112,7 @@ export function IsOpenStatus(status: EventStatus): boolean {
82
112
/**
83
113
* @author Aloento
84
114
* @since 1.0.0
85
- * @version 0.1 .0
115
+ * @version 0.2 .0
86
116
*/
87
117
export function GetStatusString ( status : EventStatus ) : string {
88
118
switch ( status ) {
0 commit comments