mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6106] Breadcrumb navigation fix on Details tab (#3482)
This commit is contained in:
committed by
GitHub
parent
99c27a88f7
commit
1c222bdd36
@@ -1,6 +1,6 @@
|
||||
<aca-page-layout>
|
||||
<div class="aca-page-layout-header">
|
||||
<adf-breadcrumb [root]="title" [folderNode]="node" (navigate)="goBack()"> </adf-breadcrumb>
|
||||
<adf-breadcrumb [root]="title" [folderNode]="node" (navigate)="onBreadcrumbNavigate($event)"> </adf-breadcrumb>
|
||||
<aca-toolbar [items]="actions"></aca-toolbar>
|
||||
</div>
|
||||
|
||||
|
@@ -30,11 +30,12 @@ import { of, Subject } from 'rxjs';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction, NavigateToFolder } from '@alfresco/aca-shared/store';
|
||||
import { NodeEntry, PathElement } from '@alfresco/js-api';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { BreadcrumbComponent, SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
describe('DetailsComponent', () => {
|
||||
let component: DetailsComponent;
|
||||
@@ -45,7 +46,7 @@ describe('DetailsComponent', () => {
|
||||
|
||||
const mockStream = new Subject();
|
||||
const storeMock = {
|
||||
dispatch: jasmine.createSpy('dispatch'),
|
||||
dispatch: jasmine.createSpy('dispatch').and.stub(),
|
||||
select: () => mockStream
|
||||
};
|
||||
|
||||
@@ -124,6 +125,17 @@ describe('DetailsComponent', () => {
|
||||
expect(contentApiService.getNode).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should dispatch navigation to a given folder', () => {
|
||||
const breadcrumbComponent: BreadcrumbComponent = fixture.debugElement.query(By.directive(BreadcrumbComponent)).componentInstance;
|
||||
const pathElement: PathElement = {
|
||||
id: 'fake-id'
|
||||
};
|
||||
breadcrumbComponent.navigate.emit(pathElement);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(store.dispatch).toHaveBeenCalledWith(new NavigateToFolder({ entry: pathElement } as NodeEntry));
|
||||
});
|
||||
|
||||
it('should dispatch node selection', () => {
|
||||
fixture.detectChanges();
|
||||
expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([node]));
|
||||
|
@@ -25,7 +25,7 @@
|
||||
import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
||||
import { NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { Subject } from 'rxjs';
|
||||
import { BreadcrumbModule, PermissionManagerModule } from '@alfresco/adf-content-services';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -36,6 +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, PathElement } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@@ -105,6 +106,10 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
||||
this.store.dispatch(new NavigateToPreviousPage());
|
||||
}
|
||||
|
||||
onBreadcrumbNavigate(path: PathElement) {
|
||||
this.store.dispatch(new NavigateToFolder({ entry: path } as NodeEntry));
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.store.dispatch(new SetSelectedNodesAction([]));
|
||||
this.onDestroy$.next();
|
||||
|
Reference in New Issue
Block a user