@acorex/connectivity 19.3.5 → 19.3.6
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.
@@ -1121,29 +1121,27 @@ function generateRandomDashboard() {
|
|
1121
1121
|
};
|
1122
1122
|
}
|
1123
1123
|
// Generate a Charts Dashboard with one of each chart type
|
1124
|
-
function generateChartsDashboard() {
|
1124
|
+
function generateChartsDashboard(user) {
|
1125
1125
|
const chartWidgets = [
|
1126
1126
|
generateBarChartWidget(),
|
1127
1127
|
generateDonutChartWidget(),
|
1128
1128
|
generateGaugeChartWidget(),
|
1129
1129
|
generateLineChartWidget(),
|
1130
1130
|
];
|
1131
|
-
// Find an admin user for the charts dashboard
|
1132
|
-
const adminUser = mockUsers.find((user) => user.roleIds.some((role) => role.id === '1001')) || mockUsers[0];
|
1133
1131
|
const createdAt = new Date(Date.now() - 15 * 24 * 60 * 60 * 1000); // Created 15 days ago
|
1134
1132
|
return {
|
1135
1133
|
id: AXPDataGenerator.uuid(),
|
1136
|
-
name:
|
1137
|
-
title: '
|
1138
|
-
description:
|
1134
|
+
name: `charts-dashboard-${user.username}`,
|
1135
|
+
title: `${user.firstName}'s Data Dashboard`,
|
1136
|
+
description: `Personal data visualization dashboard for ${user.firstName} ${user.lastName}`,
|
1139
1137
|
widgets: chartWidgets,
|
1140
|
-
roleIds:
|
1141
|
-
isDeleted:
|
1138
|
+
roleIds: user.roleIds.map((r) => r.id),
|
1139
|
+
isDeleted: false,
|
1142
1140
|
createdAt: createdAt,
|
1143
|
-
createdBy:
|
1141
|
+
createdBy: user.id,
|
1144
1142
|
updatedAt: undefined,
|
1145
1143
|
updatedBy: undefined,
|
1146
|
-
scope:
|
1144
|
+
scope: 'U', // Always user scope for personal dashboards
|
1147
1145
|
};
|
1148
1146
|
}
|
1149
1147
|
// Generate a Utility Dashboard with utility widgets
|
@@ -1155,29 +1153,44 @@ function generateUtilityDashboard() {
|
|
1155
1153
|
generateNotificationWidget(),
|
1156
1154
|
generateTaskListWidget(),
|
1157
1155
|
];
|
1158
|
-
// Find
|
1159
|
-
const
|
1156
|
+
// Find an admin user for the owner of tenant dashboard
|
1157
|
+
const adminUser = mockUsers.find((user) => user.roleIds.some((role) => role.id === '1001')) || mockUsers[0];
|
1160
1158
|
const createdAt = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000); // Created 7 days ago
|
1161
1159
|
const updatedAt = new Date(createdAt.getTime() + 2 * 24 * 60 * 60 * 1000); // Updated 2 days after creation
|
1162
|
-
// Find
|
1163
|
-
const
|
1160
|
+
// Find another admin or manager to be the updater
|
1161
|
+
const updaterUser = mockUsers.find((user) => user.roleIds.some((role) => role.id === '1001' || role.id === '1002') && user.id !== adminUser.id);
|
1162
|
+
// Generate titles for tenant-wide utility dashboards
|
1163
|
+
const tenantDashboardTitles = [
|
1164
|
+
'Company Overview',
|
1165
|
+
'Team Performance',
|
1166
|
+
'Department Productivity',
|
1167
|
+
'Organization Metrics',
|
1168
|
+
'Office Utilities',
|
1169
|
+
'Team Resources',
|
1170
|
+
'Corporate Dashboard',
|
1171
|
+
];
|
1164
1172
|
return {
|
1165
1173
|
id: AXPDataGenerator.uuid(),
|
1166
|
-
name:
|
1167
|
-
title:
|
1168
|
-
description: 'A dashboard containing useful utility widgets for
|
1174
|
+
name: `utility-dashboard-${AXPDataGenerator.alphabet(5)}`,
|
1175
|
+
title: AXPDataGenerator.pick(tenantDashboardTitles),
|
1176
|
+
description: 'A shared dashboard containing useful utility widgets for organizational productivity.',
|
1169
1177
|
widgets: utilityWidgets,
|
1170
|
-
roleIds: ['
|
1171
|
-
isDeleted: false,
|
1178
|
+
roleIds: ['1001', '1002', '1003'], // Accessible by admins, managers, and regular users
|
1179
|
+
isDeleted: false,
|
1172
1180
|
createdAt: createdAt,
|
1173
|
-
createdBy:
|
1181
|
+
createdBy: adminUser.id,
|
1174
1182
|
updatedAt: updatedAt,
|
1175
|
-
updatedBy:
|
1176
|
-
scope:
|
1183
|
+
updatedBy: updaterUser ? updaterUser.id : undefined,
|
1184
|
+
scope: 'T', // Always tenant scope for shared dashboards
|
1177
1185
|
};
|
1178
1186
|
}
|
1179
|
-
// Create dashboards:
|
1180
|
-
const DASHBOARDS = [
|
1187
|
+
// Create dashboards: personal dashboards for all users + shared tenant dashboards
|
1188
|
+
const DASHBOARDS = [
|
1189
|
+
// Create personal chart dashboards for each user with scope 'U'
|
1190
|
+
...mockUsers.map((user) => generateChartsDashboard(user)),
|
1191
|
+
// Create several tenant-wide utility dashboards with scope 'T'
|
1192
|
+
...Array.from({ length: AXPDataGenerator.number(1, 3) }, () => generateUtilityDashboard()),
|
1193
|
+
];
|
1181
1194
|
|
1182
1195
|
class AXPDashboardDataSeeder {
|
1183
1196
|
constructor() {
|