From e42d934c122debdc23329b7c6a4624266ede2942 Mon Sep 17 00:00:00 2001 From: OgunyemiO <142920130+OgunyemiO@users.noreply.github.com> Date: Thu, 4 Jul 2024 11:07:05 +0100 Subject: [PATCH] sort sub documents by recent uploads first (#1725) * sort sub documents by recent uploads first * unit test * version change * Unit test refactored * version update * new version --------- Co-authored-by: Ritesh Dsouza --- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- .../case-file-view-folder.component.spec.ts | 3 ++- .../case-file-view-folder/case-file-view-folder.component.ts | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9c76b208eb..72a29bce6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.0.42", + "version": "7.0.43", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 38ea872f73..aa5c07e98e 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "7.0.42", + "version": "7.0.43", "engines": { "node": ">=18.19.0" }, diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.spec.ts index d030e1564d..115ccd17d3 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.spec.ts @@ -90,10 +90,11 @@ describe('CaseFileViewFolderComponent', () => { documentFilterInputEl.dispatchEvent(new Event('input')); fixture.detectChanges(); await fixture.whenStable(); + component.sortDataSourceDescending(1) fixture.detectChanges(); expect(component.filter).toHaveBeenCalled(); - expect(component.documentTreeData).toEqual(treeData); + expect(treeData[3].children[0].upload_timestamp).toEqual('17 Nov 2022 00:00:00'); }); it('should generate tree data from categorised data', () => { diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.ts index 690945b9a6..dd99b75286 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/case-file-view/components/case-file-view-folder/case-file-view-folder.component.ts @@ -10,6 +10,7 @@ import { AbstractAppConfig } from '../../../../../../app.config'; import { CaseFileViewCategory, CaseFileViewDocument, + CaseFileViewSortColumns, CategoriesAndDocuments, DocumentTreeNode, DocumentTreeNodeType @@ -100,6 +101,7 @@ export class CaseFileViewFolderComponent implements OnInit, OnDestroy { // Initialise cdk tree with generated data this.nestedDataSource = this.documentTreeData; this.nestedTreeControl.dataNodes = this.documentTreeData; + this.sortDataSourceDescending(CaseFileViewSortColumns.DOCUMENT_UPLOAD_TIMESTAMP); }); }