diff --git a/src/app/project/ontology/default-data/default-resource-classes.ts b/src/app/project/ontology/default-data/default-resource-classes.ts index eae519ac4b..0991366614 100644 --- a/src/app/project/ontology/default-data/default-resource-classes.ts +++ b/src/app/project/ontology/default-data/default-resource-classes.ts @@ -128,7 +128,7 @@ export class DefaultResourceClasses { }, { iri: Constants.DocumentRepresentation, - label: 'Document (PDF, etc.)', + label: 'Document', icons: [ 'description', 'article', @@ -143,7 +143,7 @@ export class DefaultResourceClasses { }, { iri: Constants.ArchiveRepresentation, - label: 'Archive (zip, x-tar, gzip)', + label: 'Archive', icons: [ 'archive', 'folder', diff --git a/src/app/workspace/resource/representation/archive/archive.component.ts b/src/app/workspace/resource/representation/archive/archive.component.ts index 4c9ad0f0c3..c848924757 100644 --- a/src/app/workspace/resource/representation/archive/archive.component.ts +++ b/src/app/workspace/resource/representation/archive/archive.component.ts @@ -82,7 +82,7 @@ export class ArchiveComponent implements OnInit, AfterViewInit { document.body.removeChild(e); } - openReplaceFileDialog(){ + openReplaceFileDialog() { const propId = this.parentResource.properties[Constants.HasArchiveFileValue][0].id; const dialogConfig: MatDialogConfig = { @@ -91,7 +91,7 @@ export class ArchiveComponent implements OnInit, AfterViewInit { position: { top: '112px' }, - data: { mode: 'replaceFile', title: 'Archive (zip, x-tar, gzip)', subtitle: 'Update the archive file of this resource' , representation: 'archive', id: propId }, + data: { mode: 'replaceFile', title: 'Archive', subtitle: 'Update the archive file of this resource', representation: 'archive', id: propId }, disableClose: true }; const dialogRef = this._dialog.open( diff --git a/src/app/workspace/resource/representation/upload/upload.component.html b/src/app/workspace/resource/representation/upload/upload.component.html index 7d45c960bd..1667507536 100644 --- a/src/app/workspace/resource/representation/upload/upload.component.html +++ b/src/app/workspace/resource/representation/upload/upload.component.html @@ -9,13 +9,9 @@

Upload file
The following file types are supported:
- - {{ item | split: '/':1 }} - - + {{ item }} + -  mp3 -  csv, txt, xml

@@ -55,4 +51,4 @@
- + \ No newline at end of file diff --git a/src/app/workspace/resource/representation/upload/upload.component.spec.ts b/src/app/workspace/resource/representation/upload/upload.component.spec.ts index 8f154df1ee..45c81c902f 100644 --- a/src/app/workspace/resource/representation/upload/upload.component.spec.ts +++ b/src/app/workspace/resource/representation/upload/upload.component.spec.ts @@ -36,7 +36,7 @@ class TestHostComponent implements OnInit { } describe('UploadComponent', () => { - const mockFile = new File(['1'], 'testfile', { type: 'image/jpeg' }); + const mockFile = new File(['1'], 'testfile.jpg', { type: 'image/jpeg' }); const fb = new FormBuilder(); @@ -122,7 +122,7 @@ describe('UploadComponent', () => { describe('isFileTypeSupported', () => { it('should return true for the supported image files', () => { - const fileTypes = ['image/jpeg', 'image/jp2', 'image/tiff', 'image/tiff-fx', 'image/png']; + const fileTypes = ['jpg', 'jpeg', 'jp2', 'tiff', 'tif', 'png']; for (const type of fileTypes) { expect(testHostComponent.uploadComp['_isFileTypeSupported'](type)).toBeTruthy(); @@ -130,8 +130,7 @@ describe('UploadComponent', () => { }); it('should return false for unsupported image files', () => { - // --> TODO: add real unsupported filetypes? - const fileTypes = ['image/a', 'image/b', 'image/c', 'image/d', 'image/e']; + const fileTypes = ['gif', 'bmp', 'psd', 'raw', 'pdf', 'eps', 'ai', 'indd']; for (const type of fileTypes) { expect(testHostComponent.uploadComp['_isFileTypeSupported'](type)).toBeFalsy(); } diff --git a/src/app/workspace/resource/representation/upload/upload.component.ts b/src/app/workspace/resource/representation/upload/upload.component.ts index 84d677d5a1..e5bfc7ec90 100644 --- a/src/app/workspace/resource/representation/upload/upload.component.ts +++ b/src/app/workspace/resource/representation/upload/upload.component.ts @@ -46,13 +46,13 @@ export class UploadComponent implements OnInit { thumbnailUrl: string | SafeUrl; allowedFileTypes: string[]; - // todo: maybe we can use this list to display which file format is allowed to - supportedImageTypes = ['image/jpeg', 'image/jp2', 'image/tiff', 'image/tiff-fx', 'image/png']; - supportedDocumentTypes = ['application/pdf']; - supportedAudioTypes = ['audio/mpeg']; - supportedVideoTypes = ['video/mp4']; - supportedArchiveTypes = ['application/zip', 'application/x-tar', 'application/gzip']; - supportedTextTypes = ['application/csv', 'application/xml', 'text/csv', 'text/plain', 'text/xml']; + + supportedAudioTypes = ['mp3', 'wav']; + supportedArchiveTypes = ['7z', 'gz', 'gzip', 'tar', 'tgz', 'z', 'zip']; + supportedDocumentTypes = ['doc', 'docx', 'pdf', 'ppt', 'pptx', 'xls', 'xlsx']; + supportedImageTypes = ['jp2', 'jpg', 'jpeg', 'png', 'tif', 'tiff']; + supportedTextTypes = ['csv', 'txt', 'xml', 'xsd', 'xsl']; + supportedVideoTypes = ['mp4']; constructor( private _fb: FormBuilder, @@ -84,7 +84,7 @@ export class UploadComponent implements OnInit { this.file = files[0]; // only certain filetypes are supported - if (!this._isFileTypeSupported(this.file.type)) { + if (!this._isFileTypeSupported(this.file.name.split('.').pop())) { const error = 'ERROR: File type not supported'; this._notification.openSnackBar(error); this.file = null; @@ -240,7 +240,6 @@ export class UploadComponent implements OnInit { break; default: - // --> TODO for UPLOAD: expand with other representation file types break; } @@ -292,11 +291,9 @@ export class UploadComponent implements OnInit { break; default: - // --> TODO for UPLOAD: expand with other representation file types break; } - // const fileValue = new UpdateStillImageFileValue(); fileValue.filename = filename; fileValue.id = id;