@noatgnu/cupcake-vanilla 1.3.1 → 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
|
|
6
|
-
import { from, Observable, throwError, NEVER, debounceTime, distinctUntilChanged, filter, switchMap as switchMap$1, map as map$1, catchError, of, tap as tap$1, Subject,
|
|
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
|
-
|
|
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:
|
|
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:
|
|
1490
|
+
}], ctorParameters: () => [{ type: Websocket }, { type: i3.ToastService }] });
|
|
1558
1491
|
|
|
1559
1492
|
class OntologySearchService extends BaseApiService {
|
|
1560
1493
|
/**
|
|
@@ -3878,82 +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
|
-
|
|
3825
|
+
asyncTaskMonitor = inject(AsyncTaskMonitorService);
|
|
3894
3826
|
modalService = inject(NgbModal);
|
|
3895
3827
|
electronService = inject(ElectronService);
|
|
3896
|
-
tasks$ = this.
|
|
3897
|
-
activeTasks$ = this.
|
|
3898
|
-
const taskArray = Array.isArray(tasks) ? tasks : [];
|
|
3899
|
-
const active = taskArray.filter(task => task.status === TaskStatus.QUEUED || task.status === TaskStatus.STARTED);
|
|
3900
|
-
console.log('AsyncTaskUIService: activeTasks$ emitting:', active.length, 'active tasks out of', taskArray.length, 'total');
|
|
3901
|
-
return active;
|
|
3902
|
-
}));
|
|
3828
|
+
tasks$ = this.asyncTaskMonitor.tasks$;
|
|
3829
|
+
activeTasks$ = this.asyncTaskMonitor.activeTasks$;
|
|
3903
3830
|
metadataTableRefresh$ = this.metadataTableRefreshSubject.asObservable();
|
|
3904
3831
|
taskCompleted$ = this.taskCompletedSubject.asObservable();
|
|
3905
3832
|
exportTaskCompleted$ = this.exportTaskCompletedSubject.asObservable();
|
|
3906
3833
|
constructor() {
|
|
3834
|
+
this.asyncTaskMonitor.tasks$.pipe(takeUntil(this.destroy$)).subscribe(tasks => {
|
|
3835
|
+
this.handleTasksUpdate(tasks);
|
|
3836
|
+
});
|
|
3907
3837
|
}
|
|
3908
3838
|
ngOnDestroy() {
|
|
3909
3839
|
this.destroy$.next();
|
|
3910
3840
|
this.destroy$.complete();
|
|
3911
3841
|
}
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
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);
|
|
3941
3870
|
}
|
|
3942
3871
|
});
|
|
3943
3872
|
}
|
|
3944
|
-
stopRealtimeUpdates() {
|
|
3945
|
-
console.log('AsyncTaskUIService: Stopping real-time updates');
|
|
3946
|
-
this.isSubscribed = false;
|
|
3947
|
-
this.destroy$.next();
|
|
3948
|
-
}
|
|
3949
|
-
getTasks() {
|
|
3950
|
-
return this.libraryAsyncTaskService.getAsyncTasks().pipe(map(response => response.results || []));
|
|
3951
|
-
}
|
|
3952
|
-
getTask(taskId) {
|
|
3953
|
-
return this.libraryAsyncTaskService.getAsyncTask(taskId);
|
|
3954
|
-
}
|
|
3955
3873
|
cancelTask(taskId) {
|
|
3956
|
-
return this.
|
|
3874
|
+
return this.asyncTaskMonitor.cancelTask(taskId);
|
|
3957
3875
|
}
|
|
3958
3876
|
generateSessionId() {
|
|
3959
3877
|
return `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
@@ -3961,37 +3879,45 @@ class AsyncTaskUIService {
|
|
|
3961
3879
|
isTaskInitiatedByThisTab(taskId) {
|
|
3962
3880
|
return this.initiatedTasks.has(taskId);
|
|
3963
3881
|
}
|
|
3964
|
-
/**
|
|
3965
|
-
* Mark a task as initiated by this tab for tracking purposes
|
|
3966
|
-
*/
|
|
3967
3882
|
monitorTask(taskId) {
|
|
3968
3883
|
this.initiatedTasks.add(taskId);
|
|
3884
|
+
this.asyncTaskMonitor.loadSingleTask(taskId);
|
|
3969
3885
|
}
|
|
3970
3886
|
queueExcelExport(request) {
|
|
3971
3887
|
return this.asyncExportService.excelTemplate(request).pipe(tap(response => {
|
|
3972
3888
|
this.initiatedTasks.add(response.taskId);
|
|
3889
|
+
this.asyncTaskMonitor.loadSingleTask(response.taskId);
|
|
3973
3890
|
}));
|
|
3974
3891
|
}
|
|
3975
3892
|
queueSdrfExport(request) {
|
|
3976
3893
|
return this.asyncExportService.sdrfFile(request).pipe(tap(response => {
|
|
3977
3894
|
this.initiatedTasks.add(response.taskId);
|
|
3895
|
+
this.asyncTaskMonitor.loadSingleTask(response.taskId);
|
|
3978
3896
|
}));
|
|
3979
3897
|
}
|
|
3980
3898
|
queueSdrfImport(request) {
|
|
3981
3899
|
return this.asyncImportService.sdrfFile(request).pipe(tap(response => {
|
|
3982
3900
|
this.initiatedTasks.add(response.taskId);
|
|
3901
|
+
this.asyncTaskMonitor.loadSingleTask(response.taskId);
|
|
3983
3902
|
}));
|
|
3984
3903
|
}
|
|
3985
3904
|
queueExcelImport(request) {
|
|
3986
|
-
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
|
+
}));
|
|
3987
3909
|
}
|
|
3988
3910
|
queueBulkSdrfExport(request) {
|
|
3989
3911
|
return this.asyncExportService.multipleSdrfFiles(request).pipe(tap(response => {
|
|
3990
3912
|
this.initiatedTasks.add(response.taskId);
|
|
3913
|
+
this.asyncTaskMonitor.loadSingleTask(response.taskId);
|
|
3991
3914
|
}));
|
|
3992
3915
|
}
|
|
3993
3916
|
queueBulkExcelExport(request) {
|
|
3994
|
-
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
|
+
}));
|
|
3995
3921
|
}
|
|
3996
3922
|
downloadTaskResult(taskId) {
|
|
3997
3923
|
this.libraryAsyncTaskService.getDownloadUrl(taskId).subscribe({
|
|
@@ -4026,91 +3952,9 @@ class AsyncTaskUIService {
|
|
|
4026
3952
|
validateMetadataTable(validationRequest) {
|
|
4027
3953
|
return this.asyncValidationService.metadataTable(validationRequest).pipe(tap(response => {
|
|
4028
3954
|
this.initiatedTasks.add(response.taskId);
|
|
3955
|
+
this.asyncTaskMonitor.loadSingleTask(response.taskId);
|
|
4029
3956
|
}));
|
|
4030
3957
|
}
|
|
4031
|
-
handleTaskUpdate(message) {
|
|
4032
|
-
console.log('AsyncTaskUIService: handleTaskUpdate called with message:', message);
|
|
4033
|
-
const taskId = message.task_id;
|
|
4034
|
-
const currentTasks = this.tasksSubject.value;
|
|
4035
|
-
console.log('AsyncTaskUIService: Current tasks in subject:', currentTasks.length);
|
|
4036
|
-
const existingTaskIndex = currentTasks.findIndex(t => t.id === taskId);
|
|
4037
|
-
console.log('AsyncTaskUIService: Existing task index:', existingTaskIndex);
|
|
4038
|
-
if (existingTaskIndex >= 0) {
|
|
4039
|
-
const existingTask = currentTasks[existingTaskIndex];
|
|
4040
|
-
const wasRunning = existingTask.status === TaskStatus.QUEUED || existingTask.status === TaskStatus.STARTED;
|
|
4041
|
-
const updatedTask = {
|
|
4042
|
-
...existingTask,
|
|
4043
|
-
status: message.status,
|
|
4044
|
-
progressPercentage: message.progress_percentage || existingTask.progressPercentage,
|
|
4045
|
-
progressDescription: message.progress_description || existingTask.progressDescription,
|
|
4046
|
-
errorMessage: message.error_message || existingTask.errorMessage,
|
|
4047
|
-
result: message.result || existingTask.result,
|
|
4048
|
-
};
|
|
4049
|
-
const updatedTasks = [...currentTasks];
|
|
4050
|
-
updatedTasks[existingTaskIndex] = updatedTask;
|
|
4051
|
-
console.log('AsyncTaskUIService: Emitting updated tasks:', updatedTasks.length, 'active tasks:', updatedTasks.filter(t => t.status === TaskStatus.QUEUED || t.status === TaskStatus.STARTED).length);
|
|
4052
|
-
this.tasksSubject.next(updatedTasks);
|
|
4053
|
-
if (message.status === TaskStatus.STARTED) {
|
|
4054
|
-
this.showTaskProgressNotification(updatedTask, existingTask);
|
|
4055
|
-
}
|
|
4056
|
-
if (wasRunning && (message.status === TaskStatus.SUCCESS || message.status === TaskStatus.FAILURE || message.status === TaskStatus.CANCELLED)) {
|
|
4057
|
-
this.showTaskCompletionNotification(updatedTask);
|
|
4058
|
-
const isTaskFromThisTab = this.isTaskInitiatedByThisTab(updatedTask.id);
|
|
4059
|
-
this.taskCompletedSubject.next(updatedTask);
|
|
4060
|
-
if (message.status === TaskStatus.SUCCESS) {
|
|
4061
|
-
if (this.isImportTask(updatedTask.taskType) && updatedTask.metadataTable) {
|
|
4062
|
-
this.metadataTableRefreshSubject.next(updatedTask.metadataTable);
|
|
4063
|
-
}
|
|
4064
|
-
if (this.isExportTask(updatedTask.taskType)) {
|
|
4065
|
-
this.exportTaskCompletedSubject.next(updatedTask);
|
|
4066
|
-
this.handleExportTaskCompletion(updatedTask);
|
|
4067
|
-
}
|
|
4068
|
-
if (updatedTask.taskType === TaskType.VALIDATE_TABLE && updatedTask.metadataTable) {
|
|
4069
|
-
this.metadataTableRefreshSubject.next(updatedTask.metadataTable);
|
|
4070
|
-
}
|
|
4071
|
-
if ((updatedTask.taskType === TaskType.REORDER_TABLE_COLUMNS) && updatedTask.metadataTable) {
|
|
4072
|
-
this.metadataTableRefreshSubject.next(updatedTask.metadataTable);
|
|
4073
|
-
}
|
|
4074
|
-
}
|
|
4075
|
-
if (isTaskFromThisTab) {
|
|
4076
|
-
this.initiatedTasks.delete(updatedTask.id);
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
else {
|
|
4081
|
-
console.log('AsyncTaskUIService: Task not found in current list, fetching all tasks');
|
|
4082
|
-
this.getTasks().subscribe(tasks => {
|
|
4083
|
-
const taskArray = Array.isArray(tasks) ? tasks : [];
|
|
4084
|
-
console.log('AsyncTaskUIService: Fetched tasks from server:', taskArray.length);
|
|
4085
|
-
this.tasksSubject.next(taskArray);
|
|
4086
|
-
const refreshedTask = taskArray.find(t => t.id === taskId);
|
|
4087
|
-
console.log('AsyncTaskUIService: Found refreshed task:', refreshedTask ? refreshedTask.id : 'not found');
|
|
4088
|
-
if (refreshedTask && (message.status === TaskStatus.SUCCESS || message.status === TaskStatus.FAILURE || message.status === TaskStatus.CANCELLED)) {
|
|
4089
|
-
this.showTaskCompletionNotification(refreshedTask);
|
|
4090
|
-
const isTaskFromThisTab = this.isTaskInitiatedByThisTab(refreshedTask.id);
|
|
4091
|
-
this.taskCompletedSubject.next(refreshedTask);
|
|
4092
|
-
if (message.status === TaskStatus.SUCCESS) {
|
|
4093
|
-
if (this.isImportTask(refreshedTask.taskType) && refreshedTask.metadataTable) {
|
|
4094
|
-
this.metadataTableRefreshSubject.next(refreshedTask.metadataTable);
|
|
4095
|
-
}
|
|
4096
|
-
if (this.isExportTask(refreshedTask.taskType)) {
|
|
4097
|
-
this.exportTaskCompletedSubject.next(refreshedTask);
|
|
4098
|
-
this.handleExportTaskCompletion(refreshedTask);
|
|
4099
|
-
}
|
|
4100
|
-
if (refreshedTask.taskType === TaskType.VALIDATE_TABLE && refreshedTask.metadataTable) {
|
|
4101
|
-
this.metadataTableRefreshSubject.next(refreshedTask.metadataTable);
|
|
4102
|
-
}
|
|
4103
|
-
if ((refreshedTask.taskType === TaskType.REORDER_TABLE_COLUMNS) && refreshedTask.metadataTable) {
|
|
4104
|
-
this.metadataTableRefreshSubject.next(refreshedTask.metadataTable);
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
4107
|
-
if (isTaskFromThisTab) {
|
|
4108
|
-
this.initiatedTasks.delete(refreshedTask.id);
|
|
4109
|
-
}
|
|
4110
|
-
}
|
|
4111
|
-
});
|
|
4112
|
-
}
|
|
4113
|
-
}
|
|
4114
3958
|
showTaskProgressNotification(updatedTask, previousTask) {
|
|
4115
3959
|
const taskName = this.getTaskDisplayName(updatedTask.taskType);
|
|
4116
3960
|
const tableName = updatedTask.metadataTableName ? ` for "${updatedTask.metadataTableName}"` : '';
|
|
@@ -4214,15 +4058,19 @@ class AsyncTaskUIService {
|
|
|
4214
4058
|
taskType === TaskType.EXPORT_MULTIPLE_SDRF || taskType === TaskType.EXPORT_MULTIPLE_EXCEL;
|
|
4215
4059
|
}
|
|
4216
4060
|
handleExportTaskCompletion(task) {
|
|
4061
|
+
console.log('AsyncTaskUIService: handleExportTaskCompletion called for task:', task.id, 'type:', task.taskType);
|
|
4217
4062
|
const taskName = this.getTaskDisplayName(task.taskType);
|
|
4218
4063
|
const tableName = task.metadataTableName ? ` for "${task.metadataTableName}"` : '';
|
|
4219
4064
|
if (task.taskType === TaskType.EXPORT_SDRF || task.taskType === TaskType.EXPORT_EXCEL) {
|
|
4065
|
+
console.log('AsyncTaskUIService: Single export task - starting download in 1500ms');
|
|
4220
4066
|
setTimeout(() => {
|
|
4067
|
+
console.log('AsyncTaskUIService: Calling downloadTaskResult for task:', task.id);
|
|
4221
4068
|
this.downloadTaskResult(task.id);
|
|
4222
4069
|
}, 1500);
|
|
4223
4070
|
this.toastService.success(`${taskName}${tableName} completed! Starting download...`, 4000);
|
|
4224
4071
|
}
|
|
4225
4072
|
else {
|
|
4073
|
+
console.log('AsyncTaskUIService: Bulk export task - no auto-download');
|
|
4226
4074
|
this.toastService.success(`${taskName}${tableName} completed! Check your downloads.`, 6000);
|
|
4227
4075
|
}
|
|
4228
4076
|
}
|
|
@@ -6308,7 +6156,6 @@ class MetadataTableTemplates {
|
|
|
6308
6156
|
this.toastService.success(`Template column reorder task queued successfully! Task ID: ${response.taskId}`);
|
|
6309
6157
|
// Mark task for monitoring and start real-time updates (same pattern as other async operations)
|
|
6310
6158
|
this.asyncTaskService.monitorTask(response.taskId);
|
|
6311
|
-
this.asyncTaskService.startRealtimeUpdates();
|
|
6312
6159
|
this.isLoading.set(false);
|
|
6313
6160
|
},
|
|
6314
6161
|
error: (error) => {
|
|
@@ -8465,7 +8312,6 @@ class MetadataTableDetails {
|
|
|
8465
8312
|
this.toastService.success(`SDRF import task queued successfully! Task ID: ${result.taskId}`);
|
|
8466
8313
|
// Mark task for monitoring and start real-time updates (same pattern as export)
|
|
8467
8314
|
this.asyncTaskService.monitorTask(result.taskId);
|
|
8468
|
-
this.asyncTaskService.startRealtimeUpdates();
|
|
8469
8315
|
}
|
|
8470
8316
|
else {
|
|
8471
8317
|
// Fallback for immediate processing (backward compatibility)
|
|
@@ -8527,7 +8373,6 @@ class MetadataTableDetails {
|
|
|
8527
8373
|
this.toastService.success(`Excel import task queued successfully! Task ID: ${result.taskId}`);
|
|
8528
8374
|
// Mark task for monitoring and start real-time updates (same pattern as export)
|
|
8529
8375
|
this.asyncTaskService.monitorTask(result.taskId);
|
|
8530
|
-
this.asyncTaskService.startRealtimeUpdates();
|
|
8531
8376
|
}
|
|
8532
8377
|
else {
|
|
8533
8378
|
// Fallback for immediate processing (backward compatibility)
|
|
@@ -8582,8 +8427,7 @@ class MetadataTableDetails {
|
|
|
8582
8427
|
labGroupIds = [];
|
|
8583
8428
|
}
|
|
8584
8429
|
// For 'none', labGroupIds stays undefined
|
|
8585
|
-
|
|
8586
|
-
this.asyncExportService.excelTemplate({
|
|
8430
|
+
this.asyncTaskService.queueExcelExport({
|
|
8587
8431
|
metadataTableId: table.id,
|
|
8588
8432
|
metadataColumnIds: columnIds,
|
|
8589
8433
|
sampleNumber: table.sampleCount,
|
|
@@ -8593,8 +8437,6 @@ class MetadataTableDetails {
|
|
|
8593
8437
|
}).subscribe({
|
|
8594
8438
|
next: (response) => {
|
|
8595
8439
|
this.toastService.success(`Excel export queued successfully! Task ID: ${response.taskId}`);
|
|
8596
|
-
// Start monitoring tasks if not already started
|
|
8597
|
-
this.asyncTaskService.startRealtimeUpdates();
|
|
8598
8440
|
},
|
|
8599
8441
|
error: (error) => {
|
|
8600
8442
|
console.error('Error queuing Excel export:', error);
|
|
@@ -8605,8 +8447,7 @@ class MetadataTableDetails {
|
|
|
8605
8447
|
}
|
|
8606
8448
|
performSdrfExport(table) {
|
|
8607
8449
|
const columnIds = table.columns.map(col => col.id);
|
|
8608
|
-
|
|
8609
|
-
this.asyncExportService.sdrfFile({
|
|
8450
|
+
this.asyncTaskService.queueSdrfExport({
|
|
8610
8451
|
metadataTableId: table.id,
|
|
8611
8452
|
metadataColumnIds: columnIds,
|
|
8612
8453
|
sampleNumber: table.sampleCount,
|
|
@@ -8615,8 +8456,6 @@ class MetadataTableDetails {
|
|
|
8615
8456
|
}).subscribe({
|
|
8616
8457
|
next: (response) => {
|
|
8617
8458
|
this.toastService.success(`SDRF export queued successfully! Task ID: ${response.taskId}`);
|
|
8618
|
-
// Start monitoring tasks if not already started
|
|
8619
|
-
this.asyncTaskService.startRealtimeUpdates();
|
|
8620
8459
|
},
|
|
8621
8460
|
error: (error) => {
|
|
8622
8461
|
console.error('Error queuing SDRF export:', error);
|
|
@@ -8631,7 +8470,6 @@ class MetadataTableDetails {
|
|
|
8631
8470
|
this.isLoading.set(false);
|
|
8632
8471
|
this.toastService.success(`${format.toUpperCase()} export task queued successfully! Task ID: ${response.taskId}`);
|
|
8633
8472
|
// Start monitoring tasks if not already started
|
|
8634
|
-
this.asyncTaskService.startRealtimeUpdates();
|
|
8635
8473
|
},
|
|
8636
8474
|
error: (error) => {
|
|
8637
8475
|
this.isLoading.set(false);
|
|
@@ -9327,7 +9165,6 @@ class MetadataTableDetails {
|
|
|
9327
9165
|
this.toastService.success(`Column reorder task queued successfully! Task ID: ${response.taskId}`);
|
|
9328
9166
|
// Mark task for monitoring and start real-time updates (same pattern as imports)
|
|
9329
9167
|
this.asyncTaskService.monitorTask(response.taskId);
|
|
9330
|
-
this.asyncTaskService.startRealtimeUpdates();
|
|
9331
9168
|
this.isLoading.set(false);
|
|
9332
9169
|
},
|
|
9333
9170
|
error: (error) => {
|
|
@@ -9894,5 +9731,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
|
|
|
9894
9731
|
* Generated bundle index. Do not edit.
|
|
9895
9732
|
*/
|
|
9896
9733
|
|
|
9897
|
-
export {
|
|
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 };
|
|
9898
9735
|
//# sourceMappingURL=noatgnu-cupcake-vanilla.mjs.map
|