mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[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:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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({
|
||||
|
@@ -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>();
|
||||
|
@@ -48,7 +48,7 @@ import { STORE_INITIAL_APP_DATA } from '../../../store/src/states/app.state';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { RepositoryInfo } from '@alfresco/js-api';
|
||||
import { RepositoryInfo, VersionInfo } from '@alfresco/js-api';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
@@ -81,7 +81,14 @@ describe('AppService', () => {
|
||||
provide: DiscoveryApiService,
|
||||
useValue: {
|
||||
ecmProductInfo$: new BehaviorSubject<RepositoryInfo>(null),
|
||||
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' }))
|
||||
getEcmProductInfo: (): Observable<RepositoryInfo> =>
|
||||
of(
|
||||
new RepositoryInfo({
|
||||
version: {
|
||||
major: '10.0.0'
|
||||
} as VersionInfo
|
||||
})
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@@ -26,7 +26,6 @@ import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import {
|
||||
MinimalNodeEntity,
|
||||
NodePaging,
|
||||
Node,
|
||||
DeletedNodesPaging,
|
||||
@@ -37,9 +36,9 @@ import {
|
||||
SharedLinkPaging,
|
||||
SearchRequest,
|
||||
ResultSetPaging,
|
||||
SiteBody,
|
||||
SiteBodyCreate,
|
||||
SiteEntry,
|
||||
FavoriteBody,
|
||||
FavoriteBodyCreate,
|
||||
FavoriteEntry,
|
||||
NodesApi,
|
||||
TrashcanApi,
|
||||
@@ -139,7 +138,7 @@ export class ContentApiService {
|
||||
* @param options Optional parameters supported by JS-API
|
||||
* @returns Node information
|
||||
*/
|
||||
getNode(nodeId: string, options: any = {}): Observable<MinimalNodeEntity> {
|
||||
getNode(nodeId: string, options: any = {}): Observable<NodeEntry> {
|
||||
const defaults = {
|
||||
include: ['path', 'properties', 'allowableOperations', 'permissions', 'definition']
|
||||
};
|
||||
@@ -199,7 +198,7 @@ export class ContentApiService {
|
||||
return from(this.trashcanApi.listDeletedNodes(queryOptions));
|
||||
}
|
||||
|
||||
restoreNode(nodeId: string): Observable<MinimalNodeEntity> {
|
||||
restoreNode(nodeId: string): Observable<NodeEntry> {
|
||||
return from(this.trashcanApi.restoreDeletedNode(nodeId));
|
||||
}
|
||||
|
||||
@@ -299,7 +298,7 @@ export class ContentApiService {
|
||||
}
|
||||
|
||||
createSite(
|
||||
siteBody: SiteBody,
|
||||
siteBody: SiteBodyCreate,
|
||||
opts?: {
|
||||
fields?: Array<string>;
|
||||
skipConfiguration?: boolean;
|
||||
@@ -313,12 +312,12 @@ export class ContentApiService {
|
||||
return from(this.sitesApi.getSite(siteId, opts));
|
||||
}
|
||||
|
||||
updateLibrary(siteId: string, siteBody: SiteBody): Observable<SiteEntry> {
|
||||
updateLibrary(siteId: string, siteBody: SiteBodyCreate): Observable<SiteEntry> {
|
||||
return from(this.sitesApi.updateSite(siteId, siteBody));
|
||||
}
|
||||
|
||||
addFavorite(nodes: Array<MinimalNodeEntity>): Observable<FavoriteEntry> {
|
||||
const payload: FavoriteBody[] = nodes.map((node) => {
|
||||
addFavorite(nodes: Array<NodeEntry>): Observable<FavoriteEntry> {
|
||||
const payload: FavoriteBodyCreate[] = nodes.map((node) => {
|
||||
const { isFolder, nodeId, id } = node.entry as any;
|
||||
const siteId = node.entry['guid'];
|
||||
const type = siteId ? 'site' : isFolder ? 'folder' : 'file';
|
||||
@@ -336,7 +335,7 @@ export class ContentApiService {
|
||||
return from(this.favoritesApi.createFavorite('-me-', payload as any));
|
||||
}
|
||||
|
||||
removeFavorite(nodes: Array<MinimalNodeEntity>): Observable<any> {
|
||||
removeFavorite(nodes: Array<NodeEntry>): Observable<any> {
|
||||
return from(
|
||||
Promise.all(
|
||||
nodes.map((node: any) => {
|
||||
@@ -347,7 +346,7 @@ export class ContentApiService {
|
||||
);
|
||||
}
|
||||
|
||||
unlockNode(nodeId: string, opts?: any): Promise<MinimalNodeEntity> {
|
||||
unlockNode(nodeId: string, opts?: any): Promise<NodeEntry> {
|
||||
return this.nodesApi.unlockNode(nodeId, opts);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user