From 84975d7a2b7b6ae3b547da9d0780bc58f4979e50 Mon Sep 17 00:00:00 2001 From: mdelez <60604010+mdelez@users.noreply.github.com> Date: Wed, 25 May 2022 15:53:06 +0200 Subject: [PATCH] feat(text-file): add support for text file representations (DEV-920) (#751) * feat(text-file): add support for text file representations * fix(upload): add text/csv MIME type --- package-lock.json | 14 +- package.json | 2 +- src/app/app.module.ts | 4 +- src/app/main/status/status.component.ts | 2 +- .../create-link-resource.component.ts | 8 +- .../archive/archive.component.html | 2 +- .../representation/text/text.component.html | 17 +++ .../representation/text/text.component.scss | 0 .../text/text.component.spec.ts | 109 ++++++++++++++ .../representation/text/text.component.ts | 140 ++++++++++++++++++ .../upload/upload.component.html | 9 +- .../representation/upload/upload.component.ts | 21 ++- .../resource-instance-form.component.ts | 8 +- .../resource/resource.component.html | 6 + .../workspace/resource/resource.component.ts | 9 +- src/assets/style/_elements.scss | 3 +- 16 files changed, 333 insertions(+), 21 deletions(-) create mode 100644 src/app/workspace/resource/representation/text/text.component.html create mode 100644 src/app/workspace/resource/representation/text/text.component.scss create mode 100644 src/app/workspace/resource/representation/text/text.component.spec.ts create mode 100644 src/app/workspace/resource/representation/text/text.component.ts diff --git a/package-lock.json b/package-lock.json index 90369ac870..0df2013836 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@angular/platform-browser-dynamic": "^13.2.6", "@angular/router": "^13.2.6", "@ckeditor/ckeditor5-angular": "^2.0.2", - "@dasch-swiss/dsp-js": "^7.2.1", + "@dasch-swiss/dsp-js": "^7.3.0", "@datadog/browser-rum": "^3.11.0", "@ngx-translate/core": "^13.0.0", "@ngx-translate/http-loader": "6.0.0", @@ -2425,9 +2425,9 @@ } }, "node_modules/@dasch-swiss/dsp-js": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@dasch-swiss/dsp-js/-/dsp-js-7.2.1.tgz", - "integrity": "sha512-rvHx0PBmVwwPOnk9E4Rui3obY6glWBXmsk74s8b0hNdVePyxPk69wC2lKBAyHx8aX9x96ebTP9+a1jXmb//cdg==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/@dasch-swiss/dsp-js/-/dsp-js-7.3.0.tgz", + "integrity": "sha512-mtE9zwEX58A3oj6btmLxv6DbLBKtpB4W3UZxjhGDO29aKEqQIC2kNqS7YjQijXo0ZSc1P9/gv0uaZ9P8QcU1YQ==", "dependencies": { "@babel/helper-compilation-targets": "^7.16.7", "@types/jsonld": "^1.5.6", @@ -17117,9 +17117,9 @@ } }, "@dasch-swiss/dsp-js": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@dasch-swiss/dsp-js/-/dsp-js-7.2.1.tgz", - "integrity": "sha512-rvHx0PBmVwwPOnk9E4Rui3obY6glWBXmsk74s8b0hNdVePyxPk69wC2lKBAyHx8aX9x96ebTP9+a1jXmb//cdg==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/@dasch-swiss/dsp-js/-/dsp-js-7.3.0.tgz", + "integrity": "sha512-mtE9zwEX58A3oj6btmLxv6DbLBKtpB4W3UZxjhGDO29aKEqQIC2kNqS7YjQijXo0ZSc1P9/gv0uaZ9P8QcU1YQ==", "requires": { "@babel/helper-compilation-targets": "^7.16.7", "@types/jsonld": "^1.5.6", diff --git a/package.json b/package.json index 716ee55ef0..7649186ef3 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@angular/platform-browser-dynamic": "^13.2.6", "@angular/router": "^13.2.6", "@ckeditor/ckeditor5-angular": "^2.0.2", - "@dasch-swiss/dsp-js": "^7.2.1", + "@dasch-swiss/dsp-js": "^7.3.0", "@datadog/browser-rum": "^3.11.0", "@ngx-translate/core": "^13.0.0", "@ngx-translate/http-loader": "6.0.0", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2012f2af5a..04a6369c08 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -160,6 +160,7 @@ import { ExpertSearchComponent } from './workspace/search/expert-search/expert-s import { FulltextSearchComponent } from './workspace/search/fulltext-search/fulltext-search.component'; import { SearchPanelComponent } from './workspace/search/search-panel/search-panel.component'; import { HintComponent } from './main/action/hint/hint.component'; +import { TextComponent } from './workspace/resource/representation/text/text.component'; // translate: AoT requires an exported function for factories export function httpLoaderFactory(httpClient: HttpClient) { @@ -306,7 +307,8 @@ export function httpLoaderFactory(httpClient: HttpClient) { UsersListComponent, VideoComponent, VideoPreviewComponent, - HintComponent + HintComponent, + TextComponent ], imports: [ AngularSplitModule.forRoot(), diff --git a/src/app/main/status/status.component.ts b/src/app/main/status/status.component.ts index da3e63dc6e..0b6beeadbf 100644 --- a/src/app/main/status/status.component.ts +++ b/src/app/main/status/status.component.ts @@ -25,7 +25,7 @@ export class StatusComponent implements OnInit { @Input() comment?: string; @Input() url?: string; - @Input() representation?: 'archive' | 'audio' | 'document' | 'still-image' | 'video'; + @Input() representation?: 'archive' | 'audio' | 'document' | 'still-image' | 'video' | 'text'; refresh = false; diff --git a/src/app/workspace/resource/operations/create-link-resource/create-link-resource.component.ts b/src/app/workspace/resource/operations/create-link-resource/create-link-resource.component.ts index e3731dc1fd..2d60e522c6 100644 --- a/src/app/workspace/resource/operations/create-link-resource/create-link-resource.component.ts +++ b/src/app/workspace/resource/operations/create-link-resource/create-link-resource.component.ts @@ -64,7 +64,9 @@ export class CreateLinkResourceComponent implements OnInit { prop.id !== Constants.HasStillImageFileValue && prop.id !== Constants.HasDocumentFileValue && prop.id !== Constants.HasAudioFileValue && - prop.id !== Constants.HasArchiveFileValue + prop.id !== Constants.HasArchiveFileValue && + prop.id !== Constants.HasMovingImageFileValue && + prop.id !== Constants.HasTextFileValue ); if (onto.properties[Constants.HasStillImageFileValue]) { @@ -75,6 +77,10 @@ export class CreateLinkResourceComponent implements OnInit { this.hasFileValue = 'audio'; } else if (onto.properties[Constants.HasArchiveFileValue]) { this.hasFileValue = 'archive'; + } else if (onto.properties[Constants.HasMovingImageFileValue]) { + this.hasFileValue = 'movingImage'; + } else if (onto.properties[Constants.HasTextFileValue]) { + this.hasFileValue = 'text'; } else { this.hasFileValue = undefined; } diff --git a/src/app/workspace/resource/representation/archive/archive.component.html b/src/app/workspace/resource/representation/archive/archive.component.html index 7be0f4698d..755586342d 100644 --- a/src/app/workspace/resource/representation/archive/archive.component.html +++ b/src/app/workspace/resource/representation/archive/archive.component.html @@ -1,6 +1,6 @@