From 13cfd6f90477af141b12b643469c7956631bc106 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:52:35 -0800 Subject: [PATCH] Change: Revert dropdown sorting by doc count (#8887) --- src-ui/messages.xlf | 4 +-- .../filterable-dropdown.component.spec.ts | 31 ------------------- .../filterable-dropdown.component.ts | 10 ------ 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 4d628135c..9cc4086ae 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -4974,7 +4974,7 @@ Not assigned src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts - 390 + 380 Filter drop down element to filter for documents with no correspondent/type/tag assigned @@ -4982,7 +4982,7 @@ Open filter src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts - 511 + 501 diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts index 245d34830..0dcc8c9cf 100644 --- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts +++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts @@ -490,37 +490,6 @@ describe('FilterableDropdownComponent & FilterableDropdownSelectionModel', () => ]) }) - it('selection model should sort items by state and document counts, if set', () => { - component.items = items.concat([{ id: 4, name: 'Item D' }]) - component.selectionModel = selectionModel - component.documentCounts = [ - { id: 1, document_count: 0 }, // Tag1 - { id: 2, document_count: 1 }, // Tag2 - { id: 4, document_count: 2 }, - ] - component.selectionModel.apply() - expect(selectionModel.items).toEqual([ - nullItem, - { id: 4, name: 'Item D' }, - items[1], // Tag2 - items[0], // Tag1 - ]) - - selectionModel.toggle(items[1].id) - component.documentCounts = [ - { id: 1, document_count: 0 }, - { id: 2, document_count: 1 }, - { id: 4, document_count: 0 }, - ] - selectionModel.apply() - expect(selectionModel.items).toEqual([ - nullItem, - items[1], // Tag2 - { id: 4, name: 'Item D' }, - items[0], // Tag1 - ]) - }) - it('should set support create, keep open model and call createRef method', fakeAsync(() => { component.items = items component.icon = 'tag-fill' diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts index 3f8ee0dc3..73b7fd27b 100644 --- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts +++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts @@ -81,16 +81,6 @@ export class FilterableDropdownSelectionModel { this.getNonTemporary(b.id) == ToggleableItemState.NotSelected ) { return -1 - } else if ( - this._documentCounts.length && - this.getDocumentCount(a.id) > this.getDocumentCount(b.id) - ) { - return -1 - } else if ( - this._documentCounts.length && - this.getDocumentCount(a.id) < this.getDocumentCount(b.id) - ) { - return 1 } else { return a.name.localeCompare(b.name) }