diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.html b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.html index 43c53c78f1..e8bfd2aed4 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.html +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.html @@ -76,7 +76,7 @@
diff --git a/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.ts b/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.ts index 2d80eb0f8f..aa28b7b0eb 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.ts @@ -24,11 +24,10 @@ import { MatChipsModule } from '@angular/material/chips'; import { TranslatePipe } from '@ngx-translate/core'; import { ToggleIconDirective } from '../directives/toggle-icon.directive'; import { MatButtonModule } from '@angular/material/button'; -import { FileUploadErrorPipe } from '../pipes/file-upload-error.pipe'; @Component({ selector: 'adf-file-uploading-list-row', - imports: [IconModule, MatListModule, MatChipsModule, TranslatePipe, ToggleIconDirective, FileSizePipe, MatButtonModule, FileUploadErrorPipe], + imports: [IconModule, MatListModule, MatChipsModule, TranslatePipe, ToggleIconDirective, FileSizePipe, MatButtonModule], templateUrl: './file-uploading-list-row.component.html', styleUrls: ['./file-uploading-list-row.component.scss'], encapsulation: ViewEncapsulation.None @@ -83,4 +82,8 @@ export class FileUploadingListRowComponent { isUploadVersionComplete(): boolean { return this.file?.status === FileUploadStatus.Complete && this.isUploadVersion(); } + + getFileUploadErrorKey(errorCode: number): string { + return `FILE_UPLOAD.ERRORS.${errorCode || 'GENERIC'}`; + } } diff --git a/lib/content-services/src/lib/upload/components/upload-button.component.html b/lib/content-services/src/lib/upload/components/upload-button.component.html index 5203f70d16..1ed58e6536 100644 --- a/lib/content-services/src/lib/upload/components/upload-button.component.html +++ b/lib/content-services/src/lib/upload/components/upload-button.component.html @@ -21,7 +21,7 @@ {{ 'FILE_UPLOAD.BUTTON.UPLOAD_FILE' | translate }} } @if (staticTitle) { - {{ staticTitle }} + {{ staticTitle }} } } @@ -43,7 +43,7 @@ {{ 'FILE_UPLOAD.BUTTON.UPLOAD_FILE' | translate }} } @if (staticTitle) { - {{ staticTitle }} + {{ staticTitle }} } } @@ -69,7 +69,7 @@ {{ 'FILE_UPLOAD.BUTTON.UPLOAD_FOLDER' | translate }} } @if (staticTitle) { - {{ staticTitle }} + {{ staticTitle }} } } diff --git a/lib/content-services/src/lib/upload/pipes/file-upload-error.pipe.spec.ts b/lib/content-services/src/lib/upload/pipes/file-upload-error.pipe.spec.ts deleted file mode 100644 index 36828c7040..0000000000 --- a/lib/content-services/src/lib/upload/pipes/file-upload-error.pipe.spec.ts +++ /dev/null @@ -1,52 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { NoopTranslateModule } from '@alfresco/adf-core'; -import { FileUploadErrorPipe } from './file-upload-error.pipe'; -import { TestBed } from '@angular/core/testing'; - -describe('FileUploadErrorPipe', () => { - let pipe: FileUploadErrorPipe; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [NoopTranslateModule], - providers: [FileUploadErrorPipe] - }); - pipe = TestBed.inject(FileUploadErrorPipe); - }); - - it('should return generic message when error code is null', () => { - expect(pipe.transform(null)).toBe('FILE_UPLOAD.ERRORS.GENERIC'); - }); - - it('should return 500 message', () => { - expect(pipe.transform(500)).toBe('FILE_UPLOAD.ERRORS.500'); - }); - - it('should return 504 message', () => { - expect(pipe.transform(504)).toBe('FILE_UPLOAD.ERRORS.504'); - }); - - it('should return 403 message', () => { - expect(pipe.transform(403)).toBe('FILE_UPLOAD.ERRORS.403'); - }); - - it('should return 404 message', () => { - expect(pipe.transform(404)).toBe('FILE_UPLOAD.ERRORS.404'); - }); -}); diff --git a/lib/content-services/src/lib/upload/pipes/file-upload-error.pipe.ts b/lib/content-services/src/lib/upload/pipes/file-upload-error.pipe.ts deleted file mode 100644 index 4e93b18534..0000000000 --- a/lib/content-services/src/lib/upload/pipes/file-upload-error.pipe.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Pipe, PipeTransform, inject } from '@angular/core'; -import { TranslationService } from '@alfresco/adf-core'; - -@Pipe({ - name: 'adfFileUploadError', - pure: true -}) -export class FileUploadErrorPipe implements PipeTransform { - private readonly translation = inject(TranslationService); - - transform(errorCode: number): string { - return this.translation.instant(`FILE_UPLOAD.ERRORS.${errorCode || 'GENERIC'}`); - } -} diff --git a/lib/content-services/src/lib/upload/public-api.ts b/lib/content-services/src/lib/upload/public-api.ts index 35775c8ea4..d475ec8943 100644 --- a/lib/content-services/src/lib/upload/public-api.ts +++ b/lib/content-services/src/lib/upload/public-api.ts @@ -26,8 +26,6 @@ export * from './components/upload-files.event'; export * from './directives/file-draggable.directive'; export * from './directives/toggle-icon.directive'; -export * from './pipes/file-upload-error.pipe'; - export * from './components/base-upload/upload-base'; export * from './upload.module'; diff --git a/lib/content-services/src/lib/upload/upload.module.ts b/lib/content-services/src/lib/upload/upload.module.ts index d2581acb68..af8fb63f50 100644 --- a/lib/content-services/src/lib/upload/upload.module.ts +++ b/lib/content-services/src/lib/upload/upload.module.ts @@ -22,12 +22,10 @@ import { FileUploadingListComponent } from './components/file-uploading-list.com import { UploadButtonComponent } from './components/upload-button.component'; import { UploadVersionButtonComponent } from './components/upload-version-button.component'; import { UploadDragAreaComponent } from './components/upload-drag-area.component'; -import { FileUploadErrorPipe } from './pipes/file-upload-error.pipe'; import { FileDraggableDirective } from './directives/file-draggable.directive'; import { ToggleIconDirective } from './directives/toggle-icon.directive'; export const CONTENT_UPLOAD_DIRECTIVES = [ - FileUploadErrorPipe, FileDraggableDirective, ToggleIconDirective, UploadDragAreaComponent, diff --git a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts index b7065201dc..332ad747d9 100644 --- a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts +++ b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts @@ -48,6 +48,7 @@ import { AlfrescoViewerComponent } from './alfresco-viewer.component'; import { RenditionService } from '../../common/services/rendition.service'; import { NodeActionsService } from '../../document-list/services/node-actions.service'; import { provideApiTesting } from '../../testing/providers'; +import { MatIconTestingModule } from '@angular/material/icon/testing'; @Component({ selector: 'adf-viewer-container-toolbar', @@ -179,7 +180,7 @@ describe('AlfrescoViewerComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [NoopAuthModule, NoopTranslateModule, MatDialogModule, AlfrescoViewerComponent], + imports: [NoopAuthModule, MatIconTestingModule, NoopTranslateModule, MatDialogModule, AlfrescoViewerComponent], providers: [ provideApiTesting(), { diff --git a/lib/core/src/lib/viewer/components/viewer.component.spec.ts b/lib/core/src/lib/viewer/components/viewer.component.spec.ts index 2143c9eebc..b5ee2d42ac 100644 --- a/lib/core/src/lib/viewer/components/viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/viewer.component.spec.ts @@ -33,6 +33,7 @@ import { ViewerWithCustomToolbarActionsComponent } from './mock/adf-viewer-conta import { ViewerWithCustomToolbarComponent } from './mock/adf-viewer-container-toolbar.component.mock'; import { ViewerComponent } from './viewer.component'; import { ThumbnailService } from '../../common/services/thumbnail.service'; +import { MatIconTestingModule } from '@angular/material/icon/testing'; @Component({ selector: 'adf-dialog-dummy', @@ -71,6 +72,7 @@ describe('ViewerComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ + MatIconTestingModule, ViewerWithCustomToolbarComponent, ViewerWithCustomSidebarComponent, ViewerWithCustomOpenWithComponent, @@ -106,8 +108,8 @@ describe('ViewerComponent', () => { describe('Mime Type Test', () => { it('should mimeType change when blobFile changes', () => { - const mockSimpleChanges: SimpleChanges = { - blobFile: new SimpleChange(null, { type: 'image/png' }, true) + const mockSimpleChanges: SimpleChanges = { + blobFile: new SimpleChange(null, { type: 'image/png' }, true) }; component.ngOnChanges(mockSimpleChanges); @@ -117,9 +119,9 @@ describe('ViewerComponent', () => { it('should set mimeTypeIconUrl when mimeType changes and no nodeMimeType is provided', () => { spyOn(thumbnailService, 'getMimeTypeIcon').and.returnValue('image/png'); - const mockSimpleChanges: SimpleChanges = { - mimeType: new SimpleChange(null, 'image/png', true), - nodeMimeType: undefined + const mockSimpleChanges: SimpleChanges = { + mimeType: new SimpleChange(null, 'image/png', true), + nodeMimeType: undefined }; component.ngOnChanges(mockSimpleChanges); @@ -130,9 +132,9 @@ describe('ViewerComponent', () => { it('should set mimeTypeIconUrl when nodeMimeType changes', () => { spyOn(thumbnailService, 'getMimeTypeIcon').and.returnValue('application/pdf'); - const mockSimpleChanges: SimpleChanges = { - mimeType: new SimpleChange(null, 'image/png', true), - nodeMimeType: new SimpleChange(null, 'application/pdf', true) + const mockSimpleChanges: SimpleChanges = { + mimeType: new SimpleChange(null, 'image/png', true), + nodeMimeType: new SimpleChange(null, 'application/pdf', true) }; component.ngOnChanges(mockSimpleChanges); @@ -531,8 +533,8 @@ describe('ViewerComponent', () => { }); it('should file name be present if is overlay mode ', async () => { - const mockSimpleChanges: SimpleChanges = { - blobFile: new SimpleChange(null, { type: 'image/png' }, true) + const mockSimpleChanges: SimpleChanges = { + blobFile: new SimpleChange(null, { type: 'image/png' }, true) }; component.ngOnChanges(mockSimpleChanges); fixture.detectChanges();