mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACS-5133] view details button is inactive in expanded view (#3603)
* ACS-5133 Allow to click View Details button in expanded view * ACS-5133 Unit tests for returning to previous page when info drawer becomes closed * ACS-5133 Unit tests for changes in expandInfoDrawer effect * ACS-5133 Fix after rebase * ACS-5133 Fix * ACS-5133 Use first instead of filter * ACS-5133 Fix e2e * ACS-5133 Trigger jobs --------- Co-authored-by: Akash Rathod <41251473+akashrathod28@users.noreply.github.com>
This commit is contained in:
@@ -22,36 +22,38 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { NodeEffects } from './node.effects';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import {
|
||||
SharedStoreModule,
|
||||
ShareNodeAction,
|
||||
SetSelectedNodesAction,
|
||||
UnshareNodesAction,
|
||||
PurgeDeletedNodesAction,
|
||||
RestoreDeletedNodesAction,
|
||||
DeleteNodesAction,
|
||||
UndoDeleteNodesAction,
|
||||
CreateFolderAction,
|
||||
EditFolderAction,
|
||||
CopyNodesAction,
|
||||
MoveNodesAction,
|
||||
UnlockWriteAction,
|
||||
CreateFolderAction,
|
||||
DeleteNodesAction,
|
||||
EditFolderAction,
|
||||
ExpandInfoDrawerAction,
|
||||
FullscreenViewerAction,
|
||||
PrintFileAction,
|
||||
SetCurrentFolderAction,
|
||||
ManageAspectsAction,
|
||||
ManagePermissionsAction,
|
||||
ShowLoaderAction
|
||||
MoveNodesAction,
|
||||
PrintFileAction,
|
||||
PurgeDeletedNodesAction,
|
||||
RestoreDeletedNodesAction,
|
||||
SetCurrentFolderAction,
|
||||
SetInfoDrawerStateAction,
|
||||
SetSelectedNodesAction,
|
||||
SharedStoreModule,
|
||||
ShareNodeAction,
|
||||
ShowLoaderAction,
|
||||
UndoDeleteNodesAction,
|
||||
UnlockWriteAction,
|
||||
UnshareNodesAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { RenditionService } from '@alfresco/adf-content-services';
|
||||
import { ViewerEffects } from './viewer.effects';
|
||||
import { Router } from '@angular/router';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
@@ -403,6 +405,21 @@ describe('NodeEffects', () => {
|
||||
|
||||
expect(router.navigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call dispatch on store with SetInfoDrawerStateAction when NavigationEnd event occurs', () => {
|
||||
spyOn(store, 'dispatch').and.callThrough();
|
||||
Object.defineProperty(router, 'events', {
|
||||
value: of(new NavigationEnd(1, '', ''))
|
||||
});
|
||||
|
||||
store.dispatch(new ManagePermissionsAction(null));
|
||||
expect(store.dispatch).toHaveBeenCalledWith(jasmine.any(SetInfoDrawerStateAction));
|
||||
expect(store.dispatch).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({
|
||||
payload: true
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('printFile$', () => {
|
||||
@@ -507,4 +524,21 @@ describe('NodeEffects', () => {
|
||||
expect(contentService.manageAspects).toHaveBeenCalledWith({ entry: { isFile: false, id: 'folder-node-id' } }, undefined);
|
||||
}));
|
||||
});
|
||||
|
||||
describe('expandInfoDrawer$', () => {
|
||||
it('should call dispatch on store with SetInfoDrawerStateAction when NavigationEnd event occurs', () => {
|
||||
spyOn(store, 'dispatch').and.callThrough();
|
||||
Object.defineProperty(router, 'events', {
|
||||
value: of(new NavigationEnd(1, '', ''))
|
||||
});
|
||||
|
||||
store.dispatch(new ExpandInfoDrawerAction(undefined));
|
||||
expect(store.dispatch).toHaveBeenCalledWith(jasmine.any(SetInfoDrawerStateAction));
|
||||
expect(store.dispatch).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({
|
||||
payload: true
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
import { Actions, ofType, createEffect } from '@ngrx/effects';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { first, map, take } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
import {
|
||||
AppStore,
|
||||
@@ -50,12 +50,12 @@ import {
|
||||
ExpandInfoDrawerAction,
|
||||
ManageRulesAction,
|
||||
ShowLoaderAction,
|
||||
ToggleInfoDrawerAction,
|
||||
SetInfoDrawerStateAction,
|
||||
NavigateUrlAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { RenditionService } from '@alfresco/adf-content-services';
|
||||
import { Router } from '@angular/router';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
|
||||
@Injectable()
|
||||
export class NodeEffects {
|
||||
@@ -284,6 +284,9 @@ export class NodeEffects {
|
||||
this.actions$.pipe(
|
||||
ofType<ManagePermissionsAction>(NodeActionTypes.ManagePermissions),
|
||||
map((action) => {
|
||||
this.router.events
|
||||
.pipe(first((event) => event instanceof NavigationEnd))
|
||||
.subscribe(() => this.store.dispatch(new SetInfoDrawerStateAction(true)));
|
||||
if (action?.payload) {
|
||||
const route = 'personal-files/details';
|
||||
this.store.dispatch(new NavigateUrlAction([route, action.payload.entry.id, 'permissions'].join('/')));
|
||||
@@ -308,6 +311,9 @@ export class NodeEffects {
|
||||
this.actions$.pipe(
|
||||
ofType<ExpandInfoDrawerAction>(NodeActionTypes.ExpandInfoDrawer),
|
||||
map((action) => {
|
||||
this.router.events
|
||||
.pipe(first((event) => event instanceof NavigationEnd))
|
||||
.subscribe(() => this.store.dispatch(new SetInfoDrawerStateAction(true)));
|
||||
if (action?.payload) {
|
||||
const route = 'personal-files/details';
|
||||
this.router.navigate([route, action.payload.entry.id], {
|
||||
@@ -330,7 +336,6 @@ export class NodeEffects {
|
||||
}
|
||||
});
|
||||
}
|
||||
this.store.dispatch(new ToggleInfoDrawerAction());
|
||||
})
|
||||
),
|
||||
{ dispatch: false }
|
||||
|
Reference in New Issue
Block a user