cloud-ide-core 2.0.119 → 2.0.121
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.
|
@@ -13171,12 +13171,17 @@ class CideCoreUserCreateComponent {
|
|
|
13171
13171
|
// Update entity mappings FormArray
|
|
13172
13172
|
const entityMappingFormArray = this.entityMappingsFormArray;
|
|
13173
13173
|
entityMappingFormArray.clear();
|
|
13174
|
-
data.core_entity_mapping.forEach((mapping) => {
|
|
13174
|
+
data.core_entity_mapping.forEach((mapping, index) => {
|
|
13175
13175
|
const mappingGroup = this.createEntityMappingFormGroup();
|
|
13176
13176
|
let core_entity_mapping = {};
|
|
13177
|
+
// Extract entity ID as string (handle both object and string formats)
|
|
13178
|
+
const entityIdValue = mapping?.syenm_entity_id_syen;
|
|
13179
|
+
const entityIdString = typeof entityIdValue === 'string'
|
|
13180
|
+
? entityIdValue
|
|
13181
|
+
: (entityIdValue?._id || '');
|
|
13177
13182
|
core_entity_mapping = {
|
|
13178
13183
|
...mapping,
|
|
13179
|
-
syenm_entity_id_syen:
|
|
13184
|
+
syenm_entity_id_syen: entityIdString,
|
|
13180
13185
|
syenm_designation_id_sydsg: mapping?.syenm_designation_id_sydsg?._id,
|
|
13181
13186
|
syenm_role_id_syusrol: mapping?.syenm_role_id_syusrol?._id,
|
|
13182
13187
|
syenm_department_id_sydept: mapping?.syenm_department_id_sydept?._id
|
|
@@ -13184,6 +13189,11 @@ class CideCoreUserCreateComponent {
|
|
|
13184
13189
|
mappingGroup.patchValue(core_entity_mapping);
|
|
13185
13190
|
mappingGroup.get('syenm_entity_id_syen')?.disable();
|
|
13186
13191
|
entityMappingFormArray.push(mappingGroup);
|
|
13192
|
+
// Load roles for this entity after form is patched
|
|
13193
|
+
if (entityIdString) {
|
|
13194
|
+
console.log(`🎭 Loading roles for entity ${entityIdString} in mapping ${index} after form patch`);
|
|
13195
|
+
this.loadRolesForEntity(index, entityIdString);
|
|
13196
|
+
}
|
|
13187
13197
|
});
|
|
13188
13198
|
// Load role permissions for each mapping that has a role selected
|
|
13189
13199
|
data.core_entity_mapping.forEach((mapping, index) => {
|
|
@@ -13479,19 +13489,42 @@ class CideCoreUserCreateComponent {
|
|
|
13479
13489
|
});
|
|
13480
13490
|
}
|
|
13481
13491
|
getRoleOptionsForEntity(mappingIndex) {
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13492
|
+
// First try to get entity ID from form control (most reliable)
|
|
13493
|
+
const mappingFormGroup = this.entityMappingsFormArray.at(mappingIndex);
|
|
13494
|
+
let entityId = undefined;
|
|
13495
|
+
if (mappingFormGroup) {
|
|
13496
|
+
const entityIdValue = mappingFormGroup.get('syenm_entity_id_syen')?.value;
|
|
13497
|
+
if (entityIdValue) {
|
|
13498
|
+
// Handle both string and object formats
|
|
13499
|
+
entityId = typeof entityIdValue === 'string'
|
|
13500
|
+
? entityIdValue
|
|
13501
|
+
: (entityIdValue._id || undefined);
|
|
13502
|
+
}
|
|
13503
|
+
}
|
|
13504
|
+
// Fallback: try to get from entity mappings signal
|
|
13505
|
+
if (!entityId) {
|
|
13506
|
+
const mapping = this.entityMappings()[mappingIndex];
|
|
13507
|
+
if (mapping?.syenm_entity_id_syen) {
|
|
13508
|
+
const entityValue = mapping.syenm_entity_id_syen;
|
|
13509
|
+
// Handle both string and object formats
|
|
13510
|
+
entityId = typeof entityValue === 'string'
|
|
13511
|
+
? entityValue
|
|
13512
|
+
: (entityValue._id || undefined);
|
|
13513
|
+
}
|
|
13514
|
+
}
|
|
13515
|
+
if (!entityId) {
|
|
13516
|
+
console.log(`🎭 getRoleOptionsForEntity: No entity ID found for mapping ${mappingIndex}`);
|
|
13485
13517
|
return [];
|
|
13486
13518
|
}
|
|
13487
|
-
|
|
13488
|
-
console.log(`🎭 roles:`, this.roleOptions());
|
|
13519
|
+
console.log(`🎭 getRoleOptionsForEntity for entity ${entityId}:`, this.roleOptions());
|
|
13489
13520
|
const roles = this.roleOptions()[entityId];
|
|
13490
|
-
|
|
13491
|
-
|
|
13521
|
+
// If roles are not loaded yet, trigger loading
|
|
13522
|
+
if (!roles && entityId) {
|
|
13523
|
+
console.log(`🎭 Roles not cached for entity ${entityId}, loading...`);
|
|
13524
|
+
this.loadRolesForEntity(mappingIndex, entityId);
|
|
13525
|
+
return []; // Return empty while loading
|
|
13492
13526
|
}
|
|
13493
|
-
|
|
13494
|
-
return [];
|
|
13527
|
+
return roles || [];
|
|
13495
13528
|
}
|
|
13496
13529
|
/**
|
|
13497
13530
|
* Get filtered entity options with disabled state for already selected entities in other mappings
|