src/lib/model/work-item-history.model.ts
History entry of a work item.
Properties |
constructor(json: any)
|
||||||||
Defined in src/lib/model/work-item-history.model.ts:48
|
||||||||
Creates a new instance
Parameters :
|
data |
data:
|
Type : any
|
Defined in src/lib/model/work-item-history.model.ts:48
|
Additional data for special kinds of entries like errors, personalization, periods |
description |
description:
|
Type : string
|
Defined in src/lib/model/work-item-history.model.ts:23
|
Short description of the history entry |
editor |
editor:
|
Type : OrgUser
|
Defined in src/lib/model/work-item-history.model.ts:39
|
User that was responsible for creating this entry (e.g. by executing an action) |
number |
number:
|
Type : number
|
Defined in src/lib/model/work-item-history.model.ts:31
|
Index of the history entry (may be used for ordering) |
performer |
performer:
|
Type : WorkItemHistoryPerformer[]
|
Defined in src/lib/model/work-item-history.model.ts:44
|
Collection of performers. Performers are users, groups or roles that received a work item that let to the creation of a history entry. If for example a work item was forwarded, the history entry created for that action will contain the recipients of the forwarded action. |
time |
time:
|
Type : Date
|
Defined in src/lib/model/work-item-history.model.ts:27
|
The date (time) this entry was created |
title |
title:
|
Type : string
|
Defined in src/lib/model/work-item-history.model.ts:19
|
Title of the history entry |
type |
type:
|
Type : string
|
Defined in src/lib/model/work-item-history.model.ts:35
|
History entries type |
import {OrgUser} from './org.model';
/**
* @ignore
*/
export interface WorkItemHistoryPerformer {
type: string;
label: string;
}
/**
* History entry of a work item.
*/
export class WorkItemHistoryEntry {
/**
* Title of the history entry
*/
title: string;
/**
* Short description of the history entry
*/
description: string;
/**
* The date (time) this entry was created
*/
time: Date;
/**
* Index of the history entry (may be used for ordering)
*/
number: number;
/**
* History entries type
*/
type: string;
/**
* User that was responsible for creating this entry (e.g. by executing an action)
*/
editor: OrgUser;
/**
* Collection of performers. Performers are users, groups or roles that received a work item that let to the creation of a history entry.
* If for example a work item was forwarded, the history entry created for that action will contain the recipients of the forwarded action.
*/
performer: WorkItemHistoryPerformer[];
/**
* Additional data for special kinds of entries like errors, personalization, periods
*/
data: any;
/**
* Creates a new instance
* @param json The JSON object received from the backend. This will be used to construct the new work item history instance
*/
constructor(json: any) {
this.title = json.activityName;
this.description = json.description;
this.number = json.number;
this.time = json.time;
this.type = json.type;
this.data = {};
// overrides for special types of history entries
switch (json.type) {
// deadline started
case 'DEADLINE_START': {
this.title = `${json.periodName}`;
// description will be generated in template
this.description = null;
this.data = {
periodFireTime: json.periodFireTime
};
this.type = json.type;
break;
}
// deadline reached
case 'DEADLINE_FIRE': {
this.title = `${json.periodName}`;
// description will be generated in template
this.description = null;
this.data = {
periodFireTime: json.periodFireTime
};
this.type = json.type;
break;
}
}
// are there additional information about the performer
// that caused the history entry
if (json.performer) {
this.performer = [];
json.performer.groups.forEach(g => this.performer.push({type: 'group', label: g.name}));
json.performer.roles.forEach(r => this.performer.push({type: 'role', label: r.name}));
json.performer.users.forEach(u => this.performer.push({type: 'user', label: `${u.lastname}, ${u.firstname} (${u.name})`}));
}
if (json.user) {
this.editor = json.user;
}
}
}