@@ -2,6 +2,7 @@ import * as MenuApi from "../../services/menu/MenuApi";
22import { AppRoot } from "../../services/AppRoot" ;
33import { PubSubService , MessageContext } from "../../services/PubSub" ;
44import { IncidentTopcis , IncidentAssigned , IncidentClosed , IncidentIgnored } from "../../services/incidents/IncidentService" ;
5+ import * as incidents from "../../dto/Core/Incidents" ;
56
67/**
78 * null if the user do not have any assigned incidents (for the selected application)
@@ -21,6 +22,9 @@ export interface incidentListChanged {
2122export interface IMyIncident {
2223 incidentId : number ;
2324 applicationId : number ;
25+ applicationName : string ;
26+ createdAtUtc : Date ;
27+ assignedAtUtc : Date ;
2428 title : string ;
2529
2630 /**
@@ -142,9 +146,16 @@ export class MyIncidents {
142146 var index = this . allMyIncidents$ . findIndex ( menuItem => menuItem . incidentId === assignedIncident . Id ) ;
143147 var item : IMyIncident ;
144148 if ( index === - 1 ) {
145- item = this . createItem ( assignedIncident . Id ,
149+ item = this . createItem (
150+ assignedIncident . Id ,
146151 assignedIncident . ApplicationId ,
147- assignedIncident . Description ) ;
152+ '' ,
153+ assignedIncident . CreatedAtUtc ,
154+ assignedIncident . AssignedAtUtc ,
155+ assignedIncident . Description
156+ ) ;
157+ AppRoot . Instance . applicationService . get ( assignedIncident . ApplicationId )
158+ . then ( x => item . applicationName = x . name ) ;
148159 this . allMyIncidents$ . push ( item ) ;
149160 } else {
150161 item = this . allMyIncidents$ [ index ] ;
@@ -182,7 +193,7 @@ export class MyIncidents {
182193 }
183194 mine . forEach ( dto => {
184195 if ( ! this . allMyIncidents$ . find ( item => item . incidentId === dto . Id ) ) {
185- var item = this . createItem ( dto . Id , parseInt ( dto . ApplicationId , 10 ) , dto . Name ) ;
196+ var item = this . createItem2 ( dto ) ;
186197 this . allMyIncidents$ . push ( item ) ;
187198 }
188199 } ) ;
@@ -200,7 +211,7 @@ export class MyIncidents {
200211 } ) ;
201212 }
202213
203- private createItem ( incidentId : number , applicationId : number , title : string ) : IMyIncident {
214+ private createItem ( incidentId : number , applicationId : number , applicationName : string , createdAtUtc : Date , assignedAtUtc : Date , title : string ) : IMyIncident {
204215 let shortTitle = title ;
205216 if ( shortTitle . length > 50 ) {
206217 shortTitle = title . substr ( 0 , 45 ) + '[...]' ;
@@ -210,7 +221,28 @@ export class MyIncidents {
210221 title : title ,
211222 shortTitle : shortTitle ,
212223 incidentId : incidentId ,
213- applicationId : applicationId
224+ createdAtUtc : createdAtUtc ,
225+ applicationId : applicationId ,
226+ applicationName : applicationName ,
227+ assignedAtUtc : assignedAtUtc
228+ } ;
229+ return item ;
230+ }
231+
232+ private createItem2 ( incident : incidents . FindIncidentsResultItem ) : IMyIncident {
233+ let shortTitle = incident . Name ;
234+ if ( shortTitle . length > 50 ) {
235+ shortTitle = incident . Name . substr ( 0 , 45 ) + '[...]' ;
236+ }
237+
238+ var item : IMyIncident = {
239+ title : incident . Name ,
240+ shortTitle : shortTitle ,
241+ incidentId : incident . Id ,
242+ createdAtUtc : incident . CreatedAtUtc ,
243+ applicationId : incident . ApplicationId ,
244+ applicationName : incident . ApplicationName ,
245+ assignedAtUtc : incident . AssignedAtUtc
214246 } ;
215247 return item ;
216248 }
@@ -227,7 +259,7 @@ export class MyIncidents {
227259 var foundItem : IMyIncident = null ;
228260 allMine . forEach ( myIncident => {
229261 if ( myIncident . Id === incidentId ) {
230- var item = this . createItem ( myIncident . Id , parseInt ( myIncident . ApplicationId , 10 ) , myIncident . Name ) ;
262+ var item = this . createItem2 ( myIncident ) ;
231263 this . allMyIncidents$ . push ( item ) ;
232264 foundItem = item ;
233265 }
0 commit comments