mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6891] The user is not redirected to the library page after deleting the library from the Manage Members view (#3673)
This commit is contained in:
@@ -22,28 +22,29 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed, fakeAsync, tick, flush } from '@angular/core/testing';
|
import { fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
|
||||||
import { of, throwError, Subject, BehaviorSubject, EMPTY } from 'rxjs';
|
import { BehaviorSubject, EMPTY, of, Subject, throwError } from 'rxjs';
|
||||||
import { Actions, ofType, EffectsModule } from '@ngrx/effects';
|
import { Actions, EffectsModule, ofType } from '@ngrx/effects';
|
||||||
import {
|
import {
|
||||||
AppStore,
|
AppStore,
|
||||||
SnackbarWarningAction,
|
CopyNodesAction,
|
||||||
SnackbarInfoAction,
|
|
||||||
SnackbarErrorAction,
|
|
||||||
PurgeDeletedNodesAction,
|
|
||||||
RestoreDeletedNodesAction,
|
|
||||||
NavigateToParentFolder,
|
|
||||||
DeleteNodesAction,
|
DeleteNodesAction,
|
||||||
MoveNodesAction,
|
MoveNodesAction,
|
||||||
CopyNodesAction,
|
NavigateRouteAction,
|
||||||
ShareNodeAction,
|
NavigateToParentFolder,
|
||||||
SetSelectedNodesAction,
|
|
||||||
UnlockWriteAction,
|
|
||||||
SnackbarActionTypes,
|
|
||||||
NodeActionTypes,
|
NodeActionTypes,
|
||||||
|
PurgeDeletedNodesAction,
|
||||||
ReloadDocumentListAction,
|
ReloadDocumentListAction,
|
||||||
ViewNodeVersionAction,
|
RestoreDeletedNodesAction,
|
||||||
ViewNodeExtras
|
SetSelectedNodesAction,
|
||||||
|
ShareNodeAction,
|
||||||
|
SnackbarActionTypes,
|
||||||
|
SnackbarErrorAction,
|
||||||
|
SnackbarInfoAction,
|
||||||
|
SnackbarWarningAction,
|
||||||
|
UnlockWriteAction,
|
||||||
|
ViewNodeExtras,
|
||||||
|
ViewNodeVersionAction
|
||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { NodeEffects } from '../store/effects/node.effects';
|
import { NodeEffects } from '../store/effects/node.effects';
|
||||||
@@ -52,17 +53,17 @@ import { AppHookService, ContentApiService } from '@alfresco/aca-shared';
|
|||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { ContentManagementService } from './content-management.service';
|
import { ContentManagementService } from './content-management.service';
|
||||||
import { NodeActionsService } from './node-actions.service';
|
import { NodeActionsService } from './node-actions.service';
|
||||||
import { TranslationService, NotificationService } from '@alfresco/adf-core';
|
import { NotificationService, TranslationService } from '@alfresco/adf-core';
|
||||||
import { MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
import { MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { MatSnackBarModule, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBarModule, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
|
||||||
import { NodeEntry, Node, VersionPaging } from '@alfresco/js-api';
|
import { Node, NodeEntry, VersionPaging } from '@alfresco/js-api';
|
||||||
import {
|
import {
|
||||||
|
FileModel,
|
||||||
NewVersionUploaderDataAction,
|
NewVersionUploaderDataAction,
|
||||||
NewVersionUploaderService,
|
NewVersionUploaderService,
|
||||||
NodeAspectService,
|
NodeAspectService,
|
||||||
ViewVersion,
|
|
||||||
NodesApiService,
|
NodesApiService,
|
||||||
FileModel
|
ViewVersion
|
||||||
} from '@alfresco/adf-content-services';
|
} from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
describe('ContentManagementService', () => {
|
describe('ContentManagementService', () => {
|
||||||
@@ -1769,4 +1770,18 @@ describe('ContentManagementService', () => {
|
|||||||
expect(document.querySelector).not.toHaveBeenCalled();
|
expect(document.querySelector).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('deleteLibrary', () => {
|
||||||
|
it('should dispatch NavigateRouteAction to /libraries after successful deletion', fakeAsync(() => {
|
||||||
|
const libraryId = 'test-library-id';
|
||||||
|
spyOn(contentApi, 'deleteSite').and.returnValue(of(null));
|
||||||
|
spyOn(store, 'dispatch').and.callThrough();
|
||||||
|
|
||||||
|
contentManagementService.deleteLibrary(libraryId);
|
||||||
|
tick();
|
||||||
|
|
||||||
|
expect(store.dispatch).toHaveBeenCalledWith(new SnackbarInfoAction('APP.MESSAGES.INFO.LIBRARY_DELETED'));
|
||||||
|
expect(store.dispatch).toHaveBeenCalledWith(new NavigateRouteAction(['/libraries']));
|
||||||
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -48,15 +48,15 @@ import {
|
|||||||
ConfirmDialogComponent,
|
ConfirmDialogComponent,
|
||||||
FolderDialogComponent,
|
FolderDialogComponent,
|
||||||
LibraryDialogComponent,
|
LibraryDialogComponent,
|
||||||
ShareDialogComponent,
|
|
||||||
NodeAspectService,
|
|
||||||
NewVersionUploaderService,
|
|
||||||
NewVersionUploaderDialogData,
|
|
||||||
NewVersionUploaderData,
|
NewVersionUploaderData,
|
||||||
NewVersionUploaderDataAction,
|
NewVersionUploaderDataAction,
|
||||||
NodesApiService
|
NewVersionUploaderDialogData,
|
||||||
|
NewVersionUploaderService,
|
||||||
|
NodeAspectService,
|
||||||
|
NodesApiService,
|
||||||
|
ShareDialogComponent
|
||||||
} from '@alfresco/adf-content-services';
|
} from '@alfresco/adf-content-services';
|
||||||
import { TranslationService, NotificationService } from '@alfresco/adf-core';
|
import { NotificationService, TranslationService } from '@alfresco/adf-core';
|
||||||
import { DeletedNodesPaging, Node, NodeEntry, PathInfo, SiteBodyCreate, SiteEntry } from '@alfresco/js-api';
|
import { DeletedNodesPaging, Node, NodeEntry, PathInfo, SiteBodyCreate, SiteEntry } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
||||||
@@ -289,6 +289,7 @@ export class ContentManagementService {
|
|||||||
() => {
|
() => {
|
||||||
this.appHookService.libraryDeleted.next(id);
|
this.appHookService.libraryDeleted.next(id);
|
||||||
this.store.dispatch(new SnackbarInfoAction('APP.MESSAGES.INFO.LIBRARY_DELETED'));
|
this.store.dispatch(new SnackbarInfoAction('APP.MESSAGES.INFO.LIBRARY_DELETED'));
|
||||||
|
this.store.dispatch(new NavigateRouteAction(['/libraries']));
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.DELETE_LIBRARY_FAILED'));
|
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.DELETE_LIBRARY_FAILED'));
|
||||||
|
Reference in New Issue
Block a user