@noatgnu/cupcake-vanilla 1.4.4 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
File without changes
@@ -3,7 +3,7 @@ import { Injectable, inject, signal, computed, effect, untracked, NgZone, EventE
3
3
  import * as i3 from '@noatgnu/cupcake-core';
4
4
  import { BaseApiService, WebSocketService, NotificationService as NotificationService$1, SiteConfigService, LabGroupService, ToastService, AsyncTaskMonitorService, TaskStatus, TaskType, ResourceVisibility, AuthService, ConfirmDialogService } from '@noatgnu/cupcake-core';
5
5
  import { map, switchMap, tap as tap$1, takeUntil } from 'rxjs/operators';
6
- import { of, tap, map as map$1, catchError, expand, EMPTY, reduce, throwError, from, Observable, Subject, NEVER, debounceTime, distinctUntilChanged, filter, switchMap as switchMap$1, firstValueFrom, takeUntil as takeUntil$1 } from 'rxjs';
6
+ import { of, tap, map as map$1, catchError, expand, EMPTY, reduce, throwError, from, Observable, Subject, NEVER, debounceTime, distinctUntilChanged, filter, switchMap as switchMap$1, merge, firstValueFrom, takeUntil as takeUntil$1 } from 'rxjs';
7
7
  import jsSHA from 'jssha';
8
8
  import * as i1$1 from '@angular/common';
9
9
  import { CommonModule } from '@angular/common';
@@ -38,6 +38,8 @@ var OntologyType;
38
38
  OntologyType["PSI_MS"] = "psi_ms";
39
39
  OntologyType["BTO"] = "bto";
40
40
  OntologyType["DOID"] = "doid";
41
+ OntologyType["PROTOCOLS_IO_REAGENT"] = "protocols_io_reagent";
42
+ OntologyType["PROTOCOLS_IO_UNIT"] = "protocols_io_unit";
41
43
  })(OntologyType || (OntologyType = {}));
42
44
  const OntologyTypeLabels = {
43
45
  [OntologyType.NONE]: 'None',
@@ -54,7 +56,9 @@ const OntologyTypeLabels = {
54
56
  [OntologyType.MS_UNIQUE_VOCABULARIES]: 'MS Unique Vocabularies',
55
57
  [OntologyType.PSI_MS]: 'PSI-MS Controlled Vocabulary',
56
58
  [OntologyType.BTO]: 'BTO Tissue',
57
- [OntologyType.DOID]: 'Disease Ontology (DOID)'
59
+ [OntologyType.DOID]: 'Disease Ontology (DOID)',
60
+ [OntologyType.PROTOCOLS_IO_REAGENT]: 'protocols.io Reagent',
61
+ [OntologyType.PROTOCOLS_IO_UNIT]: 'protocols.io Unit'
58
62
  };
59
63
  var TemplatePermissionLevel;
60
64
  (function (TemplatePermissionLevel) {
@@ -163,6 +167,8 @@ const ONTOLOGY_TYPE_CONFIGS = [
163
167
  { value: OntologyType.PSI_MS, label: 'PSI-MS', customFilters: undefined },
164
168
  { value: OntologyType.BTO, label: 'BTO Tissue (BRENDA)', customFilters: undefined },
165
169
  { value: OntologyType.DOID, label: 'Disease Ontology (DOID)', customFilters: undefined },
170
+ { value: OntologyType.PROTOCOLS_IO_REAGENT, label: 'Reagent (protocols.io)', customFilters: undefined },
171
+ { value: OntologyType.PROTOCOLS_IO_UNIT, label: 'Unit (protocols.io)', customFilters: undefined },
166
172
  // MS Unique Vocabularies with specific term_type filters
167
173
  {
168
174
  value: OntologyType.MS_UNIQUE_VOCABULARIES,
@@ -1613,6 +1619,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImpor
1613
1619
  }], ctorParameters: () => [] });
1614
1620
 
1615
1621
  class OntologySearchService extends BaseApiService {
1622
+ websocket = inject(WebSocketService);
1616
1623
  /**
1617
1624
  * Get ontology suggestions across all sources for SDRF validation
1618
1625
  *
@@ -1673,6 +1680,13 @@ class OntologySearchService extends BaseApiService {
1673
1680
  limit
1674
1681
  });
1675
1682
  }
1683
+ /**
1684
+ * Notifications that results from an external platform, such as protocols.io, were added to
1685
+ * the local vocabulary after a search answered with remotePending.
1686
+ */
1687
+ vocabularyUpdates() {
1688
+ return this.websocket.filterMessages('external_vocabulary.updated');
1689
+ }
1676
1690
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: OntologySearchService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
1677
1691
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: OntologySearchService, providedIn: 'root' });
1678
1692
  }
@@ -4195,6 +4209,7 @@ class MetadataValueEditModal {
4195
4209
  ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
4196
4210
  isLoadingSuggestions = signal(false, /* @ts-ignore */
4197
4211
  ...(ngDevMode ? [{ debugName: "isLoadingSuggestions" }] : /* istanbul ignore next */ []));
4212
+ lastSearchTerm = '';
4198
4213
  searchType = signal('icontains', /* @ts-ignore */
4199
4214
  ...(ngDevMode ? [{ debugName: "searchType" }] : /* istanbul ignore next */ []));
4200
4215
  isLoadingFavorites = signal(false, /* @ts-ignore */
@@ -4335,7 +4350,13 @@ class MetadataValueEditModal {
4335
4350
  }
4336
4351
  // Ontology autocomplete methods
4337
4352
  searchOntology = (text$) => {
4338
- return text$.pipe(debounceTime(200), distinctUntilChanged(), tap(() => this.isLoadingSuggestions.set(true)), switchMap$1(term => {
4353
+ const typed$ = text$.pipe(debounceTime(200), distinctUntilChanged());
4354
+ const refreshed$ = this.ontologySearchService.vocabularyUpdates().pipe(filter(update => update.ontology_type === this.config?.ontologyType &&
4355
+ update.search_term.toLowerCase() === this.lastSearchTerm.trim().toLowerCase()), map$1(() => this.lastSearchTerm));
4356
+ return merge(typed$, refreshed$).pipe(tap(term => {
4357
+ this.lastSearchTerm = term;
4358
+ this.isLoadingSuggestions.set(true);
4359
+ }), switchMap$1(term => {
4339
4360
  if (term.length < 2 || !this.hasOntologyType) {
4340
4361
  this.isLoadingSuggestions.set(false);
4341
4362
  return of([]);
@@ -5067,6 +5088,7 @@ class AsyncTaskUIService {
5067
5088
  [TaskType.TRANSCRIBE_AUDIO]: 'Audio transcription',
5068
5089
  [TaskType.TRANSCRIBE_VIDEO]: 'Video transcription',
5069
5090
  [TaskType.VALIDATE_SDRF_FILE]: 'SDRF file validation',
5091
+ [TaskType.EXPORT_PROTOCOLS_IO]: 'protocols.io export',
5070
5092
  };
5071
5093
  return typeMap[taskType] || taskType;
5072
5094
  }
@@ -9992,12 +10014,18 @@ class MetadataTableDetails {
9992
10014
  if (tableId) {
9993
10015
  this.router.navigate(['/metadata-tables', tableId, 'list']);
9994
10016
  }
10017
+ else {
10018
+ this.viewMode.set('list');
10019
+ }
9995
10020
  }
9996
10021
  switchToTableMode() {
9997
10022
  const tableId = this.tableId();
9998
10023
  if (tableId) {
9999
10024
  this.router.navigate(['/metadata-tables', tableId, 'table']);
10000
10025
  }
10026
+ else {
10027
+ this.viewMode.set('table');
10028
+ }
10001
10029
  }
10002
10030
  onPageChange(page) {
10003
10031
  this.currentPage.set(page);