@noatgnu/cupcake-vanilla 1.2.22 → 1.3.1
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,7 +1,7 @@
|
|
|
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, ResourceVisibility } from '@noatgnu/cupcake-core';
|
|
4
|
+
import { BaseApiService, WebSocketService, NotificationService as NotificationService$1, LabGroupService, ToastService, TaskStatus, TaskType, ResourceVisibility } from '@noatgnu/cupcake-core';
|
|
5
5
|
import { switchMap, map, tap, takeUntil, filter as filter$1 } from 'rxjs/operators';
|
|
6
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';
|
|
7
7
|
import jsSHA from 'jssha';
|
|
@@ -502,57 +502,6 @@ function isSdrfColumnRequired(name) {
|
|
|
502
502
|
return column?.isRequired === true;
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
-
var TaskStatus;
|
|
506
|
-
(function (TaskStatus) {
|
|
507
|
-
TaskStatus["QUEUED"] = "QUEUED";
|
|
508
|
-
TaskStatus["STARTED"] = "STARTED";
|
|
509
|
-
TaskStatus["SUCCESS"] = "SUCCESS";
|
|
510
|
-
TaskStatus["FAILURE"] = "FAILURE";
|
|
511
|
-
TaskStatus["CANCELLED"] = "CANCELLED";
|
|
512
|
-
})(TaskStatus || (TaskStatus = {}));
|
|
513
|
-
var TaskType;
|
|
514
|
-
(function (TaskType) {
|
|
515
|
-
TaskType["EXPORT_EXCEL"] = "EXPORT_EXCEL";
|
|
516
|
-
TaskType["EXPORT_SDRF"] = "EXPORT_SDRF";
|
|
517
|
-
TaskType["IMPORT_SDRF"] = "IMPORT_SDRF";
|
|
518
|
-
TaskType["IMPORT_EXCEL"] = "IMPORT_EXCEL";
|
|
519
|
-
TaskType["EXPORT_MULTIPLE_SDRF"] = "EXPORT_MULTIPLE_SDRF";
|
|
520
|
-
TaskType["EXPORT_MULTIPLE_EXCEL"] = "EXPORT_MULTIPLE_EXCEL";
|
|
521
|
-
TaskType["VALIDATE_TABLE"] = "VALIDATE_TABLE";
|
|
522
|
-
TaskType["REORDER_TABLE_COLUMNS"] = "REORDER_TABLE_COLUMNS";
|
|
523
|
-
TaskType["REORDER_TEMPLATE_COLUMNS"] = "REORDER_TEMPLATE_COLUMNS";
|
|
524
|
-
TaskType["TRANSCRIBE_AUDIO"] = "TRANSCRIBE_AUDIO";
|
|
525
|
-
TaskType["TRANSCRIBE_VIDEO"] = "TRANSCRIBE_VIDEO";
|
|
526
|
-
})(TaskType || (TaskType = {}));
|
|
527
|
-
// Helper constants
|
|
528
|
-
const TASK_TYPE_LABELS = {
|
|
529
|
-
[TaskType.EXPORT_EXCEL]: 'Export Excel Template',
|
|
530
|
-
[TaskType.EXPORT_SDRF]: 'Export SDRF File',
|
|
531
|
-
[TaskType.IMPORT_SDRF]: 'Import SDRF File',
|
|
532
|
-
[TaskType.IMPORT_EXCEL]: 'Import Excel File',
|
|
533
|
-
[TaskType.EXPORT_MULTIPLE_SDRF]: 'Export Multiple SDRF Files',
|
|
534
|
-
[TaskType.EXPORT_MULTIPLE_EXCEL]: 'Export Multiple Excel Templates',
|
|
535
|
-
[TaskType.VALIDATE_TABLE]: 'Validate Metadata Table',
|
|
536
|
-
[TaskType.REORDER_TABLE_COLUMNS]: 'Reorder Table Columns',
|
|
537
|
-
[TaskType.REORDER_TEMPLATE_COLUMNS]: 'Reorder Template Columns',
|
|
538
|
-
[TaskType.TRANSCRIBE_AUDIO]: 'Transcribe Audio',
|
|
539
|
-
[TaskType.TRANSCRIBE_VIDEO]: 'Transcribe Video',
|
|
540
|
-
};
|
|
541
|
-
const TASK_STATUS_LABELS = {
|
|
542
|
-
[TaskStatus.QUEUED]: 'Queued',
|
|
543
|
-
[TaskStatus.STARTED]: 'In Progress',
|
|
544
|
-
[TaskStatus.SUCCESS]: 'Completed',
|
|
545
|
-
[TaskStatus.FAILURE]: 'Failed',
|
|
546
|
-
[TaskStatus.CANCELLED]: 'Cancelled',
|
|
547
|
-
};
|
|
548
|
-
const TASK_STATUS_COLORS = {
|
|
549
|
-
[TaskStatus.QUEUED]: 'secondary',
|
|
550
|
-
[TaskStatus.STARTED]: 'primary',
|
|
551
|
-
[TaskStatus.SUCCESS]: 'success',
|
|
552
|
-
[TaskStatus.FAILURE]: 'danger',
|
|
553
|
-
[TaskStatus.CANCELLED]: 'warning',
|
|
554
|
-
};
|
|
555
|
-
|
|
556
505
|
class MetadataTableService extends BaseApiService {
|
|
557
506
|
/**
|
|
558
507
|
* Get all metadata tables with optional filtering
|
|
@@ -1269,8 +1218,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
|
|
|
1269
1218
|
class Websocket extends WebSocketService {
|
|
1270
1219
|
constructor(authService) {
|
|
1271
1220
|
super(authService);
|
|
1272
|
-
this.endpoint = '
|
|
1273
|
-
this.config.endpoint = '
|
|
1221
|
+
this.endpoint = 'notifications';
|
|
1222
|
+
this.config.endpoint = 'notifications';
|
|
1274
1223
|
this.config.url = this.getWebSocketUrl();
|
|
1275
1224
|
}
|
|
1276
1225
|
getMetadataTableUpdates() {
|
|
@@ -1536,6 +1485,12 @@ class NotificationService extends NotificationService$1 {
|
|
|
1536
1485
|
case 'REORDER_TEMPLATE_COLUMNS':
|
|
1537
1486
|
operation = 'Template Column Reordering';
|
|
1538
1487
|
break;
|
|
1488
|
+
case 'TRANSCRIBE_AUDIO':
|
|
1489
|
+
operation = 'Audio Transcription';
|
|
1490
|
+
break;
|
|
1491
|
+
case 'TRANSCRIBE_VIDEO':
|
|
1492
|
+
operation = 'Video Transcription';
|
|
1493
|
+
break;
|
|
1539
1494
|
}
|
|
1540
1495
|
switch (status) {
|
|
1541
1496
|
case 'QUEUED':
|
|
@@ -3941,33 +3896,39 @@ class AsyncTaskUIService {
|
|
|
3941
3896
|
tasks$ = this.tasksSubject.asObservable();
|
|
3942
3897
|
activeTasks$ = this.tasks$.pipe(map(tasks => {
|
|
3943
3898
|
const taskArray = Array.isArray(tasks) ? tasks : [];
|
|
3944
|
-
|
|
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;
|
|
3945
3902
|
}));
|
|
3946
3903
|
metadataTableRefresh$ = this.metadataTableRefreshSubject.asObservable();
|
|
3947
3904
|
taskCompleted$ = this.taskCompletedSubject.asObservable();
|
|
3948
3905
|
exportTaskCompleted$ = this.exportTaskCompletedSubject.asObservable();
|
|
3949
3906
|
constructor() {
|
|
3950
|
-
this.initializeService();
|
|
3951
3907
|
}
|
|
3952
3908
|
ngOnDestroy() {
|
|
3953
3909
|
this.destroy$.next();
|
|
3954
3910
|
this.destroy$.complete();
|
|
3955
3911
|
}
|
|
3956
|
-
initializeService() {
|
|
3957
|
-
this.startRealtimeUpdates();
|
|
3958
|
-
}
|
|
3959
3912
|
startRealtimeUpdates() {
|
|
3960
3913
|
if (this.isSubscribed) {
|
|
3914
|
+
console.log('AsyncTaskUIService: Already subscribed to real-time updates');
|
|
3961
3915
|
return;
|
|
3962
3916
|
}
|
|
3917
|
+
console.log('AsyncTaskUIService: Starting real-time updates');
|
|
3963
3918
|
this.isSubscribed = true;
|
|
3964
3919
|
if (!this.websocket.connectionState$() || this.websocket.connectionState$() === 'disconnected') {
|
|
3920
|
+
console.log('AsyncTaskUIService: WebSocket not connected, connecting now...');
|
|
3965
3921
|
this.websocket.connect();
|
|
3966
3922
|
}
|
|
3923
|
+
else {
|
|
3924
|
+
console.log('AsyncTaskUIService: WebSocket already connected');
|
|
3925
|
+
}
|
|
3967
3926
|
this.websocket.isConnected$.pipe(takeUntil(this.destroy$), filter$1(connected => connected)).subscribe(() => {
|
|
3927
|
+
console.log('AsyncTaskUIService: WebSocket connected, subscribing to async_task_updates');
|
|
3968
3928
|
this.websocket.subscribe('async_task_updates');
|
|
3969
3929
|
});
|
|
3970
3930
|
this.websocket.filterMessages('async_task.update').pipe(takeUntil(this.destroy$)).subscribe((message) => {
|
|
3931
|
+
console.log('AsyncTaskUIService: Received async_task.update message:', message);
|
|
3971
3932
|
this.handleTaskUpdate(message);
|
|
3972
3933
|
});
|
|
3973
3934
|
this.getTasks().subscribe({
|
|
@@ -3981,6 +3942,7 @@ class AsyncTaskUIService {
|
|
|
3981
3942
|
});
|
|
3982
3943
|
}
|
|
3983
3944
|
stopRealtimeUpdates() {
|
|
3945
|
+
console.log('AsyncTaskUIService: Stopping real-time updates');
|
|
3984
3946
|
this.isSubscribed = false;
|
|
3985
3947
|
this.destroy$.next();
|
|
3986
3948
|
}
|
|
@@ -4067,9 +4029,12 @@ class AsyncTaskUIService {
|
|
|
4067
4029
|
}));
|
|
4068
4030
|
}
|
|
4069
4031
|
handleTaskUpdate(message) {
|
|
4032
|
+
console.log('AsyncTaskUIService: handleTaskUpdate called with message:', message);
|
|
4070
4033
|
const taskId = message.task_id;
|
|
4071
4034
|
const currentTasks = this.tasksSubject.value;
|
|
4035
|
+
console.log('AsyncTaskUIService: Current tasks in subject:', currentTasks.length);
|
|
4072
4036
|
const existingTaskIndex = currentTasks.findIndex(t => t.id === taskId);
|
|
4037
|
+
console.log('AsyncTaskUIService: Existing task index:', existingTaskIndex);
|
|
4073
4038
|
if (existingTaskIndex >= 0) {
|
|
4074
4039
|
const existingTask = currentTasks[existingTaskIndex];
|
|
4075
4040
|
const wasRunning = existingTask.status === TaskStatus.QUEUED || existingTask.status === TaskStatus.STARTED;
|
|
@@ -4083,6 +4048,7 @@ class AsyncTaskUIService {
|
|
|
4083
4048
|
};
|
|
4084
4049
|
const updatedTasks = [...currentTasks];
|
|
4085
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);
|
|
4086
4052
|
this.tasksSubject.next(updatedTasks);
|
|
4087
4053
|
if (message.status === TaskStatus.STARTED) {
|
|
4088
4054
|
this.showTaskProgressNotification(updatedTask, existingTask);
|
|
@@ -4112,10 +4078,13 @@ class AsyncTaskUIService {
|
|
|
4112
4078
|
}
|
|
4113
4079
|
}
|
|
4114
4080
|
else {
|
|
4081
|
+
console.log('AsyncTaskUIService: Task not found in current list, fetching all tasks');
|
|
4115
4082
|
this.getTasks().subscribe(tasks => {
|
|
4116
4083
|
const taskArray = Array.isArray(tasks) ? tasks : [];
|
|
4084
|
+
console.log('AsyncTaskUIService: Fetched tasks from server:', taskArray.length);
|
|
4117
4085
|
this.tasksSubject.next(taskArray);
|
|
4118
4086
|
const refreshedTask = taskArray.find(t => t.id === taskId);
|
|
4087
|
+
console.log('AsyncTaskUIService: Found refreshed task:', refreshedTask ? refreshedTask.id : 'not found');
|
|
4119
4088
|
if (refreshedTask && (message.status === TaskStatus.SUCCESS || message.status === TaskStatus.FAILURE || message.status === TaskStatus.CANCELLED)) {
|
|
4120
4089
|
this.showTaskCompletionNotification(refreshedTask);
|
|
4121
4090
|
const isTaskFromThisTab = this.isTaskInitiatedByThisTab(refreshedTask.id);
|
|
@@ -9925,5 +9894,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
|
|
|
9925
9894
|
* Generated bundle index. Do not edit.
|
|
9926
9895
|
*/
|
|
9927
9896
|
|
|
9928
|
-
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,
|
|
9897
|
+
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 };
|
|
9929
9898
|
//# sourceMappingURL=noatgnu-cupcake-vanilla.mjs.map
|