-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGleapCustomDataManager.js
More file actions
83 lines (72 loc) · 1.87 KB
/
Copy pathGleapCustomDataManager.js
File metadata and controls
83 lines (72 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { gleapDataParser } from './GleapHelper';
export default class GleapCustomDataManager {
customData = {};
ticketAttributes = {};
// GleapCustomDataManager singleton
static instance;
static getInstance() {
if (!this.instance) {
this.instance = new GleapCustomDataManager();
}
return this.instance;
}
/**
* Returns the custom data object
* @returns {*}
*/
getCustomData() {
return this.customData;
}
/**
* Set custom data that will be attached to the bug-report.
* @param {*} data
*/
attachCustomData(data) {
this.customData = Object.assign(this.customData, gleapDataParser(data));
}
/**
* Add one key value pair to the custom data object
* @param {*} key The key of the custom data entry you want to add.
* @param {*} value The custom data you want to add.
*/
setCustomData(key, value) {
this.customData[key] = value;
}
/**
* Remove one key value pair of the custom data object
* @param {*} key The key of the custom data entry you want to remove.
*/
removeCustomData(key) {
delete this.customData[key];
}
/**
* Clear the custom data
*/
clearCustomData() {
this.customData = {};
}
/**
* This method is used to set ticket attributes programmatically.
* @param {*} key The key of the attribute you want to add.
* @param {*} value The value to set.
*/
setTicketAttribute(key, value) {
this.ticketAttributes[key] = value;
}
/**
* This method is used to unset ticket attributes programmatically.
* @param {*} key The key of the attribute you want to unset.
*/
unsetTicketAttribute(key) {
delete this.ticketAttributes[key];
}
/**
* This method is used to clear ticket attributes programmatically.
*/
clearTicketAttributes() {
this.ticketAttributes = {};
}
getTicketAttributes() {
return this.ticketAttributes;
}
}