@noatgnu/cupcake-vanilla 1.3.0 → 1.3.3

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.
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, signal, computed, EventEmitter, inject, Output, Input, Component, effect, ViewChild } from '@angular/core';
3
3
  import * as i3 from '@noatgnu/cupcake-core';
4
- import { BaseApiService, WebSocketService, NotificationService as NotificationService$1, LabGroupService, ToastService, TaskStatus, TaskType, ResourceVisibility } from '@noatgnu/cupcake-core';
5
- import { switchMap, map, tap, takeUntil, filter as filter$1 } from 'rxjs/operators';
6
- import { from, Observable, throwError, NEVER, debounceTime, distinctUntilChanged, filter, switchMap as switchMap$1, map as map$1, catchError, of, tap as tap$1, Subject, BehaviorSubject, firstValueFrom, takeUntil as takeUntil$1 } from 'rxjs';
4
+ import { BaseApiService, WebSocketService, NotificationService as NotificationService$1, LabGroupService, ToastService, AsyncTaskMonitorService, TaskStatus, TaskType, ResourceVisibility } from '@noatgnu/cupcake-core';
5
+ import { switchMap, map, tap, takeUntil } from 'rxjs/operators';
6
+ import { from, Observable, throwError, NEVER, debounceTime, distinctUntilChanged, filter, switchMap as switchMap$1, map as map$1, catchError, of, tap as tap$1, Subject, firstValueFrom, takeUntil as takeUntil$1 } from 'rxjs';
7
7
  import jsSHA from 'jssha';
8
8
  import * as i3$1 from '@angular/common';
9
9
  import { CommonModule } from '@angular/common';
@@ -1218,8 +1218,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
1218
1218
  class Websocket extends WebSocketService {
1219
1219
  constructor(authService) {
1220
1220
  super(authService);
1221
- this.endpoint = 'notifications';
1222
- this.config.endpoint = 'notifications';
1221
+ this.endpoint = 'ccc/notifications';
1222
+ this.config.endpoint = 'ccc/notifications';
1223
1223
  this.config.url = this.getWebSocketUrl();
1224
1224
  }
1225
1225
  getMetadataTableUpdates() {
@@ -1238,29 +1238,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
1238
1238
  }]
1239
1239
  }], ctorParameters: () => [{ type: i3.AuthService }] });
1240
1240
 
1241
- class AdminWebSocketService extends WebSocketService {
1242
- constructor(authService) {
1243
- super(authService);
1244
- this.endpoint = 'ccv/admin';
1245
- this.config.endpoint = 'ccv/admin';
1246
- this.config.url = this.getWebSocketUrl();
1247
- }
1248
- getAdminNotifications() {
1249
- return this.filterMessages('admin.notification');
1250
- }
1251
- getSystemNotifications() {
1252
- return this.filterMessages('system.notification');
1253
- }
1254
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: AdminWebSocketService, deps: [{ token: i3.AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
1255
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: AdminWebSocketService, providedIn: 'root' });
1256
- }
1257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: AdminWebSocketService, decorators: [{
1258
- type: Injectable,
1259
- args: [{
1260
- providedIn: 'root'
1261
- }]
1262
- }], ctorParameters: () => [{ type: i3.AuthService }] });
1263
-
1264
1241
  var NotificationType;
1265
1242
  (function (NotificationType) {
1266
1243
  NotificationType["SYSTEM"] = "system";
@@ -1273,15 +1250,11 @@ var NotificationType;
1273
1250
  })(NotificationType || (NotificationType = {}));
1274
1251
  class NotificationService extends NotificationService$1 {
1275
1252
  websocketService;
1276
- adminWebSocketService;
1277
1253
  isConnected = signal(false, ...(ngDevMode ? [{ debugName: "isConnected" }] : []));
1278
- isAdminConnected = signal(false, ...(ngDevMode ? [{ debugName: "isAdminConnected" }] : []));
1279
1254
  isWebSocketConnected = computed(() => this.isConnected(), ...(ngDevMode ? [{ debugName: "isWebSocketConnected" }] : []));
1280
- isAdminWebSocketConnected = computed(() => this.isAdminConnected(), ...(ngDevMode ? [{ debugName: "isAdminWebSocketConnected" }] : []));
1281
- constructor(websocketService, adminWebSocketService, toastService) {
1255
+ constructor(websocketService, toastService) {
1282
1256
  super(toastService);
1283
1257
  this.websocketService = websocketService;
1284
- this.adminWebSocketService = adminWebSocketService;
1285
1258
  this.initializeWebSocket();
1286
1259
  }
1287
1260
  initializeWebSocket() {
@@ -1291,18 +1264,9 @@ class NotificationService extends NotificationService$1 {
1291
1264
  console.log('CCV WebSocket connected - notifications active');
1292
1265
  }
1293
1266
  });
1294
- this.adminWebSocketService.isConnected$.subscribe(connected => {
1295
- this.isAdminConnected.set(connected);
1296
- if (connected) {
1297
- console.log('CCV Admin WebSocket connected - admin notifications active');
1298
- }
1299
- });
1300
1267
  this.websocketService.messages$.subscribe(message => {
1301
1268
  this.handleWebSocketMessage(message);
1302
1269
  });
1303
- this.adminWebSocketService.messages$.subscribe(message => {
1304
- this.handleAdminWebSocketMessage(message);
1305
- });
1306
1270
  this.setupNotificationHandlers();
1307
1271
  }
1308
1272
  setupNotificationHandlers() {
@@ -1322,25 +1286,6 @@ class NotificationService extends NotificationService$1 {
1322
1286
  this.toastService.info(message.message || message['title']);
1323
1287
  }
1324
1288
  });
1325
- this.adminWebSocketService.getAdminNotifications().subscribe(message => {
1326
- const notification = this.createNotificationFromWebSocket(message, NotificationType.SYSTEM);
1327
- this.addNotification(notification);
1328
- const level = message['level'] || 'info';
1329
- const title = message['title'] || 'Admin Notification';
1330
- const messageText = message.message || '';
1331
- if (level === 'error') {
1332
- this.toastService.error(`${title}: ${messageText}`, 10000);
1333
- }
1334
- else if (level === 'warning') {
1335
- this.toastService.warning(`${title}: ${messageText}`, 8000);
1336
- }
1337
- else if (level === 'success') {
1338
- this.toastService.success(`${title}: ${messageText}`, 6000);
1339
- }
1340
- else {
1341
- this.toastService.info(`${title}: ${messageText}`, 5000);
1342
- }
1343
- });
1344
1289
  this.websocketService.getMetadataTableUpdates().subscribe(message => {
1345
1290
  const notification = this.createNotificationFromWebSocket(message, NotificationType.METADATA_TABLE);
1346
1291
  this.addNotification(notification);
@@ -1522,31 +1467,19 @@ class NotificationService extends NotificationService$1 {
1522
1467
  return 'info';
1523
1468
  }
1524
1469
  }
1525
- handleAdminWebSocketMessage(message) {
1526
- if (message.type === 'admin.notification') {
1527
- const notification = this.createNotificationFromWebSocket(message, NotificationType.SYSTEM);
1528
- this.addNotification(notification);
1529
- }
1530
- }
1531
1470
  connect() {
1532
1471
  this.websocketService.connect();
1533
1472
  }
1534
- connectAdmin() {
1535
- this.adminWebSocketService.connect();
1536
- }
1537
1473
  disconnect() {
1538
1474
  this.websocketService.disconnect();
1539
1475
  }
1540
- disconnectAdmin() {
1541
- this.adminWebSocketService.disconnect();
1542
- }
1543
1476
  subscribeToMetadataTable(tableId) {
1544
1477
  this.websocketService.subscribe('metadata_table_updates', { table_id: tableId });
1545
1478
  }
1546
1479
  createVanillaNotification(type, title, message, level = 'info', autoClose = true) {
1547
1480
  this.createLocalNotification(type, title, message, level, autoClose);
1548
1481
  }
1549
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: NotificationService, deps: [{ token: Websocket }, { token: AdminWebSocketService }, { token: i3.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
1482
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: NotificationService, deps: [{ token: Websocket }, { token: i3.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
1550
1483
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: NotificationService, providedIn: 'root' });
1551
1484
  }
1552
1485
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: NotificationService, decorators: [{
@@ -1554,7 +1487,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
1554
1487
  args: [{
1555
1488
  providedIn: 'root'
1556
1489
  }]
1557
- }], ctorParameters: () => [{ type: Websocket }, { type: AdminWebSocketService }, { type: i3.ToastService }] });
1490
+ }], ctorParameters: () => [{ type: Websocket }, { type: i3.ToastService }] });
1558
1491
 
1559
1492
  class OntologySearchService extends BaseApiService {
1560
1493
  /**
@@ -3878,80 +3811,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
3878
3811
 
3879
3812
  class AsyncTaskUIService {
3880
3813
  destroy$ = new Subject();
3881
- tasksSubject = new BehaviorSubject([]);
3882
- isSubscribed = false;
3883
3814
  metadataTableRefreshSubject = new Subject();
3884
3815
  taskCompletedSubject = new Subject();
3885
3816
  exportTaskCompletedSubject = new Subject();
3886
3817
  sessionId = this.generateSessionId();
3887
3818
  initiatedTasks = new Set();
3819
+ processedCompletedTasks = new Set();
3888
3820
  libraryAsyncTaskService = inject(AsyncTaskService);
3889
3821
  asyncExportService = inject(AsyncExportService);
3890
3822
  asyncImportService = inject(AsyncImportService);
3891
3823
  asyncValidationService = inject(AsyncValidationService);
3892
3824
  toastService = inject(ToastService);
3893
- websocket = inject(Websocket);
3825
+ asyncTaskMonitor = inject(AsyncTaskMonitorService);
3894
3826
  modalService = inject(NgbModal);
3895
3827
  electronService = inject(ElectronService);
3896
- tasks$ = this.tasksSubject.asObservable();
3897
- activeTasks$ = this.tasks$.pipe(map(tasks => {
3898
- const taskArray = Array.isArray(tasks) ? tasks : [];
3899
- return taskArray.filter(task => task.status === TaskStatus.QUEUED || task.status === TaskStatus.STARTED);
3900
- }));
3828
+ tasks$ = this.asyncTaskMonitor.tasks$;
3829
+ activeTasks$ = this.asyncTaskMonitor.activeTasks$;
3901
3830
  metadataTableRefresh$ = this.metadataTableRefreshSubject.asObservable();
3902
3831
  taskCompleted$ = this.taskCompletedSubject.asObservable();
3903
3832
  exportTaskCompleted$ = this.exportTaskCompletedSubject.asObservable();
3904
3833
  constructor() {
3834
+ this.asyncTaskMonitor.tasks$.pipe(takeUntil(this.destroy$)).subscribe(tasks => {
3835
+ this.handleTasksUpdate(tasks);
3836
+ });
3905
3837
  }
3906
3838
  ngOnDestroy() {
3907
3839
  this.destroy$.next();
3908
3840
  this.destroy$.complete();
3909
3841
  }
3910
- startRealtimeUpdates() {
3911
- if (this.isSubscribed) {
3912
- console.log('AsyncTaskUIService: Already subscribed to real-time updates');
3913
- return;
3914
- }
3915
- console.log('AsyncTaskUIService: Starting real-time updates');
3916
- this.isSubscribed = true;
3917
- if (!this.websocket.connectionState$() || this.websocket.connectionState$() === 'disconnected') {
3918
- console.log('AsyncTaskUIService: WebSocket not connected, connecting now...');
3919
- this.websocket.connect();
3920
- }
3921
- else {
3922
- console.log('AsyncTaskUIService: WebSocket already connected');
3923
- }
3924
- this.websocket.isConnected$.pipe(takeUntil(this.destroy$), filter$1(connected => connected)).subscribe(() => {
3925
- console.log('AsyncTaskUIService: WebSocket connected, subscribing to async_task_updates');
3926
- this.websocket.subscribe('async_task_updates');
3927
- });
3928
- this.websocket.filterMessages('async_task.update').pipe(takeUntil(this.destroy$)).subscribe((message) => {
3929
- console.log('AsyncTaskUIService: Received async_task.update message:', message);
3930
- this.handleTaskUpdate(message);
3931
- });
3932
- this.getTasks().subscribe({
3933
- next: tasks => {
3934
- const taskArray = Array.isArray(tasks) ? tasks : [];
3935
- this.tasksSubject.next(taskArray);
3936
- },
3937
- error: error => {
3938
- console.error('Error loading initial tasks:', error);
3842
+ handleTasksUpdate(tasks) {
3843
+ tasks.forEach(task => {
3844
+ const wasRunning = task.status === TaskStatus.QUEUED || task.status === TaskStatus.STARTED;
3845
+ if (task.status === TaskStatus.SUCCESS || task.status === TaskStatus.FAILURE || task.status === TaskStatus.CANCELLED) {
3846
+ const isTaskFromThisTab = this.isTaskInitiatedByThisTab(task.id);
3847
+ if (this.processedCompletedTasks.has(task.id)) {
3848
+ return;
3849
+ }
3850
+ this.taskCompletedSubject.next(task);
3851
+ if (task.status === TaskStatus.SUCCESS && isTaskFromThisTab) {
3852
+ if (this.isImportTask(task.taskType) && task.metadataTable) {
3853
+ this.metadataTableRefreshSubject.next(task.metadataTable);
3854
+ }
3855
+ if (this.isExportTask(task.taskType)) {
3856
+ this.exportTaskCompletedSubject.next(task);
3857
+ this.handleExportTaskCompletion(task);
3858
+ }
3859
+ if (task.taskType === TaskType.VALIDATE_TABLE && task.metadataTable) {
3860
+ this.metadataTableRefreshSubject.next(task.metadataTable);
3861
+ }
3862
+ if ((task.taskType === TaskType.REORDER_TABLE_COLUMNS) && task.metadataTable) {
3863
+ this.metadataTableRefreshSubject.next(task.metadataTable);
3864
+ }
3865
+ }
3866
+ if (isTaskFromThisTab) {
3867
+ this.showTaskCompletionNotification(task);
3868
+ }
3869
+ this.processedCompletedTasks.add(task.id);
3939
3870
  }
3940
3871
  });
3941
3872
  }
3942
- stopRealtimeUpdates() {
3943
- console.log('AsyncTaskUIService: Stopping real-time updates');
3944
- this.isSubscribed = false;
3945
- this.destroy$.next();
3946
- }
3947
- getTasks() {
3948
- return this.libraryAsyncTaskService.getAsyncTasks().pipe(map(response => response.results || []));
3949
- }
3950
- getTask(taskId) {
3951
- return this.libraryAsyncTaskService.getAsyncTask(taskId);
3952
- }
3953
3873
  cancelTask(taskId) {
3954
- return this.libraryAsyncTaskService.cancelTask(taskId);
3874
+ return this.asyncTaskMonitor.cancelTask(taskId);
3955
3875
  }
3956
3876
  generateSessionId() {
3957
3877
  return `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
@@ -3959,37 +3879,45 @@ class AsyncTaskUIService {
3959
3879
  isTaskInitiatedByThisTab(taskId) {
3960
3880
  return this.initiatedTasks.has(taskId);
3961
3881
  }
3962
- /**
3963
- * Mark a task as initiated by this tab for tracking purposes
3964
- */
3965
3882
  monitorTask(taskId) {
3966
3883
  this.initiatedTasks.add(taskId);
3884
+ this.asyncTaskMonitor.loadSingleTask(taskId);
3967
3885
  }
3968
3886
  queueExcelExport(request) {
3969
3887
  return this.asyncExportService.excelTemplate(request).pipe(tap(response => {
3970
3888
  this.initiatedTasks.add(response.taskId);
3889
+ this.asyncTaskMonitor.loadSingleTask(response.taskId);
3971
3890
  }));
3972
3891
  }
3973
3892
  queueSdrfExport(request) {
3974
3893
  return this.asyncExportService.sdrfFile(request).pipe(tap(response => {
3975
3894
  this.initiatedTasks.add(response.taskId);
3895
+ this.asyncTaskMonitor.loadSingleTask(response.taskId);
3976
3896
  }));
3977
3897
  }
3978
3898
  queueSdrfImport(request) {
3979
3899
  return this.asyncImportService.sdrfFile(request).pipe(tap(response => {
3980
3900
  this.initiatedTasks.add(response.taskId);
3901
+ this.asyncTaskMonitor.loadSingleTask(response.taskId);
3981
3902
  }));
3982
3903
  }
3983
3904
  queueExcelImport(request) {
3984
- return this.asyncImportService.excelFile(request);
3905
+ return this.asyncImportService.excelFile(request).pipe(tap(response => {
3906
+ this.initiatedTasks.add(response.taskId);
3907
+ this.asyncTaskMonitor.loadSingleTask(response.taskId);
3908
+ }));
3985
3909
  }
3986
3910
  queueBulkSdrfExport(request) {
3987
3911
  return this.asyncExportService.multipleSdrfFiles(request).pipe(tap(response => {
3988
3912
  this.initiatedTasks.add(response.taskId);
3913
+ this.asyncTaskMonitor.loadSingleTask(response.taskId);
3989
3914
  }));
3990
3915
  }
3991
3916
  queueBulkExcelExport(request) {
3992
- return this.asyncExportService.multipleExcelTemplates(request);
3917
+ return this.asyncExportService.multipleExcelTemplates(request).pipe(tap(response => {
3918
+ this.initiatedTasks.add(response.taskId);
3919
+ this.asyncTaskMonitor.loadSingleTask(response.taskId);
3920
+ }));
3993
3921
  }
3994
3922
  downloadTaskResult(taskId) {
3995
3923
  this.libraryAsyncTaskService.getDownloadUrl(taskId).subscribe({
@@ -4024,84 +3952,9 @@ class AsyncTaskUIService {
4024
3952
  validateMetadataTable(validationRequest) {
4025
3953
  return this.asyncValidationService.metadataTable(validationRequest).pipe(tap(response => {
4026
3954
  this.initiatedTasks.add(response.taskId);
3955
+ this.asyncTaskMonitor.loadSingleTask(response.taskId);
4027
3956
  }));
4028
3957
  }
4029
- handleTaskUpdate(message) {
4030
- const taskId = message.task_id;
4031
- const currentTasks = this.tasksSubject.value;
4032
- const existingTaskIndex = currentTasks.findIndex(t => t.id === taskId);
4033
- if (existingTaskIndex >= 0) {
4034
- const existingTask = currentTasks[existingTaskIndex];
4035
- const wasRunning = existingTask.status === TaskStatus.QUEUED || existingTask.status === TaskStatus.STARTED;
4036
- const updatedTask = {
4037
- ...existingTask,
4038
- status: message.status,
4039
- progressPercentage: message.progress_percentage || existingTask.progressPercentage,
4040
- progressDescription: message.progress_description || existingTask.progressDescription,
4041
- errorMessage: message.error_message || existingTask.errorMessage,
4042
- result: message.result || existingTask.result,
4043
- };
4044
- const updatedTasks = [...currentTasks];
4045
- updatedTasks[existingTaskIndex] = updatedTask;
4046
- this.tasksSubject.next(updatedTasks);
4047
- if (message.status === TaskStatus.STARTED) {
4048
- this.showTaskProgressNotification(updatedTask, existingTask);
4049
- }
4050
- if (wasRunning && (message.status === TaskStatus.SUCCESS || message.status === TaskStatus.FAILURE || message.status === TaskStatus.CANCELLED)) {
4051
- this.showTaskCompletionNotification(updatedTask);
4052
- const isTaskFromThisTab = this.isTaskInitiatedByThisTab(updatedTask.id);
4053
- this.taskCompletedSubject.next(updatedTask);
4054
- if (message.status === TaskStatus.SUCCESS) {
4055
- if (this.isImportTask(updatedTask.taskType) && updatedTask.metadataTable) {
4056
- this.metadataTableRefreshSubject.next(updatedTask.metadataTable);
4057
- }
4058
- if (this.isExportTask(updatedTask.taskType)) {
4059
- this.exportTaskCompletedSubject.next(updatedTask);
4060
- this.handleExportTaskCompletion(updatedTask);
4061
- }
4062
- if (updatedTask.taskType === TaskType.VALIDATE_TABLE && updatedTask.metadataTable) {
4063
- this.metadataTableRefreshSubject.next(updatedTask.metadataTable);
4064
- }
4065
- if ((updatedTask.taskType === TaskType.REORDER_TABLE_COLUMNS) && updatedTask.metadataTable) {
4066
- this.metadataTableRefreshSubject.next(updatedTask.metadataTable);
4067
- }
4068
- }
4069
- if (isTaskFromThisTab) {
4070
- this.initiatedTasks.delete(updatedTask.id);
4071
- }
4072
- }
4073
- }
4074
- else {
4075
- this.getTasks().subscribe(tasks => {
4076
- const taskArray = Array.isArray(tasks) ? tasks : [];
4077
- this.tasksSubject.next(taskArray);
4078
- const refreshedTask = taskArray.find(t => t.id === taskId);
4079
- if (refreshedTask && (message.status === TaskStatus.SUCCESS || message.status === TaskStatus.FAILURE || message.status === TaskStatus.CANCELLED)) {
4080
- this.showTaskCompletionNotification(refreshedTask);
4081
- const isTaskFromThisTab = this.isTaskInitiatedByThisTab(refreshedTask.id);
4082
- this.taskCompletedSubject.next(refreshedTask);
4083
- if (message.status === TaskStatus.SUCCESS) {
4084
- if (this.isImportTask(refreshedTask.taskType) && refreshedTask.metadataTable) {
4085
- this.metadataTableRefreshSubject.next(refreshedTask.metadataTable);
4086
- }
4087
- if (this.isExportTask(refreshedTask.taskType)) {
4088
- this.exportTaskCompletedSubject.next(refreshedTask);
4089
- this.handleExportTaskCompletion(refreshedTask);
4090
- }
4091
- if (refreshedTask.taskType === TaskType.VALIDATE_TABLE && refreshedTask.metadataTable) {
4092
- this.metadataTableRefreshSubject.next(refreshedTask.metadataTable);
4093
- }
4094
- if ((refreshedTask.taskType === TaskType.REORDER_TABLE_COLUMNS) && refreshedTask.metadataTable) {
4095
- this.metadataTableRefreshSubject.next(refreshedTask.metadataTable);
4096
- }
4097
- }
4098
- if (isTaskFromThisTab) {
4099
- this.initiatedTasks.delete(refreshedTask.id);
4100
- }
4101
- }
4102
- });
4103
- }
4104
- }
4105
3958
  showTaskProgressNotification(updatedTask, previousTask) {
4106
3959
  const taskName = this.getTaskDisplayName(updatedTask.taskType);
4107
3960
  const tableName = updatedTask.metadataTableName ? ` for "${updatedTask.metadataTableName}"` : '';
@@ -4205,15 +4058,19 @@ class AsyncTaskUIService {
4205
4058
  taskType === TaskType.EXPORT_MULTIPLE_SDRF || taskType === TaskType.EXPORT_MULTIPLE_EXCEL;
4206
4059
  }
4207
4060
  handleExportTaskCompletion(task) {
4061
+ console.log('AsyncTaskUIService: handleExportTaskCompletion called for task:', task.id, 'type:', task.taskType);
4208
4062
  const taskName = this.getTaskDisplayName(task.taskType);
4209
4063
  const tableName = task.metadataTableName ? ` for "${task.metadataTableName}"` : '';
4210
4064
  if (task.taskType === TaskType.EXPORT_SDRF || task.taskType === TaskType.EXPORT_EXCEL) {
4065
+ console.log('AsyncTaskUIService: Single export task - starting download in 1500ms');
4211
4066
  setTimeout(() => {
4067
+ console.log('AsyncTaskUIService: Calling downloadTaskResult for task:', task.id);
4212
4068
  this.downloadTaskResult(task.id);
4213
4069
  }, 1500);
4214
4070
  this.toastService.success(`${taskName}${tableName} completed! Starting download...`, 4000);
4215
4071
  }
4216
4072
  else {
4073
+ console.log('AsyncTaskUIService: Bulk export task - no auto-download');
4217
4074
  this.toastService.success(`${taskName}${tableName} completed! Check your downloads.`, 6000);
4218
4075
  }
4219
4076
  }
@@ -6299,7 +6156,6 @@ class MetadataTableTemplates {
6299
6156
  this.toastService.success(`Template column reorder task queued successfully! Task ID: ${response.taskId}`);
6300
6157
  // Mark task for monitoring and start real-time updates (same pattern as other async operations)
6301
6158
  this.asyncTaskService.monitorTask(response.taskId);
6302
- this.asyncTaskService.startRealtimeUpdates();
6303
6159
  this.isLoading.set(false);
6304
6160
  },
6305
6161
  error: (error) => {
@@ -8456,7 +8312,6 @@ class MetadataTableDetails {
8456
8312
  this.toastService.success(`SDRF import task queued successfully! Task ID: ${result.taskId}`);
8457
8313
  // Mark task for monitoring and start real-time updates (same pattern as export)
8458
8314
  this.asyncTaskService.monitorTask(result.taskId);
8459
- this.asyncTaskService.startRealtimeUpdates();
8460
8315
  }
8461
8316
  else {
8462
8317
  // Fallback for immediate processing (backward compatibility)
@@ -8518,7 +8373,6 @@ class MetadataTableDetails {
8518
8373
  this.toastService.success(`Excel import task queued successfully! Task ID: ${result.taskId}`);
8519
8374
  // Mark task for monitoring and start real-time updates (same pattern as export)
8520
8375
  this.asyncTaskService.monitorTask(result.taskId);
8521
- this.asyncTaskService.startRealtimeUpdates();
8522
8376
  }
8523
8377
  else {
8524
8378
  // Fallback for immediate processing (backward compatibility)
@@ -8573,8 +8427,7 @@ class MetadataTableDetails {
8573
8427
  labGroupIds = [];
8574
8428
  }
8575
8429
  // For 'none', labGroupIds stays undefined
8576
- // Use async export only
8577
- this.asyncExportService.excelTemplate({
8430
+ this.asyncTaskService.queueExcelExport({
8578
8431
  metadataTableId: table.id,
8579
8432
  metadataColumnIds: columnIds,
8580
8433
  sampleNumber: table.sampleCount,
@@ -8584,8 +8437,6 @@ class MetadataTableDetails {
8584
8437
  }).subscribe({
8585
8438
  next: (response) => {
8586
8439
  this.toastService.success(`Excel export queued successfully! Task ID: ${response.taskId}`);
8587
- // Start monitoring tasks if not already started
8588
- this.asyncTaskService.startRealtimeUpdates();
8589
8440
  },
8590
8441
  error: (error) => {
8591
8442
  console.error('Error queuing Excel export:', error);
@@ -8596,8 +8447,7 @@ class MetadataTableDetails {
8596
8447
  }
8597
8448
  performSdrfExport(table) {
8598
8449
  const columnIds = table.columns.map(col => col.id);
8599
- // Use async export only
8600
- this.asyncExportService.sdrfFile({
8450
+ this.asyncTaskService.queueSdrfExport({
8601
8451
  metadataTableId: table.id,
8602
8452
  metadataColumnIds: columnIds,
8603
8453
  sampleNumber: table.sampleCount,
@@ -8606,8 +8456,6 @@ class MetadataTableDetails {
8606
8456
  }).subscribe({
8607
8457
  next: (response) => {
8608
8458
  this.toastService.success(`SDRF export queued successfully! Task ID: ${response.taskId}`);
8609
- // Start monitoring tasks if not already started
8610
- this.asyncTaskService.startRealtimeUpdates();
8611
8459
  },
8612
8460
  error: (error) => {
8613
8461
  console.error('Error queuing SDRF export:', error);
@@ -8622,7 +8470,6 @@ class MetadataTableDetails {
8622
8470
  this.isLoading.set(false);
8623
8471
  this.toastService.success(`${format.toUpperCase()} export task queued successfully! Task ID: ${response.taskId}`);
8624
8472
  // Start monitoring tasks if not already started
8625
- this.asyncTaskService.startRealtimeUpdates();
8626
8473
  },
8627
8474
  error: (error) => {
8628
8475
  this.isLoading.set(false);
@@ -9318,7 +9165,6 @@ class MetadataTableDetails {
9318
9165
  this.toastService.success(`Column reorder task queued successfully! Task ID: ${response.taskId}`);
9319
9166
  // Mark task for monitoring and start real-time updates (same pattern as imports)
9320
9167
  this.asyncTaskService.monitorTask(response.taskId);
9321
- this.asyncTaskService.startRealtimeUpdates();
9322
9168
  this.isLoading.set(false);
9323
9169
  },
9324
9170
  error: (error) => {
@@ -9885,5 +9731,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
9885
9731
  * Generated bundle index. Do not edit.
9886
9732
  */
9887
9733
 
9888
- export { AdminWebSocketService, AsyncExportService, AsyncImportService, AsyncTaskService, AsyncTaskUIService, AsyncValidationService, COLUMN_TYPE_CONFIGS, ChunkedImportService, ChunkedUploadService, ColumnEditModal, ColumnTemplateEditModal, ColumnTemplates, ColumnType, CupcakeVanilla, ElectronService, ExcelExportModalComponent, FavoriteManagement, FavouriteMetadataOptionService, MSTermType, MetadataColumnAutofillModal, MetadataColumnHistoryModal, MetadataColumnService, MetadataColumnTemplateService, MetadataColumnTemplateShareService, MetadataManagementService, MetadataTableDetails, MetadataTableEditModal, MetadataTableService, MetadataTableTemplateEditModal, MetadataTableTemplateService, MetadataTableTemplates, MetadataValidationModal, MetadataValueEditModal, NotificationService, NotificationType, OFFICIAL_SDRF_COLUMNS, ONTOLOGY_TYPE_CONFIGS, OntologySearchService, OntologyType, OntologyTypeLabels, OntologyUtils, SDRFDefaultsService, SamplePoolCreateModal, SamplePoolDetailsModal, SamplePoolEditModal, SamplePoolService, SchemaSelectionModal, SchemaService, SdrfAgeInput, SdrfCleavageInput, SdrfColumnCategory, SdrfModificationInput, SdrfSpikedCompoundInput, SdrfSyntaxService, SearchReplaceModal, TableCreationModalComponent, TemplatePermissionLabels, TemplatePermissionLevel, TemplateSchemaSelectionModal, ValidationResultsModal, Websocket, getRequiredSdrfColumns, getSdrfColumnByName, getSdrfColumnsByCategory, isSdrfColumnRequired, isUnimodFullData };
9734
+ export { AsyncExportService, AsyncImportService, AsyncTaskService, AsyncTaskUIService, AsyncValidationService, COLUMN_TYPE_CONFIGS, ChunkedImportService, ChunkedUploadService, ColumnEditModal, ColumnTemplateEditModal, ColumnTemplates, ColumnType, CupcakeVanilla, ElectronService, ExcelExportModalComponent, FavoriteManagement, FavouriteMetadataOptionService, MSTermType, MetadataColumnAutofillModal, MetadataColumnHistoryModal, MetadataColumnService, MetadataColumnTemplateService, MetadataColumnTemplateShareService, MetadataManagementService, MetadataTableDetails, MetadataTableEditModal, MetadataTableService, MetadataTableTemplateEditModal, MetadataTableTemplateService, MetadataTableTemplates, MetadataValidationModal, MetadataValueEditModal, NotificationService, NotificationType, OFFICIAL_SDRF_COLUMNS, ONTOLOGY_TYPE_CONFIGS, OntologySearchService, OntologyType, OntologyTypeLabels, OntologyUtils, SDRFDefaultsService, SamplePoolCreateModal, SamplePoolDetailsModal, SamplePoolEditModal, SamplePoolService, SchemaSelectionModal, SchemaService, SdrfAgeInput, SdrfCleavageInput, SdrfColumnCategory, SdrfModificationInput, SdrfSpikedCompoundInput, SdrfSyntaxService, SearchReplaceModal, TableCreationModalComponent, TemplatePermissionLabels, TemplatePermissionLevel, TemplateSchemaSelectionModal, ValidationResultsModal, Websocket, getRequiredSdrfColumns, getSdrfColumnByName, getSdrfColumnsByCategory, isSdrfColumnRequired, isUnimodFullData };
9889
9735
  //# sourceMappingURL=noatgnu-cupcake-vanilla.mjs.map