@openinc/parse-server-opendash 3.32.3 → 3.32.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Maintenance_Downtime, Maintenance_Frequency, Maintenance_Priority, Maintenance_Restriction, Maintenance_Ticket, Maintenance_Ticket_Issuecategory, Maintenance_Ticket_Kanban_State, Maintenance_Ticket_Source } from "../../../types";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
*/
|
|
2
5
|
export type OpenWareTicketObject = {
|
|
3
6
|
ticket: Maintenance_Ticket;
|
|
4
7
|
priority: Maintenance_Priority | Number;
|
|
@@ -6,7 +6,6 @@ exports.saveTicketData = saveTicketData;
|
|
|
6
6
|
exports.serializeTicketData = serializeTicketData;
|
|
7
7
|
const parse_1 = require("parse");
|
|
8
8
|
const openservice_1 = require("../features/openservice");
|
|
9
|
-
const openware_1 = require("../features/openware");
|
|
10
9
|
const catchError_1 = require("../helper/catchError");
|
|
11
10
|
const types_1 = require("../types");
|
|
12
11
|
const openinc_openservice_ticket_data_1 = require("./openinc-openservice-ticket-data");
|
|
@@ -71,16 +70,17 @@ async function saveTicketData(data, user, overrideFetchOptions) {
|
|
|
71
70
|
(user ? { sessionToken: user.getSessionToken() } : { useMasterKey: true });
|
|
72
71
|
console.log("[saveTicketData] effective fetchOptions:", fetchOptions);
|
|
73
72
|
const ticket = await (0, openservice_1.getTicketObject)(data, user, fetchOptions);
|
|
74
|
-
const owticketobj = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
73
|
+
// const owticketobj: OpenWareTicketObject = {
|
|
74
|
+
// ticket: ticket,
|
|
75
|
+
// priority: 0,
|
|
76
|
+
// downtime: 0,
|
|
77
|
+
// restriction: 0,
|
|
78
|
+
// frequency: 0,
|
|
79
|
+
// issuecategory: "",
|
|
80
|
+
// state: "",
|
|
81
|
+
// source: new Maintenance_Ticket_Source(),
|
|
82
|
+
// metadata: { fields: [] },
|
|
83
|
+
// };
|
|
84
84
|
// needs to be the first save to save a message before data change messages are created on ticket creation
|
|
85
85
|
if (data.message)
|
|
86
86
|
await (0, openservice_1.saveMessage)(ticket, data.message, fetchOptions, data);
|
|
@@ -90,13 +90,11 @@ async function saveTicketData(data, user, overrideFetchOptions) {
|
|
|
90
90
|
await (0, openservice_1.saveTicketTitle)(ticket, fetchOptions);
|
|
91
91
|
if (data.description)
|
|
92
92
|
await (0, openservice_1.saveDescription)(ticket, data, fetchOptions);
|
|
93
|
-
if (data.meta)
|
|
94
|
-
await (0, openservice_1.saveTicketMeta)(ticket, data.meta, fetchOptions);
|
|
95
93
|
if (data.duedate)
|
|
96
94
|
await (0, openservice_1.saveDuedate)(ticket, data.duedate, fetchOptions);
|
|
97
95
|
if (data.priority !== undefined) {
|
|
98
96
|
const savedpriority = await (0, openservice_1.savePriority)(ticket, data.priority, fetchOptions);
|
|
99
|
-
owticketobj.priority = savedpriority;
|
|
97
|
+
// owticketobj.priority = savedpriority;
|
|
100
98
|
}
|
|
101
99
|
else {
|
|
102
100
|
//Fetch last value so it won't publish a 0 value to openware and overwrite the last value with default 0
|
|
@@ -108,83 +106,101 @@ async function saveTicketData(data, user, overrideFetchOptions) {
|
|
|
108
106
|
console.log("Error fetching last priority", lastPriorityError);
|
|
109
107
|
}
|
|
110
108
|
else {
|
|
111
|
-
owticketobj.priority = lastPriority?.get("value") ?? 0;
|
|
109
|
+
// owticketobj.priority = lastPriority?.get("value") ?? 0;
|
|
112
110
|
}
|
|
113
111
|
}
|
|
114
112
|
if (data.downtime !== undefined) {
|
|
115
113
|
const saveddowntime = await (0, openservice_1.saveDowntime)(ticket, data.downtime, fetchOptions);
|
|
116
|
-
owticketobj.downtime = saveddowntime;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
//Fetch last value so it won't publish a 0 value to openware and overwrite the last value with default 0
|
|
120
|
-
const [lastDowntimeError, lastDowntime] = await (0, catchError_1.catchError)(new Parse.Query(types_1.Maintenance_Downtime)
|
|
121
|
-
.equalTo("ticket", ticket)
|
|
122
|
-
.descending("createdAt")
|
|
123
|
-
.first(fetchOptions), [Error]);
|
|
124
|
-
if (lastDowntimeError) {
|
|
125
|
-
console.log("Error fetching last downtime", lastDowntimeError);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
owticketobj.downtime = lastDowntime?.get("value") ?? 0;
|
|
129
|
-
}
|
|
114
|
+
// owticketobj.downtime = saveddowntime;
|
|
130
115
|
}
|
|
116
|
+
// else {
|
|
117
|
+
// //Fetch last value so it won't publish a 0 value to openware and overwrite the last value with default 0
|
|
118
|
+
// const [lastDowntimeError, lastDowntime] = await catchError(
|
|
119
|
+
// new Parse.Query(Maintenance_Downtime)
|
|
120
|
+
// .equalTo("ticket", ticket)
|
|
121
|
+
// .descending("createdAt")
|
|
122
|
+
// .first(fetchOptions),
|
|
123
|
+
// [Error]
|
|
124
|
+
// );
|
|
125
|
+
// if (lastDowntimeError) {
|
|
126
|
+
// console.log("Error fetching last downtime", lastDowntimeError);
|
|
127
|
+
// } else {
|
|
128
|
+
// owticketobj.downtime = lastDowntime?.get("value") ?? 0;
|
|
129
|
+
// }
|
|
130
|
+
// }
|
|
131
131
|
if (data.frequency !== undefined) {
|
|
132
132
|
const savedfrequency = await (0, openservice_1.saveFrequency)(ticket, data.frequency, fetchOptions);
|
|
133
|
-
owticketobj.frequency = savedfrequency;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
//Fetch last value so it won't publish a 0 value to openware and overwrite the last value with default 0
|
|
137
|
-
const [lastFrequencyError, lastFrequency] = await (0, catchError_1.catchError)(new Parse.Query(types_1.Maintenance_Frequency)
|
|
138
|
-
.equalTo("ticket", ticket)
|
|
139
|
-
.descending("createdAt")
|
|
140
|
-
.first(fetchOptions), [Error]);
|
|
141
|
-
if (lastFrequencyError) {
|
|
142
|
-
console.log("Error fetching last frequency", lastFrequencyError);
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
owticketobj.frequency = lastFrequency?.get("value") ?? 0;
|
|
146
|
-
}
|
|
133
|
+
// owticketobj.frequency = savedfrequency;
|
|
147
134
|
}
|
|
135
|
+
// else {
|
|
136
|
+
// //Fetch last value so it won't publish a 0 value to openware and overwrite the last value with default 0
|
|
137
|
+
// const [lastFrequencyError, lastFrequency] = await catchError(
|
|
138
|
+
// new Parse.Query(Maintenance_Frequency)
|
|
139
|
+
// .equalTo("ticket", ticket)
|
|
140
|
+
// .descending("createdAt")
|
|
141
|
+
// .first(fetchOptions),
|
|
142
|
+
// [Error]
|
|
143
|
+
// );
|
|
144
|
+
// if (lastFrequencyError) {
|
|
145
|
+
// console.log("Error fetching last frequency", lastFrequencyError);
|
|
146
|
+
// } else {
|
|
147
|
+
// owticketobj.frequency = lastFrequency?.get("value") ?? 0;
|
|
148
|
+
// }
|
|
149
|
+
// }
|
|
148
150
|
if (data.restriction !== undefined) {
|
|
149
151
|
const savedrestriction = await (0, openservice_1.saveRestriction)(ticket, data.restriction, fetchOptions);
|
|
150
|
-
owticketobj.restriction = savedrestriction;
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
//Fetch last value so it won't publish a 0 value to openware and overwrite the last value with default 0
|
|
154
|
-
const [lastRestrictionError, lastRestriction] = await (0, catchError_1.catchError)(new Parse.Query(types_1.Maintenance_Restriction)
|
|
155
|
-
.equalTo("ticket", ticket)
|
|
156
|
-
.descending("createdAt")
|
|
157
|
-
.first(fetchOptions), [Error]);
|
|
158
|
-
if (lastRestrictionError) {
|
|
159
|
-
console.log("Error fetching last restriction", lastRestrictionError);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
owticketobj.restriction = lastRestriction?.get("value") ?? 0;
|
|
163
|
-
}
|
|
152
|
+
// owticketobj.restriction = savedrestriction;
|
|
164
153
|
}
|
|
154
|
+
// else {
|
|
155
|
+
// //Fetch last value so it won't publish a 0 value to openware and overwrite the last value with default 0
|
|
156
|
+
// const [lastRestrictionError, lastRestriction] = await catchError(
|
|
157
|
+
// new Parse.Query(Maintenance_Restriction)
|
|
158
|
+
// .equalTo("ticket", ticket)
|
|
159
|
+
// .descending("createdAt")
|
|
160
|
+
// .first(fetchOptions),
|
|
161
|
+
// [Error]
|
|
162
|
+
// );
|
|
163
|
+
// if (lastRestrictionError) {
|
|
164
|
+
// console.log("Error fetching last restriction", lastRestrictionError);
|
|
165
|
+
// } else {
|
|
166
|
+
// owticketobj.restriction = lastRestriction?.get("value") ?? 0;
|
|
167
|
+
// }
|
|
168
|
+
// }
|
|
165
169
|
if (data.issuecategory) {
|
|
166
170
|
const savedissuecategory = await (0, openservice_1.saveIssueCategory)(ticket, data.issuecategory, fetchOptions);
|
|
167
|
-
const [fetchedSavedIssuecategoryError, fetchedSavedIssuecategory] =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
// const [fetchedSavedIssuecategoryError, fetchedSavedIssuecategory] =
|
|
172
|
+
// await catchError(
|
|
173
|
+
// new Parse.Query(Maintenance_Ticket_Issuecategory)
|
|
174
|
+
// .include("issuecategory")
|
|
175
|
+
// .get(savedissuecategory.id, fetchOptions),
|
|
176
|
+
// [Error]
|
|
177
|
+
// );
|
|
178
|
+
// if (fetchedSavedIssuecategoryError) {
|
|
179
|
+
// console.log(
|
|
180
|
+
// "Error fetching saved issue category",
|
|
181
|
+
// fetchedSavedIssuecategoryError
|
|
182
|
+
// );
|
|
183
|
+
// } else {
|
|
184
|
+
// owticketobj.issuecategory = fetchedSavedIssuecategory;
|
|
185
|
+
// }
|
|
176
186
|
}
|
|
177
187
|
if (data.state) {
|
|
178
188
|
const savedstate = await (0, openservice_1.saveState)(ticket, data.state, fetchOptions);
|
|
179
|
-
const [fetchedSavedStateError, fetchedSavedState] = await
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
189
|
+
// const [fetchedSavedStateError, fetchedSavedState] = await catchError(
|
|
190
|
+
// new Parse.Query(Maintenance_Ticket_Kanban_State)
|
|
191
|
+
// .include("state")
|
|
192
|
+
// .get(savedstate.id, fetchOptions),
|
|
193
|
+
// [Error]
|
|
194
|
+
// );
|
|
195
|
+
// if (fetchedSavedStateError) {
|
|
196
|
+
// console.log("Error fetching saved state", fetchedSavedStateError);
|
|
197
|
+
// } else {
|
|
198
|
+
// owticketobj.state = fetchedSavedState;
|
|
199
|
+
// }
|
|
200
|
+
}
|
|
201
|
+
if (data.meta) {
|
|
202
|
+
await (0, openservice_1.saveTicketMeta)(ticket, data.meta, fetchOptions);
|
|
203
|
+
// owticketobj.metadata = savedTicket.get("meta");
|
|
188
204
|
}
|
|
189
205
|
if (data.material) {
|
|
190
206
|
try {
|
|
@@ -229,21 +245,27 @@ async function saveTicketData(data, user, overrideFetchOptions) {
|
|
|
229
245
|
}
|
|
230
246
|
}
|
|
231
247
|
//Get source from ticket and save to openware
|
|
232
|
-
const [fetchedTicketSourceError, ticketsource] = await
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
248
|
+
// const [fetchedTicketSourceError, ticketsource] = await catchError(
|
|
249
|
+
// new Parse.Query(Maintenance_Ticket_Source)
|
|
250
|
+
// .equalTo("ticket", new Maintenance_Ticket({ objectId: ticket.id }))
|
|
251
|
+
// .descending("createdAt")
|
|
252
|
+
// .include("source")
|
|
253
|
+
// .first({ useMasterKey: true }),
|
|
254
|
+
// [Error]
|
|
255
|
+
// );
|
|
256
|
+
// if (fetchedTicketSourceError) {
|
|
257
|
+
// console.log("Error fetching saved source", fetchedTicketSourceError);
|
|
258
|
+
// } else if (ticketsource && ticketsource.get("source")) {
|
|
259
|
+
// owticketobj.source = ticketsource;
|
|
260
|
+
// // publish to openware
|
|
261
|
+
// await publishToOpenWare(
|
|
262
|
+
// owticketobj,
|
|
263
|
+
// ticket,
|
|
264
|
+
// ticketsource.get("source").get("tag")
|
|
265
|
+
// ? ticketsource.get("source").get("tag")!
|
|
266
|
+
// : ""
|
|
267
|
+
// );
|
|
268
|
+
// }
|
|
247
269
|
// save TicketData in TicketData Table
|
|
248
270
|
const [ticketData] = await (0, openinc_openservice_ticket_data_1.getTicketData)([ticket]);
|
|
249
271
|
if (ticketData) {
|
|
@@ -269,126 +291,150 @@ async function saveTicketData(data, user, overrideFetchOptions) {
|
|
|
269
291
|
* Publishes the ticket to open.WARE with all changed data
|
|
270
292
|
* @param owticketobj OpenWareTicketObject
|
|
271
293
|
* @param source OD3_Source
|
|
294
|
+
* @deprecated
|
|
272
295
|
*/
|
|
273
296
|
async function publishToOpenWare(owticketobj, ticket, source) {
|
|
274
|
-
const time = new Date().getTime();
|
|
275
|
-
const values = {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
297
|
+
// const time: number = new Date().getTime();
|
|
298
|
+
// const values: DataItemValueInterface = {
|
|
299
|
+
// date: time,
|
|
300
|
+
// value: Object.entries(owticketobj).map(([key, value]) => {
|
|
301
|
+
// if (key === "downtime") {
|
|
302
|
+
// if (value instanceof Maintenance_Downtime) {
|
|
303
|
+
// return value.get("value");
|
|
304
|
+
// }
|
|
305
|
+
// return value;
|
|
306
|
+
// } else if (key === "frequency") {
|
|
307
|
+
// if (value instanceof Maintenance_Frequency) {
|
|
308
|
+
// return value.get("value");
|
|
309
|
+
// }
|
|
310
|
+
// return value;
|
|
311
|
+
// } else if (key === "priority") {
|
|
312
|
+
// if (value instanceof Maintenance_Priority) {
|
|
313
|
+
// return value.get("value");
|
|
314
|
+
// }
|
|
315
|
+
// return value;
|
|
316
|
+
// } else if (key === "restriction") {
|
|
317
|
+
// if (value instanceof Maintenance_Restriction) {
|
|
318
|
+
// return value.get("value");
|
|
319
|
+
// }
|
|
320
|
+
// return value;
|
|
321
|
+
// } else if (key === "issuecategory") {
|
|
322
|
+
// if (value instanceof Maintenance_Ticket_Issuecategory) {
|
|
323
|
+
// return value.get("issuecategory").id;
|
|
324
|
+
// }
|
|
325
|
+
// return value;
|
|
326
|
+
// } else if (key === "state") {
|
|
327
|
+
// if (value instanceof Maintenance_Ticket_Kanban_State) {
|
|
328
|
+
// return value.get("state").id;
|
|
329
|
+
// }
|
|
330
|
+
// return value;
|
|
331
|
+
// } else if (key === "ticket") {
|
|
332
|
+
// if (value instanceof Maintenance_Ticket) {
|
|
333
|
+
// return value.id;
|
|
334
|
+
// }
|
|
335
|
+
// return value;
|
|
336
|
+
// } else if (key === "source") {
|
|
337
|
+
// if (value instanceof Maintenance_Ticket_Source) {
|
|
338
|
+
// return value.get("source").id;
|
|
339
|
+
// }
|
|
340
|
+
// return value;
|
|
341
|
+
// } else if (key === "metadata") {
|
|
342
|
+
// return value;
|
|
343
|
+
// }
|
|
344
|
+
// return value;
|
|
345
|
+
// }),
|
|
346
|
+
// };
|
|
347
|
+
// const valueTypes: DataItemValueTypeInterface[] = Object.keys(owticketobj).map(
|
|
348
|
+
// (key): DataItemValueTypeInterface => {
|
|
349
|
+
// const tmpvaluetype: DataItemValueTypeInterface = {
|
|
350
|
+
// name: "",
|
|
351
|
+
// unit: "",
|
|
352
|
+
// type: "String",
|
|
353
|
+
// };
|
|
354
|
+
// if (key === "downtime") {
|
|
355
|
+
// tmpvaluetype.name = Maintenance_Downtime.className.replace(
|
|
356
|
+
// "OD3_Maintenance_",
|
|
357
|
+
// ""
|
|
358
|
+
// );
|
|
359
|
+
// tmpvaluetype.unit = "%";
|
|
360
|
+
// tmpvaluetype.type = "Number";
|
|
361
|
+
// } else if (key === "frequency") {
|
|
362
|
+
// tmpvaluetype.name = Maintenance_Frequency.className.replace(
|
|
363
|
+
// "OD3_Maintenance_",
|
|
364
|
+
// ""
|
|
365
|
+
// );
|
|
366
|
+
// tmpvaluetype.unit = "%";
|
|
367
|
+
// tmpvaluetype.type = "Number";
|
|
368
|
+
// } else if (key === "priority") {
|
|
369
|
+
// tmpvaluetype.name = Maintenance_Priority.className.replace(
|
|
370
|
+
// "OD3_Maintenance_",
|
|
371
|
+
// ""
|
|
372
|
+
// );
|
|
373
|
+
// tmpvaluetype.unit = "%";
|
|
374
|
+
// tmpvaluetype.type = "Number";
|
|
375
|
+
// } else if (key === "restriction") {
|
|
376
|
+
// tmpvaluetype.name = Maintenance_Restriction.className.replace(
|
|
377
|
+
// "OD3_Maintenance_",
|
|
378
|
+
// ""
|
|
379
|
+
// );
|
|
380
|
+
// tmpvaluetype.unit = "%";
|
|
381
|
+
// tmpvaluetype.type = "Number";
|
|
382
|
+
// } else if (key === "issuecategory") {
|
|
383
|
+
// tmpvaluetype.name = Maintenance_Ticket_Issuecategory.className.replace(
|
|
384
|
+
// "OD3_Maintenance_",
|
|
385
|
+
// ""
|
|
386
|
+
// );
|
|
387
|
+
// tmpvaluetype.unit = "";
|
|
388
|
+
// tmpvaluetype.type = "String";
|
|
389
|
+
// } else if (key === "state") {
|
|
390
|
+
// tmpvaluetype.name = Maintenance_Ticket_Kanban_State.className.replace(
|
|
391
|
+
// "OD3_Maintenance_",
|
|
392
|
+
// ""
|
|
393
|
+
// );
|
|
394
|
+
// tmpvaluetype.unit = "";
|
|
395
|
+
// tmpvaluetype.type = "String";
|
|
396
|
+
// } else if (key === "ticket") {
|
|
397
|
+
// tmpvaluetype.name = Maintenance_Ticket.className.replace(
|
|
398
|
+
// "OD3_Maintenance_",
|
|
399
|
+
// ""
|
|
400
|
+
// );
|
|
401
|
+
// tmpvaluetype.unit = "";
|
|
402
|
+
// tmpvaluetype.type = "String";
|
|
403
|
+
// } else if (key === "source") {
|
|
404
|
+
// tmpvaluetype.name = Maintenance_Ticket_Source.className.replace(
|
|
405
|
+
// "OD3_Maintenance_",
|
|
406
|
+
// ""
|
|
407
|
+
// );
|
|
408
|
+
// tmpvaluetype.unit = "";
|
|
409
|
+
// tmpvaluetype.type = "String";
|
|
410
|
+
// }
|
|
411
|
+
// else if (key === "metadata") {
|
|
412
|
+
// tmpvaluetype.name = "meta";
|
|
413
|
+
// tmpvaluetype.unit = "";
|
|
414
|
+
// tmpvaluetype.type = "Object";
|
|
415
|
+
// }
|
|
416
|
+
// return tmpvaluetype;
|
|
417
|
+
// }
|
|
418
|
+
// );
|
|
419
|
+
// const dataitem: DataItemInterface = {
|
|
420
|
+
// id: `openservice_ticket_${ticket.id}`,
|
|
421
|
+
// name: `Ticket ${owticketobj.ticket.get("title")}`,
|
|
422
|
+
// source: source,
|
|
423
|
+
// values: [values],
|
|
424
|
+
// valueTypes: valueTypes,
|
|
425
|
+
// meta: {},
|
|
426
|
+
// };
|
|
427
|
+
// console.log(
|
|
428
|
+
// "Publishing ticket to openware: ",
|
|
429
|
+
// dataitem,
|
|
430
|
+
// "with values",
|
|
431
|
+
// JSON.stringify(dataitem.values)
|
|
432
|
+
// );
|
|
433
|
+
// try {
|
|
434
|
+
// await publishDataItem(dataitem, ticket.get("user")?.get("email"), true);
|
|
435
|
+
// } catch (error) {
|
|
436
|
+
// console.error("Error publishing ticket to openware", error);
|
|
437
|
+
// }
|
|
392
438
|
}
|
|
393
439
|
function serializeTicketData(obj) {
|
|
394
440
|
if (!obj)
|