cloud-ide-layout 1.0.168 → 1.0.174

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.
Files changed (20) hide show
  1. package/fesm2022/{cloud-ide-layout-cloud-ide-layout-TXOQ0tip.mjs → cloud-ide-layout-cloud-ide-layout-Cwim-wD5.mjs} +309 -16
  2. package/fesm2022/cloud-ide-layout-cloud-ide-layout-Cwim-wD5.mjs.map +1 -0
  3. package/fesm2022/cloud-ide-layout-dashboard-cards.service-BGaKcq7H.mjs.map +1 -1
  4. package/fesm2022/{cloud-ide-layout-dashboard-manager.component-ik-G60a-.mjs → cloud-ide-layout-dashboard-manager.component-By3-I91u.mjs} +2 -2
  5. package/fesm2022/{cloud-ide-layout-dashboard-manager.component-ik-G60a-.mjs.map → cloud-ide-layout-dashboard-manager.component-By3-I91u.mjs.map} +1 -1
  6. package/fesm2022/cloud-ide-layout-drawer-theme.component-DVg-dInv.mjs +346 -0
  7. package/fesm2022/cloud-ide-layout-drawer-theme.component-DVg-dInv.mjs.map +1 -0
  8. package/fesm2022/{cloud-ide-layout-home-wrapper.component-C4YxNQIe.mjs → cloud-ide-layout-home-wrapper.component-DAPSGYLf.mjs} +5 -4
  9. package/fesm2022/cloud-ide-layout-home-wrapper.component-DAPSGYLf.mjs.map +1 -0
  10. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-DKBaKoE7.mjs → cloud-ide-layout-sidedrawer-notes.component-DhnrHthy.mjs} +2 -2
  11. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-DKBaKoE7.mjs.map → cloud-ide-layout-sidedrawer-notes.component-DhnrHthy.mjs.map} +1 -1
  12. package/fesm2022/cloud-ide-layout.mjs +1 -1
  13. package/index.d.ts +68 -2
  14. package/package.json +1 -1
  15. package/fesm2022/cloud-ide-layout-cloud-ide-layout-TXOQ0tip.mjs.map +0 -1
  16. package/fesm2022/cloud-ide-layout-drawer-theme.component-Dzt70vGh.mjs +0 -328
  17. package/fesm2022/cloud-ide-layout-drawer-theme.component-Dzt70vGh.mjs.map +0 -1
  18. package/fesm2022/cloud-ide-layout-floating-entity-selection.component-CFvHxAw7.mjs +0 -232
  19. package/fesm2022/cloud-ide-layout-floating-entity-selection.component-CFvHxAw7.mjs.map +0 -1
  20. package/fesm2022/cloud-ide-layout-home-wrapper.component-C4YxNQIe.mjs.map +0 -1
@@ -10,12 +10,13 @@ import { Title, DomSanitizer } from '@angular/platform-browser';
10
10
  import { CideEleFileManagerService, CideElementsService, CideEleFloatingContainerService, NotificationService, CideIconComponent, CideEleButtonComponent, CideInputComponent, CideSelectComponent, CideThemeService, ConfirmationService, WebSocketNotificationService, NotificationApiService, CideEleDropdownComponent, CideEleFileImageDirective, CideEleResizerDirective, TooltipDirective, CideSpinnerComponent, CideEleSkeletonLoaderComponent, KeyboardShortcutService, FloatingContainerShortcutsService, CideEleFloatingContainerManagerComponent, CideEleGlobalNotificationsComponent, CideEleBreadcrumbComponent } from 'cloud-ide-element';
11
11
  import * as i1$1 from '@angular/common';
12
12
  import { CommonModule, NgClass, NgFor, NgIf, isPlatformBrowser } from '@angular/common';
13
- import { FINANCIAL_YEAR_SERVICE_TOKEN, ACADEMIC_YEAR_SERVICE_TOKEN, AUTH_SERVICE_TOKEN, authGuard, ENTITY_SERVICE_TOKEN } from 'cloud-ide-shared';
13
+ import { FINANCIAL_YEAR_SERVICE_TOKEN, ACADEMIC_YEAR_SERVICE_TOKEN, AUTH_SERVICE_TOKEN, authGuard, ENTITY_SERVICE_TOKEN, CideSharedOrgStructureComponent } from 'cloud-ide-shared';
14
14
  import * as i1 from '@angular/forms';
15
15
  import { FormBuilder, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
16
16
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
17
17
  import { trigger, state, transition, style, animate } from '@angular/animations';
18
18
  import { merge } from 'lodash-es';
19
+ import { CloudIdeAuthService } from 'cloud-ide-auth';
19
20
 
20
21
  class CloudIdeLayoutService {
21
22
  constructor() { }
@@ -1408,7 +1409,7 @@ class CideLytFloatingEntitySelectionService {
1408
1409
  }
1409
1410
  try {
1410
1411
  // Use relative import to avoid circular dependency
1411
- const module = await import('./cloud-ide-layout-floating-entity-selection.component-CFvHxAw7.mjs');
1412
+ const module = await Promise.resolve().then(function () { return floatingEntitySelection_component; });
1412
1413
  if (module.CideLytFloatingEntitySelectionComponent) {
1413
1414
  this.containerService.registerComponent('entity-selection-header', module.CideLytFloatingEntitySelectionComponent);
1414
1415
  console.log('✅ Entity selection component registered successfully');
@@ -1418,10 +1419,54 @@ class CideLytFloatingEntitySelectionService {
1418
1419
  console.error('❌ Failed to register entity selection component:', error);
1419
1420
  }
1420
1421
  }
1422
+ /**
1423
+ * Get responsive dimensions based on screen size
1424
+ */
1425
+ getResponsiveDimensions() {
1426
+ // Check if we're in a browser environment
1427
+ if (typeof window === 'undefined') {
1428
+ // Default desktop dimensions
1429
+ return {
1430
+ width: '800px',
1431
+ height: '600px',
1432
+ minWidth: '600px',
1433
+ minHeight: '500px'
1434
+ };
1435
+ }
1436
+ const viewportWidth = window.innerWidth;
1437
+ const viewportHeight = window.innerHeight;
1438
+ // Mobile devices (up to 768px)
1439
+ if (viewportWidth <= 768) {
1440
+ return {
1441
+ width: '95vw',
1442
+ height: '90vh',
1443
+ minWidth: '280px',
1444
+ minHeight: '400px'
1445
+ };
1446
+ }
1447
+ // Tablet devices (769px to 1024px)
1448
+ if (viewportWidth <= 1024) {
1449
+ return {
1450
+ width: '90vw',
1451
+ height: '85vh',
1452
+ minWidth: '500px',
1453
+ minHeight: '450px'
1454
+ };
1455
+ }
1456
+ // Desktop devices (above 1024px)
1457
+ return {
1458
+ width: '800px',
1459
+ height: '600px',
1460
+ minWidth: '600px',
1461
+ minHeight: '500px'
1462
+ };
1463
+ }
1421
1464
  /**
1422
1465
  * Show entity selection in floating container
1466
+ * @param onSelect - Optional callback function that receives the selected entity (for selection mode, not switching)
1467
+ * @param title - Optional title for the container (default: 'Switch Entity')
1423
1468
  */
1424
- async show() {
1469
+ async show(onSelect, title = 'Switch Entity') {
1425
1470
  console.log('🏢 Showing entity selection...');
1426
1471
  console.log('📋 Current registered components:', this.containerService.getRegisteredComponentIds());
1427
1472
  // Ensure component is registered before showing
@@ -1434,20 +1479,30 @@ class CideLytFloatingEntitySelectionService {
1434
1479
  console.log('✅ Entity selection component already registered');
1435
1480
  }
1436
1481
  try {
1482
+ // Get responsive dimensions based on screen size
1483
+ const dimensions = this.getResponsiveDimensions();
1437
1484
  const config = {
1438
1485
  id: 'entity-selection-header',
1439
- title: 'Switch Entity',
1486
+ title: title,
1440
1487
  icon: 'business',
1441
- width: '800px',
1442
- height: '600px',
1443
- minWidth: '600px',
1444
- minHeight: '500px',
1488
+ width: dimensions.width,
1489
+ height: dimensions.height,
1490
+ minWidth: dimensions.minWidth,
1491
+ minHeight: dimensions.minHeight,
1492
+ maxWidth: '95vw',
1493
+ maxHeight: '95vh',
1445
1494
  resizable: true,
1446
1495
  draggable: true,
1447
1496
  closable: true,
1448
1497
  minimizable: true,
1449
1498
  maximizable: true,
1450
- componentId: 'entity-selection-header'
1499
+ componentId: 'entity-selection-header',
1500
+ componentConfig: {
1501
+ inputs: {
1502
+ onSelectCallback: signal(onSelect),
1503
+ selectionMode: signal(!!onSelect) // If callback provided, use selection mode
1504
+ }
1505
+ }
1451
1506
  };
1452
1507
  const containerId = this.containerService.show(config);
1453
1508
  console.log('✅ Entity selection container opened with ID:', containerId);
@@ -5192,8 +5247,8 @@ class CideLytSidedrawerWrapperComponent {
5192
5247
  }
5193
5248
  ngOnInit() {
5194
5249
  // Initialize the component map (You'd likely populate this from a config or service)
5195
- this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-DKBaKoE7.mjs').then(m => m.CideLytSidedrawerNotesComponent);
5196
- this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-Dzt70vGh.mjs').then(m => m.CideLytDrawerThemeComponent);
5250
+ this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-DhnrHthy.mjs').then(m => m.CideLytSidedrawerNotesComponent);
5251
+ this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-DVg-dInv.mjs').then(m => m.CideLytDrawerThemeComponent);
5197
5252
  }
5198
5253
  async loadComponent(configFor) {
5199
5254
  console.log('🔍 SIDEDRAWER - Loading component:', configFor, 'Current tab:', this.currentTabId);
@@ -6600,7 +6655,7 @@ class CideLytSharedWrapperComponent {
6600
6655
  }
6601
6656
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CideLytSharedWrapperComponent, decorators: [{
6602
6657
  type: Component,
6603
- args: [{ selector: 'cide-lyt-shared-wrapper', imports: [CideEleBreadcrumbComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"tw-w-full tw-h-full tw-flex tw-flex-col tw-max-w-full tw-overflow-hidden\">\n <div\n class=\"tw-sticky tw-w-full tw-max-w-full tw-top-0 tw-z-10 tw-bg-white tw-border-b tw-border-gray-200 tw-shadow-sm\">\n <div\n class=\"tw-flex tw-items-start sm:tw-items-center tw-justify-between tw-gap-2 tw-px-0 tw-py-0 tw-min-w-0 tw-overflow-hidden tw-flex-col sm:tw-flex-row\">\n <!-- Breadcrumb - Full width on mobile/tablet, flex-1 on desktop -->\n <div class=\"tw-w-full sm:tw-flex-1 tw-min-w-0 tw-overflow-hidden tw-order-1\">\n <cide-ele-breadcrumb [style]=\"'modern'\" [compact]=\"true\"\n (homeClick)=\"onBreadcrumbHomeClick()\"></cide-ele-breadcrumb>\n </div>\n <!-- Breadcrumb Actions - Full width on mobile, auto on tablet/desktop -->\n <div class=\"tw-w-full sm:tw-w-auto tw-flex-shrink-0 sm:tw-ml-2 md:tw-ml-4 tw-order-2\">\n <ng-content select=\"[breadcrumb-actions]\"></ng-content>\n </div>\n </div>\n </div>\n\n <div class=\"tw-flex-1 tw-w-full tw-max-w-full tw-overflow-y-auto tw-overflow-x-hidden tw-min-h-0\">\n <ng-content></ng-content>\n </div>\n</div>", styles: [":host{display:block;height:100%;width:100%}:host>div{display:flex;flex-direction:column;height:100%;width:100%}::ng-deep cide-lyt-shared-wrapper{height:100%!important;display:block!important;width:100%!important}@media (max-width: 479px){::ng-deep [breadcrumb-actions]{flex-shrink:0;width:100%;display:flex;justify-content:flex-end;margin-top:.5rem}::ng-deep cide-ele-breadcrumb{font-size:.5625rem;width:100%}::ng-deep cide-ele-breadcrumb nav ol{flex-wrap:wrap;align-items:center;gap:.125rem}::ng-deep cide-ele-breadcrumb .breadcrumb-container{width:100%;overflow:visible}}@media (min-width: 480px) and (max-width: 640px){::ng-deep [breadcrumb-actions]{flex-shrink:0;width:100%;display:flex;justify-content:flex-end;margin-top:.5rem}::ng-deep cide-ele-breadcrumb{font-size:.625rem;width:100%}::ng-deep cide-ele-breadcrumb nav ol{flex-wrap:wrap;align-items:center}::ng-deep cide-ele-breadcrumb .breadcrumb-container{width:100%;overflow:visible}}@media (min-width: 641px) and (max-width: 1024px){::ng-deep [breadcrumb-actions]{flex-shrink:0;margin-left:1rem}::ng-deep cide-ele-breadcrumb{font-size:.6875rem;width:100%}::ng-deep cide-ele-breadcrumb nav ol{flex-wrap:wrap;align-items:center}::ng-deep cide-ele-breadcrumb .breadcrumb-container{width:100%;overflow:visible}}@media (min-width: 1025px){::ng-deep [breadcrumb-actions]{flex-shrink:0;width:auto;margin-top:0;margin-left:1rem}::ng-deep cide-ele-breadcrumb{font-size:.75rem;width:auto}::ng-deep cide-ele-breadcrumb nav ol{flex-wrap:nowrap;align-items:center;gap:.25rem}::ng-deep cide-ele-breadcrumb .breadcrumb-container{width:auto;overflow:visible}}\n"] }]
6658
+ args: [{ selector: 'cide-lyt-shared-wrapper', standalone: true, imports: [CideEleBreadcrumbComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"tw-w-full tw-h-full tw-flex tw-flex-col tw-max-w-full tw-overflow-hidden\">\n <div\n class=\"tw-sticky tw-w-full tw-max-w-full tw-top-0 tw-z-10 tw-bg-white tw-border-b tw-border-gray-200 tw-shadow-sm\">\n <div\n class=\"tw-flex tw-items-start sm:tw-items-center tw-justify-between tw-gap-2 tw-px-0 tw-py-0 tw-min-w-0 tw-overflow-hidden tw-flex-col sm:tw-flex-row\">\n <!-- Breadcrumb - Full width on mobile/tablet, flex-1 on desktop -->\n <div class=\"tw-w-full sm:tw-flex-1 tw-min-w-0 tw-overflow-hidden tw-order-1\">\n <cide-ele-breadcrumb [style]=\"'modern'\" [compact]=\"true\"\n (homeClick)=\"onBreadcrumbHomeClick()\"></cide-ele-breadcrumb>\n </div>\n <!-- Breadcrumb Actions - Full width on mobile, auto on tablet/desktop -->\n <div class=\"tw-w-full sm:tw-w-auto tw-flex-shrink-0 sm:tw-ml-2 md:tw-ml-4 tw-order-2\">\n <ng-content select=\"[breadcrumb-actions]\"></ng-content>\n </div>\n </div>\n </div>\n\n <div class=\"tw-flex-1 tw-w-full tw-max-w-full tw-overflow-y-auto tw-overflow-x-hidden tw-min-h-0\">\n <ng-content></ng-content>\n </div>\n</div>", styles: [":host{display:block;height:100%;width:100%}:host>div{display:flex;flex-direction:column;height:100%;width:100%}::ng-deep cide-lyt-shared-wrapper{height:100%!important;display:block!important;width:100%!important}@media (max-width: 479px){::ng-deep [breadcrumb-actions]{flex-shrink:0;width:100%;display:flex;justify-content:flex-end;margin-top:.5rem}::ng-deep cide-ele-breadcrumb{font-size:.5625rem;width:100%}::ng-deep cide-ele-breadcrumb nav ol{flex-wrap:wrap;align-items:center;gap:.125rem}::ng-deep cide-ele-breadcrumb .breadcrumb-container{width:100%;overflow:visible}}@media (min-width: 480px) and (max-width: 640px){::ng-deep [breadcrumb-actions]{flex-shrink:0;width:100%;display:flex;justify-content:flex-end;margin-top:.5rem}::ng-deep cide-ele-breadcrumb{font-size:.625rem;width:100%}::ng-deep cide-ele-breadcrumb nav ol{flex-wrap:wrap;align-items:center}::ng-deep cide-ele-breadcrumb .breadcrumb-container{width:100%;overflow:visible}}@media (min-width: 641px) and (max-width: 1024px){::ng-deep [breadcrumb-actions]{flex-shrink:0;margin-left:1rem}::ng-deep cide-ele-breadcrumb{font-size:.6875rem;width:100%}::ng-deep cide-ele-breadcrumb nav ol{flex-wrap:wrap;align-items:center}::ng-deep cide-ele-breadcrumb .breadcrumb-container{width:100%;overflow:visible}}@media (min-width: 1025px){::ng-deep [breadcrumb-actions]{flex-shrink:0;width:auto;margin-top:0;margin-left:1rem}::ng-deep cide-ele-breadcrumb{font-size:.75rem;width:auto}::ng-deep cide-ele-breadcrumb nav ol{flex-wrap:nowrap;align-items:center;gap:.25rem}::ng-deep cide-ele-breadcrumb .breadcrumb-container{width:auto;overflow:visible}}\n"] }]
6604
6659
  }], ctorParameters: () => [], propDecorators: { breadcrumb: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CideEleBreadcrumbComponent), { isSignal: true }] }], shared_wrapper_setup_param: [{ type: i0.Input, args: [{ isSignal: true, alias: "shared_wrapper_setup_param", required: false }] }], breadcrumb_data: [{ type: i0.Input, args: [{ isSignal: true, alias: "breadcrumb_data", required: false }] }] } });
6605
6660
 
6606
6661
  /**
@@ -6885,7 +6940,7 @@ const layoutControlPannelChildRoutes = [{
6885
6940
  },
6886
6941
  {
6887
6942
  path: "home",
6888
- loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-C4YxNQIe.mjs').then(c => c.CideLytHomeWrapperComponent),
6943
+ loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-DAPSGYLf.mjs').then(c => c.CideLytHomeWrapperComponent),
6889
6944
  canActivate: [authGuard],
6890
6945
  data: {
6891
6946
  sypg_page_code: "cide_lyt_home" // Used by RequestService to fetch tab properties
@@ -6893,7 +6948,7 @@ const layoutControlPannelChildRoutes = [{
6893
6948
  },
6894
6949
  {
6895
6950
  path: "dashboard-manager",
6896
- loadComponent: () => import('./cloud-ide-layout-dashboard-manager.component-ik-G60a-.mjs').then(c => c.DashboardManagerComponent),
6951
+ loadComponent: () => import('./cloud-ide-layout-dashboard-manager.component-By3-I91u.mjs').then(c => c.DashboardManagerComponent),
6897
6952
  canActivate: [authGuard],
6898
6953
  data: {
6899
6954
  sypg_page_code: "cide_lyt_dashboard_manager"
@@ -8467,6 +8522,244 @@ var floatingEntityRightsSharing_component = /*#__PURE__*/Object.freeze({
8467
8522
  CideLytFloatingEntityRightsSharingComponent: CideLytFloatingEntityRightsSharingComponent
8468
8523
  });
8469
8524
 
8525
+ class CideLytFloatingEntitySelectionComponent {
8526
+ // Input parameters for configuration
8527
+ allowSwitching = input(true, ...(ngDevMode ? [{ debugName: "allowSwitching" }] : [])); // Allow entity switching (default: true)
8528
+ showActions = input(true, ...(ngDevMode ? [{ debugName: "showActions" }] : [])); // Show action buttons (default: true)
8529
+ mode = input('selection', ...(ngDevMode ? [{ debugName: "mode" }] : [])); // Mode: selection or view-only
8530
+ onSelectCallback = input(undefined, ...(ngDevMode ? [{ debugName: "onSelectCallback" }] : [])); // Callback for selection mode
8531
+ selectionMode = input(false, ...(ngDevMode ? [{ debugName: "selectionMode" }] : [])); // If true, use selection mode (don't switch entity, just call callback)
8532
+ // Service injections
8533
+ appStateService = inject(AppStateService);
8534
+ appStateHelperService = inject(AppStateHelperService);
8535
+ floatingContainerService = inject(CideEleFloatingContainerService);
8536
+ authService = inject(CloudIdeAuthService);
8537
+ notificationService = inject(NotificationService);
8538
+ router = inject(Router);
8539
+ // Loading state
8540
+ isSwitchingEntity = signal(false, ...(ngDevMode ? [{ debugName: "isSwitchingEntity" }] : []));
8541
+ ngOnInit() {
8542
+ // No initialization needed - shared org structure component handles everything
8543
+ }
8544
+ /**
8545
+ * Handle entity click event from org structure
8546
+ */
8547
+ onEntityClick(entity) {
8548
+ console.log('🏢 Entity clicked:', entity);
8549
+ // This is just a click event, no action needed unless specific handling is required
8550
+ }
8551
+ /**
8552
+ * Handle entity select event from org structure (for switching or selection)
8553
+ * If selectionMode is true, calls the callback and closes container
8554
+ * Otherwise, calls the switch entity API to create new auth_logs entry
8555
+ */
8556
+ onEntitySelect(entity) {
8557
+ console.log('🏢 Entity selected:', entity);
8558
+ if (!entity._id) {
8559
+ this.notificationService.error('Invalid entity selected');
8560
+ return;
8561
+ }
8562
+ // If in selection mode (callback provided), call callback and close
8563
+ if (this.selectionMode() && this.onSelectCallback()) {
8564
+ console.log('✅ Selection mode: calling callback with entity:', entity);
8565
+ this.onSelectCallback()(entity);
8566
+ this.closeContainer();
8567
+ return;
8568
+ }
8569
+ // Otherwise, proceed with entity switching
8570
+ console.log('🏢 Entity selected for switching:', entity);
8571
+ // Check if already switching
8572
+ if (this.isSwitchingEntity()) {
8573
+ return;
8574
+ }
8575
+ this.isSwitchingEntity.set(true);
8576
+ // Call switch entity API
8577
+ this.authService.switchEntity(entity._id).subscribe({
8578
+ next: async (response) => {
8579
+ // Wait for response and check if successful
8580
+ if (response?.success === true && response?.data) {
8581
+ // CRITICAL: Update token FIRST so subsequent API calls can use it
8582
+ // The setter automatically saves to localStorage (same as login flow)
8583
+ // This prevents 401 errors on other API calls
8584
+ if (response.token) {
8585
+ this.authService.auth_token = response.token;
8586
+ console.log('✅ Token updated and saved to localStorage after entity switch');
8587
+ }
8588
+ else {
8589
+ console.warn('⚠️ No token received in switch entity response');
8590
+ this.notificationService.error('No token received. Entity switch failed.');
8591
+ this.isSwitchingEntity.set(false);
8592
+ return;
8593
+ }
8594
+ // Store user data in auth service (saves to localStorage)
8595
+ // Follow same pattern as sign-in component
8596
+ if (response.data.auth_user_mst) {
8597
+ this.authService.storeUserData(response.data.auth_user_mst);
8598
+ }
8599
+ // Synchronize AppStateService with the same user data (saves to localStorage via effect)
8600
+ // Follow same pattern as sign-in component
8601
+ if (response.data.auth_user_mst) {
8602
+ this.appStateService.setUser(response.data.auth_user_mst);
8603
+ }
8604
+ // Store active entity data (saves to localStorage via effect)
8605
+ // Use entity from response if available, otherwise use the selected entity
8606
+ // Follow same pattern as sign-in component
8607
+ const entityToSet = response.data.core_system_entity || entity;
8608
+ if (entityToSet && entityToSet._id) {
8609
+ this.appStateService.setActiveEntity(entityToSet);
8610
+ console.log('✅ Active entity updated and saved to localStorage:', entityToSet._id);
8611
+ }
8612
+ else {
8613
+ console.warn('⚠️ No entity data available to set as active entity');
8614
+ }
8615
+ // Wait a moment to ensure token and state are fully stored
8616
+ await new Promise(resolve => setTimeout(resolve, 200));
8617
+ // Show success notification
8618
+ this.notificationService.success('Entity switched successfully');
8619
+ // Close drawer
8620
+ this.closeContainer();
8621
+ // Navigate to home after successful entity switch and token storage
8622
+ // Wait a bit more to ensure all state updates are complete
8623
+ await new Promise(resolve => setTimeout(resolve, 100));
8624
+ this.router.navigate(['/control-panel']);
8625
+ console.log('✅ Navigated to home after successful entity switch');
8626
+ // Hide loader after navigation completes
8627
+ this.isSwitchingEntity.set(false);
8628
+ }
8629
+ else {
8630
+ // Entity switch was not successful
8631
+ const errorMessage = response?.message || 'Failed to switch entity';
8632
+ this.notificationService.error(errorMessage);
8633
+ console.error('❌ Entity switch failed:', errorMessage);
8634
+ this.isSwitchingEntity.set(false);
8635
+ }
8636
+ },
8637
+ error: (error) => {
8638
+ this.isSwitchingEntity.set(false);
8639
+ console.error('Error switching entity:', error);
8640
+ const errorMessage = error?.error?.message || error?.message || 'Failed to switch entity';
8641
+ this.notificationService.error(errorMessage);
8642
+ // Do not navigate on error - stay on current page
8643
+ }
8644
+ });
8645
+ }
8646
+ /**
8647
+ * Handle entity view event from org structure (for viewing)
8648
+ */
8649
+ onEntityView(entity) {
8650
+ console.log('👁️ Entity viewed:', entity);
8651
+ // Handle view-only mode - could show entity details or navigate
8652
+ // This can be customized based on your needs
8653
+ }
8654
+ /**
8655
+ * Cancel selection
8656
+ */
8657
+ onCancel() {
8658
+ this.closeContainer();
8659
+ }
8660
+ /**
8661
+ * Close the floating container
8662
+ */
8663
+ closeContainer() {
8664
+ this.floatingContainerService.hideAll();
8665
+ }
8666
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CideLytFloatingEntitySelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
8667
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: CideLytFloatingEntitySelectionComponent, isStandalone: true, selector: "cide-lyt-floating-entity-selection", inputs: { allowSwitching: { classPropertyName: "allowSwitching", publicName: "allowSwitching", isSignal: true, isRequired: false, transformFunction: null }, showActions: { classPropertyName: "showActions", publicName: "showActions", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, onSelectCallback: { classPropertyName: "onSelectCallback", publicName: "onSelectCallback", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8668
+ <!-- Entity Selection Content using Org Structure Component -->
8669
+ <div class="tw-flex tw-flex-col tw-h-full tw-relative">
8670
+ <!-- Loading Overlay -->
8671
+ @if (isSwitchingEntity()) {
8672
+ <div class="tw-absolute tw-inset-0 tw-bg-white/80 tw-backdrop-blur-sm tw-z-50 tw-flex tw-items-center tw-justify-center tw-flex-col tw-gap-3">
8673
+ <cide-ele-spinner [size]="'lg'"></cide-ele-spinner>
8674
+ <p class="tw-text-sm tw-font-medium tw-text-gray-700">Switching entity...</p>
8675
+ <p class="tw-text-xs tw-text-gray-500">Please wait</p>
8676
+ </div>
8677
+ }
8678
+
8679
+ <!-- Header -->
8680
+ <div class="tw-bg-white tw-border-b tw-border-gray-200 tw-px-4 tw-py-3 tw-flex-shrink-0" [class.tw-opacity-50]="isSwitchingEntity()" [class.tw-pointer-events-none]="isSwitchingEntity()">
8681
+ <div class="tw-flex tw-items-center tw-justify-between">
8682
+ <div class="tw-flex tw-items-center tw-space-x-2">
8683
+ <cide-ele-icon class="tw-text-blue-600">account_tree</cide-ele-icon>
8684
+ <h3 class="tw-text-sm tw-font-semibold tw-text-gray-900">Entity Structure</h3>
8685
+ </div>
8686
+ @if (mode() === 'selection') {
8687
+ <button cideEleButton variant="secondary" size="xs" type="button" (click)="onCancel()" [disabled]="isSwitchingEntity()">
8688
+ Cancel
8689
+ </button>
8690
+ }
8691
+ </div>
8692
+ </div>
8693
+
8694
+ <!-- Org Structure Component -->
8695
+ <div class="tw-flex-1 tw-overflow-hidden" [class.tw-opacity-50]="isSwitchingEntity()" [class.tw-pointer-events-none]="isSwitchingEntity()">
8696
+ <cide-shared-org-structure
8697
+ [allowSwitching]="allowSwitching()"
8698
+ [showActions]="showActions()"
8699
+ [mode]="mode()"
8700
+ (entityClick)="onEntityClick($event)"
8701
+ (entitySelect)="onEntitySelect($event)"
8702
+ (entityView)="onEntityView($event)">
8703
+ </cide-shared-org-structure>
8704
+ </div>
8705
+ </div>
8706
+ `, isInline: true, styles: [".tw-dashed{border-style:dashed}.tw-bg-gray-300{background-color:#d1d5db}.level-0{border-top-color:#3b82f6!important}.level-1{border-top-color:#f59e0b!important}.level-2{border-top-color:#10b981!important}.level-3{border-top-color:#8b5cf6!important}.level-4{border-top-color:#ef4444!important}.level-5{border-top-color:#06b6d4!important}.connection-line-compact{pointer-events:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: CideEleButtonComponent, selector: "button[cideEleButton], a[cideEleButton], cide-ele-button", inputs: ["label", "variant", "size", "type", "shape", "elevation", "disabled", "id", "loading", "fullWidth", "leftIcon", "rightIcon", "customClass", "tooltip", "ariaLabel", "testId", "routerLink", "routerExtras", "preventDoubleClick", "animated"], outputs: ["btnClick", "doubleClick"] }, { kind: "component", type: CideIconComponent, selector: "cide-ele-icon", inputs: ["size", "type", "toolTip"] }, { kind: "component", type: CideSharedOrgStructureComponent, selector: "cide-shared-org-structure", inputs: ["allowSwitching", "showActions", "mode"], outputs: ["entityClick", "entitySelect", "entityView"] }, { kind: "component", type: CideSpinnerComponent, selector: "cide-ele-spinner", inputs: ["size", "type"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
8707
+ }
8708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CideLytFloatingEntitySelectionComponent, decorators: [{
8709
+ type: Component,
8710
+ args: [{ selector: 'cide-lyt-floating-entity-selection', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
8711
+ CommonModule,
8712
+ CideEleButtonComponent,
8713
+ CideIconComponent,
8714
+ CideSharedOrgStructureComponent,
8715
+ CideSpinnerComponent
8716
+ ], template: `
8717
+ <!-- Entity Selection Content using Org Structure Component -->
8718
+ <div class="tw-flex tw-flex-col tw-h-full tw-relative">
8719
+ <!-- Loading Overlay -->
8720
+ @if (isSwitchingEntity()) {
8721
+ <div class="tw-absolute tw-inset-0 tw-bg-white/80 tw-backdrop-blur-sm tw-z-50 tw-flex tw-items-center tw-justify-center tw-flex-col tw-gap-3">
8722
+ <cide-ele-spinner [size]="'lg'"></cide-ele-spinner>
8723
+ <p class="tw-text-sm tw-font-medium tw-text-gray-700">Switching entity...</p>
8724
+ <p class="tw-text-xs tw-text-gray-500">Please wait</p>
8725
+ </div>
8726
+ }
8727
+
8728
+ <!-- Header -->
8729
+ <div class="tw-bg-white tw-border-b tw-border-gray-200 tw-px-4 tw-py-3 tw-flex-shrink-0" [class.tw-opacity-50]="isSwitchingEntity()" [class.tw-pointer-events-none]="isSwitchingEntity()">
8730
+ <div class="tw-flex tw-items-center tw-justify-between">
8731
+ <div class="tw-flex tw-items-center tw-space-x-2">
8732
+ <cide-ele-icon class="tw-text-blue-600">account_tree</cide-ele-icon>
8733
+ <h3 class="tw-text-sm tw-font-semibold tw-text-gray-900">Entity Structure</h3>
8734
+ </div>
8735
+ @if (mode() === 'selection') {
8736
+ <button cideEleButton variant="secondary" size="xs" type="button" (click)="onCancel()" [disabled]="isSwitchingEntity()">
8737
+ Cancel
8738
+ </button>
8739
+ }
8740
+ </div>
8741
+ </div>
8742
+
8743
+ <!-- Org Structure Component -->
8744
+ <div class="tw-flex-1 tw-overflow-hidden" [class.tw-opacity-50]="isSwitchingEntity()" [class.tw-pointer-events-none]="isSwitchingEntity()">
8745
+ <cide-shared-org-structure
8746
+ [allowSwitching]="allowSwitching()"
8747
+ [showActions]="showActions()"
8748
+ [mode]="mode()"
8749
+ (entityClick)="onEntityClick($event)"
8750
+ (entitySelect)="onEntitySelect($event)"
8751
+ (entityView)="onEntityView($event)">
8752
+ </cide-shared-org-structure>
8753
+ </div>
8754
+ </div>
8755
+ `, styles: [".tw-dashed{border-style:dashed}.tw-bg-gray-300{background-color:#d1d5db}.level-0{border-top-color:#3b82f6!important}.level-1{border-top-color:#f59e0b!important}.level-2{border-top-color:#10b981!important}.level-3{border-top-color:#8b5cf6!important}.level-4{border-top-color:#ef4444!important}.level-5{border-top-color:#06b6d4!important}.connection-line-compact{pointer-events:none}\n"] }]
8756
+ }], propDecorators: { allowSwitching: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowSwitching", required: false }] }], showActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "showActions", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], onSelectCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "onSelectCallback", required: false }] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }] } });
8757
+
8758
+ var floatingEntitySelection_component = /*#__PURE__*/Object.freeze({
8759
+ __proto__: null,
8760
+ CideLytFloatingEntitySelectionComponent: CideLytFloatingEntitySelectionComponent
8761
+ });
8762
+
8470
8763
  /*
8471
8764
  * Public API Surface of cloud-ide-layout
8472
8765
  */
@@ -8478,5 +8771,5 @@ var floatingEntityRightsSharing_component = /*#__PURE__*/Object.freeze({
8478
8771
  * Generated bundle index. Do not edit.
8479
8772
  */
8480
8773
 
8481
- export { AppStateHelperService as A, CideLytSharedWrapperComponent as C, ENVIRONMENT_CONFIG as E, NotificationSettingsService as N, RightsService as R, CideLytSidebarService as a, CideLytSidedrawerService as b, CideLytThemeService as c, AppStateService as d, CloudIdeLayoutService as e, CloudIdeLayoutComponent as f, CideLytSharedService as g, ComponentContextService as h, layoutControlPannelChildRoutes as i, CustomRouteReuseStrategy as j, CideLytUserStatusService as k, layoutRoutes as l, CacheManagerService as m, CideLytFileManagerService as n, CideLytFloatingEntityRightsSharingComponent as o, processThemeVariable as p, CideLytFloatingEntityRightsSharingService as q, setCSSVariable as s, themeFactory as t };
8482
- //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-TXOQ0tip.mjs.map
8774
+ export { AppStateHelperService as A, CideLytSharedWrapperComponent as C, ENVIRONMENT_CONFIG as E, NotificationSettingsService as N, RightsService as R, CideLytSidebarService as a, CideLytSidedrawerService as b, CideLytThemeService as c, CloudIdeLayoutService as d, CloudIdeLayoutComponent as e, CideLytSharedService as f, ComponentContextService as g, layoutControlPannelChildRoutes as h, CustomRouteReuseStrategy as i, AppStateService as j, CideLytUserStatusService as k, layoutRoutes as l, CacheManagerService as m, CideLytFileManagerService as n, CideLytFloatingEntityRightsSharingComponent as o, processThemeVariable as p, CideLytFloatingEntityRightsSharingService as q, CideLytFloatingEntitySelectionComponent as r, setCSSVariable as s, themeFactory as t, CideLytFloatingEntitySelectionService as u };
8775
+ //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-Cwim-wD5.mjs.map