Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-6891] The user is not redirected to the library page after deleting the library from the Manage Members view #3673

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,29 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { TestBed, fakeAsync, tick, flush } from '@angular/core/testing';
import { of, throwError, Subject, BehaviorSubject, EMPTY } from 'rxjs';
import { Actions, ofType, EffectsModule } from '@ngrx/effects';
import { fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
import { BehaviorSubject, EMPTY, of, Subject, throwError } from 'rxjs';
import { Actions, EffectsModule, ofType } from '@ngrx/effects';
import {
AppStore,
SnackbarWarningAction,
SnackbarInfoAction,
SnackbarErrorAction,
PurgeDeletedNodesAction,
RestoreDeletedNodesAction,
NavigateToParentFolder,
CopyNodesAction,
DeleteNodesAction,
MoveNodesAction,
CopyNodesAction,
ShareNodeAction,
SetSelectedNodesAction,
UnlockWriteAction,
SnackbarActionTypes,
NavigateRouteAction,
NavigateToParentFolder,
NodeActionTypes,
PurgeDeletedNodesAction,
ReloadDocumentListAction,
ViewNodeVersionAction,
ViewNodeExtras
RestoreDeletedNodesAction,
SetSelectedNodesAction,
ShareNodeAction,
SnackbarActionTypes,
SnackbarErrorAction,
SnackbarInfoAction,
SnackbarWarningAction,
UnlockWriteAction,
ViewNodeExtras,
ViewNodeVersionAction
} from '@alfresco/aca-shared/store';
import { map } from 'rxjs/operators';
import { NodeEffects } from '../store/effects/node.effects';
Expand All @@ -52,17 +53,17 @@ import { AppHookService, ContentApiService } from '@alfresco/aca-shared';
import { Store } from '@ngrx/store';
import { ContentManagementService } from './content-management.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 { 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 {
FileModel,
NewVersionUploaderDataAction,
NewVersionUploaderService,
NodeAspectService,
ViewVersion,
NodesApiService,
FileModel
ViewVersion
} from '@alfresco/adf-content-services';

describe('ContentManagementService', () => {
Expand Down Expand Up @@ -1769,4 +1770,18 @@ describe('ContentManagementService', () => {
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']));
}));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ import {
ConfirmDialogComponent,
FolderDialogComponent,
LibraryDialogComponent,
ShareDialogComponent,
NodeAspectService,
NewVersionUploaderService,
NewVersionUploaderDialogData,
NewVersionUploaderData,
NewVersionUploaderDataAction,
NodesApiService
NewVersionUploaderDialogData,
NewVersionUploaderService,
NodeAspectService,
NodesApiService,
ShareDialogComponent
} 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 { Injectable } from '@angular/core';
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
Expand Down Expand Up @@ -289,6 +289,7 @@ export class ContentManagementService {
() => {
this.appHookService.libraryDeleted.next(id);
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'));
Expand Down
Loading