From bbadd5f5042cefeae903e71c7dd9f1c9a8027f36 Mon Sep 17 00:00:00 2001 From: Daniel Frett Date: Tue, 6 Apr 2021 15:44:01 -0400 Subject: [PATCH 1/2] use ngx-pipes to sort the list of attachments --- package.json | 1 + src/app/app.module.ts | 2 ++ src/app/components/attachments/attachments.component.html | 6 +++++- .../components/attachments/attachments.component.spec.ts | 3 ++- yarn.lock | 7 +++++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e43b6cb0..9ff104ce 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "jsonapi-datastore": "0.4.0-beta", "ng2-ace-editor": "0.3.9", "ng2-file-upload": "1.4.0", + "ngx-pipes": "^2.7.5", "rxjs": "6.6.7", "rxjs-compat": "6.6.7", "tslib": "2.2.0", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3049a5aa..1e6a85bc 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -45,6 +45,7 @@ import { ResourceComponent } from './components/resource/resource.component'; import { CustomManifestService } from './service/custom-manifest.service'; import 'brace/mode/xml'; import { TranslationVersionBadgeComponent } from './components/translation/translation-version-badge/translation-version-badge.component'; +import { NgArrayPipesModule } from 'ngx-pipes'; @NgModule({ declarations: [ @@ -77,6 +78,7 @@ import { TranslationVersionBadgeComponent } from './components/translation/trans FormsModule, AppRoutingModule, HttpModule, + NgArrayPipesModule, NgbModule.forRoot(), ], providers: [ diff --git a/src/app/components/attachments/attachments.component.html b/src/app/components/attachments/attachments.component.html index af5a1bb0..8f08b2f5 100644 --- a/src/app/components/attachments/attachments.component.html +++ b/src/app/components/attachments/attachments.component.html @@ -113,7 +113,11 @@
Upload new attachment
Actions
-
+
{{ attachment.id }} diff --git a/src/app/components/attachments/attachments.component.spec.ts b/src/app/components/attachments/attachments.component.spec.ts index 67edfb00..01f6dd6e 100644 --- a/src/app/components/attachments/attachments.component.spec.ts +++ b/src/app/components/attachments/attachments.component.spec.ts @@ -9,6 +9,7 @@ import { Attachment } from '../../models/attachment'; import { By } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { FileSelectDirective } from 'ng2-file-upload'; +import { NgArrayPipesModule } from 'ngx-pipes'; describe('AttachmentsComponent', () => { let comp: AttachmentsComponent; @@ -47,7 +48,7 @@ describe('AttachmentsComponent', () => { TestBed.configureTestingModule({ declarations: [AttachmentsComponent, FileSelectDirective], - imports: [NgbModule.forRoot(), FormsModule], + imports: [NgbModule.forRoot(), FormsModule, NgArrayPipesModule], providers: [ { provide: ResourceService, useValue: resourceServiceStub }, { provide: WindowRefService, useValue: windowRefStub }, diff --git a/yarn.lock b/yarn.lock index 82379d94..037216e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4930,6 +4930,13 @@ ng2-file-upload@1.4.0: dependencies: tslib "^1.9.0" +ngx-pipes@^2.7.5: + version "2.7.5" + resolved "https://registry.yarnpkg.com/ngx-pipes/-/ngx-pipes-2.7.5.tgz#22e2e4b7015ae9103210dfa2dacd6f4ae4411639" + integrity sha512-hlxHzu+snGJ038Z+HdkgEZRlZeE7suDTLWJD1yUP11eAM+xLPJAur1QtvvtZTHRHutOc7Wij1keBtuWIS9D0JQ== + dependencies: + tslib "^2.0.0" + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" From 980a06da441c056608fafa6fd6aa009c804cc600 Mon Sep 17 00:00:00 2001 From: Daniel Frett Date: Tue, 6 Apr 2021 15:48:09 -0400 Subject: [PATCH 2/2] sort tools on the attachments UI --- src/app/components/attachments/attachments.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/attachments/attachments.component.html b/src/app/components/attachments/attachments.component.html index 8f08b2f5..ef23f509 100644 --- a/src/app/components/attachments/attachments.component.html +++ b/src/app/components/attachments/attachments.component.html @@ -86,7 +86,7 @@
Upload new attachment
Loading... -
+