@optimiser/common 1.0.232 → 1.0.236
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.
- package/dist/lib/utility.d.ts +1 -1
- package/dist/lib/utility.js +133 -35
- package/package.json +1 -1
package/dist/lib/utility.d.ts
CHANGED
|
@@ -176,7 +176,7 @@ declare function GetUserProfile(msp_d: AnyObjectInterface, db: Db, mdb: Db, next
|
|
|
176
176
|
data: any;
|
|
177
177
|
} | undefined>;
|
|
178
178
|
declare function CheckPageAuthentication(pageData: AnyObjectInterface, msp_d: AnyObjectInterface, db: Db, mdb: Db, next: NextFunction): Promise<boolean>;
|
|
179
|
-
declare function RemoveFieldsFromFilters(condition: AnyObjectInterface, fields: AnyObjectInterface[]): void;
|
|
179
|
+
declare function RemoveFieldsFromFilters(condition: AnyObjectInterface, fields: AnyObjectInterface[], identifier: string): void;
|
|
180
180
|
/**
|
|
181
181
|
* @param Error Error object
|
|
182
182
|
* @param ServiceOrigin - Error Occur in Service (Service Name)
|
package/dist/lib/utility.js
CHANGED
|
@@ -206,7 +206,7 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
|
|
|
206
206
|
else {
|
|
207
207
|
db.collection("ObjectSchema").findOne({ 'Name': pageData.ObjectName }, function (err, objectData) {
|
|
208
208
|
return __awaiter(this, void 0, void 0, function () {
|
|
209
|
-
var removeFieldsFromFilter, j, filterData, _loop_2, i, g, group, childObjectSchema, _loop_3, i, _loop_4, i
|
|
209
|
+
var removeFieldsFromFilter, j, filterData, _loop_2, i, g, group, childObjectSchema, _loop_3, i, _loop_4, i;
|
|
210
210
|
return __generator(this, function (_a) {
|
|
211
211
|
switch (_a.label) {
|
|
212
212
|
case 0:
|
|
@@ -215,10 +215,10 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
|
|
|
215
215
|
}
|
|
216
216
|
pageData["ObjectSchema"] = objectData;
|
|
217
217
|
removeFieldsFromFilter = objectData.Fields.filter(function (f) { return f.IsFilter == false; }).map(function (fld) { return fld.Name; });
|
|
218
|
-
if (removeFieldsFromFilter && pageData.ListViewFilters && removeFieldsFromFilter.length > 0 && pageData.ListViewFilters > 0) {
|
|
218
|
+
if (removeFieldsFromFilter && pageData.ListViewFilters && removeFieldsFromFilter.length > 0 && pageData.ListViewFilters.length > 0) {
|
|
219
219
|
for (j = 0; j < pageData.ListViewFilters.length; j++) {
|
|
220
220
|
filterData = pageData.ListViewFilters[j];
|
|
221
|
-
RemoveFieldsFromFilters(filterData.Conditions, removeFieldsFromFilter);
|
|
221
|
+
RemoveFieldsFromFilters(filterData.Conditions, removeFieldsFromFilter, 'Name');
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
//** Ends */
|
|
@@ -277,34 +277,123 @@ function GetPageFieldData(pageName, db, mdb, msp_d, next, callback) {
|
|
|
277
277
|
g++;
|
|
278
278
|
return [3 /*break*/, 1];
|
|
279
279
|
case 5:
|
|
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
|
-
|
|
280
|
+
// CODE COMMNETED DUE TO _ID & CREATED FIELDS SHOWN ON PRODUCTION - Rohit Kumar (Kashish assisted)
|
|
281
|
+
//By Kashish : To handle System Info Fields in Grid and Detail
|
|
282
|
+
// let createdByObj = {
|
|
283
|
+
// Name: "CreatedBy",
|
|
284
|
+
// DisplayName: "Created By",
|
|
285
|
+
// ApiName: "CreatedBy",
|
|
286
|
+
// HideON: "both",
|
|
287
|
+
// Sequence: 100,
|
|
288
|
+
// UniqueID: "CreatedBy",
|
|
289
|
+
// Schema: {
|
|
290
|
+
// Name: "CreatedBy",
|
|
291
|
+
// DisplayName: "Created By",
|
|
292
|
+
// HideON: "both",
|
|
293
|
+
// ApiName: "CreatedBy",
|
|
294
|
+
// UIDataType: "lookup",
|
|
295
|
+
// LookupObject: "User",
|
|
296
|
+
// LookupFields: [
|
|
297
|
+
// "FirstName",
|
|
298
|
+
// "LastName"
|
|
299
|
+
// ],
|
|
300
|
+
// ExtraLookupFields: [
|
|
301
|
+
// "UserStatus",
|
|
302
|
+
// "IsAppUser"
|
|
303
|
+
// ]
|
|
304
|
+
// }
|
|
305
|
+
// }
|
|
306
|
+
// let modByObj = {
|
|
307
|
+
// Name: "ModifiedBy",
|
|
308
|
+
// DisplayName: "Modified By",
|
|
309
|
+
// ApiName: "ModifiedBy",
|
|
310
|
+
// HideON: "both",
|
|
311
|
+
// Sequence: 101,
|
|
312
|
+
// UniqueID: "ModifiedBy",
|
|
313
|
+
// Schema: {
|
|
314
|
+
// Name: "ModifiedBy",
|
|
315
|
+
// DisplayName: "Modified By",
|
|
316
|
+
// HideON: "both",
|
|
317
|
+
// ApiName: "ModifiedBy",
|
|
318
|
+
// UIDataType: "lookup",
|
|
319
|
+
// LookupObject: "User",
|
|
320
|
+
// LookupFields: [
|
|
321
|
+
// "FirstName",
|
|
322
|
+
// "LastName"
|
|
323
|
+
// ],
|
|
324
|
+
// ExtraLookupFields: [
|
|
325
|
+
// "UserStatus",
|
|
326
|
+
// "IsAppUser"
|
|
327
|
+
// ]
|
|
328
|
+
// }
|
|
329
|
+
// }
|
|
330
|
+
// let createdDateObj = {
|
|
331
|
+
// Name: "CreatedDate",
|
|
332
|
+
// DisplayName: "Created Date",
|
|
333
|
+
// UniqueID: "CreatedDate",
|
|
334
|
+
// Sequence: 102,
|
|
335
|
+
// HideON: "both",
|
|
336
|
+
// Schema: {
|
|
337
|
+
// Name: "CreatedDate",
|
|
338
|
+
// HideON: "both",
|
|
339
|
+
// DisplayName: "Created Date",
|
|
340
|
+
// ApiName: "CreatedDate",
|
|
341
|
+
// UIDataType: "datetime"
|
|
342
|
+
// }
|
|
343
|
+
// };
|
|
344
|
+
// let modDateObj = {
|
|
345
|
+
// Name: "ModifiedDate",
|
|
346
|
+
// DisplayName: "Modified Date",
|
|
347
|
+
// UniqueID: "ModifiedDate",
|
|
348
|
+
// HideON: "both",
|
|
349
|
+
// Sequence: 103,
|
|
350
|
+
// Schema: {
|
|
351
|
+
// Name: "ModifiedDate",
|
|
352
|
+
// HideON: "both",
|
|
353
|
+
// DisplayName: "Modified Date",
|
|
354
|
+
// ApiName: "ModifiedDate",
|
|
355
|
+
// UIDataType: "datetime"
|
|
356
|
+
// }
|
|
357
|
+
// };
|
|
358
|
+
// if (pageData.Fields && pageData.Type == "ObjectGrid") {
|
|
359
|
+
// let idObject = {
|
|
360
|
+
// Name: "_id",
|
|
361
|
+
// Schema: { Name: "_id", DisplayName: "ID", ApiName: "ID", UIDataType: "objectid" },
|
|
362
|
+
// Sequence: 0,
|
|
363
|
+
// UniqueID: "_id",
|
|
364
|
+
// DisplayName: "ID",
|
|
365
|
+
// Width: 100
|
|
366
|
+
// }
|
|
367
|
+
// pageData.Fields.splice(0, 0, idObject);
|
|
368
|
+
// //By Kashish : To handle System Info Fields in Grid
|
|
369
|
+
// if (!pageData.Fields.find((x: any) => x.Name == 'CreatedBy'))
|
|
370
|
+
// pageData.Fields.push(createdByObj);
|
|
371
|
+
// if (!pageData.Fields.find((x: any) => x.Name == 'CreatedDate'))
|
|
372
|
+
// pageData.Fields.push(createdDateObj);
|
|
373
|
+
// if (!pageData.Fields.find((x: any) => x.Name == 'ModifiedBy'))
|
|
374
|
+
// pageData.Fields.push(modByObj);
|
|
375
|
+
// if (!pageData.Fields.find((x: any) => x.Name == 'ModifiedDate'))
|
|
376
|
+
// pageData.Fields.push(modDateObj);
|
|
377
|
+
// }
|
|
378
|
+
// if (pageData.Fields && pageData.Type == "ObjectDetail") {
|
|
379
|
+
// let idObject = {
|
|
380
|
+
// Name: "_id",
|
|
381
|
+
// Sequence: 0,
|
|
382
|
+
// UIDataType: "objectid",
|
|
383
|
+
// UniqueID: "_id",
|
|
384
|
+
// DisplayName: "ID",
|
|
385
|
+
// HideON: "both"
|
|
386
|
+
// }
|
|
387
|
+
// pageData.Fields == pageData.Fields.map((s: any) => {
|
|
388
|
+
// if (s.Schema && s.Schema.UIDataType == "collection") {
|
|
389
|
+
// s.Schema.Fields.splice(0, 0, idObject);
|
|
390
|
+
// //By Kashish : To handle System Info Fields
|
|
391
|
+
// if (createdByObj && createdDateObj && modByObj && modDateObj) {
|
|
392
|
+
// s.Schema.Fields.splice(-1, 0, createdByObj.Schema, createdDateObj.Schema, modByObj.Schema, modDateObj.Schema);
|
|
393
|
+
// }
|
|
394
|
+
// }
|
|
395
|
+
// })
|
|
396
|
+
// }
|
|
308
397
|
callback(pageData);
|
|
309
398
|
return [2 /*return*/];
|
|
310
399
|
}
|
|
@@ -3814,15 +3903,24 @@ function CheckPageAuthentication(pageData, msp_d, db, mdb, next) {
|
|
|
3814
3903
|
});
|
|
3815
3904
|
}
|
|
3816
3905
|
exports.CheckPageAuthentication = CheckPageAuthentication;
|
|
3817
|
-
|
|
3906
|
+
/*
|
|
3907
|
+
* Created by: Shahzaib as on 08-12-21
|
|
3908
|
+
* This is a common function and used to remove fields from Advanced/Report filter.
|
|
3909
|
+
* @param1: filter condition object from DB
|
|
3910
|
+
* @param2: fields name
|
|
3911
|
+
* @param3: identifier in string, like- Name or UniqueID
|
|
3912
|
+
* Desc: This is a common function and used to remove fields from Advanced/Report filter.
|
|
3913
|
+
* return value: array.
|
|
3914
|
+
*/
|
|
3915
|
+
function RemoveFieldsFromFilters(condition, fields, identifier) {
|
|
3818
3916
|
if (condition != undefined && condition.Filters.length > 0) {
|
|
3819
|
-
fields.forEach(function (
|
|
3820
|
-
condition.Filters = condition.Filters.filter(function (fltr) { return fltr
|
|
3917
|
+
fields.forEach(function (fld) {
|
|
3918
|
+
condition.Filters = condition.Filters.filter(function (fltr) { return fltr[identifier] !== fld; });
|
|
3821
3919
|
});
|
|
3822
3920
|
for (var i = 0; i < condition.Filters.length; i++) {
|
|
3823
3921
|
var objFilter = condition.Filters[i];
|
|
3824
3922
|
if (objFilter.Type == "Child") {
|
|
3825
|
-
RemoveFieldsFromFilters(objFilter, fields);
|
|
3923
|
+
RemoveFieldsFromFilters(objFilter, fields, identifier);
|
|
3826
3924
|
}
|
|
3827
3925
|
}
|
|
3828
3926
|
}
|