mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-11486] move NodeUdpdate in nodeapiservice (#8077)
* move NodeUdpdate in nodeapiservice * fix * build fix * Update name-column.component.ts * Update viewer.component.spec.ts
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
import { MinimalNode } from '@alfresco/js-api';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AlfrescoApiService, NodesApiService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { NodesApiService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
import { NodeAspectService } from './node-aspect.service';
|
||||
@@ -30,7 +30,6 @@ describe('NodeAspectService', () => {
|
||||
let dialogAspectListService: DialogAspectListService;
|
||||
let nodeAspectService: NodeAspectService;
|
||||
let nodeApiService: NodesApiService;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
let cardViewContentUpdateService: CardViewContentUpdateService;
|
||||
|
||||
setupTestBed({
|
||||
@@ -44,7 +43,6 @@ describe('NodeAspectService', () => {
|
||||
dialogAspectListService = TestBed.inject(DialogAspectListService);
|
||||
nodeAspectService = TestBed.inject(NodeAspectService);
|
||||
nodeApiService = TestBed.inject(NodesApiService);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
cardViewContentUpdateService = TestBed.inject(CardViewContentUpdateService);
|
||||
});
|
||||
|
||||
@@ -79,7 +77,7 @@ describe('NodeAspectService', () => {
|
||||
});
|
||||
|
||||
it('should send and update node event once the node has been updated', async () => {
|
||||
await alfrescoApiService.nodeUpdated.subscribe((nodeUpdated) => {
|
||||
await nodeApiService.nodeUpdated.subscribe((nodeUpdated) => {
|
||||
expect(nodeUpdated.id).toBe('fake-node-id');
|
||||
expect(nodeUpdated.aspectNames).toEqual(['a', 'b', 'c']);
|
||||
});
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService, NodesApiService } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { DialogAspectListService } from './dialog-aspect-list.service';
|
||||
import { CardViewContentUpdateService } from '../../services/card-view-content-update.service';
|
||||
|
||||
@@ -25,8 +25,7 @@ import { CardViewContentUpdateService } from '../../services/card-view-content-u
|
||||
})
|
||||
export class NodeAspectService {
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService,
|
||||
private nodesApiService: NodesApiService,
|
||||
constructor(private nodesApiService: NodesApiService,
|
||||
private dialogAspectListService: DialogAspectListService,
|
||||
private cardViewContentUpdateService: CardViewContentUpdateService) {
|
||||
}
|
||||
@@ -34,7 +33,7 @@ export class NodeAspectService {
|
||||
updateNodeAspects(nodeId: string, selectorAutoFocusedOnClose?: string) {
|
||||
this.dialogAspectListService.openAspectListDialog(nodeId, selectorAutoFocusedOnClose).subscribe((aspectList) => {
|
||||
this.nodesApiService.updateNode(nodeId, { aspectNames: [...aspectList] }).subscribe((updatedNode) => {
|
||||
this.alfrescoApiService.nodeUpdated.next(updatedNode);
|
||||
this.nodesApiService.nodeUpdated.next(updatedNode);
|
||||
this.cardViewContentUpdateService.updateNodeAspect(updatedNode);
|
||||
});
|
||||
});
|
||||
|
@@ -22,7 +22,6 @@ import {
|
||||
CardViewItem,
|
||||
NodesApiService,
|
||||
LogService,
|
||||
AlfrescoApiService,
|
||||
TranslationService,
|
||||
AppConfigService,
|
||||
CardViewBaseItemModel,
|
||||
@@ -100,7 +99,6 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
||||
private cardViewContentUpdateService: CardViewContentUpdateService,
|
||||
private nodesApiService: NodesApiService,
|
||||
private logService: LogService,
|
||||
private alfrescoApiService: AlfrescoApiService,
|
||||
private translationService: TranslationService,
|
||||
private appConfig: AppConfigService
|
||||
) {
|
||||
@@ -212,7 +210,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
||||
}
|
||||
this.revertChanges();
|
||||
Object.assign(this.node, updatedNode);
|
||||
this.alfrescoApiService.nodeUpdated.next(this.node);
|
||||
this.nodesApiService.nodeUpdated.next(this.node);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { NodeEntry, Site } from '@alfresco/js-api';
|
||||
import { ShareDataRow } from '../../data/share-data-row.model';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@@ -63,13 +63,13 @@ export class LibraryNameColumnComponent implements OnInit, OnDestroy {
|
||||
|
||||
constructor(
|
||||
private element: ElementRef,
|
||||
private alfrescoApiService: AlfrescoApiService
|
||||
private nodesApiService: NodesApiService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateValue();
|
||||
|
||||
this.alfrescoApiService.nodeUpdated
|
||||
this.nodesApiService.nodeUpdated
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(node => {
|
||||
const row: ShareDataRow = this.context.row;
|
||||
|
@@ -24,7 +24,7 @@ import {
|
||||
OnDestroy
|
||||
} from '@angular/core';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { SiteEntry, Site } from '@alfresco/js-api';
|
||||
import { ShareDataRow } from '../../data/share-data-row.model';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
@@ -48,12 +48,12 @@ export class LibraryRoleColumnComponent implements OnInit, OnDestroy {
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private api: AlfrescoApiService) {}
|
||||
constructor(private nodesApiService: NodesApiService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateValue();
|
||||
|
||||
this.api.nodeUpdated
|
||||
this.nodesApiService.nodeUpdated
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(node => {
|
||||
const row: ShareDataRow = this.context.row;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, OnDestroy } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { Site, SiteEntry } from '@alfresco/js-api';
|
||||
import { ShareDataRow } from '../../data/share-data-row.model';
|
||||
@@ -39,12 +39,12 @@ export class LibraryStatusColumnComponent implements OnInit, OnDestroy {
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private api: AlfrescoApiService) {}
|
||||
constructor(private nodesApiService: NodesApiService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateValue();
|
||||
|
||||
this.api.nodeUpdated
|
||||
this.nodesApiService.nodeUpdated
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(node => {
|
||||
const row: ShareDataRow = this.context.row;
|
||||
|
@@ -26,7 +26,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { ShareDataRow } from '../../data/share-data-row.model';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@@ -61,12 +61,12 @@ export class NameColumnComponent implements OnInit, OnDestroy {
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(private element: ElementRef, private alfrescoApiService: AlfrescoApiService) {}
|
||||
constructor(private element: ElementRef, private nodesApiService: NodesApiService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateValue();
|
||||
|
||||
this.alfrescoApiService.nodeUpdated
|
||||
this.nodesApiService.nodeUpdated
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(node => {
|
||||
const row: ShareDataRow = this.context.row;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { NodesApiService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { Node, VersionPaging } from '@alfresco/js-api';
|
||||
import { VersionManagerComponent } from './version-manager.component';
|
||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||
@@ -28,7 +28,7 @@ describe('VersionManagerComponent', () => {
|
||||
let component: VersionManagerComponent;
|
||||
let fixture: ComponentFixture<VersionManagerComponent>;
|
||||
let spyOnListVersionHistory: jasmine.Spy;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
let nodesApiService: NodesApiService;
|
||||
|
||||
const expectedComment = 'test-version-comment';
|
||||
const node: Node = new Node({
|
||||
@@ -57,7 +57,7 @@ describe('VersionManagerComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
component.node = node;
|
||||
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
nodesApiService = TestBed.inject(NodesApiService);
|
||||
spyOnListVersionHistory = spyOn(component.versionListComponent['versionsApi'], 'listVersionHistory').and
|
||||
.callFake(() => Promise.resolve(new VersionPaging({ list: { entries: [ versionEntry ] }})));
|
||||
});
|
||||
@@ -102,7 +102,7 @@ describe('VersionManagerComponent', () => {
|
||||
|
||||
it('should emit nodeUpdated event upon successful upload of a new version', () => {
|
||||
fixture.detectChanges();
|
||||
alfrescoApiService.nodeUpdated.subscribe((res) => {
|
||||
nodesApiService.nodeUpdated.subscribe((res) => {
|
||||
expect(res).toEqual(node);
|
||||
});
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { Component, Input, ViewEncapsulation, ViewChild, Output, EventEmitter, OnInit } from '@angular/core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { VersionListComponent } from './version-list.component';
|
||||
import { ContentService, AlfrescoApiService, FileUploadErrorEvent } from '@alfresco/adf-core';
|
||||
import { ContentService, FileUploadErrorEvent, NodesApiService } from '@alfresco/adf-core';
|
||||
import { trigger, state, style, animate, transition } from '@angular/animations';
|
||||
|
||||
@Component({
|
||||
@@ -85,7 +85,7 @@ export class VersionManagerComponent implements OnInit {
|
||||
uploadState: string = 'close';
|
||||
|
||||
constructor(private contentService: ContentService,
|
||||
private alfrescoApiService: AlfrescoApiService) {
|
||||
private nodesApiService: NodesApiService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -95,7 +95,7 @@ export class VersionManagerComponent implements OnInit {
|
||||
}
|
||||
|
||||
refresh(node: Node) {
|
||||
this.alfrescoApiService.nodeUpdated.next(node);
|
||||
this.nodesApiService.nodeUpdated.next(node);
|
||||
this.versionListComponent.loadVersionHistory();
|
||||
this.uploadSuccess.emit(node);
|
||||
this.uploadState = 'close';
|
||||
@@ -104,7 +104,7 @@ export class VersionManagerComponent implements OnInit {
|
||||
onUploadSuccess(event: any) {
|
||||
this.showVersionComparison = false;
|
||||
this.newFileVersion = null;
|
||||
this.alfrescoApiService.nodeUpdated.next(event.value.entry);
|
||||
this.nodesApiService.nodeUpdated.next(event.value.entry);
|
||||
this.versionListComponent.loadVersionHistory();
|
||||
this.uploadSuccess.emit(event.value.entry);
|
||||
this.uploadState = 'close';
|
||||
|
Reference in New Issue
Block a user