[ACS-5281] Changed editable state of metadata content based on change o… (#3400)

* ACS-5281 Changed editable state of metadata content based on change of file lock state

* ACS-5281 Updated versions

* ACS-5281 Reverted change

* ACS-5281 Upgrade version

* ACS-5281 Small correction

* ACS-5281 Fixed e2e
This commit is contained in:
AleksanderSklorz
2023-08-27 10:00:35 +02:00
committed by GitHub
parent bc9c58176f
commit aec6852672
45 changed files with 455 additions and 364 deletions

View File

@@ -27,7 +27,7 @@ import { ShowHeaderMode } from '@alfresco/adf-core';
import { ContentActionRef, DocumentListPresetRef, SelectionState } from '@alfresco/adf-extensions';
import { OnDestroy, OnInit, OnChanges, ViewChild, SimpleChanges, Directive, inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging } from '@alfresco/js-api';
import { NodeEntry, Node, NodePaging } from '@alfresco/js-api';
import { Observable, Subject, Subscription } from 'rxjs';
import { takeUntil, map } from 'rxjs/operators';
import { DocumentBasePageService } from './document-base-page.service';
@@ -58,7 +58,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
title = 'Page';
infoDrawerOpened$: Observable<boolean>;
node: MinimalNodeEntryEntity;
node: Node;
selection: SelectionState;
sharedPreviewUrl$: Observable<string>;
actions: Array<ContentActionRef> = [];
@@ -144,7 +144,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
this.store.dispatch(new SetSelectedNodesAction([]));
}
showPreview(node: MinimalNodeEntity, extras?: ViewNodeExtras) {
showPreview(node: NodeEntry, extras?: ViewNodeExtras) {
if (node && node.entry) {
if (this.fileAutoDownloadService?.shouldFileAutoDownload(node.entry?.content?.sizeInBytes)) {
this.fileAutoDownloadService.autoDownloadFile(node);
@@ -180,7 +180,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
return null;
}
reload(selectedNode?: MinimalNodeEntity): void {
reload(selectedNode?: NodeEntry): void {
if (this.isOutletPreviewUrl()) {
return;
}

View File

@@ -22,9 +22,9 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { MinimalNodeEntity, MinimalNodeEntryEntity } from '@alfresco/js-api';
import { NodeEntry, Node } from '@alfresco/js-api';
export abstract class DocumentBasePageService {
abstract canUpdateNode(node: MinimalNodeEntity): boolean;
abstract canUploadContent(node: MinimalNodeEntryEntity): boolean;
abstract canUpdateNode(node: NodeEntry): boolean;
abstract canUploadContent(node: Node): boolean;
}

View File

@@ -26,7 +26,7 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
import { PageComponent } from './document-base-page.component';
import { ReloadDocumentListAction, SetSelectedNodesAction, AppState, ViewNodeAction } from '@alfresco/aca-shared/store';
import { AppExtensionService } from '@alfresco/aca-shared';
import { MinimalNodeEntity, NodePaging, RepositoryInfo } from '@alfresco/js-api';
import { NodeEntry, NodePaging, RepositoryInfo, VersionInfo } from '@alfresco/js-api';
import { DocumentBasePageService } from './document-base-page.service';
import { Store, StoreModule } from '@ngrx/store';
import { Component, Injectable } from '@angular/core';
@@ -141,7 +141,14 @@ describe('PageComponent', () => {
provide: DiscoveryApiService,
useValue: {
ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null),
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' }))
getEcmProductInfo: (): Observable<RepositoryInfo> =>
of(
new RepositoryInfo({
version: {
major: '10.0.0'
} as VersionInfo
})
)
}
},
AppExtensionService
@@ -198,7 +205,7 @@ describe('PageComponent', () => {
entry: {
id: 'node-id'
}
} as MinimalNodeEntity;
} as NodeEntry;
spyOn(store, 'dispatch');
component.reload(node);
@@ -244,7 +251,7 @@ describe('PageComponent', () => {
entry: {
id: 'node-id'
}
} as MinimalNodeEntity;
} as NodeEntry;
component.showPreview(node);
expect(store.dispatch).toHaveBeenCalledWith(new ViewNodeAction(node.entry.id));
@@ -260,7 +267,7 @@ describe('PageComponent', () => {
'cm:destination': 'original-node-id'
}
}
} as MinimalNodeEntity;
} as NodeEntry;
component.showPreview(linkNode);
const id = linkNode.entry.properties['cm:destination'];
@@ -298,7 +305,14 @@ describe('Info Drawer state', () => {
provide: DiscoveryApiService,
useValue: {
ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null),
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' }))
getEcmProductInfo: (): Observable<RepositoryInfo> =>
of(
new RepositoryInfo({
version: {
major: '10.0.0'
} as VersionInfo
})
)
}
},
provideMockStore({

View File

@@ -23,7 +23,7 @@
*/
import { Component, HostListener, Input, OnChanges, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { MinimalNodeEntity, MinimalNodeEntryEntity, SiteEntry } from '@alfresco/js-api';
import { NodeEntry, Node, SiteEntry } from '@alfresco/js-api';
import { ContentActionRef, ExtensionsModule, SidebarTabRef } from '@alfresco/adf-extensions';
import { Store } from '@ngrx/store';
import { SetInfoDrawerStateAction, ToggleInfoDrawerAction, infoDrawerPreview } from '@alfresco/aca-shared/store';
@@ -50,10 +50,10 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
nodeId: string;
@Input()
node: MinimalNodeEntity;
node: NodeEntry;
isLoading = false;
displayNode: MinimalNodeEntryEntity | SiteEntry;
displayNode: Node | SiteEntry;
tabs: Array<SidebarTabRef> = [];
actions: Array<ContentActionRef> = [];
onDestroy$ = new Subject<boolean>();