mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-5932] - Sidenav not able to expand when search page is closed (#3412)
This commit is contained in:
parent
4a8faeaa8e
commit
46ea85436b
@ -42,10 +42,12 @@ describe('SearchInputComponent', () => {
|
|||||||
let searchInputService: SearchNavigationService;
|
let searchInputService: SearchNavigationService;
|
||||||
const appServiceMock = {
|
const appServiceMock = {
|
||||||
appNavNarMode$: new BehaviorSubject('collapsed'),
|
appNavNarMode$: new BehaviorSubject('collapsed'),
|
||||||
|
setAppNavbarMode: jasmine.createSpy('setAppNavbarMode'),
|
||||||
toggleAppNavBar$: new Subject()
|
toggleAppNavBar$: new Subject()
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
appServiceMock.setAppNavbarMode.calls.reset();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [AppTestingModule, SearchInputComponent],
|
imports: [AppTestingModule, SearchInputComponent],
|
||||||
providers: [
|
providers: [
|
||||||
@ -70,10 +72,9 @@ describe('SearchInputComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should collapsed sidenav by default', () => {
|
it('should collapsed sidenav by default', () => {
|
||||||
spyOn(appServiceMock.appNavNarMode$, 'next');
|
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
|
|
||||||
expect(appServiceMock.appNavNarMode$.next).toHaveBeenCalledWith('collapsed');
|
expect(appServiceMock.setAppNavbarMode).toHaveBeenCalledWith('collapsed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should change flag on library400Error event', async () => {
|
it('should change flag on library400Error event', async () => {
|
||||||
@ -244,9 +245,8 @@ describe('SearchInputComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should sidenav expanded after the component is destroy', () => {
|
it('should sidenav expanded after the component is destroy', () => {
|
||||||
spyOn(appServiceMock.appNavNarMode$, 'next');
|
|
||||||
component.ngOnDestroy();
|
component.ngOnDestroy();
|
||||||
|
|
||||||
expect(appServiceMock.appNavNarMode$.next).toHaveBeenCalledWith('expanded');
|
expect(appServiceMock.setAppNavbarMode).toHaveBeenCalledWith('expanded');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -139,7 +139,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showInputValue() {
|
showInputValue() {
|
||||||
this.appService.appNavNarMode$.next('collapsed');
|
this.appService.setAppNavbarMode('collapsed');
|
||||||
this.has400LibraryError = false;
|
this.has400LibraryError = false;
|
||||||
this.hasLibrariesConstraint = this.evaluateLibrariesConstraint();
|
this.hasLibrariesConstraint = this.evaluateLibrariesConstraint();
|
||||||
this.searchedWord = this.getUrlSearchTerm();
|
this.searchedWord = this.getUrlSearchTerm();
|
||||||
@ -150,7 +150,7 @@ export class SearchInputComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.appService.appNavNarMode$.next('expanded');
|
this.appService.setAppNavbarMode('expanded');
|
||||||
this.onDestroy$.next(true);
|
this.onDestroy$.next(true);
|
||||||
this.onDestroy$.complete();
|
this.onDestroy$.complete();
|
||||||
this.removeContentFilters();
|
this.removeContentFilters();
|
||||||
|
@ -37,10 +37,12 @@ describe('SearchLibrariesResultsComponent', () => {
|
|||||||
const emptyPage = { list: { pagination: { totalItems: 0 }, entries: [] } };
|
const emptyPage = { list: { pagination: { totalItems: 0 }, entries: [] } };
|
||||||
const appServiceMock = {
|
const appServiceMock = {
|
||||||
appNavNarMode$: new BehaviorSubject('collapsed'),
|
appNavNarMode$: new BehaviorSubject('collapsed'),
|
||||||
toggleAppNavBar$: new Subject()
|
toggleAppNavBar$: new Subject(),
|
||||||
|
setAppNavbarMode: jasmine.createSpy('setAppNavbarMode')
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
appServiceMock.setAppNavbarMode.calls.reset();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [AppTestingModule, SearchLibrariesResultsComponent],
|
imports: [AppTestingModule, SearchLibrariesResultsComponent],
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
@ -65,9 +67,8 @@ describe('SearchLibrariesResultsComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should collapsed sidenav by default', () => {
|
it('should collapsed sidenav by default', () => {
|
||||||
spyOn(appServiceMock.appNavNarMode$, 'next');
|
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
|
|
||||||
expect(appServiceMock.appNavNarMode$.next).toHaveBeenCalledWith('collapsed');
|
expect(appServiceMock.setAppNavbarMode).toHaveBeenCalledWith('collapsed');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -92,7 +92,7 @@ export class SearchLibrariesResultsComponent extends PageComponent implements On
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.appService.appNavNarMode$.next('collapsed');
|
this.appService.setAppNavbarMode('collapsed');
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
|
|
||||||
this.columns = this.extensions.documentListPresets.searchLibraries || [];
|
this.columns = this.extensions.documentListPresets.searchLibraries || [];
|
||||||
|
@ -54,7 +54,8 @@ describe('SearchComponent', () => {
|
|||||||
provide: AppService,
|
provide: AppService,
|
||||||
useValue: {
|
useValue: {
|
||||||
appNavNarMode$: new BehaviorSubject('expanded'),
|
appNavNarMode$: new BehaviorSubject('expanded'),
|
||||||
toggleAppNavBar$: new Subject()
|
toggleAppNavBar$: new Subject(),
|
||||||
|
setAppNavbarMode: jasmine.createSpy('setAppNavbarMode')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,8 @@ describe('SidenavComponent', () => {
|
|||||||
provide: AppService,
|
provide: AppService,
|
||||||
useValue: {
|
useValue: {
|
||||||
appNavNarMode$: new BehaviorSubject('expanded'),
|
appNavNarMode$: new BehaviorSubject('expanded'),
|
||||||
toggleAppNavBar$: new Subject()
|
toggleAppNavBar$: new Subject(),
|
||||||
|
setAppNavbarMode: jasmine.createSpy('setAppNavbarMode')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SidenavLayoutComponent
|
SidenavLayoutComponent
|
||||||
|
@ -64,7 +64,7 @@ export class SidenavComponent implements OnInit, OnDestroy {
|
|||||||
this.groups = this.extensions.getApplicationNavigation(this.extensions.navbar);
|
this.groups = this.extensions.getApplicationNavigation(this.extensions.navbar);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.appService.appNavNarMode$.next(this.data.mode);
|
this.appService.setAppNavbarMode(this.data.mode);
|
||||||
this.appService.toggleAppNavBar$.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.toggleNavBar());
|
this.appService.toggleAppNavBar$.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.toggleNavBar());
|
||||||
this.data.layout.expanded.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.setNavBarMode());
|
this.data.layout.expanded.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.setNavBarMode());
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ export class SidenavComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setNavBarMode() {
|
private setNavBarMode() {
|
||||||
this.appService.appNavNarMode$.next(this.data.layout.isMenuMinimized || this.data.layout.isHeaderInside ? 'collapsed' : 'expanded');
|
this.appService.setAppNavbarMode(this.data.layout.isMenuMinimized || this.data.layout.isHeaderInside ? 'collapsed' : 'expanded');
|
||||||
}
|
}
|
||||||
|
|
||||||
private toggleNavBar() {
|
private toggleNavBar() {
|
||||||
|
@ -174,6 +174,11 @@ export class AppService implements OnDestroy {
|
|||||||
this.overlayContainer.getContainerElement().setAttribute('role', 'region');
|
this.overlayContainer.getContainerElement().setAttribute('role', 'region');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setAppNavbarMode(mode: 'expanded' | 'collapsed'): void {
|
||||||
|
this.appNavNarMode$.next(mode);
|
||||||
|
this.preferencesService.set('expandedSidenav', mode === 'expanded');
|
||||||
|
}
|
||||||
|
|
||||||
private loadRepositoryStatus() {
|
private loadRepositoryStatus() {
|
||||||
this.contentApi.getRepositoryInformation().subscribe((response: DiscoveryEntry) => {
|
this.contentApi.getRepositoryInformation().subscribe((response: DiscoveryEntry) => {
|
||||||
if (response?.entry?.repository) {
|
if (response?.entry?.repository) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user