From c7c24fd28f77a1fe202bece65b009ca1b66b3a33 Mon Sep 17 00:00:00 2001 From: manuel-delvillar <68391066+manuel-delvillar@users.noreply.github.com> Date: Thu, 27 Apr 2023 13:08:11 -0600 Subject: [PATCH 1/2] Fix select all/page - Fix for this component. --- ui/src/app/collection/collection-skill-search.component.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ui/src/app/collection/collection-skill-search.component.ts b/ui/src/app/collection/collection-skill-search.component.ts index d35605da3..e7e2daaa7 100644 --- a/ui/src/app/collection/collection-skill-search.component.ts +++ b/ui/src/app/collection/collection-skill-search.component.ts @@ -125,7 +125,7 @@ export class CollectionSkillSearchComponent extends SkillsListComponent implemen if (result) { this.toastService.hideBlockingLoader() const isWorkspace = this.collection?.status === PublishStatus.Workspace - const baseMessage = `You added ${selectedCount} RSD${selectedCount ? "s" : ""} to the` + const baseMessage = `You added ${this.selectAllChecked ? this.totalCount : this.size} RSD${selectedCount ? "s" : ""} to the` const message = ` ${baseMessage} ${this.collectionOrWorkspace(false)} ${ isWorkspace ? "" : this.collection?.name}.` this.toastService.showToast("Success!", message) } @@ -135,10 +135,7 @@ export class CollectionSkillSearchComponent extends SkillsListComponent implemen } getApiSearch(skill?: ApiSkillSummary): ApiSearch | undefined { - return (this.multiplePagesSelected) ? new ApiSearch({query: this.searchQuery}) : super.getApiSearch(skill) + return this.selectAllChecked ? new ApiSearch({query: this.searchQuery}) : new ApiSearch({uuids: this.selectedUuids()}) } - handleSelectAll(selectAllChecked: boolean): void { - this.multiplePagesSelected = this.totalPageCount > 1 - } } From 984b009bd396a77025bc30a3f4b4bdae6d1ddfdc Mon Sep 17 00:00:00 2001 From: manuel-delvillar <68391066+manuel-delvillar@users.noreply.github.com> Date: Thu, 27 Apr 2023 16:28:55 -0600 Subject: [PATCH 2/2] Update tests --- .../collection-skill-search.component.spec.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ui/src/app/collection/collection-skill-search.component.spec.ts b/ui/src/app/collection/collection-skill-search.component.spec.ts index 1783fb571..5d987ff4b 100644 --- a/ui/src/app/collection/collection-skill-search.component.spec.ts +++ b/ui/src/app/collection/collection-skill-search.component.spec.ts @@ -191,7 +191,7 @@ describe("CollectionSkillSearchComponent", () => { it("getApiSearch should return canned search", () => { // Arrange - component.multiplePagesSelected = true + component.selectAllChecked = true const search = "testQueryString" component.searchForm.setValue({search}) @@ -204,14 +204,12 @@ describe("CollectionSkillSearchComponent", () => { it("getApiSearch should return specified search", () => { // Arrange - component.multiplePagesSelected = false - const skill = createMockSkillSummary() - - // Act - const result = component.getApiSearch(skill) + component.selectAllChecked = false + component.selectedSkills = [createMockSkillSummary("1")] + const result = component.selectedUuids() // Assert - expect(result).toEqual(new ApiSearch({ uuids: [ skill.uuid ] } )) + expect(result).toEqual(component.getApiSearch()?.uuids) }) it("handleSelectAll should be correct", () => { @@ -222,7 +220,7 @@ describe("CollectionSkillSearchComponent", () => { // Act component.handleSelectAll(true) // Assert - expect(component.multiplePagesSelected).toBeTrue() + expect(component.selectAllChecked).toBeTrue() // Arrange component.results = new PaginatedSkills([], 5)