mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +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 { 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