cloud-ide-core 2.0.57 → 2.0.60
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/cloud-ide-core.mjs +105 -92
- package/fesm2022/cloud-ide-core.mjs.map +1 -1
- package/index.d.ts +18 -19
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { authGuard, CideSharedOrgStructureComponent } from 'cloud-ide-shared';
|
|
1
|
+
import { authGuard, SharedObjectIdService, CideSharedOrgStructureComponent } from 'cloud-ide-shared';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Injectable, Component, inject, DestroyRef, viewChild, signal, computed, input, output, ChangeDetectorRef, ViewChild } from '@angular/core';
|
|
4
4
|
import * as i1$1 from '@angular/common';
|
|
@@ -9613,6 +9613,8 @@ class CideCoreEntityCreateComponent {
|
|
|
9613
9613
|
breadcrumbData = signal([], ...(ngDevMode ? [{ debugName: "breadcrumbData" }] : []));
|
|
9614
9614
|
// Reactive form
|
|
9615
9615
|
entityForm;
|
|
9616
|
+
// Generated entity ID - created during form initialization
|
|
9617
|
+
generatedEntityId = null;
|
|
9616
9618
|
entityTypes = signal([], ...(ngDevMode ? [{ debugName: "entityTypes" }] : []));
|
|
9617
9619
|
currencies = signal([], ...(ngDevMode ? [{ debugName: "currencies" }] : []));
|
|
9618
9620
|
users = signal([], ...(ngDevMode ? [{ debugName: "users" }] : []));
|
|
@@ -9726,6 +9728,7 @@ class CideCoreEntityCreateComponent {
|
|
|
9726
9728
|
route = inject(ActivatedRoute);
|
|
9727
9729
|
router = inject(Router);
|
|
9728
9730
|
fileManagerService = inject(CideEleFileManagerService);
|
|
9731
|
+
sharedObjectIdService = inject(SharedObjectIdService);
|
|
9729
9732
|
destroy$ = new Subject();
|
|
9730
9733
|
globalErrorHandler;
|
|
9731
9734
|
globalRejectionHandler;
|
|
@@ -9796,6 +9799,8 @@ class CideCoreEntityCreateComponent {
|
|
|
9796
9799
|
// Store handlers for cleanup
|
|
9797
9800
|
this.globalErrorHandler = errorHandler;
|
|
9798
9801
|
this.globalRejectionHandler = rejectionHandler;
|
|
9802
|
+
// Generate entity ID during form initialization
|
|
9803
|
+
this.generateEntityId();
|
|
9799
9804
|
// Initialize dropdown options
|
|
9800
9805
|
// this.initializeDropdownOptions(); // Removed - using shared wrapper breadcrumb system
|
|
9801
9806
|
// Check for entity ID in query parameters
|
|
@@ -10073,80 +10078,96 @@ class CideCoreEntityCreateComponent {
|
|
|
10073
10078
|
}
|
|
10074
10079
|
});
|
|
10075
10080
|
}
|
|
10081
|
+
/**
|
|
10082
|
+
* Generate entity ID during form initialization
|
|
10083
|
+
* This ID will be used for the entity and its mappings
|
|
10084
|
+
*/
|
|
10085
|
+
generateEntityId() {
|
|
10086
|
+
this.sharedObjectIdService.generateObjectId().subscribe({
|
|
10087
|
+
next: (response) => {
|
|
10088
|
+
if (response?.success && response?.data?.objectId) {
|
|
10089
|
+
this.generatedEntityId = response.data.objectId;
|
|
10090
|
+
console.log('🆔 [EntityCreate] Generated entity ID during initialization:', this.generatedEntityId);
|
|
10091
|
+
}
|
|
10092
|
+
else {
|
|
10093
|
+
console.error('❌ [EntityCreate] Failed to generate entity ID');
|
|
10094
|
+
}
|
|
10095
|
+
},
|
|
10096
|
+
error: (error) => {
|
|
10097
|
+
console.error('❌ [EntityCreate] Error generating entity ID:', error);
|
|
10098
|
+
}
|
|
10099
|
+
});
|
|
10100
|
+
}
|
|
10076
10101
|
addUserMapping() {
|
|
10077
10102
|
if (this.userMappingForm.valid) {
|
|
10078
10103
|
const formValue = this.userMappingForm.value;
|
|
10079
|
-
//
|
|
10080
|
-
this.
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
error: (err) => {
|
|
10138
|
-
console.error('Error generating mapping ID:', err);
|
|
10139
|
-
this.notificationService.error('Failed to generate mapping ID');
|
|
10140
|
-
}
|
|
10104
|
+
// Check if entity ID is available
|
|
10105
|
+
if (!this.generatedEntityId) {
|
|
10106
|
+
console.error('❌ [EntityCreate] Entity ID not generated yet');
|
|
10107
|
+
this.notificationService.error('Entity ID not ready. Please try again.');
|
|
10108
|
+
return;
|
|
10109
|
+
}
|
|
10110
|
+
// Generate mapping ID using shared service
|
|
10111
|
+
this.sharedObjectIdService.generateObjectId().subscribe({
|
|
10112
|
+
next: (mappingResponse) => {
|
|
10113
|
+
if (mappingResponse?.success && mappingResponse?.data?.objectId) {
|
|
10114
|
+
const generatedMappingId = mappingResponse.data.objectId;
|
|
10115
|
+
// Check if user is already mapped to any entity
|
|
10116
|
+
const existingMapping = this.userEntityMappings().find(m => m.syenm_id_user === formValue.syenm_id_user);
|
|
10117
|
+
if (existingMapping) {
|
|
10118
|
+
this.notificationService.error('This user is already mapped to an entity');
|
|
10119
|
+
return;
|
|
10120
|
+
}
|
|
10121
|
+
// Find user details from available users
|
|
10122
|
+
const selectedUser = this.availableUsers().find(u => u.value === formValue.syenm_id_user);
|
|
10123
|
+
if (!selectedUser) {
|
|
10124
|
+
this.notificationService.error('Selected user not found');
|
|
10125
|
+
return;
|
|
10126
|
+
}
|
|
10127
|
+
const newMapping = {
|
|
10128
|
+
_id: generatedMappingId, // Use generated mapping ID
|
|
10129
|
+
syenm_id_user: formValue.syenm_id_user, // Store user ID as string
|
|
10130
|
+
_displayUserName: selectedUser.label, // Store user name for display
|
|
10131
|
+
syenm_id_logses: '',
|
|
10132
|
+
syenm_entity_id_syen: this.generatedEntityId, // Use pre-generated entity ID
|
|
10133
|
+
syenm_role_id_syusrol: undefined, // Set to undefined as requested
|
|
10134
|
+
syenm_designation_id_sydsg: undefined, // Set to undefined as requested
|
|
10135
|
+
syenm_department_id_sydept: undefined, // Set to undefined as requested
|
|
10136
|
+
syenm_activefrom: new Date().toISOString().split('T')[0], // Default to today
|
|
10137
|
+
syenm_activeupto: '', // Default to empty
|
|
10138
|
+
syenm_isdefault: false, // Always false
|
|
10139
|
+
syenm_isactive: true, // Always active
|
|
10140
|
+
syenm_isloggedin: false // Always false
|
|
10141
|
+
};
|
|
10142
|
+
console.log('🍞 Selected user:', newMapping);
|
|
10143
|
+
// Add to existing mappings
|
|
10144
|
+
const currentMappings = this.userEntityMappings();
|
|
10145
|
+
const updatedMappings = [...currentMappings, newMapping];
|
|
10146
|
+
// Update signal first
|
|
10147
|
+
this.userEntityMappings.set(updatedMappings);
|
|
10148
|
+
// Update grid config data - create new reference to trigger change detection
|
|
10149
|
+
this.userMappingsGridConfig = {
|
|
10150
|
+
...this.userMappingsGridConfig,
|
|
10151
|
+
data: updatedMappings
|
|
10152
|
+
};
|
|
10153
|
+
// Reset form
|
|
10154
|
+
this.userMappingForm.reset({
|
|
10155
|
+
syenm_id_user: ''
|
|
10156
|
+
});
|
|
10157
|
+
this.notificationService.success('User mapping added successfully');
|
|
10158
|
+
console.log('✅ [EntityCreate] User mapped successfully:', {
|
|
10159
|
+
userId: formValue.syenm_id_user,
|
|
10160
|
+
entityId: this.generatedEntityId,
|
|
10161
|
+
mappingId: generatedMappingId
|
|
10141
10162
|
});
|
|
10142
10163
|
}
|
|
10143
10164
|
else {
|
|
10144
|
-
this.notificationService.error('Failed to generate
|
|
10165
|
+
this.notificationService.error('Failed to generate mapping ID');
|
|
10145
10166
|
}
|
|
10146
10167
|
},
|
|
10147
10168
|
error: (err) => {
|
|
10148
|
-
console.error('Error generating
|
|
10149
|
-
this.notificationService.error('Failed to generate
|
|
10169
|
+
console.error('Error generating mapping ID:', err);
|
|
10170
|
+
this.notificationService.error('Failed to generate mapping ID');
|
|
10150
10171
|
}
|
|
10151
10172
|
});
|
|
10152
10173
|
}
|
|
@@ -11599,6 +11620,7 @@ class CideCoreUserCreateComponent {
|
|
|
11599
11620
|
appState = inject(AppStateHelperService);
|
|
11600
11621
|
floatingFeaturesService = inject(CideEleFloatingFeaturesService);
|
|
11601
11622
|
fileManagerService = inject(CideEleFileManagerService);
|
|
11623
|
+
sharedObjectIdService = inject(SharedObjectIdService);
|
|
11602
11624
|
entityRightsService = inject(CideLytFloatingEntityRightsSharingService);
|
|
11603
11625
|
notificationService = inject(NotificationService);
|
|
11604
11626
|
userMasterForm;
|
|
@@ -14327,11 +14349,11 @@ class CideCoreUserCreateComponent {
|
|
|
14327
14349
|
console.log('📸 Profile photo preview will be loaded by file-input component for ID:', fileId);
|
|
14328
14350
|
}
|
|
14329
14351
|
addContactAddress() {
|
|
14330
|
-
// Generate a new ObjectId for the address
|
|
14331
|
-
this.
|
|
14352
|
+
// Generate a new ObjectId for the address using shared service
|
|
14353
|
+
this.sharedObjectIdService.generateObjectId().subscribe({
|
|
14332
14354
|
next: (response) => {
|
|
14333
14355
|
const newObjectId = response.data?.objectId;
|
|
14334
|
-
console.log('🆔 [UserCreate] Generated new ObjectId for address:', newObjectId);
|
|
14356
|
+
console.log('🆔 [UserCreate] Generated new ObjectId for address via SharedObjectIdService:', newObjectId);
|
|
14335
14357
|
// Create entity access pass management record with owner rights
|
|
14336
14358
|
const currentUser = this.appState.currentUser();
|
|
14337
14359
|
const currentEntity = this.appState.activeEntity();
|
|
@@ -14480,11 +14502,11 @@ class CideCoreUserCreateComponent {
|
|
|
14480
14502
|
});
|
|
14481
14503
|
}
|
|
14482
14504
|
addDocument() {
|
|
14483
|
-
// Generate a new ObjectId for the document
|
|
14484
|
-
this.
|
|
14505
|
+
// Generate a new ObjectId for the document using shared service
|
|
14506
|
+
this.sharedObjectIdService.generateObjectId().subscribe({
|
|
14485
14507
|
next: (response) => {
|
|
14486
14508
|
const newObjectId = response.data?.objectId;
|
|
14487
|
-
console.log('🆔 [UserCreate] Generated new ObjectId for document:', newObjectId);
|
|
14509
|
+
console.log('🆔 [UserCreate] Generated new ObjectId for document via SharedObjectIdService:', newObjectId);
|
|
14488
14510
|
// Create entity access pass management record with owner rights
|
|
14489
14511
|
const currentUser = this.appState.currentUser();
|
|
14490
14512
|
const currentEntity = this.appState.activeEntity();
|
|
@@ -14558,11 +14580,11 @@ class CideCoreUserCreateComponent {
|
|
|
14558
14580
|
this.applyDocumentAccessControl();
|
|
14559
14581
|
}
|
|
14560
14582
|
addFamilyDetail() {
|
|
14561
|
-
// Generate a new ObjectId for the family detail
|
|
14562
|
-
this.
|
|
14583
|
+
// Generate a new ObjectId for the family detail using shared service
|
|
14584
|
+
this.sharedObjectIdService.generateObjectId().subscribe({
|
|
14563
14585
|
next: (response) => {
|
|
14564
14586
|
const newObjectId = response.data?.objectId;
|
|
14565
|
-
console.log('🆔 [UserCreate] Generated new ObjectId for family detail:', newObjectId);
|
|
14587
|
+
console.log('🆔 [UserCreate] Generated new ObjectId for family detail via SharedObjectIdService:', newObjectId);
|
|
14566
14588
|
// Create entity access pass management record with owner rights
|
|
14567
14589
|
const currentUser = this.appState.currentUser();
|
|
14568
14590
|
const currentEntity = this.appState.activeEntity();
|
|
@@ -15244,19 +15266,14 @@ class CideCoreUserCreateComponent {
|
|
|
15244
15266
|
}
|
|
15245
15267
|
/**
|
|
15246
15268
|
* Generate Object ID for new user creation
|
|
15247
|
-
* Uses the
|
|
15269
|
+
* Uses the shared object ID service to generate a unique ObjectId
|
|
15248
15270
|
* @returns Promise<string> - The generated ObjectId
|
|
15249
15271
|
*/
|
|
15250
15272
|
async generateObjectId() {
|
|
15251
15273
|
try {
|
|
15252
|
-
const
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
return response.data.objectId;
|
|
15256
|
-
}
|
|
15257
|
-
else {
|
|
15258
|
-
throw new Error('Failed to generate ObjectId: Invalid response');
|
|
15259
|
-
}
|
|
15274
|
+
const objectId = await this.sharedObjectIdService.generateObjectIdAsync();
|
|
15275
|
+
console.log('🆔 [UserCreate] Generated new ObjectId for user via SharedObjectIdService:', objectId);
|
|
15276
|
+
return objectId;
|
|
15260
15277
|
}
|
|
15261
15278
|
catch (error) {
|
|
15262
15279
|
console.error('❌ [UserCreate] Error generating ObjectId:', error);
|
|
@@ -15265,18 +15282,14 @@ class CideCoreUserCreateComponent {
|
|
|
15265
15282
|
}
|
|
15266
15283
|
/**
|
|
15267
15284
|
* Generate Object ID for user-related entities (addresses, documents, family details)
|
|
15285
|
+
* Uses the shared object ID service for consistency
|
|
15268
15286
|
* @returns Promise<string> - The generated ObjectId
|
|
15269
15287
|
*/
|
|
15270
15288
|
async generateEntityObjectId() {
|
|
15271
15289
|
try {
|
|
15272
|
-
const
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
return response.data.objectId;
|
|
15276
|
-
}
|
|
15277
|
-
else {
|
|
15278
|
-
throw new Error('Failed to generate ObjectId: Invalid response');
|
|
15279
|
-
}
|
|
15290
|
+
const objectId = await this.sharedObjectIdService.generateObjectIdAsync();
|
|
15291
|
+
console.log('🆔 [UserCreate] Generated new ObjectId for entity via SharedObjectIdService:', objectId);
|
|
15292
|
+
return objectId;
|
|
15280
15293
|
}
|
|
15281
15294
|
catch (error) {
|
|
15282
15295
|
console.error('❌ [UserCreate] Error generating entity ObjectId:', error);
|