@acorex/connectivity 19.3.0 → 19.3.1
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/fesm2022/acorex-connectivity-mock.mjs +818 -624
- package/fesm2022/acorex-connectivity-mock.mjs.map +1 -1
- package/mock/index.d.ts +2 -0
- package/mock/lib/security-management/datasource-provider.mock.service.d.ts +4 -0
- package/mock/lib/security-management/index.d.ts +3 -0
- package/mock/lib/security-management/mock-data.d.ts +2 -2
- package/mock/lib/security-management/role.seeder.d.ts +9 -0
- package/mock/lib/security-management/user.seeder.d.ts +9 -0
- package/package.json +1 -1
- /package/mock/lib/{common/dashboard → dashboard-management}/dashboard.mock.data.d.ts +0 -0
- /package/mock/lib/{common/dashboard → dashboard-management}/dashboard.seeder.d.ts +0 -0
- /package/mock/lib/{common/dashboard → dashboard-management}/index.d.ts +0 -0
@@ -1,17 +1,16 @@
|
|
1
|
+
import { AXPDataGenerator, applySortArray, applyFilterArray } from '@acorex/platform/core';
|
2
|
+
import Dexie from 'dexie';
|
1
3
|
import { APPLICATION_SOURCE_NAME, MODULE_SOURCE_NAME, ENTITY_SOURCE_NAME, FEATURE_SOURCE_NAME, PERMISSION_SOURCE_NAME, PROPERTY_SOURCE_NAME, AXPModuleDesignerService } from '@acorex/modules/application-management';
|
2
4
|
import { RootConfig as RootConfig$1, AXMFolderServiceImpl, AXMDocumentServiceImpl, AXMFolderService, AXMDocumentService } from '@acorex/modules/document-management';
|
3
5
|
import { RootConfig as RootConfig$6, AXMNotificationEntityService } from '@acorex/modules/notification-management';
|
4
6
|
import { RootConfig as RootConfig$5, AXMDeviceSessionsServiceImpl, AXMSessionStatusTypes, AXMDeviceSessionsService } from '@acorex/modules/security-management';
|
5
7
|
import * as i1$1 from '@acorex/platform/auth';
|
6
8
|
import { AXPSessionService, AXPAuthModule } from '@acorex/platform/auth';
|
7
|
-
import {
|
9
|
+
import { AXPRegionalService, AXPFileStorageStatus, AXPFileStorageService, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
|
8
10
|
import { AXPEntityDefinitionRegistryService, AXP_DATA_SEEDER_TOKEN, AXPEntityStorageService } from '@acorex/platform/layout/entity';
|
9
11
|
import * as i0 from '@angular/core';
|
10
12
|
import { inject, Injectable, NgModule } from '@angular/core';
|
11
|
-
import {
|
12
|
-
import Dexie from 'dexie';
|
13
|
-
import { AXPBarChartWidget, AXPClockCalendarWidget, AXPWeatherWidget, AXPStickyNoteWidget, AXPNotificationWidget, AXPDonutChartWidget, AXPGaugeChartWidget, AXPChartColors, AXPLineChartWidget, AXPTaskListWidget } from '@acorex/platform/widgets';
|
14
|
-
import { RootConfig } from '@acorex/modules/dashboard-management';
|
13
|
+
import { AXPBarChartWidget, AXPClockCalendarWidget, AXPWeatherWidget, AXPStickyNoteWidget, AXPNotificationWidget, AXPDonutChartWidget, AXPGaugeChartWidget, AXPChartColors, AXPLineChartWidget, AXPTaskListWidget, RootConfig } from '@acorex/modules/dashboard-management';
|
15
14
|
import * as i1 from '@acorex/modules/conversation';
|
16
15
|
import { AXMConverstionModuleConst, AXMChatServiceImpl, AXMCommentServiceImpl, AXMChatModule, AXMChatService } from '@acorex/modules/conversation';
|
17
16
|
import { AXMFormTemplateTypes, RootConfig as RootConfig$2 } from '@acorex/modules/form-template-management';
|
@@ -24,116 +23,9 @@ import { firstValueFrom } from 'rxjs';
|
|
24
23
|
import { AXFileService } from '@acorex/core/file';
|
25
24
|
import { RootConfig as RootConfig$9 } from '@acorex/modules/project-management';
|
26
25
|
import { RootConfig as RootConfig$a } from '@acorex/modules/scheduler-job-management';
|
26
|
+
import { convertArrayToDataSource } from '@acorex/components/common';
|
27
27
|
import { RootConfig as RootConfig$b } from '@acorex/modules/text-template-management';
|
28
28
|
|
29
|
-
const APPLICATIONS = Array.from({ length: 5 }).map((_, i) => {
|
30
|
-
const source = ['appOne', 'appTwo', 'appThree', 'myCoolApp', 'awesomeApp', 'superApp'];
|
31
|
-
const name = AXPDataGenerator.pick(source);
|
32
|
-
return {
|
33
|
-
id: AXPDataGenerator.uuid(),
|
34
|
-
name: name,
|
35
|
-
title: name,
|
36
|
-
isArchived: AXPDataGenerator.boolean(),
|
37
|
-
};
|
38
|
-
});
|
39
|
-
const MODULES = Array.from({ length: 5 }).map((_, i) => {
|
40
|
-
const source = [
|
41
|
-
'UserManagement',
|
42
|
-
'Analytics',
|
43
|
-
'Reporting',
|
44
|
-
'PaymentGateway',
|
45
|
-
'NotificationService',
|
46
|
-
'InventoryManagement',
|
47
|
-
];
|
48
|
-
const name = AXPDataGenerator.pick(source);
|
49
|
-
return {
|
50
|
-
id: AXPDataGenerator.uuid(),
|
51
|
-
name: name,
|
52
|
-
title: name,
|
53
|
-
isArchived: AXPDataGenerator.boolean(),
|
54
|
-
};
|
55
|
-
});
|
56
|
-
const APPLICATIONS_MODULES = Array.from({ length: 5 }).map((_, i) => {
|
57
|
-
return {
|
58
|
-
id: AXPDataGenerator.uuid(),
|
59
|
-
application: AXPDataGenerator.pick(APPLICATIONS),
|
60
|
-
module: AXPDataGenerator.pick(MODULES),
|
61
|
-
};
|
62
|
-
});
|
63
|
-
const EDITIONS = Array.from({ length: 5 }).map((_, i) => {
|
64
|
-
const source = ['Standard', 'Premium', 'Gold', 'Silver', 'Bronze', 'Platinum', 'Enterprise'];
|
65
|
-
const name = AXPDataGenerator.pick(source);
|
66
|
-
return {
|
67
|
-
id: AXPDataGenerator.uuid(),
|
68
|
-
application: AXPDataGenerator.pick(APPLICATIONS),
|
69
|
-
name: name,
|
70
|
-
title: name,
|
71
|
-
isArchived: AXPDataGenerator.boolean(),
|
72
|
-
};
|
73
|
-
});
|
74
|
-
const FEATURES = Array.from({ length: 5 }).map((_, i) => {
|
75
|
-
const source = [
|
76
|
-
'User Authentication',
|
77
|
-
'Data Encryption',
|
78
|
-
'Real-time Notifications',
|
79
|
-
'Customizable Dashboards',
|
80
|
-
'API Access',
|
81
|
-
'Multi-language Support',
|
82
|
-
'Analytics and Reporting',
|
83
|
-
'Offline Mode',
|
84
|
-
];
|
85
|
-
const name = AXPDataGenerator.pick(source);
|
86
|
-
return {
|
87
|
-
id: AXPDataGenerator.uuid(),
|
88
|
-
moduleId: AXPDataGenerator.pick(MODULES).id,
|
89
|
-
name: name,
|
90
|
-
title: name,
|
91
|
-
isArchived: AXPDataGenerator.boolean(),
|
92
|
-
};
|
93
|
-
});
|
94
|
-
const ENTITIES = Array.from({ length: 5 }).map((_, i) => {
|
95
|
-
const source = ['User', 'Product', 'Order', 'Customer', 'Transaction', 'Category', 'Review', 'InventoryItem'];
|
96
|
-
const name = AXPDataGenerator.pick(source);
|
97
|
-
return {
|
98
|
-
id: AXPDataGenerator.uuid(),
|
99
|
-
moduleId: AXPDataGenerator.pick(MODULES).id,
|
100
|
-
name: name,
|
101
|
-
title: name,
|
102
|
-
isArchived: AXPDataGenerator.boolean(),
|
103
|
-
};
|
104
|
-
});
|
105
|
-
const PERMISSIONS = Array.from({ length: 5 }).map((_, i) => {
|
106
|
-
const source = ['Read', 'Write', 'Update', 'Delete', 'ManageUsers', 'ViewReports', 'AccessSettings', 'CreateContent'];
|
107
|
-
const name = AXPDataGenerator.pick(source);
|
108
|
-
return {
|
109
|
-
id: AXPDataGenerator.uuid(),
|
110
|
-
moduleId: AXPDataGenerator.pick(MODULES).id,
|
111
|
-
name: name,
|
112
|
-
title: name,
|
113
|
-
isArchived: AXPDataGenerator.boolean(),
|
114
|
-
};
|
115
|
-
});
|
116
|
-
const PROPERTIES = Array.from({ length: 10 }).map((_, i) => {
|
117
|
-
const source = [
|
118
|
-
'property1',
|
119
|
-
'property2',
|
120
|
-
'property3',
|
121
|
-
'property4',
|
122
|
-
'property5',
|
123
|
-
'property6',
|
124
|
-
'property7',
|
125
|
-
'property8',
|
126
|
-
];
|
127
|
-
const name = AXPDataGenerator.pick(source);
|
128
|
-
return {
|
129
|
-
id: AXPDataGenerator.uuid(),
|
130
|
-
entityId: AXPDataGenerator.pick(ENTITIES).id,
|
131
|
-
name: name,
|
132
|
-
title: name,
|
133
|
-
path: name,
|
134
|
-
};
|
135
|
-
});
|
136
|
-
|
137
29
|
class AXPDexieEntityStorageService extends Dexie {
|
138
30
|
constructor() {
|
139
31
|
super('ACoreXPlatform');
|
@@ -262,6 +154,114 @@ class AXPDexieEntityStorageService extends Dexie {
|
|
262
154
|
// }
|
263
155
|
// }
|
264
156
|
|
157
|
+
const APPLICATIONS = Array.from({ length: 5 }).map((_, i) => {
|
158
|
+
const source = ['appOne', 'appTwo', 'appThree', 'myCoolApp', 'awesomeApp', 'superApp'];
|
159
|
+
const name = AXPDataGenerator.pick(source);
|
160
|
+
return {
|
161
|
+
id: AXPDataGenerator.uuid(),
|
162
|
+
name: name,
|
163
|
+
title: name,
|
164
|
+
isArchived: AXPDataGenerator.boolean(),
|
165
|
+
};
|
166
|
+
});
|
167
|
+
const MODULES = Array.from({ length: 5 }).map((_, i) => {
|
168
|
+
const source = [
|
169
|
+
'UserManagement',
|
170
|
+
'Analytics',
|
171
|
+
'Reporting',
|
172
|
+
'PaymentGateway',
|
173
|
+
'NotificationService',
|
174
|
+
'InventoryManagement',
|
175
|
+
];
|
176
|
+
const name = AXPDataGenerator.pick(source);
|
177
|
+
return {
|
178
|
+
id: AXPDataGenerator.uuid(),
|
179
|
+
name: name,
|
180
|
+
title: name,
|
181
|
+
isArchived: AXPDataGenerator.boolean(),
|
182
|
+
};
|
183
|
+
});
|
184
|
+
const APPLICATIONS_MODULES = Array.from({ length: 5 }).map((_, i) => {
|
185
|
+
return {
|
186
|
+
id: AXPDataGenerator.uuid(),
|
187
|
+
application: AXPDataGenerator.pick(APPLICATIONS),
|
188
|
+
module: AXPDataGenerator.pick(MODULES),
|
189
|
+
};
|
190
|
+
});
|
191
|
+
const EDITIONS = Array.from({ length: 5 }).map((_, i) => {
|
192
|
+
const source = ['Standard', 'Premium', 'Gold', 'Silver', 'Bronze', 'Platinum', 'Enterprise'];
|
193
|
+
const name = AXPDataGenerator.pick(source);
|
194
|
+
return {
|
195
|
+
id: AXPDataGenerator.uuid(),
|
196
|
+
application: AXPDataGenerator.pick(APPLICATIONS),
|
197
|
+
name: name,
|
198
|
+
title: name,
|
199
|
+
isArchived: AXPDataGenerator.boolean(),
|
200
|
+
};
|
201
|
+
});
|
202
|
+
const FEATURES = Array.from({ length: 5 }).map((_, i) => {
|
203
|
+
const source = [
|
204
|
+
'User Authentication',
|
205
|
+
'Data Encryption',
|
206
|
+
'Real-time Notifications',
|
207
|
+
'Customizable Dashboards',
|
208
|
+
'API Access',
|
209
|
+
'Multi-language Support',
|
210
|
+
'Analytics and Reporting',
|
211
|
+
'Offline Mode',
|
212
|
+
];
|
213
|
+
const name = AXPDataGenerator.pick(source);
|
214
|
+
return {
|
215
|
+
id: AXPDataGenerator.uuid(),
|
216
|
+
moduleId: AXPDataGenerator.pick(MODULES).id,
|
217
|
+
name: name,
|
218
|
+
title: name,
|
219
|
+
isArchived: AXPDataGenerator.boolean(),
|
220
|
+
};
|
221
|
+
});
|
222
|
+
const ENTITIES = Array.from({ length: 5 }).map((_, i) => {
|
223
|
+
const source = ['User', 'Product', 'Order', 'Customer', 'Transaction', 'Category', 'Review', 'InventoryItem'];
|
224
|
+
const name = AXPDataGenerator.pick(source);
|
225
|
+
return {
|
226
|
+
id: AXPDataGenerator.uuid(),
|
227
|
+
moduleId: AXPDataGenerator.pick(MODULES).id,
|
228
|
+
name: name,
|
229
|
+
title: name,
|
230
|
+
isArchived: AXPDataGenerator.boolean(),
|
231
|
+
};
|
232
|
+
});
|
233
|
+
const PERMISSIONS = Array.from({ length: 5 }).map((_, i) => {
|
234
|
+
const source = ['Read', 'Write', 'Update', 'Delete', 'ManageUsers', 'ViewReports', 'AccessSettings', 'CreateContent'];
|
235
|
+
const name = AXPDataGenerator.pick(source);
|
236
|
+
return {
|
237
|
+
id: AXPDataGenerator.uuid(),
|
238
|
+
moduleId: AXPDataGenerator.pick(MODULES).id,
|
239
|
+
name: name,
|
240
|
+
title: name,
|
241
|
+
isArchived: AXPDataGenerator.boolean(),
|
242
|
+
};
|
243
|
+
});
|
244
|
+
const PROPERTIES = Array.from({ length: 10 }).map((_, i) => {
|
245
|
+
const source = [
|
246
|
+
'property1',
|
247
|
+
'property2',
|
248
|
+
'property3',
|
249
|
+
'property4',
|
250
|
+
'property5',
|
251
|
+
'property6',
|
252
|
+
'property7',
|
253
|
+
'property8',
|
254
|
+
];
|
255
|
+
const name = AXPDataGenerator.pick(source);
|
256
|
+
return {
|
257
|
+
id: AXPDataGenerator.uuid(),
|
258
|
+
entityId: AXPDataGenerator.pick(ENTITIES).id,
|
259
|
+
name: name,
|
260
|
+
title: name,
|
261
|
+
path: name,
|
262
|
+
};
|
263
|
+
});
|
264
|
+
|
265
265
|
class AXCApplicationTemplateDataSeeder {
|
266
266
|
constructor() {
|
267
267
|
this.storageService = inject(AXPDexieEntityStorageService);
|
@@ -375,41 +375,245 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
375
375
|
}]
|
376
376
|
}] });
|
377
377
|
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
'task-list',
|
378
|
+
const tenantsMock = [
|
379
|
+
{
|
380
|
+
id: '99',
|
381
|
+
name: 'acorex-tenant',
|
382
|
+
title: 'ACoreX Platform Tenant',
|
383
|
+
},
|
384
|
+
{
|
385
|
+
id: '1',
|
386
|
+
name: 'demo-tenant',
|
387
|
+
title: 'DEMO Tenant',
|
388
|
+
},
|
390
389
|
];
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
390
|
+
const applications = [
|
391
|
+
{
|
392
|
+
id: AXPDataGenerator.uuid(),
|
393
|
+
name: 'demo',
|
394
|
+
title: 'DEMO Application',
|
395
|
+
version: '1.0.0',
|
396
|
+
editionName: 'Standard',
|
397
|
+
},
|
398
|
+
{
|
399
|
+
id: AXPDataGenerator.uuid(),
|
400
|
+
name: 'platform',
|
401
|
+
title: 'Platform Console',
|
402
|
+
version: '1.0.0',
|
403
|
+
editionName: 'Standard',
|
404
|
+
},
|
405
|
+
];
|
406
|
+
// Now we only define role structure without permissions
|
407
|
+
const mockRoleDefinitions = [
|
408
|
+
{
|
409
|
+
id: '1001',
|
410
|
+
name: 'admin',
|
411
|
+
title: 'Administrator',
|
412
|
+
description: 'Full system access with all administrative privileges',
|
413
|
+
permissions: [], // Will be filled dynamically
|
414
|
+
},
|
415
|
+
{
|
416
|
+
id: '1002',
|
417
|
+
name: 'manager',
|
418
|
+
title: 'Manager',
|
419
|
+
description: 'Manages users and has access to most system features',
|
420
|
+
permissions: [],
|
421
|
+
},
|
422
|
+
{
|
423
|
+
id: '1003',
|
424
|
+
name: 'user',
|
425
|
+
title: 'Regular User',
|
426
|
+
description: 'Standard user with basic system access',
|
427
|
+
permissions: [],
|
428
|
+
},
|
429
|
+
{
|
430
|
+
id: '1004',
|
431
|
+
name: 'readonly',
|
432
|
+
title: 'Read Only',
|
433
|
+
description: 'View-only access to specific system areas',
|
434
|
+
permissions: [],
|
435
|
+
},
|
436
|
+
{
|
437
|
+
id: '1005',
|
438
|
+
name: 'support',
|
439
|
+
title: 'Support Staff',
|
440
|
+
description: 'Customer support and ticket management access',
|
441
|
+
permissions: [],
|
442
|
+
},
|
443
|
+
{
|
444
|
+
id: '1006',
|
445
|
+
name: 'hr',
|
446
|
+
title: 'Human Resources',
|
447
|
+
description: 'Access to HR-related features and user management',
|
448
|
+
permissions: [],
|
449
|
+
},
|
450
|
+
{
|
451
|
+
id: '1007',
|
452
|
+
name: 'finance',
|
453
|
+
title: 'Finance',
|
454
|
+
description: 'Access to financial reports and invoicing features',
|
455
|
+
permissions: [],
|
456
|
+
},
|
457
|
+
{
|
458
|
+
id: '1008',
|
459
|
+
name: 'dev',
|
460
|
+
title: 'Developer',
|
461
|
+
description: 'Technical access to development and debugging features',
|
462
|
+
permissions: [],
|
463
|
+
},
|
464
|
+
];
|
465
|
+
const mockUsers = [
|
466
|
+
{
|
467
|
+
id: AXPDataGenerator.uuid(),
|
468
|
+
username: 'johndoe',
|
469
|
+
firstName: 'John',
|
470
|
+
lastName: 'Doe',
|
471
|
+
nationalCode: '1234567890',
|
472
|
+
mobile: '555-123-4567',
|
473
|
+
roleIds: [
|
474
|
+
{ id: '1001', title: 'Administrator' },
|
475
|
+
{ id: '1002', title: 'Manager' },
|
476
|
+
],
|
477
|
+
},
|
478
|
+
{
|
479
|
+
id: AXPDataGenerator.uuid(),
|
480
|
+
username: 'janesmith',
|
481
|
+
firstName: 'Jane',
|
482
|
+
lastName: 'Smith',
|
483
|
+
nationalCode: '0987654321',
|
484
|
+
mobile: '555-987-6543',
|
485
|
+
roleIds: [
|
486
|
+
{ id: '1002', title: 'Manager' },
|
487
|
+
{ id: '1006', title: 'Human Resources' },
|
488
|
+
],
|
489
|
+
},
|
490
|
+
{
|
491
|
+
id: AXPDataGenerator.uuid(),
|
492
|
+
username: 'mikeross',
|
493
|
+
firstName: 'Mike',
|
494
|
+
lastName: 'Ross',
|
495
|
+
nationalCode: '2468135790',
|
496
|
+
mobile: '555-246-8135',
|
497
|
+
roleIds: [
|
498
|
+
{ id: '1008', title: 'Developer' },
|
499
|
+
{ id: '1005', title: 'Support Staff' },
|
500
|
+
],
|
501
|
+
},
|
502
|
+
{
|
503
|
+
id: AXPDataGenerator.uuid(),
|
504
|
+
username: 'emilyparker',
|
505
|
+
firstName: 'Emily',
|
506
|
+
lastName: 'Parker',
|
507
|
+
nationalCode: '1357924680',
|
508
|
+
mobile: '555-135-7924',
|
509
|
+
roleIds: [{ id: '1003', title: 'Regular User' }],
|
510
|
+
},
|
511
|
+
{
|
512
|
+
id: AXPDataGenerator.uuid(),
|
513
|
+
username: 'robertjohnson',
|
514
|
+
firstName: 'Robert',
|
515
|
+
lastName: 'Johnson',
|
516
|
+
nationalCode: '9876543210',
|
517
|
+
mobile: '555-987-6542',
|
518
|
+
roleIds: [{ id: '1007', title: 'Finance' }],
|
519
|
+
},
|
520
|
+
{
|
521
|
+
id: AXPDataGenerator.uuid(),
|
522
|
+
username: 'sarahwilliams',
|
523
|
+
firstName: 'Sarah',
|
524
|
+
lastName: 'Williams',
|
525
|
+
nationalCode: '5678901234',
|
526
|
+
mobile: '555-567-8901',
|
527
|
+
roleIds: [{ id: '1004', title: 'Read Only' }],
|
528
|
+
},
|
529
|
+
{
|
530
|
+
id: AXPDataGenerator.uuid(),
|
531
|
+
username: 'davidbrown',
|
532
|
+
firstName: 'David',
|
533
|
+
lastName: 'Brown',
|
534
|
+
nationalCode: '3456789012',
|
535
|
+
mobile: '555-345-6789',
|
536
|
+
roleIds: [
|
537
|
+
{ id: '1003', title: 'Regular User' },
|
538
|
+
{ id: '1005', title: 'Support Staff' },
|
539
|
+
],
|
540
|
+
},
|
541
|
+
{
|
542
|
+
id: AXPDataGenerator.uuid(),
|
543
|
+
username: 'lisadavis',
|
544
|
+
firstName: 'Lisa',
|
545
|
+
lastName: 'Davis',
|
546
|
+
nationalCode: '7890123456',
|
547
|
+
mobile: '555-789-0123',
|
548
|
+
roleIds: [{ id: '1006', title: 'Human Resources' }],
|
549
|
+
},
|
550
|
+
{
|
551
|
+
id: AXPDataGenerator.uuid(),
|
552
|
+
username: 'michaelwilson',
|
553
|
+
firstName: 'Michael',
|
554
|
+
lastName: 'Wilson',
|
555
|
+
nationalCode: '6789012345',
|
556
|
+
mobile: '555-678-9012',
|
557
|
+
roleIds: [
|
558
|
+
{ id: '1002', title: 'Manager' },
|
559
|
+
{ id: '1007', title: 'Finance' },
|
560
|
+
],
|
561
|
+
},
|
562
|
+
{
|
563
|
+
id: AXPDataGenerator.uuid(),
|
564
|
+
username: 'amandamiller',
|
565
|
+
firstName: 'Amanda',
|
566
|
+
lastName: 'Miller',
|
567
|
+
nationalCode: '4567890123',
|
568
|
+
mobile: '555-456-7890',
|
569
|
+
roleIds: [{ id: '1008', title: 'Developer' }],
|
570
|
+
},
|
571
|
+
{
|
572
|
+
id: 'a683a19a-e3eb-46a7-b81c-7cf9468ae831',
|
573
|
+
username: 'root',
|
574
|
+
firstName: 'Root',
|
575
|
+
lastName: 'Root',
|
576
|
+
nationalCode: '4567890124',
|
577
|
+
mobile: '555-456-7891',
|
578
|
+
roleIds: [{ id: '1001', title: 'Administrator' }],
|
579
|
+
},
|
580
|
+
];
|
581
|
+
|
582
|
+
// Widget types that can be used for generating mock data
|
583
|
+
const widgetTypes = [
|
584
|
+
'bar-chart',
|
585
|
+
'donut-chart',
|
586
|
+
'gauge-chart',
|
587
|
+
'line-chart',
|
588
|
+
'map',
|
589
|
+
'clock-calendar',
|
590
|
+
'weather',
|
591
|
+
'sticky-note',
|
592
|
+
'notification',
|
593
|
+
'task-list',
|
594
|
+
];
|
595
|
+
// Generate bar chart widget
|
596
|
+
function generateBarChartWidget() {
|
597
|
+
const uniqueId = AXPDataGenerator.uuid();
|
598
|
+
return {
|
599
|
+
config: {
|
600
|
+
id: AXPDataGenerator.uuid(),
|
601
|
+
...AXPBarChartWidget?.meta?.['dimensions'],
|
602
|
+
},
|
603
|
+
node: {
|
604
|
+
name: `bar-chart-${uniqueId}`,
|
605
|
+
path: `bar-chart-${uniqueId}`,
|
606
|
+
type: 'bar-chart',
|
607
|
+
defaultValue: [
|
608
|
+
{ id: 'a', label: 'Category A', value: AXPDataGenerator.number(30, 100), color: 'green' },
|
609
|
+
{ id: 'b', label: 'Category B', value: AXPDataGenerator.number(30, 100) },
|
610
|
+
{ id: 'c', label: 'Category C', value: AXPDataGenerator.number(30, 100) },
|
611
|
+
{ id: 'd', label: 'Category D', value: AXPDataGenerator.number(10, 30) },
|
612
|
+
{ id: 'e', label: 'Category E', value: AXPDataGenerator.number(70, 100) },
|
613
|
+
],
|
614
|
+
options: {
|
615
|
+
width: 600,
|
616
|
+
height: 400,
|
413
617
|
color: ['red', 'yellow', 'blue'],
|
414
618
|
hasConfiguration: true,
|
415
619
|
},
|
@@ -418,10 +622,10 @@ function generateBarChartWidget() {
|
|
418
622
|
}
|
419
623
|
// Generate clock-calendar widget
|
420
624
|
function generateClockCalendarWidget() {
|
421
|
-
const uniqueId = AXPDataGenerator
|
625
|
+
const uniqueId = AXPDataGenerator.uuid();
|
422
626
|
return {
|
423
627
|
config: {
|
424
|
-
id: AXPDataGenerator
|
628
|
+
id: AXPDataGenerator.uuid(),
|
425
629
|
...AXPClockCalendarWidget?.meta?.['dimensions'],
|
426
630
|
},
|
427
631
|
node: {
|
@@ -432,11 +636,11 @@ function generateClockCalendarWidget() {
|
|
432
636
|
showDigital: true,
|
433
637
|
showAnalog: true,
|
434
638
|
showDate: true,
|
435
|
-
use24Hour: AXPDataGenerator
|
639
|
+
use24Hour: AXPDataGenerator.boolean(),
|
436
640
|
digitalClockSize: 3,
|
437
641
|
analogClockSize: 200,
|
438
642
|
bgColor: '#ffffff',
|
439
|
-
accentColor: AXPDataGenerator
|
643
|
+
accentColor: AXPDataGenerator.color(),
|
440
644
|
}),
|
441
645
|
options: {
|
442
646
|
hasConfiguration: true,
|
@@ -446,10 +650,10 @@ function generateClockCalendarWidget() {
|
|
446
650
|
}
|
447
651
|
// Generate weather widget
|
448
652
|
function generateWeatherWidget() {
|
449
|
-
const uniqueId = AXPDataGenerator
|
653
|
+
const uniqueId = AXPDataGenerator.uuid();
|
450
654
|
return {
|
451
655
|
config: {
|
452
|
-
id: AXPDataGenerator
|
656
|
+
id: AXPDataGenerator.uuid(),
|
453
657
|
...AXPWeatherWidget?.meta?.['dimensions'],
|
454
658
|
},
|
455
659
|
node: {
|
@@ -457,7 +661,7 @@ function generateWeatherWidget() {
|
|
457
661
|
path: `weather-${uniqueId}`,
|
458
662
|
type: 'weather',
|
459
663
|
options: {
|
460
|
-
city: AXPDataGenerator
|
664
|
+
city: AXPDataGenerator.city(),
|
461
665
|
hasConfiguration: true,
|
462
666
|
},
|
463
667
|
meta: {
|
@@ -468,18 +672,18 @@ function generateWeatherWidget() {
|
|
468
672
|
}
|
469
673
|
// Generate sticky-note widget
|
470
674
|
function generateStickyNoteWidget() {
|
471
|
-
const uniqueId = AXPDataGenerator
|
675
|
+
const uniqueId = AXPDataGenerator.uuid();
|
472
676
|
return {
|
473
677
|
config: {
|
474
|
-
id: AXPDataGenerator
|
678
|
+
id: AXPDataGenerator.uuid(),
|
475
679
|
...AXPStickyNoteWidget?.meta?.['dimensions'],
|
476
680
|
},
|
477
681
|
node: {
|
478
682
|
name: `sticky-note-${uniqueId}`,
|
479
683
|
path: `sticky-note-${uniqueId}`,
|
480
684
|
type: 'sticky-note',
|
481
|
-
defaultValue: `Note from ${AXPDataGenerator
|
482
|
-
Remember to complete the ${AXPDataGenerator
|
685
|
+
defaultValue: `Note from ${AXPDataGenerator.firstName()} ${AXPDataGenerator.lastName()}:
|
686
|
+
Remember to complete the ${AXPDataGenerator.pick(['project', 'task', 'meeting', 'report'])} by end of day.`,
|
483
687
|
options: {
|
484
688
|
hasConfiguration: false,
|
485
689
|
},
|
@@ -488,27 +692,27 @@ Remember to complete the ${AXPDataGenerator$1.pick(['project', 'task', 'meeting'
|
|
488
692
|
}
|
489
693
|
// Generate notification widget
|
490
694
|
function generateNotificationWidget() {
|
491
|
-
const uniqueId = AXPDataGenerator
|
695
|
+
const uniqueId = AXPDataGenerator.uuid();
|
492
696
|
// Generate 3-8 random notifications
|
493
|
-
const notifications = Array.from({ length: AXPDataGenerator
|
494
|
-
const firstName = AXPDataGenerator
|
495
|
-
const lastName = AXPDataGenerator
|
697
|
+
const notifications = Array.from({ length: AXPDataGenerator.number(3, 8) }).map((_, index) => {
|
698
|
+
const firstName = AXPDataGenerator.firstName();
|
699
|
+
const lastName = AXPDataGenerator.lastName();
|
496
700
|
// Select a random notification type
|
497
|
-
const type = AXPDataGenerator
|
701
|
+
const type = AXPDataGenerator.pick(['File', 'Person', 'Notification']);
|
498
702
|
// Select a random notification priority
|
499
|
-
const priority = AXPDataGenerator
|
703
|
+
const priority = AXPDataGenerator.pick(['Warning', 'Danger', 'Notice']);
|
500
704
|
// Create message based on type
|
501
705
|
let message = '';
|
502
706
|
switch (type) {
|
503
707
|
case 'File':
|
504
|
-
message = `New document "${AXPDataGenerator
|
708
|
+
message = `New document "${AXPDataGenerator.alphabet(AXPDataGenerator.number(5, 20))}.${AXPDataGenerator.pick([
|
505
709
|
'pdf',
|
506
710
|
'docx',
|
507
711
|
'xlsx',
|
508
712
|
])}" has been shared with you`;
|
509
713
|
break;
|
510
714
|
case 'Person':
|
511
|
-
message = `${firstName} ${lastName} ${AXPDataGenerator
|
715
|
+
message = `${firstName} ${lastName} ${AXPDataGenerator.pick([
|
512
716
|
'sent you a message',
|
513
717
|
'mentioned you in a comment',
|
514
718
|
'added you to a project',
|
@@ -516,7 +720,7 @@ function generateNotificationWidget() {
|
|
516
720
|
])}`;
|
517
721
|
break;
|
518
722
|
case 'Notification':
|
519
|
-
message = AXPDataGenerator
|
723
|
+
message = AXPDataGenerator.pick([
|
520
724
|
'Your task is due tomorrow',
|
521
725
|
'Meeting starts in 15 minutes',
|
522
726
|
'Your report has been approved',
|
@@ -529,11 +733,11 @@ function generateNotificationWidget() {
|
|
529
733
|
const now = new Date();
|
530
734
|
const weekAgo = new Date();
|
531
735
|
weekAgo.setDate(now.getDate() - 7);
|
532
|
-
const timestamp = AXPDataGenerator
|
736
|
+
const timestamp = AXPDataGenerator.date(weekAgo, now);
|
533
737
|
// Make some notifications read and some unread
|
534
|
-
const isRead = index < 2 ? false : AXPDataGenerator
|
738
|
+
const isRead = index < 2 ? false : AXPDataGenerator.boolean();
|
535
739
|
return {
|
536
|
-
id: AXPDataGenerator
|
740
|
+
id: AXPDataGenerator.uuid(),
|
537
741
|
title: `${firstName} ${lastName}`,
|
538
742
|
body: message,
|
539
743
|
channel: 'InApp',
|
@@ -542,7 +746,7 @@ function generateNotificationWidget() {
|
|
542
746
|
data: {},
|
543
747
|
},
|
544
748
|
user: {
|
545
|
-
id: AXPDataGenerator
|
749
|
+
id: AXPDataGenerator.uuid(),
|
546
750
|
name: `${firstName} ${lastName}`,
|
547
751
|
// image: `assets/images/avatar/user-${AXPDataGenerator.number(1, 12)}.png`,
|
548
752
|
image: `https://picsum.photos/300/300`,
|
@@ -550,16 +754,16 @@ function generateNotificationWidget() {
|
|
550
754
|
template: {
|
551
755
|
category: 'Inbox',
|
552
756
|
priority,
|
553
|
-
icon: `fa-light fa-${AXPDataGenerator
|
554
|
-
isPinned: AXPDataGenerator
|
757
|
+
icon: `fa-light fa-${AXPDataGenerator.pick(['envelope', 'bell', 'file', 'user', 'calendar'])}`,
|
758
|
+
isPinned: AXPDataGenerator.boolean(),
|
555
759
|
},
|
556
|
-
readAt: isRead ? AXPDataGenerator
|
760
|
+
readAt: isRead ? AXPDataGenerator.date(weekAgo, timestamp) : null,
|
557
761
|
createdAt: timestamp,
|
558
762
|
};
|
559
763
|
});
|
560
764
|
return {
|
561
765
|
config: {
|
562
|
-
id: AXPDataGenerator
|
766
|
+
id: AXPDataGenerator.uuid(),
|
563
767
|
...AXPNotificationWidget?.meta?.['dimensions'],
|
564
768
|
},
|
565
769
|
node: {
|
@@ -581,10 +785,10 @@ function generateNotificationWidget() {
|
|
581
785
|
}
|
582
786
|
// Generate donut-chart widget
|
583
787
|
function generateDonutChartWidget() {
|
584
|
-
const uniqueId = AXPDataGenerator
|
788
|
+
const uniqueId = AXPDataGenerator.uuid();
|
585
789
|
return {
|
586
790
|
config: {
|
587
|
-
id: AXPDataGenerator
|
791
|
+
id: AXPDataGenerator.uuid(),
|
588
792
|
...AXPDonutChartWidget?.meta?.['dimensions'],
|
589
793
|
},
|
590
794
|
node: {
|
@@ -592,10 +796,10 @@ function generateDonutChartWidget() {
|
|
592
796
|
path: `donut-chart-${uniqueId}`,
|
593
797
|
type: 'donut-chart',
|
594
798
|
defaultValue: [
|
595
|
-
{ id: 'a', name: 'Apples', value: AXPDataGenerator
|
596
|
-
{ id: 'b', name: 'Bananas', value: AXPDataGenerator
|
597
|
-
{ id: 'c', name: AXPDataGenerator
|
598
|
-
{ id: 'd', name: 'Dates', value: AXPDataGenerator
|
799
|
+
{ id: 'a', name: 'Apples', value: AXPDataGenerator.number(20, 50), color: '#E57373' },
|
800
|
+
{ id: 'b', name: 'Bananas', value: AXPDataGenerator.number(20, 40), color: '#FFF176' },
|
801
|
+
{ id: 'c', name: AXPDataGenerator.firstName(), value: AXPDataGenerator.number(10, 30), color: '#F06292' },
|
802
|
+
{ id: 'd', name: 'Dates', value: AXPDataGenerator.number(5, 20), color: '#9575CD' },
|
599
803
|
],
|
600
804
|
options: {
|
601
805
|
width: 500,
|
@@ -611,17 +815,17 @@ function generateDonutChartWidget() {
|
|
611
815
|
}
|
612
816
|
// Generate gauge-chart widget
|
613
817
|
function generateGaugeChartWidget() {
|
614
|
-
const uniqueId = AXPDataGenerator
|
818
|
+
const uniqueId = AXPDataGenerator.uuid();
|
615
819
|
return {
|
616
820
|
config: {
|
617
|
-
id: AXPDataGenerator
|
821
|
+
id: AXPDataGenerator.uuid(),
|
618
822
|
...AXPGaugeChartWidget?.meta?.['dimensions'],
|
619
823
|
},
|
620
824
|
node: {
|
621
825
|
name: `gauge-chart-${uniqueId}`,
|
622
826
|
path: `gauge-chart-${uniqueId}`,
|
623
827
|
type: 'gauge-chart',
|
624
|
-
defaultValue: AXPDataGenerator
|
828
|
+
defaultValue: AXPDataGenerator.number(30, 90),
|
625
829
|
options: {
|
626
830
|
width: 250,
|
627
831
|
height: 250,
|
@@ -635,22 +839,22 @@ function generateGaugeChartWidget() {
|
|
635
839
|
}
|
636
840
|
// Generate line chart widget
|
637
841
|
function generateLineChartWidget() {
|
638
|
-
const uniqueId = AXPDataGenerator
|
842
|
+
const uniqueId = AXPDataGenerator.uuid();
|
639
843
|
// Generate random data points for the line chart
|
640
844
|
const generateDataPoints = (seriesName, count, color) => {
|
641
845
|
return Array.from({ length: count }).map((_, index) => ({
|
642
846
|
id: `${seriesName}-${index}`,
|
643
847
|
label: `Point ${index + 1}`,
|
644
|
-
value: AXPDataGenerator
|
848
|
+
value: AXPDataGenerator.number(10, 100),
|
645
849
|
xValue: index + 1,
|
646
850
|
seriesName,
|
647
851
|
color,
|
648
852
|
}));
|
649
853
|
};
|
650
854
|
// Create 1-3 data series
|
651
|
-
const seriesCount = AXPDataGenerator
|
855
|
+
const seriesCount = AXPDataGenerator.number(1, 3);
|
652
856
|
const seriesNames = ['Revenue', 'Users', 'Growth', 'Sales', 'Traffic', 'Engagement'];
|
653
|
-
const pointsPerSeries = AXPDataGenerator
|
857
|
+
const pointsPerSeries = AXPDataGenerator.number(5, 10);
|
654
858
|
// Generate data organized by series for better visualization
|
655
859
|
const allDataSeries = [];
|
656
860
|
for (let i = 0; i < seriesCount; i++) {
|
@@ -664,7 +868,7 @@ function generateLineChartWidget() {
|
|
664
868
|
const chartData = seriesCount === 1 ? allDataSeries[0] : allDataSeries.flat();
|
665
869
|
return {
|
666
870
|
config: {
|
667
|
-
id: AXPDataGenerator
|
871
|
+
id: AXPDataGenerator.uuid(),
|
668
872
|
...AXPLineChartWidget?.meta?.['dimensions'],
|
669
873
|
},
|
670
874
|
node: {
|
@@ -675,9 +879,9 @@ function generateLineChartWidget() {
|
|
675
879
|
options: {
|
676
880
|
width: 600,
|
677
881
|
height: 400,
|
678
|
-
lineWidth: AXPDataGenerator
|
882
|
+
lineWidth: AXPDataGenerator.number(1, 4),
|
679
883
|
showPoints: true,
|
680
|
-
pointRadius: AXPDataGenerator
|
884
|
+
pointRadius: AXPDataGenerator.number(3, 6),
|
681
885
|
smoothLine: true,
|
682
886
|
fillArea: false, // Set fillArea to false by default to avoid unwanted fills
|
683
887
|
fillOpacity: 0.1, // Use very light opacity if fill is enabled
|
@@ -689,22 +893,22 @@ function generateLineChartWidget() {
|
|
689
893
|
}
|
690
894
|
// Generate task list widget
|
691
895
|
function generateTaskListWidget() {
|
692
|
-
const uniqueId = AXPDataGenerator
|
896
|
+
const uniqueId = AXPDataGenerator.uuid();
|
693
897
|
// Generate 5-12 random tasks
|
694
|
-
const tasks = Array.from({ length: AXPDataGenerator
|
898
|
+
const tasks = Array.from({ length: AXPDataGenerator.number(5, 12) }).map((_, index) => {
|
695
899
|
// Generate random due date between yesterday and next month
|
696
900
|
const yesterday = new Date();
|
697
901
|
yesterday.setDate(yesterday.getDate() - 1);
|
698
902
|
const nextMonth = new Date();
|
699
903
|
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
700
|
-
const dueDate = AXPDataGenerator
|
904
|
+
const dueDate = AXPDataGenerator.date(yesterday, nextMonth);
|
701
905
|
// Generate random task data
|
702
|
-
const firstName = AXPDataGenerator
|
703
|
-
const lastName = AXPDataGenerator
|
906
|
+
const firstName = AXPDataGenerator.firstName();
|
907
|
+
const lastName = AXPDataGenerator.lastName();
|
704
908
|
// Random priority
|
705
|
-
const priority = AXPDataGenerator
|
909
|
+
const priority = AXPDataGenerator.pick(['low', 'medium', 'high']);
|
706
910
|
// Random category
|
707
|
-
const category = AXPDataGenerator
|
911
|
+
const category = AXPDataGenerator.pick([
|
708
912
|
'Development',
|
709
913
|
'Design',
|
710
914
|
'Marketing',
|
@@ -714,11 +918,11 @@ function generateTaskListWidget() {
|
|
714
918
|
'Documentation',
|
715
919
|
]);
|
716
920
|
// Generate sample data for second person in a meeting task
|
717
|
-
const secondPersonFirstName = AXPDataGenerator
|
718
|
-
const secondPersonLastName = AXPDataGenerator
|
921
|
+
const secondPersonFirstName = AXPDataGenerator.firstName();
|
922
|
+
const secondPersonLastName = AXPDataGenerator.lastName();
|
719
923
|
// Random task title
|
720
|
-
const taskTitle = AXPDataGenerator
|
721
|
-
`${AXPDataGenerator
|
924
|
+
const taskTitle = AXPDataGenerator.pick([
|
925
|
+
`${AXPDataGenerator.pick(['Create', 'Update', 'Fix', 'Review', 'Finalize'])} ${AXPDataGenerator.pick([
|
722
926
|
'dashboard',
|
723
927
|
'report',
|
724
928
|
'component',
|
@@ -726,25 +930,25 @@ function generateTaskListWidget() {
|
|
726
930
|
'documentation',
|
727
931
|
'presentation',
|
728
932
|
])}`,
|
729
|
-
`${AXPDataGenerator
|
933
|
+
`${AXPDataGenerator.pick([
|
730
934
|
'Prepare',
|
731
935
|
'Schedule',
|
732
936
|
'Attend',
|
733
937
|
'Summarize',
|
734
938
|
])} meeting with ${secondPersonFirstName} ${secondPersonLastName}`,
|
735
|
-
`${AXPDataGenerator
|
939
|
+
`${AXPDataGenerator.pick(['Research', 'Analyze', 'Document'])} ${AXPDataGenerator.pick([
|
736
940
|
'market trends',
|
737
941
|
'user feedback',
|
738
942
|
'competitor features',
|
739
943
|
'new technology',
|
740
944
|
])}`,
|
741
|
-
`${AXPDataGenerator
|
945
|
+
`${AXPDataGenerator.pick(['Deploy', 'Test', 'Debug'])} ${AXPDataGenerator.pick([
|
742
946
|
'application',
|
743
947
|
'feature',
|
744
948
|
'hotfix',
|
745
949
|
'release',
|
746
950
|
])}`,
|
747
|
-
`${AXPDataGenerator
|
951
|
+
`${AXPDataGenerator.pick(['Contact', 'Follow up with', 'Email'])} ${firstName} about ${AXPDataGenerator.pick([
|
748
952
|
'project status',
|
749
953
|
'contract',
|
750
954
|
'feedback',
|
@@ -761,23 +965,23 @@ function generateTaskListWidget() {
|
|
761
965
|
// Task is completed if it's in the past 30% of the time
|
762
966
|
const isCompleted = diffDays < 0 ? Math.random() < 0.8 : Math.random() < 0.3;
|
763
967
|
return {
|
764
|
-
id: AXPDataGenerator
|
968
|
+
id: AXPDataGenerator.uuid(),
|
765
969
|
title: taskTitle,
|
766
970
|
completed: isCompleted,
|
767
971
|
priority: priority,
|
768
972
|
dueDate: dueDate,
|
769
973
|
category: category,
|
770
974
|
assignedTo: {
|
771
|
-
id: AXPDataGenerator
|
975
|
+
id: AXPDataGenerator.uuid(),
|
772
976
|
name: `${firstName} ${lastName}`,
|
773
|
-
image: Math.random() < 0.3 ? `https://i.pravatar.cc/150?u=${AXPDataGenerator
|
977
|
+
image: Math.random() < 0.3 ? `https://i.pravatar.cc/150?u=${AXPDataGenerator.uuid()}` : undefined,
|
774
978
|
},
|
775
|
-
createdAt: AXPDataGenerator
|
979
|
+
createdAt: AXPDataGenerator.date(new Date(new Date().setDate(new Date().getDate() - 30)), new Date()),
|
776
980
|
};
|
777
981
|
});
|
778
982
|
return {
|
779
983
|
config: {
|
780
|
-
id: AXPDataGenerator
|
984
|
+
id: AXPDataGenerator.uuid(),
|
781
985
|
...AXPTaskListWidget?.meta?.['dimensions'],
|
782
986
|
},
|
783
987
|
node: {
|
@@ -791,8 +995,8 @@ function generateTaskListWidget() {
|
|
791
995
|
maxItems: 10,
|
792
996
|
showDate: true,
|
793
997
|
showAssignee: true,
|
794
|
-
groupByCategory: AXPDataGenerator
|
795
|
-
showPriority: AXPDataGenerator
|
998
|
+
groupByCategory: AXPDataGenerator.boolean(),
|
999
|
+
showPriority: AXPDataGenerator.boolean(),
|
796
1000
|
allowMarkComplete: true,
|
797
1001
|
hasConfiguration: true,
|
798
1002
|
},
|
@@ -824,24 +1028,49 @@ function getWidgetGenerator(type) {
|
|
824
1028
|
return generateBarChartWidget;
|
825
1029
|
}
|
826
1030
|
}
|
827
|
-
//
|
828
|
-
function
|
829
|
-
const
|
830
|
-
|
831
|
-
|
1031
|
+
// Utility function to shuffle an array
|
1032
|
+
function shuffleArray(array) {
|
1033
|
+
const arr = array.slice();
|
1034
|
+
for (let i = arr.length - 1; i > 0; i--) {
|
1035
|
+
const j = Math.floor(Math.random() * (i + 1));
|
1036
|
+
[arr[i], arr[j]] = [arr[j], arr[i]];
|
1037
|
+
}
|
1038
|
+
return arr;
|
832
1039
|
}
|
833
|
-
// Generate a random dashboard with random widgets
|
1040
|
+
// Generate a random dashboard with random widgets (no duplicate widget types)
|
834
1041
|
function generateRandomDashboard() {
|
835
|
-
const
|
836
|
-
const
|
1042
|
+
const maxWidgets = widgetTypes.length;
|
1043
|
+
const widgetCount = Math.min(AXPDataGenerator.number(1, 5), maxWidgets);
|
1044
|
+
const shuffledTypes = shuffleArray(widgetTypes);
|
1045
|
+
const selectedTypes = shuffledTypes.slice(0, widgetCount);
|
1046
|
+
const widgets = selectedTypes.map((type) => {
|
1047
|
+
const generator = getWidgetGenerator(type);
|
1048
|
+
return generator();
|
1049
|
+
});
|
1050
|
+
const user = AXPDataGenerator.pick(mockUsers);
|
1051
|
+
const titleTemplates = [
|
1052
|
+
`Sales Dashboard`,
|
1053
|
+
`Project Overview`,
|
1054
|
+
`Task Board`,
|
1055
|
+
`Analytics`,
|
1056
|
+
`Notifications`,
|
1057
|
+
`Performance Monitor`,
|
1058
|
+
`Weather & Events`,
|
1059
|
+
`Team Dashboard`,
|
1060
|
+
`Marketing Insights`,
|
1061
|
+
`Operations Panel`,
|
1062
|
+
];
|
1063
|
+
const userFullName = `${user.firstName} ${user.lastName}`;
|
1064
|
+
const titleTemplate = AXPDataGenerator.pick(titleTemplates);
|
1065
|
+
const title = titleTemplate.replace("{user}", userFullName);
|
837
1066
|
return {
|
838
|
-
id: AXPDataGenerator
|
839
|
-
name:
|
840
|
-
title:
|
841
|
-
description: `This is a sample dashboard for ${
|
1067
|
+
id: AXPDataGenerator.uuid(),
|
1068
|
+
name: AXPDataGenerator.uuid(),
|
1069
|
+
title: title,
|
1070
|
+
description: `This is a sample dashboard for ${title}`,
|
842
1071
|
widgets: widgets,
|
843
|
-
createdAt: AXPDataGenerator
|
844
|
-
createdBy:
|
1072
|
+
createdAt: AXPDataGenerator.date(new Date(2023, 0, 1), new Date()),
|
1073
|
+
createdBy: userFullName,
|
845
1074
|
};
|
846
1075
|
}
|
847
1076
|
// Generate extra random dashboards (in addition to the predefined ones)
|
@@ -849,7 +1078,7 @@ function generateExtraRandomDashboards(count) {
|
|
849
1078
|
return Array.from({ length: count }).map(() => generateRandomDashboard());
|
850
1079
|
}
|
851
1080
|
// Create dashboards: predefined + some random ones
|
852
|
-
const DASHBOARDS = [...generateExtraRandomDashboards(AXPDataGenerator
|
1081
|
+
const DASHBOARDS = [...generateExtraRandomDashboards(AXPDataGenerator.number(3, 5))];
|
853
1082
|
|
854
1083
|
class AXPDashboardDataSeeder {
|
855
1084
|
constructor() {
|
@@ -1286,7 +1515,7 @@ const evaluatorInterface$1 = `{
|
|
1286
1515
|
}`;
|
1287
1516
|
const DOCUMENT_TYPES = [
|
1288
1517
|
{
|
1289
|
-
id: AXPDataGenerator
|
1518
|
+
id: AXPDataGenerator.uuid(),
|
1290
1519
|
name: 'risk-assessment-report',
|
1291
1520
|
title: 'Risk Assessment Report',
|
1292
1521
|
maxSize: 5000,
|
@@ -1329,7 +1558,7 @@ const DOCUMENT_TYPES = [
|
|
1329
1558
|
},
|
1330
1559
|
},
|
1331
1560
|
{
|
1332
|
-
id: AXPDataGenerator
|
1561
|
+
id: AXPDataGenerator.uuid(),
|
1333
1562
|
name: 'any',
|
1334
1563
|
title: 'Upload File',
|
1335
1564
|
maxSize: 50000,
|
@@ -1440,361 +1669,157 @@ class AXMFolderMockService extends AXMFolderServiceImpl {
|
|
1440
1669
|
if (folder) {
|
1441
1670
|
folder.nodeCount = (folder.folders?.length ?? 0) + (folder.documents?.length ?? 0);
|
1442
1671
|
folder.folders?.forEach((f) => {
|
1443
|
-
f.nodeCount = (f.folders?.length ?? 0) + (f.documents?.length ?? 0);
|
1444
|
-
});
|
1445
|
-
}
|
1446
|
-
return folder;
|
1447
|
-
}
|
1448
|
-
/**
|
1449
|
-
* Search folders with specified name using recursive method
|
1450
|
-
* @param searchTerm search term
|
1451
|
-
* @param rootFolderId ID of the root folder to start the search
|
1452
|
-
*/
|
1453
|
-
async searchFolders(searchTerm, rootFolderId) {
|
1454
|
-
const result = [];
|
1455
|
-
await this.searchFoldersRecursive(searchTerm, rootFolderId, result);
|
1456
|
-
return result;
|
1457
|
-
}
|
1458
|
-
/**
|
1459
|
-
* Recursive folder search
|
1460
|
-
* @param searchTerm search term
|
1461
|
-
* @param folderId current folder ID
|
1462
|
-
* @param result results array
|
1463
|
-
*/
|
1464
|
-
async searchFoldersRecursive(searchTerm, folderId, result) {
|
1465
|
-
try {
|
1466
|
-
// Get current folder
|
1467
|
-
const currentFolder = await this.getOne(folderId);
|
1468
|
-
if (!currentFolder) {
|
1469
|
-
return;
|
1470
|
-
}
|
1471
|
-
// Check subfolders
|
1472
|
-
const subFolders = currentFolder.folders || [];
|
1473
|
-
// Add folders that match the search term
|
1474
|
-
for (const folder of subFolders) {
|
1475
|
-
if (folder.name.toLowerCase().includes(searchTerm.toLowerCase())) {
|
1476
|
-
result.push(folder);
|
1477
|
-
}
|
1478
|
-
// Recursive search in subfolders
|
1479
|
-
if (folder.id) {
|
1480
|
-
await this.searchFoldersRecursive(searchTerm, folder.id, result);
|
1481
|
-
}
|
1482
|
-
}
|
1483
|
-
}
|
1484
|
-
catch (error) {
|
1485
|
-
console.error('Error searching folders:', error);
|
1486
|
-
}
|
1487
|
-
}
|
1488
|
-
}
|
1489
|
-
|
1490
|
-
class AXMFileMockService extends AXMDocumentServiceImpl {
|
1491
|
-
constructor() {
|
1492
|
-
super();
|
1493
|
-
this.folderService = new AXMFolderMockService();
|
1494
|
-
}
|
1495
|
-
async updateParentFolder(file) {
|
1496
|
-
if (!file.parentId) {
|
1497
|
-
throw new Error('File must have a parent folder');
|
1498
|
-
}
|
1499
|
-
const parent = await this.folderService.getOne(file.parentId);
|
1500
|
-
if (parent && parent.id) {
|
1501
|
-
if (!parent.documents) {
|
1502
|
-
parent.documents = [];
|
1503
|
-
}
|
1504
|
-
const existingIndex = parent.documents.findIndex((f) => f.id === file.id);
|
1505
|
-
if (existingIndex === -1) {
|
1506
|
-
parent.documents.push(file);
|
1507
|
-
}
|
1508
|
-
else {
|
1509
|
-
parent.documents[existingIndex] = file;
|
1510
|
-
}
|
1511
|
-
await this.folderService.updateOne(parent.id, { documents: parent.documents });
|
1512
|
-
}
|
1513
|
-
}
|
1514
|
-
async removeFromParent(file) {
|
1515
|
-
if (!file.parentId) {
|
1516
|
-
throw new Error('File must have a parent folder');
|
1517
|
-
}
|
1518
|
-
const parent = await this.folderService.getOne(file.parentId);
|
1519
|
-
if (parent && parent.id && parent.documents) {
|
1520
|
-
parent.documents = parent.documents.filter((f) => f.id !== file.id);
|
1521
|
-
await this.folderService.updateOne(parent.id, { documents: parent.documents });
|
1522
|
-
}
|
1523
|
-
}
|
1524
|
-
async insertOne(request) {
|
1525
|
-
if (!request.parentId) {
|
1526
|
-
throw new Error('File must have a parent folder');
|
1527
|
-
}
|
1528
|
-
const newId = await super.insertOne(request);
|
1529
|
-
const fileData = {
|
1530
|
-
...request,
|
1531
|
-
id: newId,
|
1532
|
-
};
|
1533
|
-
await this.updateParentFolder(fileData);
|
1534
|
-
return newId;
|
1535
|
-
}
|
1536
|
-
async updateOne(id, values) {
|
1537
|
-
const currentFile = await this.getOne(id);
|
1538
|
-
const updatedFile = await super.updateOne(id, values);
|
1539
|
-
if (currentFile && values.parentId !== undefined && currentFile.parentId !== values.parentId) {
|
1540
|
-
await this.removeFromParent(currentFile);
|
1541
|
-
}
|
1542
|
-
await this.updateParentFolder(updatedFile);
|
1543
|
-
return updatedFile;
|
1544
|
-
}
|
1545
|
-
async deleteOne(id) {
|
1546
|
-
const fileToDelete = await this.getOne(id);
|
1547
|
-
if (fileToDelete) {
|
1548
|
-
await this.removeFromParent(fileToDelete);
|
1549
|
-
await super.deleteOne(id);
|
1550
|
-
}
|
1551
|
-
}
|
1552
|
-
async getPath(documentId, stop) {
|
1553
|
-
const file = await this.getOne(documentId);
|
1554
|
-
if (!file) {
|
1555
|
-
throw new Error('File not found');
|
1556
|
-
}
|
1557
|
-
return await this.folderService.getPath(file.parentId, stop);
|
1558
|
-
}
|
1559
|
-
async searchFiles(searchTerm, rootFolderId) {
|
1560
|
-
const result = [];
|
1561
|
-
await this.searchFilesRecursive(searchTerm, rootFolderId, result);
|
1562
|
-
return result;
|
1563
|
-
}
|
1564
|
-
/**
|
1565
|
-
* جستجوی بازگشتی فایلها
|
1566
|
-
* @param searchTerm عبارت جستجو
|
1567
|
-
* @param folderId شناسه فولدر فعلی
|
1568
|
-
* @param result آرایه نتایج
|
1569
|
-
*/
|
1570
|
-
async searchFilesRecursive(searchTerm, folderId, result) {
|
1571
|
-
try {
|
1572
|
-
const currentFolder = await this.folderService.getOne(folderId);
|
1573
|
-
if (!currentFolder) {
|
1574
|
-
return;
|
1575
|
-
}
|
1576
|
-
const files = currentFolder.documents || [];
|
1577
|
-
for (const file of files) {
|
1578
|
-
if (file.name.toLowerCase().includes(searchTerm.toLowerCase())) {
|
1579
|
-
result.push(file);
|
1580
|
-
}
|
1581
|
-
}
|
1582
|
-
const subFolders = currentFolder.folders || [];
|
1583
|
-
for (const folder of subFolders) {
|
1584
|
-
if (folder.id) {
|
1585
|
-
await this.searchFilesRecursive(searchTerm, folder.id, result);
|
1586
|
-
}
|
1587
|
-
}
|
1588
|
-
}
|
1589
|
-
catch (error) {
|
1590
|
-
console.error('Error searching files:', error);
|
1591
|
-
}
|
1592
|
-
}
|
1593
|
-
}
|
1594
|
-
|
1595
|
-
const tenantsMock = [
|
1596
|
-
{
|
1597
|
-
id: '99',
|
1598
|
-
name: 'acorex-tenant',
|
1599
|
-
title: 'ACoreX Platform Tenant',
|
1600
|
-
},
|
1601
|
-
{
|
1602
|
-
id: '1',
|
1603
|
-
name: 'demo-tenant',
|
1604
|
-
title: 'DEMO Tenant',
|
1605
|
-
},
|
1606
|
-
];
|
1607
|
-
const applications = [
|
1608
|
-
{
|
1609
|
-
id: AXPDataGenerator$1.uuid(),
|
1610
|
-
name: 'demo',
|
1611
|
-
title: 'DEMO Application',
|
1612
|
-
version: '1.0.0',
|
1613
|
-
editionName: 'Standard',
|
1614
|
-
},
|
1615
|
-
{
|
1616
|
-
id: AXPDataGenerator$1.uuid(),
|
1617
|
-
name: 'platform',
|
1618
|
-
title: 'Platform Console',
|
1619
|
-
version: '1.0.0',
|
1620
|
-
editionName: 'Standard',
|
1621
|
-
},
|
1622
|
-
];
|
1623
|
-
// Now we only define role structure without permissions
|
1624
|
-
const mockRoleDefinitions = [
|
1625
|
-
{
|
1626
|
-
id: '1001',
|
1627
|
-
name: 'admin',
|
1628
|
-
title: 'Administrator',
|
1629
|
-
description: 'Full system access with all administrative privileges',
|
1630
|
-
permissions: [], // Will be filled dynamically
|
1631
|
-
},
|
1632
|
-
{
|
1633
|
-
id: '1002',
|
1634
|
-
name: 'manager',
|
1635
|
-
title: 'Manager',
|
1636
|
-
description: 'Manages users and has access to most system features',
|
1637
|
-
permissions: [],
|
1638
|
-
},
|
1639
|
-
{
|
1640
|
-
id: '1003',
|
1641
|
-
name: 'user',
|
1642
|
-
title: 'Regular User',
|
1643
|
-
description: 'Standard user with basic system access',
|
1644
|
-
permissions: [],
|
1645
|
-
},
|
1646
|
-
{
|
1647
|
-
id: '1004',
|
1648
|
-
name: 'readonly',
|
1649
|
-
title: 'Read Only',
|
1650
|
-
description: 'View-only access to specific system areas',
|
1651
|
-
permissions: [],
|
1652
|
-
},
|
1653
|
-
{
|
1654
|
-
id: '1005',
|
1655
|
-
name: 'support',
|
1656
|
-
title: 'Support Staff',
|
1657
|
-
description: 'Customer support and ticket management access',
|
1658
|
-
permissions: [],
|
1659
|
-
},
|
1660
|
-
{
|
1661
|
-
id: '1006',
|
1662
|
-
name: 'hr',
|
1663
|
-
title: 'Human Resources',
|
1664
|
-
description: 'Access to HR-related features and user management',
|
1665
|
-
permissions: [],
|
1666
|
-
},
|
1667
|
-
{
|
1668
|
-
id: '1007',
|
1669
|
-
name: 'finance',
|
1670
|
-
title: 'Finance',
|
1671
|
-
description: 'Access to financial reports and invoicing features',
|
1672
|
-
permissions: [],
|
1673
|
-
},
|
1674
|
-
{
|
1675
|
-
id: '1008',
|
1676
|
-
name: 'dev',
|
1677
|
-
title: 'Developer',
|
1678
|
-
description: 'Technical access to development and debugging features',
|
1679
|
-
permissions: [],
|
1680
|
-
},
|
1681
|
-
];
|
1682
|
-
const mockUsers = [
|
1683
|
-
{
|
1684
|
-
id: AXPDataGenerator$1.uuid(),
|
1685
|
-
username: 'johndoe',
|
1686
|
-
firstname: 'John',
|
1687
|
-
lastname: 'Doe',
|
1688
|
-
nationalCode: '1234567890',
|
1689
|
-
mobile: '555-123-4567',
|
1690
|
-
roleIds: [
|
1691
|
-
{ id: '1001', title: 'Administrator' },
|
1692
|
-
{ id: '1002', title: 'Manager' },
|
1693
|
-
],
|
1694
|
-
},
|
1695
|
-
{
|
1696
|
-
id: AXPDataGenerator$1.uuid(),
|
1697
|
-
username: 'janesmith',
|
1698
|
-
firstname: 'Jane',
|
1699
|
-
lastname: 'Smith',
|
1700
|
-
nationalCode: '0987654321',
|
1701
|
-
mobile: '555-987-6543',
|
1702
|
-
roleIds: [
|
1703
|
-
{ id: '1002', title: 'Manager' },
|
1704
|
-
{ id: '1006', title: 'Human Resources' },
|
1705
|
-
],
|
1706
|
-
},
|
1707
|
-
{
|
1708
|
-
id: AXPDataGenerator$1.uuid(),
|
1709
|
-
username: 'mikeross',
|
1710
|
-
firstname: 'Mike',
|
1711
|
-
lastname: 'Ross',
|
1712
|
-
nationalCode: '2468135790',
|
1713
|
-
mobile: '555-246-8135',
|
1714
|
-
roleIds: [
|
1715
|
-
{ id: '1008', title: 'Developer' },
|
1716
|
-
{ id: '1005', title: 'Support Staff' },
|
1717
|
-
],
|
1718
|
-
},
|
1719
|
-
{
|
1720
|
-
id: AXPDataGenerator$1.uuid(),
|
1721
|
-
username: 'emilyparker',
|
1722
|
-
firstname: 'Emily',
|
1723
|
-
lastname: 'Parker',
|
1724
|
-
nationalCode: '1357924680',
|
1725
|
-
mobile: '555-135-7924',
|
1726
|
-
roleIds: [{ id: '1003', title: 'Regular User' }],
|
1727
|
-
},
|
1728
|
-
{
|
1729
|
-
id: AXPDataGenerator$1.uuid(),
|
1730
|
-
username: 'robertjohnson',
|
1731
|
-
firstname: 'Robert',
|
1732
|
-
lastname: 'Johnson',
|
1733
|
-
nationalCode: '9876543210',
|
1734
|
-
mobile: '555-987-6542',
|
1735
|
-
roleIds: [{ id: '1007', title: 'Finance' }],
|
1736
|
-
},
|
1737
|
-
{
|
1738
|
-
id: AXPDataGenerator$1.uuid(),
|
1739
|
-
username: 'sarahwilliams',
|
1740
|
-
firstname: 'Sarah',
|
1741
|
-
lastname: 'Williams',
|
1742
|
-
nationalCode: '5678901234',
|
1743
|
-
mobile: '555-567-8901',
|
1744
|
-
roleIds: [{ id: '1004', title: 'Read Only' }],
|
1745
|
-
},
|
1746
|
-
{
|
1747
|
-
id: AXPDataGenerator$1.uuid(),
|
1748
|
-
username: 'davidbrown',
|
1749
|
-
firstname: 'David',
|
1750
|
-
lastname: 'Brown',
|
1751
|
-
nationalCode: '3456789012',
|
1752
|
-
mobile: '555-345-6789',
|
1753
|
-
roleIds: [
|
1754
|
-
{ id: '1003', title: 'Regular User' },
|
1755
|
-
{ id: '1005', title: 'Support Staff' },
|
1756
|
-
],
|
1757
|
-
},
|
1758
|
-
{
|
1759
|
-
id: AXPDataGenerator$1.uuid(),
|
1760
|
-
username: 'lisadavis',
|
1761
|
-
firstname: 'Lisa',
|
1762
|
-
lastname: 'Davis',
|
1763
|
-
nationalCode: '7890123456',
|
1764
|
-
mobile: '555-789-0123',
|
1765
|
-
roleIds: [{ id: '1006', title: 'Human Resources' }],
|
1766
|
-
},
|
1767
|
-
{
|
1768
|
-
id: AXPDataGenerator$1.uuid(),
|
1769
|
-
username: 'michaelwilson',
|
1770
|
-
firstname: 'Michael',
|
1771
|
-
lastname: 'Wilson',
|
1772
|
-
nationalCode: '6789012345',
|
1773
|
-
mobile: '555-678-9012',
|
1774
|
-
roleIds: [
|
1775
|
-
{ id: '1002', title: 'Manager' },
|
1776
|
-
{ id: '1007', title: 'Finance' },
|
1777
|
-
],
|
1778
|
-
},
|
1779
|
-
{
|
1780
|
-
id: AXPDataGenerator$1.uuid(),
|
1781
|
-
username: 'amandamiller',
|
1782
|
-
firstname: 'Amanda',
|
1783
|
-
lastname: 'Miller',
|
1784
|
-
nationalCode: '4567890123',
|
1785
|
-
mobile: '555-456-7890',
|
1786
|
-
roleIds: [{ id: '1008', title: 'Developer' }],
|
1787
|
-
},
|
1788
|
-
{
|
1789
|
-
id: 'a683a19a-e3eb-46a7-b81c-7cf9468ae831',
|
1790
|
-
username: 'root',
|
1791
|
-
firstname: 'Root',
|
1792
|
-
lastname: 'Root',
|
1793
|
-
nationalCode: '4567890124',
|
1794
|
-
mobile: '555-456-7891',
|
1795
|
-
roleIds: [{ id: '1001', title: 'Administrator' }],
|
1796
|
-
},
|
1797
|
-
];
|
1672
|
+
f.nodeCount = (f.folders?.length ?? 0) + (f.documents?.length ?? 0);
|
1673
|
+
});
|
1674
|
+
}
|
1675
|
+
return folder;
|
1676
|
+
}
|
1677
|
+
/**
|
1678
|
+
* Search folders with specified name using recursive method
|
1679
|
+
* @param searchTerm search term
|
1680
|
+
* @param rootFolderId ID of the root folder to start the search
|
1681
|
+
*/
|
1682
|
+
async searchFolders(searchTerm, rootFolderId) {
|
1683
|
+
const result = [];
|
1684
|
+
await this.searchFoldersRecursive(searchTerm, rootFolderId, result);
|
1685
|
+
return result;
|
1686
|
+
}
|
1687
|
+
/**
|
1688
|
+
* Recursive folder search
|
1689
|
+
* @param searchTerm search term
|
1690
|
+
* @param folderId current folder ID
|
1691
|
+
* @param result results array
|
1692
|
+
*/
|
1693
|
+
async searchFoldersRecursive(searchTerm, folderId, result) {
|
1694
|
+
try {
|
1695
|
+
// Get current folder
|
1696
|
+
const currentFolder = await this.getOne(folderId);
|
1697
|
+
if (!currentFolder) {
|
1698
|
+
return;
|
1699
|
+
}
|
1700
|
+
// Check subfolders
|
1701
|
+
const subFolders = currentFolder.folders || [];
|
1702
|
+
// Add folders that match the search term
|
1703
|
+
for (const folder of subFolders) {
|
1704
|
+
if (folder.name.toLowerCase().includes(searchTerm.toLowerCase())) {
|
1705
|
+
result.push(folder);
|
1706
|
+
}
|
1707
|
+
// Recursive search in subfolders
|
1708
|
+
if (folder.id) {
|
1709
|
+
await this.searchFoldersRecursive(searchTerm, folder.id, result);
|
1710
|
+
}
|
1711
|
+
}
|
1712
|
+
}
|
1713
|
+
catch (error) {
|
1714
|
+
console.error('Error searching folders:', error);
|
1715
|
+
}
|
1716
|
+
}
|
1717
|
+
}
|
1718
|
+
|
1719
|
+
class AXMFileMockService extends AXMDocumentServiceImpl {
|
1720
|
+
constructor() {
|
1721
|
+
super();
|
1722
|
+
this.folderService = new AXMFolderMockService();
|
1723
|
+
}
|
1724
|
+
async updateParentFolder(file) {
|
1725
|
+
if (!file.parentId) {
|
1726
|
+
throw new Error('File must have a parent folder');
|
1727
|
+
}
|
1728
|
+
const parent = await this.folderService.getOne(file.parentId);
|
1729
|
+
if (parent && parent.id) {
|
1730
|
+
if (!parent.documents) {
|
1731
|
+
parent.documents = [];
|
1732
|
+
}
|
1733
|
+
const existingIndex = parent.documents.findIndex((f) => f.id === file.id);
|
1734
|
+
if (existingIndex === -1) {
|
1735
|
+
parent.documents.push(file);
|
1736
|
+
}
|
1737
|
+
else {
|
1738
|
+
parent.documents[existingIndex] = file;
|
1739
|
+
}
|
1740
|
+
await this.folderService.updateOne(parent.id, { documents: parent.documents });
|
1741
|
+
}
|
1742
|
+
}
|
1743
|
+
async removeFromParent(file) {
|
1744
|
+
if (!file.parentId) {
|
1745
|
+
throw new Error('File must have a parent folder');
|
1746
|
+
}
|
1747
|
+
const parent = await this.folderService.getOne(file.parentId);
|
1748
|
+
if (parent && parent.id && parent.documents) {
|
1749
|
+
parent.documents = parent.documents.filter((f) => f.id !== file.id);
|
1750
|
+
await this.folderService.updateOne(parent.id, { documents: parent.documents });
|
1751
|
+
}
|
1752
|
+
}
|
1753
|
+
async insertOne(request) {
|
1754
|
+
if (!request.parentId) {
|
1755
|
+
throw new Error('File must have a parent folder');
|
1756
|
+
}
|
1757
|
+
const newId = await super.insertOne(request);
|
1758
|
+
const fileData = {
|
1759
|
+
...request,
|
1760
|
+
id: newId,
|
1761
|
+
};
|
1762
|
+
await this.updateParentFolder(fileData);
|
1763
|
+
return newId;
|
1764
|
+
}
|
1765
|
+
async updateOne(id, values) {
|
1766
|
+
const currentFile = await this.getOne(id);
|
1767
|
+
const updatedFile = await super.updateOne(id, values);
|
1768
|
+
if (currentFile && values.parentId !== undefined && currentFile.parentId !== values.parentId) {
|
1769
|
+
await this.removeFromParent(currentFile);
|
1770
|
+
}
|
1771
|
+
await this.updateParentFolder(updatedFile);
|
1772
|
+
return updatedFile;
|
1773
|
+
}
|
1774
|
+
async deleteOne(id) {
|
1775
|
+
const fileToDelete = await this.getOne(id);
|
1776
|
+
if (fileToDelete) {
|
1777
|
+
await this.removeFromParent(fileToDelete);
|
1778
|
+
await super.deleteOne(id);
|
1779
|
+
}
|
1780
|
+
}
|
1781
|
+
async getPath(documentId, stop) {
|
1782
|
+
const file = await this.getOne(documentId);
|
1783
|
+
if (!file) {
|
1784
|
+
throw new Error('File not found');
|
1785
|
+
}
|
1786
|
+
return await this.folderService.getPath(file.parentId, stop);
|
1787
|
+
}
|
1788
|
+
async searchFiles(searchTerm, rootFolderId) {
|
1789
|
+
const result = [];
|
1790
|
+
await this.searchFilesRecursive(searchTerm, rootFolderId, result);
|
1791
|
+
return result;
|
1792
|
+
}
|
1793
|
+
/**
|
1794
|
+
* جستجوی بازگشتی فایلها
|
1795
|
+
* @param searchTerm عبارت جستجو
|
1796
|
+
* @param folderId شناسه فولدر فعلی
|
1797
|
+
* @param result آرایه نتایج
|
1798
|
+
*/
|
1799
|
+
async searchFilesRecursive(searchTerm, folderId, result) {
|
1800
|
+
try {
|
1801
|
+
const currentFolder = await this.folderService.getOne(folderId);
|
1802
|
+
if (!currentFolder) {
|
1803
|
+
return;
|
1804
|
+
}
|
1805
|
+
const files = currentFolder.documents || [];
|
1806
|
+
for (const file of files) {
|
1807
|
+
if (file.name.toLowerCase().includes(searchTerm.toLowerCase())) {
|
1808
|
+
result.push(file);
|
1809
|
+
}
|
1810
|
+
}
|
1811
|
+
const subFolders = currentFolder.folders || [];
|
1812
|
+
for (const folder of subFolders) {
|
1813
|
+
if (folder.id) {
|
1814
|
+
await this.searchFilesRecursive(searchTerm, folder.id, result);
|
1815
|
+
}
|
1816
|
+
}
|
1817
|
+
}
|
1818
|
+
catch (error) {
|
1819
|
+
console.error('Error searching files:', error);
|
1820
|
+
}
|
1821
|
+
}
|
1822
|
+
}
|
1798
1823
|
|
1799
1824
|
// Section: Constants and Initial Setup
|
1800
1825
|
const checkbox$1 = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"checkbox-editor","name":"checkbox-editor1","options":{"label":"i accept","readonly":false,"disabled":false},"defaultValue":false,"path":"accept-check-box"}],"name":"page-layout1"}],"name":"document"}';
|
@@ -1804,11 +1829,11 @@ const tenantId = '99';
|
|
1804
1829
|
const allFolders = [];
|
1805
1830
|
const allFiles = [];
|
1806
1831
|
function getRandomSize() {
|
1807
|
-
return AXPDataGenerator
|
1832
|
+
return AXPDataGenerator.number(500 * 1024, 10 * 1024 * 1024);
|
1808
1833
|
}
|
1809
1834
|
// Section: Root Folder Setup
|
1810
1835
|
const rootFolder = {
|
1811
|
-
id: AXPDataGenerator
|
1836
|
+
id: AXPDataGenerator.uuid(),
|
1812
1837
|
name: 'WHS Documentation',
|
1813
1838
|
color: '#FFFFFF',
|
1814
1839
|
description: 'Root folder for WHS/OHS Documentation',
|
@@ -1827,7 +1852,7 @@ const rootFolder = {
|
|
1827
1852
|
};
|
1828
1853
|
// Section: Tenant Folders
|
1829
1854
|
const rootTenantsFolder = {
|
1830
|
-
id: AXPDataGenerator
|
1855
|
+
id: AXPDataGenerator.uuid(),
|
1831
1856
|
name: 'Tenants',
|
1832
1857
|
color: '#FFFFFF',
|
1833
1858
|
size: getRandomSize(),
|
@@ -1846,7 +1871,7 @@ const rootTenantsFolder = {
|
|
1846
1871
|
allFolders.push(rootTenantsFolder);
|
1847
1872
|
rootFolder.folders?.push(rootTenantsFolder);
|
1848
1873
|
const mainTenantFolder = {
|
1849
|
-
id: AXPDataGenerator
|
1874
|
+
id: AXPDataGenerator.uuid(),
|
1850
1875
|
name: 'ACoreX',
|
1851
1876
|
color: '#FFFFFF',
|
1852
1877
|
size: getRandomSize(),
|
@@ -1954,7 +1979,7 @@ const whsFolders = [
|
|
1954
1979
|
];
|
1955
1980
|
// Section: User Folders
|
1956
1981
|
const rootUsersFolder = {
|
1957
|
-
id: AXPDataGenerator
|
1982
|
+
id: AXPDataGenerator.uuid(),
|
1958
1983
|
name: 'Users',
|
1959
1984
|
color: '#FFFFFF',
|
1960
1985
|
size: getRandomSize(),
|
@@ -1974,11 +1999,11 @@ const rootUsersFolder = {
|
|
1974
1999
|
// Section: User Specific Folders and Files
|
1975
2000
|
mockUsers.forEach((user) => {
|
1976
2001
|
const specificUserFolder = {
|
1977
|
-
id: AXPDataGenerator
|
2002
|
+
id: AXPDataGenerator.uuid(),
|
1978
2003
|
name: user.username,
|
1979
2004
|
color: '#FFFFFF',
|
1980
2005
|
size: getRandomSize(),
|
1981
|
-
description: `Folder of User : ${user.
|
2006
|
+
description: `Folder of User : ${user.firstName} ${user.lastName}`,
|
1982
2007
|
parentId: rootUsersFolder.id,
|
1983
2008
|
isSystem: false,
|
1984
2009
|
isHidden: false,
|
@@ -1996,7 +2021,7 @@ mockUsers.forEach((user) => {
|
|
1996
2021
|
commonFilesForUser.forEach((fileName) => {
|
1997
2022
|
const [name, extension] = fileName.split('.');
|
1998
2023
|
const file = {
|
1999
|
-
id: AXPDataGenerator
|
2024
|
+
id: AXPDataGenerator.uuid(),
|
2000
2025
|
name: fileName,
|
2001
2026
|
title: name,
|
2002
2027
|
parentId: specificUserFolder.id,
|
@@ -2020,7 +2045,7 @@ mainTenantFolder.folders?.push(rootUsersFolder);
|
|
2020
2045
|
allFolders.push(rootUsersFolder);
|
2021
2046
|
// Section: Site Folders and Role Specific Folders
|
2022
2047
|
sites.forEach((site) => {
|
2023
|
-
const siteFolderId = AXPDataGenerator
|
2048
|
+
const siteFolderId = AXPDataGenerator.uuid();
|
2024
2049
|
const siteFolder = {
|
2025
2050
|
id: siteFolderId,
|
2026
2051
|
name: site,
|
@@ -2043,7 +2068,7 @@ sites.forEach((site) => {
|
|
2043
2068
|
};
|
2044
2069
|
const safetyRoles = ['Safety Officer', 'Site Supervisor', 'WHS Representative'];
|
2045
2070
|
safetyRoles.forEach((role) => {
|
2046
|
-
const roleFolderId = AXPDataGenerator
|
2071
|
+
const roleFolderId = AXPDataGenerator.uuid();
|
2047
2072
|
const roleFolder = {
|
2048
2073
|
id: roleFolderId,
|
2049
2074
|
name: role,
|
@@ -2068,7 +2093,7 @@ sites.forEach((site) => {
|
|
2068
2093
|
fileType.titles.forEach((title) => {
|
2069
2094
|
if (Math.random() > 0.5) {
|
2070
2095
|
const file = {
|
2071
|
-
id: AXPDataGenerator
|
2096
|
+
id: AXPDataGenerator.uuid(),
|
2072
2097
|
name: `${title.toLowerCase().replace(/\s+/g, '-')}.${fileType.ext}`,
|
2073
2098
|
title: title,
|
2074
2099
|
parentId: roleFolderId,
|
@@ -2092,7 +2117,7 @@ sites.forEach((site) => {
|
|
2092
2117
|
});
|
2093
2118
|
// Section: WHS Department Folders
|
2094
2119
|
whsFolders.forEach((dept) => {
|
2095
|
-
const deptFolderId = AXPDataGenerator
|
2120
|
+
const deptFolderId = AXPDataGenerator.uuid();
|
2096
2121
|
const deptFolder = {
|
2097
2122
|
id: deptFolderId,
|
2098
2123
|
name: dept.name,
|
@@ -2115,7 +2140,7 @@ sites.forEach((site) => {
|
|
2115
2140
|
dept.commonFiles.forEach((fileName) => {
|
2116
2141
|
const [name, extension] = fileName.split('.');
|
2117
2142
|
const file = {
|
2118
|
-
id: AXPDataGenerator
|
2143
|
+
id: AXPDataGenerator.uuid(),
|
2119
2144
|
name: fileName,
|
2120
2145
|
title: name,
|
2121
2146
|
parentId: deptFolderId,
|
@@ -2133,7 +2158,7 @@ sites.forEach((site) => {
|
|
2133
2158
|
deptFolder.documents?.push(file);
|
2134
2159
|
});
|
2135
2160
|
dept.subFolders.forEach((subFolderName) => {
|
2136
|
-
const subFolderId = AXPDataGenerator
|
2161
|
+
const subFolderId = AXPDataGenerator.uuid();
|
2137
2162
|
const subFolder = {
|
2138
2163
|
id: subFolderId,
|
2139
2164
|
name: subFolderName,
|
@@ -2157,7 +2182,7 @@ sites.forEach((site) => {
|
|
2157
2182
|
fileType.titles.forEach((title) => {
|
2158
2183
|
if (Math.random() > 0.7) {
|
2159
2184
|
const file = {
|
2160
|
-
id: AXPDataGenerator
|
2185
|
+
id: AXPDataGenerator.uuid(),
|
2161
2186
|
name: `${title.toLowerCase().replace(/\s+/g, '-')}.${fileType.ext}`,
|
2162
2187
|
title: title,
|
2163
2188
|
parentId: subFolderId,
|
@@ -2273,7 +2298,7 @@ function generateCategories() {
|
|
2273
2298
|
'Chemical Safety',
|
2274
2299
|
];
|
2275
2300
|
rootCategories.forEach((title) => {
|
2276
|
-
const categoryId = AXPDataGenerator
|
2301
|
+
const categoryId = AXPDataGenerator.uuid();
|
2277
2302
|
categories.push({ id: categoryId, title, parentId: undefined, childCount: 0 });
|
2278
2303
|
});
|
2279
2304
|
const childCategories = [
|
@@ -2310,7 +2335,7 @@ function generateCategories() {
|
|
2310
2335
|
const parentCat = categories.find((c) => c.title === parent);
|
2311
2336
|
if (parentCat) {
|
2312
2337
|
children.forEach((title) => {
|
2313
|
-
categories.push({ id: AXPDataGenerator
|
2338
|
+
categories.push({ id: AXPDataGenerator.uuid(), title, parentId: parentCat.id, childCount: 0 });
|
2314
2339
|
});
|
2315
2340
|
parentCat.childCount = children.length;
|
2316
2341
|
}
|
@@ -2320,13 +2345,13 @@ function generateCategories() {
|
|
2320
2345
|
const TEMPLATE_CATEGORIES = generateCategories();
|
2321
2346
|
function generateTemplates() {
|
2322
2347
|
const templates = [];
|
2323
|
-
AXPDataGenerator
|
2348
|
+
AXPDataGenerator.pick(TEMPLATE_CATEGORIES, 5).forEach((category) => {
|
2324
2349
|
const numberOfTemplates = 2; // Generate 1 to 5 templates per category
|
2325
2350
|
for (let i = 0; i < numberOfTemplates; i++) {
|
2326
2351
|
// Assuming 10 is for Form and 20 is for Widget
|
2327
2352
|
const type = i % 2 === 0 ? AXMFormTemplateTypes.Form : AXMFormTemplateTypes.Widget;
|
2328
2353
|
templates.push({
|
2329
|
-
id: AXPDataGenerator
|
2354
|
+
id: AXPDataGenerator.uuid(),
|
2330
2355
|
templateId: `Document-${i + 1}`,
|
2331
2356
|
template: null,
|
2332
2357
|
typeId: type.id,
|
@@ -2399,60 +2424,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
2399
2424
|
function generateIssueTypes() {
|
2400
2425
|
const issueTypes = [
|
2401
2426
|
{
|
2402
|
-
id: AXPDataGenerator
|
2427
|
+
id: AXPDataGenerator.uuid(),
|
2403
2428
|
name: 'system-error',
|
2404
2429
|
title: 'System Error',
|
2405
2430
|
description: 'Technical issues related to system functionality, crashes, or unexpected errors',
|
2406
2431
|
},
|
2407
2432
|
{
|
2408
|
-
id: AXPDataGenerator
|
2433
|
+
id: AXPDataGenerator.uuid(),
|
2409
2434
|
name: 'performance',
|
2410
2435
|
title: 'Performance Issue',
|
2411
2436
|
description: 'Problems with system speed, response time, or resource usage',
|
2412
2437
|
},
|
2413
2438
|
{
|
2414
|
-
id: AXPDataGenerator
|
2439
|
+
id: AXPDataGenerator.uuid(),
|
2415
2440
|
name: 'security',
|
2416
2441
|
title: 'Security Concern',
|
2417
2442
|
description: 'Security-related issues, access problems, or potential vulnerabilities',
|
2418
2443
|
},
|
2419
2444
|
{
|
2420
|
-
id: AXPDataGenerator
|
2445
|
+
id: AXPDataGenerator.uuid(),
|
2421
2446
|
name: 'data',
|
2422
2447
|
title: 'Data Issue',
|
2423
2448
|
description: 'Problems with data integrity, synchronization, or corruption',
|
2424
2449
|
},
|
2425
2450
|
{
|
2426
|
-
id: AXPDataGenerator
|
2451
|
+
id: AXPDataGenerator.uuid(),
|
2427
2452
|
name: 'ui-ux',
|
2428
2453
|
title: 'UI/UX Problem',
|
2429
2454
|
description: 'Issues with user interface, layout, or user experience',
|
2430
2455
|
},
|
2431
2456
|
{
|
2432
|
-
id: AXPDataGenerator
|
2457
|
+
id: AXPDataGenerator.uuid(),
|
2433
2458
|
name: 'configuration',
|
2434
2459
|
title: 'Configuration Error',
|
2435
2460
|
description: 'Problems with system settings, environment configuration, or setup',
|
2436
2461
|
},
|
2437
2462
|
{
|
2438
|
-
id: AXPDataGenerator
|
2463
|
+
id: AXPDataGenerator.uuid(),
|
2439
2464
|
name: 'integration',
|
2440
2465
|
title: 'Integration Issue',
|
2441
2466
|
},
|
2442
2467
|
{
|
2443
|
-
id: AXPDataGenerator
|
2468
|
+
id: AXPDataGenerator.uuid(),
|
2444
2469
|
name: 'network',
|
2445
2470
|
title: 'Network Problem',
|
2446
2471
|
description: 'Connectivity issues, network timeouts, or communication errors',
|
2447
2472
|
},
|
2448
2473
|
{
|
2449
|
-
id: AXPDataGenerator
|
2474
|
+
id: AXPDataGenerator.uuid(),
|
2450
2475
|
name: 'feature-request',
|
2451
2476
|
title: 'Feature Request',
|
2452
2477
|
description: 'Requests for new features, enhancements, or functionality improvements',
|
2453
2478
|
},
|
2454
2479
|
{
|
2455
|
-
id: AXPDataGenerator
|
2480
|
+
id: AXPDataGenerator.uuid(),
|
2456
2481
|
name: 'documentation',
|
2457
2482
|
title: 'Documentation Issue',
|
2458
2483
|
description: 'Problems with system documentation, help guides, or instructions',
|
@@ -4116,22 +4141,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
4116
4141
|
type: Injectable
|
4117
4142
|
}], ctorParameters: () => [] });
|
4118
4143
|
|
4119
|
-
const OHS_ID = AXPDataGenerator
|
4144
|
+
const OHS_ID = AXPDataGenerator.uuid();
|
4120
4145
|
const child1 = {
|
4121
|
-
id: AXPDataGenerator
|
4146
|
+
id: AXPDataGenerator.uuid(),
|
4122
4147
|
title: 'General',
|
4123
4148
|
parentId: OHS_ID,
|
4124
4149
|
childCount: 0,
|
4125
4150
|
};
|
4126
4151
|
const child2 = {
|
4127
|
-
id: AXPDataGenerator
|
4152
|
+
id: AXPDataGenerator.uuid(),
|
4128
4153
|
title: 'License',
|
4129
4154
|
parentId: OHS_ID,
|
4130
4155
|
childCount: 0,
|
4131
4156
|
};
|
4132
4157
|
const METADATA_CATEGORY_MOCK = [
|
4133
4158
|
{
|
4134
|
-
id: AXPDataGenerator
|
4159
|
+
id: AXPDataGenerator.uuid(),
|
4135
4160
|
title: 'General',
|
4136
4161
|
childCount: 0,
|
4137
4162
|
},
|
@@ -4152,7 +4177,7 @@ const contractNumberInterface = '{"type":"document-layout","children":[{"type":"
|
|
4152
4177
|
const evaluatorInterface = '{"type":"document-layout","children":[{"type":"page-layout","children":[{"type":"text-editor","name":"text-editor1","meta":{"header":true},"options":{"multiple":false,"disabled":false,"hasClearButton":false},"defaultValue":"","path":"evaluator"}],"name":"page-layout1"}],"name":"document"}';
|
4153
4178
|
const METADATA_MOCK = [
|
4154
4179
|
{
|
4155
|
-
id: AXPDataGenerator
|
4180
|
+
id: AXPDataGenerator.uuid(),
|
4156
4181
|
name: 'title',
|
4157
4182
|
title: 'Title',
|
4158
4183
|
defaultValue: '',
|
@@ -4161,7 +4186,7 @@ const METADATA_MOCK = [
|
|
4161
4186
|
categories: [METADATA_CATEGORY_MOCK[0]],
|
4162
4187
|
},
|
4163
4188
|
{
|
4164
|
-
id: AXPDataGenerator
|
4189
|
+
id: AXPDataGenerator.uuid(),
|
4165
4190
|
name: 'description',
|
4166
4191
|
title: 'Description',
|
4167
4192
|
defaultValue: '',
|
@@ -4170,7 +4195,7 @@ const METADATA_MOCK = [
|
|
4170
4195
|
categories: [METADATA_CATEGORY_MOCK[0]],
|
4171
4196
|
},
|
4172
4197
|
{
|
4173
|
-
id: AXPDataGenerator
|
4198
|
+
id: AXPDataGenerator.uuid(),
|
4174
4199
|
name: 'agreement-check-box',
|
4175
4200
|
title: 'Agreement Box',
|
4176
4201
|
defaultValue: false,
|
@@ -4179,7 +4204,7 @@ const METADATA_MOCK = [
|
|
4179
4204
|
categories: [METADATA_CATEGORY_MOCK[2]],
|
4180
4205
|
},
|
4181
4206
|
{
|
4182
|
-
id: AXPDataGenerator
|
4207
|
+
id: AXPDataGenerator.uuid(),
|
4183
4208
|
name: 'contract-number',
|
4184
4209
|
title: 'Contract Number',
|
4185
4210
|
defaultValue: '',
|
@@ -4188,7 +4213,7 @@ const METADATA_MOCK = [
|
|
4188
4213
|
categories: [METADATA_CATEGORY_MOCK[2]],
|
4189
4214
|
},
|
4190
4215
|
{
|
4191
|
-
id: AXPDataGenerator
|
4216
|
+
id: AXPDataGenerator.uuid(),
|
4192
4217
|
name: 'evaluator',
|
4193
4218
|
title: 'Evaluator',
|
4194
4219
|
defaultValue: '',
|
@@ -4578,6 +4603,155 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
4578
4603
|
type: Injectable
|
4579
4604
|
}] });
|
4580
4605
|
|
4606
|
+
class AXPSecurityManagementMockWidgetDataSourceProvider {
|
4607
|
+
async items() {
|
4608
|
+
return [
|
4609
|
+
{
|
4610
|
+
name: 'mock.securityUsers',
|
4611
|
+
title: 'Security Users',
|
4612
|
+
valueField: 'id',
|
4613
|
+
textField: 'displayName',
|
4614
|
+
columns: [
|
4615
|
+
{
|
4616
|
+
name: 'id',
|
4617
|
+
title: 'Id',
|
4618
|
+
},
|
4619
|
+
{
|
4620
|
+
name: 'username',
|
4621
|
+
title: 'Username',
|
4622
|
+
},
|
4623
|
+
{
|
4624
|
+
name: 'displayName',
|
4625
|
+
title: 'Display Name',
|
4626
|
+
},
|
4627
|
+
],
|
4628
|
+
samples: [
|
4629
|
+
{
|
4630
|
+
id: '1',
|
4631
|
+
username: 'johndoe',
|
4632
|
+
displayName: 'John Doe',
|
4633
|
+
},
|
4634
|
+
{
|
4635
|
+
id: '2',
|
4636
|
+
username: 'janesmith',
|
4637
|
+
displayName: 'Jane Smith',
|
4638
|
+
},
|
4639
|
+
],
|
4640
|
+
source: () => convertArrayToDataSource([
|
4641
|
+
{
|
4642
|
+
id: '1',
|
4643
|
+
username: 'johndoe',
|
4644
|
+
displayName: 'John Doe',
|
4645
|
+
},
|
4646
|
+
{
|
4647
|
+
id: '2',
|
4648
|
+
username: 'janesmith',
|
4649
|
+
displayName: 'Jane Smith',
|
4650
|
+
},
|
4651
|
+
{
|
4652
|
+
id: '3',
|
4653
|
+
username: 'mikeross',
|
4654
|
+
displayName: 'Mike Ross',
|
4655
|
+
},
|
4656
|
+
]),
|
4657
|
+
},
|
4658
|
+
{
|
4659
|
+
name: 'mock.securityRoles',
|
4660
|
+
title: 'Security Roles',
|
4661
|
+
valueField: 'id',
|
4662
|
+
textField: 'title',
|
4663
|
+
columns: [
|
4664
|
+
{
|
4665
|
+
name: 'id',
|
4666
|
+
title: 'Id',
|
4667
|
+
},
|
4668
|
+
{
|
4669
|
+
name: 'title',
|
4670
|
+
title: 'Title',
|
4671
|
+
},
|
4672
|
+
],
|
4673
|
+
samples: [
|
4674
|
+
{
|
4675
|
+
id: 'admin',
|
4676
|
+
title: 'Administrator',
|
4677
|
+
},
|
4678
|
+
{
|
4679
|
+
id: 'user',
|
4680
|
+
title: 'Regular User',
|
4681
|
+
},
|
4682
|
+
],
|
4683
|
+
source: () => convertArrayToDataSource([
|
4684
|
+
{
|
4685
|
+
id: 'admin',
|
4686
|
+
title: 'Administrator',
|
4687
|
+
},
|
4688
|
+
{
|
4689
|
+
id: 'manager',
|
4690
|
+
title: 'Manager',
|
4691
|
+
},
|
4692
|
+
{
|
4693
|
+
id: 'user',
|
4694
|
+
title: 'Regular User',
|
4695
|
+
},
|
4696
|
+
]),
|
4697
|
+
},
|
4698
|
+
];
|
4699
|
+
}
|
4700
|
+
}
|
4701
|
+
|
4702
|
+
class AXPSecurityManagementRoleDataSeeder {
|
4703
|
+
constructor() {
|
4704
|
+
this.storageService = inject(AXPDexieEntityStorageService);
|
4705
|
+
}
|
4706
|
+
// private permissionService = inject(AXPPermissionDefinitionProviderService);
|
4707
|
+
async seed() {
|
4708
|
+
// const permissions = await this.permissionService.permissions();
|
4709
|
+
// const permissionKeys = permissions.map((p) => p.name);
|
4710
|
+
// Generate roles with random permissions from the actual permission list
|
4711
|
+
const roles = mockRoleDefinitions.map((role) => ({
|
4712
|
+
...role,
|
4713
|
+
// permissions: this.getRandomPermissions(permissionKeys, 2, 5), // Get 2-5 random permissions
|
4714
|
+
}));
|
4715
|
+
await this.storageService.initial(`${RootConfig$5.module.name}.${RootConfig$5.entities.roles.name}`, roles);
|
4716
|
+
}
|
4717
|
+
getRandomPermissions(permissions, min, max) {
|
4718
|
+
const count = Math.floor(Math.random() * (max - min + 1)) + min;
|
4719
|
+
const shuffled = [...permissions].sort(() => 0.5 - Math.random());
|
4720
|
+
return shuffled.slice(0, count);
|
4721
|
+
}
|
4722
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSecurityManagementRoleDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
4723
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSecurityManagementRoleDataSeeder }); }
|
4724
|
+
}
|
4725
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSecurityManagementRoleDataSeeder, decorators: [{
|
4726
|
+
type: Injectable
|
4727
|
+
}] });
|
4728
|
+
|
4729
|
+
class AXPSecurityManagementUserDataSeeder {
|
4730
|
+
constructor() {
|
4731
|
+
this.storageService = inject(AXPDexieEntityStorageService);
|
4732
|
+
}
|
4733
|
+
async seed() {
|
4734
|
+
await this.storageService.initial(`${RootConfig$5.module.name}.${RootConfig$5.entities.users.name}`, this.generateUsers());
|
4735
|
+
}
|
4736
|
+
generateUsers() {
|
4737
|
+
return mockUsers.map((user) => ({
|
4738
|
+
id: user.id,
|
4739
|
+
username: user.username,
|
4740
|
+
firstname: user.firstName,
|
4741
|
+
lastname: user.lastName,
|
4742
|
+
nationalCode: user.nationalCode,
|
4743
|
+
mobile: user.mobile,
|
4744
|
+
password: '123',
|
4745
|
+
roles: user.roleIds,
|
4746
|
+
}));
|
4747
|
+
}
|
4748
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSecurityManagementUserDataSeeder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
4749
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSecurityManagementUserDataSeeder }); }
|
4750
|
+
}
|
4751
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSecurityManagementUserDataSeeder, decorators: [{
|
4752
|
+
type: Injectable
|
4753
|
+
}] });
|
4754
|
+
|
4581
4755
|
class AXCDeviceSessionService extends AXMDeviceSessionsServiceImpl {
|
4582
4756
|
async terminate(id) {
|
4583
4757
|
const item = await this.updateOne(id, {
|
@@ -4934,6 +5108,16 @@ class AXCMockModule {
|
|
4934
5108
|
useClass: AXPSecurityManagementDeviceSessionDataSeeder,
|
4935
5109
|
multi: true,
|
4936
5110
|
},
|
5111
|
+
{
|
5112
|
+
provide: AXP_DATA_SEEDER_TOKEN,
|
5113
|
+
useClass: AXPSecurityManagementUserDataSeeder,
|
5114
|
+
multi: true,
|
5115
|
+
},
|
5116
|
+
{
|
5117
|
+
provide: AXP_DATA_SEEDER_TOKEN,
|
5118
|
+
useClass: AXPSecurityManagementRoleDataSeeder,
|
5119
|
+
multi: true,
|
5120
|
+
},
|
4937
5121
|
{
|
4938
5122
|
provide: AXP_DATA_SEEDER_TOKEN,
|
4939
5123
|
useClass: AXPDashboardDataSeeder,
|
@@ -5108,6 +5292,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
5108
5292
|
useClass: AXPSecurityManagementDeviceSessionDataSeeder,
|
5109
5293
|
multi: true,
|
5110
5294
|
},
|
5295
|
+
{
|
5296
|
+
provide: AXP_DATA_SEEDER_TOKEN,
|
5297
|
+
useClass: AXPSecurityManagementUserDataSeeder,
|
5298
|
+
multi: true,
|
5299
|
+
},
|
5300
|
+
{
|
5301
|
+
provide: AXP_DATA_SEEDER_TOKEN,
|
5302
|
+
useClass: AXPSecurityManagementRoleDataSeeder,
|
5303
|
+
multi: true,
|
5304
|
+
},
|
5111
5305
|
{
|
5112
5306
|
provide: AXP_DATA_SEEDER_TOKEN,
|
5113
5307
|
useClass: AXPDashboardDataSeeder,
|
@@ -5191,5 +5385,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
5191
5385
|
* Generated bundle index. Do not edit.
|
5192
5386
|
*/
|
5193
5387
|
|
5194
|
-
export { AXCMockModule };
|
5388
|
+
export { AXCMockModule, AXPDexieEntityStorageService, MOCKStrategy };
|
5195
5389
|
//# sourceMappingURL=acorex-connectivity-mock.mjs.map
|