@noatgnu/cupcake-vanilla 1.3.6 → 1.3.8

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.
@@ -4545,7 +4545,7 @@ class ColumnEditModal {
4545
4545
  }
4546
4546
  populateForm() {
4547
4547
  if (this.column) {
4548
- const customFilters = this.column.ontologyOptions || undefined;
4548
+ const customFilters = this.column.customOntologyFilters || undefined;
4549
4549
  const ontologyTypeIndex = this.getOntologyTypeIndex(this.column.ontologyType, customFilters);
4550
4550
  this.editForm.patchValue({
4551
4551
  name: this.column.name,
@@ -4566,24 +4566,49 @@ class ColumnEditModal {
4566
4566
  if (!ontologyType)
4567
4567
  return 0;
4568
4568
  if (!customFilters || Object.keys(customFilters).length === 0) {
4569
- const index = this.ontologyTypes.findIndex(o => o.value === ontologyType);
4569
+ const index = this.ontologyTypes.findIndex(o => o.value === ontologyType && (!o.customFilters || Object.keys(o.customFilters).length === 0));
4570
4570
  return index >= 0 ? index : 0;
4571
4571
  }
4572
+ console.log('[Column] Looking for ontology match:', {
4573
+ ontologyType,
4574
+ customFilters,
4575
+ keys: Object.keys(customFilters)
4576
+ });
4577
+ // Handle both wrapped and unwrapped formats
4578
+ // Also handle camelCase from API vs snake_case in config
4579
+ // API returns: {"msUniqueVocabularies": {"termType": "cell line"}}
4580
+ // Config has: {"ms_unique_vocabularies": {"term_type": "cell line"}}
4581
+ // Convert ontologyType to camelCase to match API format
4582
+ const camelOntologyType = ontologyType.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
4583
+ let actualFilters = customFilters[ontologyType] || customFilters[camelOntologyType] || customFilters;
4584
+ console.log('[Column] Actual filters after unwrapping:', actualFilters);
4572
4585
  const matchingIndex = this.ontologyTypes.findIndex(opt => {
4573
4586
  if (opt.value !== ontologyType)
4574
4587
  return false;
4575
4588
  if (!opt.customFilters)
4576
4589
  return false;
4577
- const optFilterKey = Object.keys(opt.customFilters)[0];
4578
- const templateFilterKey = Object.keys(customFilters)[0];
4579
- if (optFilterKey !== templateFilterKey)
4590
+ // Get the filter value from config (wrapped with snake_case key)
4591
+ const optFilterValue = opt.customFilters[ontologyType];
4592
+ if (!optFilterValue)
4580
4593
  return false;
4581
- const optFilterValue = opt.customFilters[optFilterKey];
4582
- const templateFilterValue = customFilters[templateFilterKey];
4583
- const optTermType = optFilterValue?.['term_type'];
4584
- const templateTermType = templateFilterValue?.['term_type'];
4585
- return optTermType === templateTermType;
4594
+ // Compare term_type values (handle both snake_case and camelCase)
4595
+ const optTermType = optFilterValue['term_type'];
4596
+ const actualTermType = actualFilters['term_type'] || actualFilters['termType'];
4597
+ const matches = optTermType === actualTermType;
4598
+ console.log('[Column] Comparing:', {
4599
+ label: opt.label,
4600
+ optTermType,
4601
+ actualTermType,
4602
+ matches
4603
+ });
4604
+ return matches;
4586
4605
  });
4606
+ if (matchingIndex >= 0) {
4607
+ console.log('[Column] Found match at index:', matchingIndex, this.ontologyTypes[matchingIndex].label);
4608
+ }
4609
+ else {
4610
+ console.warn('[Column] No match found for:', { ontologyType, customFilters });
4611
+ }
4587
4612
  return matchingIndex >= 0 ? matchingIndex : 0;
4588
4613
  }
4589
4614
  onSubmit() {