@noatgnu/cupcake-vanilla 1.3.6 → 1.3.7

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,43 @@ 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
+ });
4576
+ // Handle both wrapped and unwrapped formats
4577
+ // Wrapped: {"ms_unique_vocabularies": {"term_type": "cell line"}}
4578
+ // Unwrapped: {"term_type": "cell line"}
4579
+ const actualFilters = customFilters[ontologyType] || customFilters;
4572
4580
  const matchingIndex = this.ontologyTypes.findIndex(opt => {
4573
4581
  if (opt.value !== ontologyType)
4574
4582
  return false;
4575
4583
  if (!opt.customFilters)
4576
4584
  return false;
4577
- const optFilterKey = Object.keys(opt.customFilters)[0];
4578
- const templateFilterKey = Object.keys(customFilters)[0];
4579
- if (optFilterKey !== templateFilterKey)
4585
+ // Get the filter value from config (should be wrapped like {"ms_unique_vocabularies": {"term_type": "..."}})
4586
+ const optFilterValue = opt.customFilters[ontologyType];
4587
+ if (!optFilterValue)
4580
4588
  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;
4589
+ const optFiltersJson = JSON.stringify(optFilterValue);
4590
+ const templateFiltersJson = JSON.stringify(actualFilters);
4591
+ const matches = optFiltersJson === templateFiltersJson;
4592
+ console.log('[Column] Comparing:', {
4593
+ label: opt.label,
4594
+ optFilters: optFilterValue,
4595
+ templateFilters: actualFilters,
4596
+ matches
4597
+ });
4598
+ return matches;
4586
4599
  });
4600
+ if (matchingIndex >= 0) {
4601
+ console.log('[Column] Found match at index:', matchingIndex, this.ontologyTypes[matchingIndex].label);
4602
+ }
4603
+ else {
4604
+ console.warn('[Column] No match found for:', { ontologyType, customFilters });
4605
+ }
4587
4606
  return matchingIndex >= 0 ? matchingIndex : 0;
4588
4607
  }
4589
4608
  onSubmit() {