mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-9554] Redirect from permissions page after node delete (#4531)
This commit is contained in:
parent
5a168fa0c2
commit
ba1ef44fdf
@ -29,7 +29,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { BehaviorSubject, of, Subject } from 'rxjs';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { AppHookService, ContentApiService } from '@alfresco/aca-shared';
|
||||
import { NavigateToFolder, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { Node, NodeEntry, PathElement } from '@alfresco/js-api';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
@ -38,6 +38,7 @@ import { BreadcrumbComponent, ContentService, NodesApiService, SearchQueryBuilde
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
describe('DetailsComponent', () => {
|
||||
let component: DetailsComponent;
|
||||
@ -45,6 +46,8 @@ describe('DetailsComponent', () => {
|
||||
let contentApiService: ContentApiService;
|
||||
let contentService: ContentService;
|
||||
let nodesApiService: NodesApiService;
|
||||
let appHookService: AppHookService;
|
||||
let location: Location;
|
||||
let store: Store;
|
||||
let node: NodeEntry;
|
||||
|
||||
@ -101,6 +104,8 @@ describe('DetailsComponent', () => {
|
||||
contentApiService = TestBed.inject(ContentApiService);
|
||||
contentService = TestBed.inject(ContentService);
|
||||
nodesApiService = TestBed.inject(NodesApiService);
|
||||
appHookService = TestBed.inject(AppHookService);
|
||||
location = TestBed.inject(Location);
|
||||
store = TestBed.inject(Store);
|
||||
storeMock.dispatch.calls.reset();
|
||||
|
||||
@ -258,4 +263,12 @@ describe('DetailsComponent', () => {
|
||||
component.setActiveTab('permissions');
|
||||
expect(component.activeTab).not.toBe(2);
|
||||
});
|
||||
|
||||
it('should navigate back when nodesDeleted event is triggered', () => {
|
||||
const locationSpy = spyOn(location, 'back');
|
||||
fixture.detectChanges();
|
||||
appHookService.nodesDeleted.next();
|
||||
|
||||
expect(locationSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -24,10 +24,10 @@
|
||||
|
||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
||||
import { AppHookService, ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
||||
import { NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { BreadcrumbComponent, ContentService, NodesApiService, PermissionListComponent } from '@alfresco/adf-content-services';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CommonModule, Location } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
@ -76,7 +76,9 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly contentApi: ContentApiService,
|
||||
private readonly contentService: ContentService,
|
||||
private readonly nodesApiService: NodesApiService
|
||||
private readonly nodesApiService: NodesApiService,
|
||||
private readonly appHookService: AppHookService,
|
||||
private readonly location: Location
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@ -88,6 +90,7 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
||||
const { data } = route.snapshot;
|
||||
this.title = data.title;
|
||||
this.nodesApiService.nodeUpdated.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((node) => (this.node = { ...node }));
|
||||
this.appHookService.nodesDeleted.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.location.back());
|
||||
this.route.params.subscribe((params) => {
|
||||
this.isLoading = true;
|
||||
this.setActiveTab(params.activeTab);
|
||||
|
Loading…
x
Reference in New Issue
Block a user