mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-9158] Remove 'View Details' button from node Details page (#4351)
* [ACS-9158] Remove 'View Details' button from node Details page * [ACS-9158] remove redundant onDestroy$ * cr fix
This commit is contained in:
parent
c799049790
commit
4751dcd12c
@ -248,7 +248,7 @@ for example mixing `core.every` and `core.not`.
|
|||||||
`!app.navigation.isTrashcan` is the opposite of the `app.navigation.isTrashcan`.
|
`!app.navigation.isTrashcan` is the opposite of the `app.navigation.isTrashcan`.
|
||||||
|
|
||||||
| Version | Key | Description |
|
| Version | Key | Description |
|
||||||
| ------- | --------------------------------- | ---------------------------------------------------------------- |
|
|---------|-----------------------------------|------------------------------------------------------------------|
|
||||||
| 1.7.0 | app.navigation.folder.canCreate | User can create content in the currently opened folder. |
|
| 1.7.0 | app.navigation.folder.canCreate | User can create content in the currently opened folder. |
|
||||||
| 1.7.0 | app.navigation.folder.canUpload | User can upload content to the currently opened folder. |
|
| 1.7.0 | app.navigation.folder.canUpload | User can upload content to the currently opened folder. |
|
||||||
| 1.7.0 | app.navigation.isTrashcan | User is using the **Trashcan** page. |
|
| 1.7.0 | app.navigation.isTrashcan | User is using the **Trashcan** page. |
|
||||||
@ -269,6 +269,7 @@ for example mixing `core.every` and `core.not`.
|
|||||||
| 1.7.0 | app.navigation.isPreview | Current page is **Preview**. |
|
| 1.7.0 | app.navigation.isPreview | Current page is **Preview**. |
|
||||||
| 1.7.0 | app.navigation.isPersonalFiles | Current page is **Personal Files**. |
|
| 1.7.0 | app.navigation.isPersonalFiles | Current page is **Personal Files**. |
|
||||||
| 1.7.0 | app.navigation.isLibraryFiles | Current page is **Library Files**. |
|
| 1.7.0 | app.navigation.isLibraryFiles | Current page is **Library Files**. |
|
||||||
|
| 5.3.0 | app.navigation.isNotDetails | Current page is not **Details**. |
|
||||||
|
|
||||||
**Tip:** See the [Registration](./registration) section for more details
|
**Tip:** See the [Registration](./registration) section for more details
|
||||||
on how to register your own entries to be re-used at runtime.
|
on how to register your own entries to be re-used at runtime.
|
||||||
|
@ -495,7 +495,7 @@
|
|||||||
"order": 700,
|
"order": 700,
|
||||||
"component": "app.toolbar.toggleInfoDrawer",
|
"component": "app.toolbar.toggleInfoDrawer",
|
||||||
"rules": {
|
"rules": {
|
||||||
"visible": "canShowInfoDrawer"
|
"visible": ["canShowInfoDrawer", "app.navigation.isNotDetails"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1084,7 +1084,7 @@
|
|||||||
"order": 500,
|
"order": 500,
|
||||||
"component": "app.toolbar.toggleInfoDrawer",
|
"component": "app.toolbar.toggleInfoDrawer",
|
||||||
"rules": {
|
"rules": {
|
||||||
"visible": "canShowInfoDrawer"
|
"visible": ["canShowInfoDrawer", "app.navigation.isNotDetails"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -223,6 +223,7 @@ export class ContentServiceExtensionModule {
|
|||||||
'app.navigation.isSharedPreview': rules.isSharedPreview,
|
'app.navigation.isSharedPreview': rules.isSharedPreview,
|
||||||
'app.navigation.isFavoritesPreview': rules.isFavoritesPreview,
|
'app.navigation.isFavoritesPreview': rules.isFavoritesPreview,
|
||||||
'app.navigation.isSharedFileViewer': rules.isSharedFileViewer,
|
'app.navigation.isSharedFileViewer': rules.isSharedFileViewer,
|
||||||
|
'app.navigation.isNotDetails': rules.isNotDetails,
|
||||||
|
|
||||||
'repository.isQuickShareEnabled': rules.hasQuickShareEnabled,
|
'repository.isQuickShareEnabled': rules.hasQuickShareEnabled,
|
||||||
'user.isAdmin': rules.isAdmin,
|
'user.isAdmin': rules.isAdmin,
|
||||||
|
@ -25,12 +25,12 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
import { DetailsComponent } from './details.component';
|
import { DetailsComponent } from './details.component';
|
||||||
import { ActivatedRoute, NavigationStart, Router } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { BehaviorSubject, of, Subject } from 'rxjs';
|
import { BehaviorSubject, of, Subject } from 'rxjs';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { DefaultProjectorFn, MemoizedSelector, Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { ContentApiService } from '@alfresco/aca-shared';
|
import { ContentApiService } from '@alfresco/aca-shared';
|
||||||
import { AppStore, isInfoDrawerOpened, NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
import { NavigateToFolder, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||||
import { Node, NodeEntry, PathElement } from '@alfresco/js-api';
|
import { Node, NodeEntry, PathElement } from '@alfresco/js-api';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { AuthenticationService, CORE_PIPES, PageTitleService } from '@alfresco/adf-core';
|
import { AuthenticationService, CORE_PIPES, PageTitleService } from '@alfresco/adf-core';
|
||||||
@ -258,45 +258,4 @@ describe('DetailsComponent', () => {
|
|||||||
component.setActiveTab('permissions');
|
component.setActiveTab('permissions');
|
||||||
expect(component.activeTab).not.toBe(2);
|
expect(component.activeTab).not.toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('infoDrawerOpened$ event', () => {
|
|
||||||
let infoDrawerOpened$: Subject<boolean>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
infoDrawerOpened$ = new Subject<boolean>();
|
|
||||||
spyOn(store, 'select').and.callFake((mapFn: MemoizedSelector<AppStore, boolean, DefaultProjectorFn<boolean>>) =>
|
|
||||||
mapFn === isInfoDrawerOpened ? infoDrawerOpened$ : mockStream
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should dispatch store NavigateToPreviousPage by store if info drawer is closed', () => {
|
|
||||||
component.ngOnInit();
|
|
||||||
|
|
||||||
infoDrawerOpened$.next(false);
|
|
||||||
expect(storeMock.dispatch).toHaveBeenCalledWith(jasmine.any(NavigateToPreviousPage));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not dispatch store NavigateToPreviousPage by store if info drawer is opened', () => {
|
|
||||||
component.ngOnInit();
|
|
||||||
|
|
||||||
infoDrawerOpened$.next(true);
|
|
||||||
expect(storeMock.dispatch).not.toHaveBeenCalledWith(jasmine.any(NavigateToPreviousPage));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not dispatch store NavigateToPreviousPage by store if info drawer opening state is not changed', () => {
|
|
||||||
component.ngOnInit();
|
|
||||||
|
|
||||||
expect(storeMock.dispatch).not.toHaveBeenCalledWith(jasmine.any(NavigateToPreviousPage));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not dispatch store NavigateToPreviousPage by store if info drawer is closed but there occurred NavigationStart event', () => {
|
|
||||||
Object.defineProperty(TestBed.inject(Router), 'events', {
|
|
||||||
value: of(new NavigationStart(1, ''))
|
|
||||||
});
|
|
||||||
component.ngOnInit();
|
|
||||||
|
|
||||||
infoDrawerOpened$.next(false);
|
|
||||||
expect(storeMock.dispatch).not.toHaveBeenCalledWith(jasmine.any(NavigateToPreviousPage));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -23,10 +23,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ActivatedRoute, NavigationStart } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
||||||
import { NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
import { NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||||
import { merge, Subject } from 'rxjs';
|
|
||||||
import { BreadcrumbComponent, ContentService, NodesApiService, PermissionListComponent } from '@alfresco/adf-content-services';
|
import { BreadcrumbComponent, ContentService, NodesApiService, PermissionListComponent } from '@alfresco/adf-content-services';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
@ -37,7 +36,7 @@ import { MatButtonModule } from '@angular/material/button';
|
|||||||
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component';
|
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component';
|
||||||
import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component';
|
import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component';
|
||||||
import { NodeEntry, PathElement } from '@alfresco/js-api';
|
import { NodeEntry, PathElement } from '@alfresco/js-api';
|
||||||
import { first, takeUntil } from 'rxjs/operators';
|
import { first } from 'rxjs/operators';
|
||||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||||
import { FileSizePipe, InfoDrawerButtonsDirective } from '@alfresco/adf-core';
|
import { FileSizePipe, InfoDrawerButtonsDirective } from '@alfresco/adf-core';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
@ -73,8 +72,6 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
nodeIcon: string;
|
nodeIcon: string;
|
||||||
canManagePermissions = true;
|
canManagePermissions = true;
|
||||||
|
|
||||||
private readonly onDestroy$: Subject<void> = new Subject<void>();
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly route: ActivatedRoute,
|
private readonly route: ActivatedRoute,
|
||||||
private readonly contentApi: ContentApiService,
|
private readonly contentApi: ContentApiService,
|
||||||
@ -110,20 +107,6 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
.subscribe((aspectActions) => {
|
.subscribe((aspectActions) => {
|
||||||
this.aspectActions = aspectActions;
|
this.aspectActions = aspectActions;
|
||||||
});
|
});
|
||||||
this.infoDrawerOpened$
|
|
||||||
.pipe(
|
|
||||||
first((opened) => !opened),
|
|
||||||
takeUntil(
|
|
||||||
merge(
|
|
||||||
this.onDestroy$,
|
|
||||||
this.router.events.pipe(
|
|
||||||
first((event) => event instanceof NavigationStart),
|
|
||||||
takeUntil(this.onDestroy$)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.subscribe(() => this.goBack());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setActiveTab(tabName: string) {
|
setActiveTab(tabName: string) {
|
||||||
@ -153,8 +136,6 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.onDestroy$.next();
|
|
||||||
this.onDestroy$.complete();
|
|
||||||
this.store.dispatch(new SetSelectedNodesAction([]));
|
this.store.dispatch(new SetSelectedNodesAction([]));
|
||||||
super.ngOnDestroy();
|
super.ngOnDestroy();
|
||||||
}
|
}
|
||||||
|
@ -1412,16 +1412,19 @@ describe('app.evaluators', () => {
|
|||||||
expect(app.canShowInfoDrawer(context)).toBeFalse();
|
expect(app.canShowInfoDrawer(context)).toBeFalse();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false when user is in libraries or trashcan', () => {
|
it('should return false when user is in libraries or trashcan or details', () => {
|
||||||
context.selection.isEmpty = false;
|
context.selection.isEmpty = false;
|
||||||
context.navigation.url = '/trashcan/test';
|
context.navigation.url = '/trashcan/test';
|
||||||
expect(app.canShowInfoDrawer(context)).toBeFalse();
|
expect(app.canShowInfoDrawer(context)).toBeFalse();
|
||||||
|
|
||||||
context.navigation.url = '/test/libraries';
|
context.navigation.url = '/test/libraries';
|
||||||
expect(app.canShowInfoDrawer(context)).toBeFalse();
|
expect(app.canShowInfoDrawer(context)).toBeFalse();
|
||||||
|
|
||||||
|
context.navigation.url = '/test/details';
|
||||||
|
expect(app.canShowInfoDrawer(context)).toBeFalse();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true when selection exists and user is not in trashcan or libraries', () => {
|
it('should return true when selection exists and user is not in trashcan, libraries or details', () => {
|
||||||
context.navigation.url = '/personal-files/test';
|
context.navigation.url = '/personal-files/test';
|
||||||
context.selection.isEmpty = false;
|
context.selection.isEmpty = false;
|
||||||
expect(app.canShowInfoDrawer(context)).toBeTrue();
|
expect(app.canShowInfoDrawer(context)).toBeTrue();
|
||||||
|
@ -247,6 +247,28 @@ describe('navigation.evaluators', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isNotDetails', () => {
|
||||||
|
it('should return true if url does not include `/details`', () => {
|
||||||
|
const context: any = {
|
||||||
|
navigation: {
|
||||||
|
url: '/path'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(app.isNotDetails(context)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false if url includes `/details`', () => {
|
||||||
|
const context: any = {
|
||||||
|
navigation: {
|
||||||
|
url: 'personal-files/details/path'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(app.isNotDetails(context)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('isRecentFiles', () => {
|
describe('isRecentFiles', () => {
|
||||||
it('should return [true] if url starts with `/recent-files`', () => {
|
it('should return [true] if url starts with `/recent-files`', () => {
|
||||||
const context: any = {
|
const context: any = {
|
||||||
|
@ -115,6 +115,12 @@ export function isDetails(context: RuleContext): boolean {
|
|||||||
return url?.includes('/details');
|
return url?.includes('/details');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the activated route is not **Details**.
|
||||||
|
* JSON ref: `app.navigation.isNotDetails`
|
||||||
|
*/
|
||||||
|
export const isNotDetails = (context: RuleContext): boolean => !isDetails(context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the activated route is neither **Libraries** nor **Library Search Results**.
|
* Checks if the activated route is neither **Libraries** nor **Library Search Results**.
|
||||||
* JSON ref: `app.navigation.isNotLibraries`
|
* JSON ref: `app.navigation.isNotLibraries`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user