diff --git a/projects/aca-content/src/lib/components/details/details.component.html b/projects/aca-content/src/lib/components/details/details.component.html index 112a0c6f77..fcc9101aa7 100644 --- a/projects/aca-content/src/lib/components/details/details.component.html +++ b/projects/aca-content/src/lib/components/details/details.component.html @@ -9,7 +9,7 @@
- {{ 'APP.INFO_DRAWER.ICON' | translate }} + {{ 'APP.INFO_DRAWER.ICON' | translate }} {{ node.name }}
diff --git a/projects/aca-content/src/lib/components/details/details.component.scss b/projects/aca-content/src/lib/components/details/details.component.scss index fdf1c208ac..b9e4ebb1ef 100644 --- a/projects/aca-content/src/lib/components/details/details.component.scss +++ b/projects/aca-content/src/lib/components/details/details.component.scss @@ -57,6 +57,9 @@ app-details-manager { .aca-details-breadcrumb { font-size: 18px; margin-left: 20px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; &-library { font-weight: 900; diff --git a/projects/aca-content/src/lib/components/details/details.component.spec.ts b/projects/aca-content/src/lib/components/details/details.component.spec.ts index 8db7cbddcd..1003ae6ec5 100644 --- a/projects/aca-content/src/lib/components/details/details.component.spec.ts +++ b/projects/aca-content/src/lib/components/details/details.component.spec.ts @@ -61,23 +61,6 @@ describe('DetailsComponent', () => { const mockAspectActionsSubject$ = new BehaviorSubject(mockAspectActions); extensionsServiceMock.getAllowedSidebarActions.and.returnValue(mockAspectActionsSubject$.asObservable()); - const mockNode = { - isFile: false, - createdByUser: { id: 'admin', displayName: 'Administrator' }, - modifiedAt: new Date('2017-05-24T15:08:55.640Z'), - nodeType: 'cm:content', - content: { - mimeType: 'application/rtf', - mimeTypeName: 'Rich Text Format', - sizeInBytes: 14530 - }, - createdAt: new Date('2017-05-24T15:08:55.640Z'), - isFolder: true, - modifiedByUser: { id: 'admin', displayName: 'Administrator' }, - name: 'b_txt_file.rtf', - id: 'test node 1' - }; - beforeEach(() => { TestBed.configureTestingModule({ imports: [AppTestingModule, DetailsComponent], @@ -170,10 +153,10 @@ describe('DetailsComponent', () => { expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([node])); }); - it('should set aspectActions from extensions', () => { + it('should set aspectActions from extensions', async () => { extensionsServiceMock.getAllowedSidebarActions.and.returnValue(of(mockAspectActions)); fixture.detectChanges(); - fixture.whenStable().then(() => { + await fixture.whenStable().then(() => { expect(component.aspectActions).toEqual(mockAspectActions); }); }); @@ -182,11 +165,11 @@ describe('DetailsComponent', () => { const expectedIcon = 'assets/images/ft_ic_folder'; spyOn(thumbnailService, 'getNodeIcon').and.returnValue(expectedIcon); fixture.detectChanges(); - component.getNodeIcon(mockNode); - expect(component.getIcon).toContain(expectedIcon); + component.ngOnInit(); + expect(component.nodeIcon).toContain(expectedIcon); }); - it('should set aspectActions from extensions', async () => { + it('should set aspectActions from extensions', () => { const extensionMock = { getAllowedSidebarActions: () => of([ diff --git a/projects/aca-content/src/lib/components/details/details.component.ts b/projects/aca-content/src/lib/components/details/details.component.ts index 4f4ba3bc96..0e979cba9d 100644 --- a/projects/aca-content/src/lib/components/details/details.component.ts +++ b/projects/aca-content/src/lib/components/details/details.component.ts @@ -36,7 +36,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatButtonModule } from '@angular/material/button'; import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component'; import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component'; -import { NodeEntry, Node, PathElement } from '@alfresco/js-api'; +import { NodeEntry, PathElement } from '@alfresco/js-api'; import { takeUntil } from 'rxjs/operators'; import { ContentActionRef } from '@alfresco/adf-extensions'; import { ThumbnailService } from '@alfresco/adf-core'; @@ -68,7 +68,7 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy onDestroy$ = new Subject(); activeTab = 1; aspectActions: Array = []; - getIcon: string; + nodeIcon: string; constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private thumbnailService: ThumbnailService) { super(); @@ -88,7 +88,7 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy this.contentApi.getNode(this.nodeId).subscribe((node) => { this.node = node.entry; this.isLoading = false; - this.getNodeIcon(this.node); + this.nodeIcon = this.thumbnailService.getNodeIcon(this.node); this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }])); }); }); @@ -100,10 +100,6 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy }); } - getNodeIcon(node: Node): void { - this.getIcon = this.thumbnailService.getNodeIcon(node); - } - setActiveTab(tabName: string) { switch (tabName) { case 'comments': diff --git a/projects/aca-content/src/lib/components/info-drawer/metadata-tab/metadata-tab.component.ts b/projects/aca-content/src/lib/components/info-drawer/metadata-tab/metadata-tab.component.ts index 3d11602427..ba96a4d666 100644 --- a/projects/aca-content/src/lib/components/info-drawer/metadata-tab/metadata-tab.component.ts +++ b/projects/aca-content/src/lib/components/info-drawer/metadata-tab/metadata-tab.component.ts @@ -29,7 +29,13 @@ import { AppStore, EditOfflineAction, infoDrawerMetadataAspect, NodeActionTypes import { AppConfigService, NotificationService } from '@alfresco/adf-core'; import { Observable, Subject } from 'rxjs'; import { Store } from '@ngrx/store'; -import { ContentMetadataModule, ContentMetadataService, ContentMetadataCustomPanel } from '@alfresco/adf-content-services'; +import { + ContentMetadataModule, + ContentMetadataService, + ContentMetadataCustomPanel, + TagService, + CategoryService +} from '@alfresco/adf-content-services'; import { filter, map, takeUntil } from 'rxjs/operators'; import { CommonModule } from '@angular/common'; import { Actions, ofType } from '@ngrx/effects'; @@ -45,6 +51,8 @@ import { Actions, ofType } from '@ngrx/effects'; [node]="node" [displayAspect]="displayAspect$ | async" [customPanels]="customPanels | async" + [displayCategories]="displayCategories" + [displayTags]="displayTags" > `, @@ -53,6 +61,9 @@ import { Actions, ofType } from '@ngrx/effects'; }) export class MetadataTabComponent implements OnInit, OnDestroy { protected onDestroy$ = new Subject(); + private _displayCategories = true; + private _displayTags = true; + @Input() node: Node; @@ -60,6 +71,13 @@ export class MetadataTabComponent implements OnInit, OnDestroy { readOnly = false; customPanels: Observable; + get displayCategories(): boolean { + return this._displayCategories; + } + get displayTags(): boolean { + return this._displayTags; + } + constructor( private permission: NodePermissionService, protected extensions: AppExtensionService, @@ -67,7 +85,9 @@ export class MetadataTabComponent implements OnInit, OnDestroy { private store: Store, private notificationService: NotificationService, private contentMetadataService: ContentMetadataService, - private actions$: Actions + private actions$: Actions, + private tagService: TagService, + private categoryService: CategoryService ) { if (this.extensions.contentMetadata) { this.appConfig.config['content-metadata'].presets = this.extensions.contentMetadata.presets; @@ -76,6 +96,9 @@ export class MetadataTabComponent implements OnInit, OnDestroy { } ngOnInit() { + this._displayTags = this.tagService.areTagsEnabled(); + this._displayCategories = this.categoryService.areCategoriesEnabled(); + this.contentMetadataService.error.pipe(takeUntil(this.onDestroy$)).subscribe((err: { message: string }) => { this.notificationService.showError(err.message); }); diff --git a/projects/aca-shared/src/lib/services/app.extension.service.spec.ts b/projects/aca-shared/src/lib/services/app.extension.service.spec.ts index ea9f60827b..72da737f68 100644 --- a/projects/aca-shared/src/lib/services/app.extension.service.spec.ts +++ b/projects/aca-shared/src/lib/services/app.extension.service.spec.ts @@ -30,6 +30,7 @@ import { AppStore } from '@alfresco/aca-shared/store'; import { ContentActionType, ExtensionConfig, + ExtensionLoaderService, ExtensionService, filterEnabled, mergeArrays, @@ -53,6 +54,7 @@ describe('AppExtensionService', () => { let logService: LogService; let iconRegistry: MatIconRegistry; let sanitizer: DomSanitizer; + let loader: ExtensionLoaderService; beforeEach(() => { TestBed.configureTestingModule({ @@ -70,6 +72,7 @@ describe('AppExtensionService', () => { extensions = TestBed.inject(ExtensionService); logService = TestBed.inject(LogService); + loader = TestBed.inject(ExtensionLoaderService); }); const applyConfig = (config: ExtensionConfig, selection?: boolean) => { @@ -1836,9 +1839,9 @@ describe('AppExtensionService', () => { }); }); - it('should update the sidebarActions', () => { - spyOn(service, 'updateSidebarActions').and.callThrough(); + it('should update sidebar actions correctly', () => { + spyOn(loader, 'getContentActions').and.callThrough(); service.updateSidebarActions(); - expect(service.updateSidebarActions).toHaveBeenCalled(); + expect(loader.getContentActions).toHaveBeenCalledWith(service.config, 'features.sidebar.toolbar'); }); });