move nodeupdate in nodeapiservice (#2860)

* move nodeupdate in nodeapiservice

* [ci:force][auto-commit] Update @alfresco/adf-testing to 6.0.0-A.1-37577 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 37578f

# Conflicts:
#	package-lock.json
#	package.json

* fix lint

* fix compiler issue
This commit is contained in:
Eugenio Romano
2023-01-02 10:21:06 +01:00
committed by GitHub
parent ffc00b44cc
commit 8ba18bb6dc
9 changed files with 46 additions and 46 deletions

View File

@@ -24,7 +24,7 @@
*/
import { NameColumnComponent } from '@alfresco/adf-content-services';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { NodesApiService } from '@alfresco/adf-core';
import { ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Actions, ofType } from '@ngrx/effects';
import { Subject } from 'rxjs';
@@ -44,14 +44,14 @@ import { isLocked } from '@alfresco/aca-shared';
export class CustomNameColumnComponent extends NameColumnComponent implements OnInit, OnDestroy {
private onDestroy$$ = new Subject<boolean>();
constructor(element: ElementRef, private cd: ChangeDetectorRef, private actions$: Actions, private apiService: AlfrescoApiService) {
super(element, apiService);
constructor(element: ElementRef, private cd: ChangeDetectorRef, private actions$: Actions, private nodesService: NodesApiService) {
super(element, nodesService);
}
ngOnInit() {
this.updateValue();
this.apiService.nodeUpdated.pipe(takeUntil(this.onDestroy$$)).subscribe((node: any) => {
this.nodesService.nodeUpdated.pipe(takeUntil(this.onDestroy$$)).subscribe((node: any) => {
const row = this.context.row;
if (row) {
const { entry } = row.node;

View File

@@ -25,7 +25,7 @@
import { Router, ActivatedRoute } from '@angular/router';
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
import { UserPreferencesService, UploadService, AlfrescoApiService } from '@alfresco/adf-core';
import { UserPreferencesService, UploadService, NodesApiService } from '@alfresco/adf-core';
import { ClosePreviewAction } from '@alfresco/aca-shared/store';
import { PreviewComponent } from './preview.component';
import { of, throwError } from 'rxjs';
@@ -45,7 +45,7 @@ describe('PreviewComponent', () => {
let preferences: UserPreferencesService;
let contentApi: ContentApiService;
let uploadService: UploadService;
let alfrescoApiService: AlfrescoApiService;
let nodesApiService: NodesApiService;
let appHookService: AppHookService;
let store: Store<any>;
@@ -62,7 +62,7 @@ describe('PreviewComponent', () => {
preferences = TestBed.inject(UserPreferencesService);
contentApi = TestBed.inject(ContentApiService);
uploadService = TestBed.inject(UploadService);
alfrescoApiService = TestBed.inject(AlfrescoApiService);
nodesApiService = TestBed.inject(NodesApiService);
appHookService = TestBed.inject(AppHookService);
store = TestBed.inject(Store);
});
@@ -633,12 +633,12 @@ describe('PreviewComponent', () => {
});
it('should emit nodeUpdated event on fileUploadComplete event', fakeAsync(() => {
spyOn(alfrescoApiService.nodeUpdated, 'next');
spyOn(nodesApiService.nodeUpdated, 'next');
fixture.detectChanges();
uploadService.fileUploadComplete.next({ data: { entry: {} } } as any);
tick(300);
expect(alfrescoApiService.nodeUpdated.next).toHaveBeenCalled();
expect(nodesApiService.nodeUpdated.next).toHaveBeenCalled();
}));
it('should return to parent folder when event emitted from extension', async () => {

View File

@@ -27,7 +27,7 @@ import { Component, OnInit, OnDestroy, ViewEncapsulation, HostListener } from '@
import { Location } from '@angular/common';
import { ActivatedRoute, Router, UrlTree, UrlSegmentGroup, UrlSegment, PRIMARY_OUTLET } from '@angular/router';
import { debounceTime, map, takeUntil } from 'rxjs/operators';
import { UserPreferencesService, ObjectUtils, UploadService, AlfrescoApiService } from '@alfresco/adf-core';
import { UserPreferencesService, ObjectUtils, UploadService, NodesApiService } from '@alfresco/adf-core';
import { Store } from '@ngrx/store';
import { AppStore, ClosePreviewAction, ViewerActionTypes, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { PageComponent } from '../page.component';
@@ -92,7 +92,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
private preferences: UserPreferencesService,
private route: ActivatedRoute,
private router: Router,
private apiService: AlfrescoApiService,
private nodesApiService: NodesApiService,
private uploadService: UploadService,
private actions$: Actions,
private location: Location,
@@ -143,7 +143,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
this.uploadService.fileUploadDeleted.subscribe(() => this.navigateToFileLocation(true)),
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe((file) => this.apiService.nodeUpdated.next(file.data.entry)),
this.uploadService.fileUploadComplete.pipe(debounceTime(300)).subscribe((file) => this.nodesApiService.nodeUpdated.next(file.data.entry)),
this.actions$
.pipe(

View File

@@ -28,7 +28,7 @@ import { MinimalNodeEntity } from '@alfresco/js-api';
import { ViewNodeAction, NavigateToFolder } from '@alfresco/aca-shared/store';
import { Store } from '@ngrx/store';
import { BehaviorSubject, Subject } from 'rxjs';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { NodesApiService } from '@alfresco/adf-core';
import { takeUntil } from 'rxjs/operators';
import { Router } from '@angular/router';
@@ -50,12 +50,12 @@ export class SearchResultsRowComponent implements OnInit, OnDestroy {
name$ = new BehaviorSubject<string>('');
title$ = new BehaviorSubject<string>('');
constructor(private store: Store<any>, private alfrescoApiService: AlfrescoApiService, private router: Router) {}
constructor(private store: Store<any>, private nodesApiService: NodesApiService, private router: Router) {}
ngOnInit() {
this.updateValues();
this.alfrescoApiService.nodeUpdated.pipe(takeUntil(this.onDestroy$)).subscribe((node) => {
this.nodesApiService.nodeUpdated.pipe(takeUntil(this.onDestroy$)).subscribe((node) => {
const row = this.context.row;
if (row) {
const { entry } = row.node;

View File

@@ -40,7 +40,7 @@ import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
import { MinimalNodeEntryEntity, SearchRequest, VersionEntry, VersionsApi } from '@alfresco/js-api';
import { Component, HostListener, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, PRIMARY_OUTLET, Router } from '@angular/router';
import { AlfrescoApiService, ObjectUtils, UploadService, UserPreferencesService } from '@alfresco/adf-core';
import { AlfrescoApiService, ObjectUtils, UploadService, UserPreferencesService, NodesApiService } from '@alfresco/adf-core';
import { Store } from '@ngrx/store';
import { from, Observable, Subject } from 'rxjs';
import { debounceTime, takeUntil } from 'rxjs/operators';
@@ -117,6 +117,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
private actions$: Actions,
private preferences: UserPreferencesService,
private apiService: AlfrescoApiService,
private nodesApiService: NodesApiService,
private uploadService: UploadService,
private appHookService: AppHookService
) {}
@@ -194,7 +195,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
this.uploadService.fileUploadDeleted.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.navigateToFileLocation());
this.uploadService.fileUploadComplete.pipe(debounceTime(300), takeUntil(this.onDestroy$)).subscribe((file) => {
this.apiService.nodeUpdated.next(file.data.entry);
this.nodesApiService.nodeUpdated.next(file.data.entry);
this.displayNode(file.data.entry.id);
});

View File

@@ -53,7 +53,7 @@ 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, AlfrescoApiService, FileModel, NotificationService } from '@alfresco/adf-core';
import { TranslationService, NodesApiService, FileModel, NotificationService } from '@alfresco/adf-core';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
import { NodeEntry, Node, VersionPaging, MinimalNodeEntity } from '@alfresco/js-api';
@@ -68,7 +68,7 @@ describe('ContentManagementService', () => {
let notificationService: NotificationService;
let nodeActions: NodeActionsService;
let translationService: TranslationService;
let alfrescoApiService: AlfrescoApiService;
let nodesApiService: NodesApiService;
let nodeAspectService: NodeAspectService;
let appHookService: AppHookService;
let newVersionUploaderService: NewVersionUploaderService;
@@ -85,7 +85,7 @@ describe('ContentManagementService', () => {
notificationService = TestBed.inject(NotificationService);
nodeActions = TestBed.inject(NodeActionsService);
translationService = TestBed.inject(TranslationService);
alfrescoApiService = TestBed.inject(AlfrescoApiService);
nodesApiService = TestBed.inject(NodesApiService);
nodeAspectService = TestBed.inject(NodeAspectService);
appHookService = TestBed.inject(AppHookService);
newVersionUploaderService = TestBed.inject(NewVersionUploaderService);
@@ -1659,12 +1659,12 @@ describe('ContentManagementService', () => {
afterClosed: () => of(newNode)
};
spyOn(alfrescoApiService.nodeUpdated, 'next');
spyOn(nodesApiService.nodeUpdated, 'next');
spyOn(dialog, 'open').and.returnValue(mockDialogInstance);
contentManagementService.editFolder(node);
expect(alfrescoApiService.nodeUpdated.next).toHaveBeenCalledWith(newNode);
expect(nodesApiService.nodeUpdated.next).toHaveBeenCalledWith(newNode);
}));
it('should focus element indicated by passed selector after closing modal', () => {

View File

@@ -56,7 +56,7 @@ import {
NewVersionUploaderData,
NewVersionUploaderDataAction
} from '@alfresco/adf-content-services';
import { TranslationService, AlfrescoApiService, NotificationService } from '@alfresco/adf-core';
import { TranslationService, NodesApiService, NotificationService } from '@alfresco/adf-core';
import {
DeletedNodesPaging,
MinimalNodeEntity,
@@ -88,7 +88,7 @@ export class ContentManagementService {
private readonly createMenuButtonSelector = 'app-create-menu button';
constructor(
private alfrescoApiService: AlfrescoApiService,
private nodesApiService: NodesApiService,
private store: Store<AppStore>,
private contentApi: ContentApiService,
private permission: NodePermissionService,
@@ -262,7 +262,7 @@ export class ContentManagementService {
dialog.afterClosed().subscribe((node) => {
if (node) {
this.alfrescoApiService.nodeUpdated.next(node);
this.nodesApiService.nodeUpdated.next(node);
}
this.focusAfterClose(focusedElementOnCloseSelector);
});