mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +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:
parent
b0561a2453
commit
ae126475f7
@ -26,7 +26,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { NodeEntry, Node } from '@alfresco/js-api';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
@ -52,12 +52,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: Node) => {
|
||||
const row = this.context.row;
|
||||
|
@ -124,6 +124,19 @@ v6.0.0 and after:
|
||||
````
|
||||
]})
|
||||
```
|
||||
### nodeUpdated Subject
|
||||
The nodeUpdated Subject has been moved from AlfrescoApiService to NodesApiService
|
||||
|
||||
v6.0.0 and before:
|
||||
```
|
||||
this.alfrescoApiService.nodeUpdated.pipe .....
|
||||
```
|
||||
|
||||
v6.0.0 and after:
|
||||
|
||||
```
|
||||
this.nodesApiService.nodeUpdated.pipe .....
|
||||
```
|
||||
|
||||
## Renamed items
|
||||
|
||||
|
@ -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';
|
||||
|
@ -26,9 +26,9 @@ import {
|
||||
import { DataColumn } from '../../data/data-column.model';
|
||||
import { DataRow } from '../../data/data-row.model';
|
||||
import { DataTableAdapter } from '../../data/datatable-adapter';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { NodesApiService } from '../../../services/nodes-api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-datatable-cell',
|
||||
@ -82,11 +82,11 @@ export class DataTableCellComponent implements OnInit, OnDestroy {
|
||||
|
||||
protected onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(protected alfrescoApiService: AlfrescoApiService) {}
|
||||
constructor(protected nodesApiService: NodesApiService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateValue();
|
||||
this.alfrescoApiService.nodeUpdated
|
||||
this.nodesApiService.nodeUpdated
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(node => {
|
||||
if (this.row && node && node.id) {
|
||||
|
@ -21,7 +21,7 @@ import {
|
||||
UserPreferencesService,
|
||||
UserPreferenceValues
|
||||
} from '../../../services/user-preferences.service';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
import { NodesApiService } from '../../../services/nodes-api.service';
|
||||
import { AppConfigService } from '../../../app-config/app-config.service';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@ -65,10 +65,10 @@ export class DateCellComponent extends DataTableCellComponent {
|
||||
|
||||
constructor(
|
||||
userPreferenceService: UserPreferencesService,
|
||||
alfrescoApiService: AlfrescoApiService,
|
||||
nodesApiService: NodesApiService,
|
||||
appConfig: AppConfigService
|
||||
) {
|
||||
super(alfrescoApiService);
|
||||
super(nodesApiService);
|
||||
|
||||
this.dateFormat = appConfig.get('dateValues.defaultDateFormat', DateCellComponent.DATE_FORMAT);
|
||||
this.tooltipDateFormat = appConfig.get('dateValues.defaultTooltipDateFormat', DateCellComponent.DATE_FORMAT);
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { DataTableCellComponent } from '../datatable-cell/datatable-cell.component';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
import { NodesApiService } from '../../../services/nodes-api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-filesize-cell',
|
||||
@ -33,7 +33,7 @@ import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
host: { class: 'adf-filesize-cell' }
|
||||
})
|
||||
export class FileSizeCellComponent extends DataTableCellComponent {
|
||||
constructor(alfrescoApiService: AlfrescoApiService) {
|
||||
super(alfrescoApiService);
|
||||
constructor(nodesApiService: NodesApiService) {
|
||||
super(nodesApiService);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import { ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation, Input }
|
||||
import { DataTableCellComponent } from '../datatable-cell/datatable-cell.component';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { EditJsonDialogComponent, EditJsonDialogSettings } from '../../../dialogs/edit-json/edit-json.dialog';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
import { NodesApiService } from '../../../services/nodes-api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-json-cell',
|
||||
@ -45,9 +45,9 @@ export class JsonCellComponent extends DataTableCellComponent implements OnInit
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
alfrescoApiService: AlfrescoApiService
|
||||
nodesApiService: NodesApiService
|
||||
) {
|
||||
super(alfrescoApiService);
|
||||
super(nodesApiService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -24,7 +24,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { PathInfoEntity } from '@alfresco/js-api';
|
||||
import { DataTableCellComponent } from '../datatable-cell/datatable-cell.component';
|
||||
import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
||||
import { NodesApiService } from '../../../services/nodes-api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-location-cell',
|
||||
@ -43,8 +43,8 @@ export class LocationCellComponent extends DataTableCellComponent implements OnI
|
||||
@Input()
|
||||
link: any[];
|
||||
|
||||
constructor(alfrescoApiService: AlfrescoApiService) {
|
||||
super(alfrescoApiService);
|
||||
constructor(nodesApiService: NodesApiService) {
|
||||
super(nodesApiService);
|
||||
}
|
||||
|
||||
/** @override */
|
||||
|
@ -16,9 +16,9 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Node, AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
|
||||
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
|
||||
import { Subject, ReplaySubject } from 'rxjs';
|
||||
import { ReplaySubject } from 'rxjs';
|
||||
import { OauthConfigModel } from '../models/oauth-config.model';
|
||||
import { StorageService } from './storage.service';
|
||||
import { OpenidConfiguration } from './openid-configuration.interface';
|
||||
@ -27,10 +27,6 @@ import { OpenidConfiguration } from './openid-configuration.interface';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AlfrescoApiService {
|
||||
/**
|
||||
* Publish/subscribe to events related to node updates.
|
||||
*/
|
||||
nodeUpdated = new Subject<Node>();
|
||||
|
||||
alfrescoApiInitialized: ReplaySubject<boolean> = new ReplaySubject(1);
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MinimalNode, NodeEntry, NodePaging, NodesApi, TrashcanApi } from '@alfresco/js-api';
|
||||
import { from, Observable, throwError } from 'rxjs';
|
||||
import { MinimalNode, NodeEntry, NodePaging, NodesApi, TrashcanApi, Node } from '@alfresco/js-api';
|
||||
import { Subject, from, Observable, throwError } from 'rxjs';
|
||||
import { AlfrescoApiService } from './alfresco-api.service';
|
||||
import { UserPreferencesService } from './user-preferences.service';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
@ -28,6 +28,11 @@ import { NodeMetadata } from '../models/node-metadata.model';
|
||||
})
|
||||
export class NodesApiService {
|
||||
|
||||
/**
|
||||
* Publish/subscribe to events related to node updates.
|
||||
*/
|
||||
nodeUpdated = new Subject<Node>();
|
||||
|
||||
_trashcanApi: TrashcanApi;
|
||||
get trashcanApi(): TrashcanApi {
|
||||
this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.apiService.getInstance());
|
||||
|
@ -19,7 +19,7 @@ import { Location } from '@angular/common';
|
||||
import { SpyLocation } from '@angular/common/testing';
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, RenditionsService } from '../../services';
|
||||
import { NodesApiService, RenditionsService } from '../../services';
|
||||
|
||||
import { throwError } from 'rxjs';
|
||||
import { EventMock } from '../../mock/event.mock';
|
||||
@ -153,7 +153,7 @@ describe('ViewerComponent', () => {
|
||||
|
||||
let component: ViewerComponent;
|
||||
let fixture: ComponentFixture<ViewerComponent>;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
let nodesApiService: NodesApiService;
|
||||
let element: HTMLElement;
|
||||
let dialog: MatDialog;
|
||||
let uploadService: UploadService;
|
||||
@ -192,8 +192,8 @@ describe('ViewerComponent', () => {
|
||||
element = fixture.nativeElement;
|
||||
component = fixture.componentInstance;
|
||||
|
||||
nodesApiService = TestBed.inject(NodesApiService);
|
||||
uploadService = TestBed.inject(UploadService);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
dialog = TestBed.inject(MatDialog);
|
||||
extensionService = TestBed.inject(AppExtensionService);
|
||||
});
|
||||
@ -609,15 +609,15 @@ describe('ViewerComponent', () => {
|
||||
|
||||
expect(component.fileTitle).toBe('file1');
|
||||
|
||||
alfrescoApiService.nodeUpdated.next({ id: 'id1', name: 'file2' } as any);
|
||||
nodesApiService.nodeUpdated.next({ id: 'id1', name: 'file2' } as any);
|
||||
fixture.detectChanges();
|
||||
expect(component.fileTitle).toBe('file2');
|
||||
|
||||
alfrescoApiService.nodeUpdated.next({ id: 'id1', name: 'file3' } as any);
|
||||
nodesApiService.nodeUpdated.next({ id: 'id1', name: 'file3' } as any);
|
||||
fixture.detectChanges();
|
||||
expect(component.fileTitle).toBe('file3');
|
||||
|
||||
alfrescoApiService.nodeUpdated.next({ id: 'id2', name: 'file4' } as any);
|
||||
nodesApiService.nodeUpdated.next({ id: 'id2', name: 'file4' } as any);
|
||||
fixture.detectChanges();
|
||||
expect(component.fileTitle).toBe('file3');
|
||||
expect(component.nodeId).toBe('id1');
|
||||
|
@ -44,6 +44,7 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
import { ContentService } from '../../services/content.service';
|
||||
import { UploadService } from '../../services/upload.service';
|
||||
import { FileModel } from '../../models';
|
||||
import { NodesApiService } from '../../services/nodes-api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-viewer',
|
||||
@ -304,6 +305,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
constructor(private apiService: AlfrescoApiService,
|
||||
private nodesApiService: NodesApiService,
|
||||
private viewUtilService: ViewUtilService,
|
||||
private logService: LogService,
|
||||
private extensionService: AppExtensionService,
|
||||
@ -320,7 +322,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.apiService.nodeUpdated.pipe(
|
||||
this.nodesApiService.nodeUpdated.pipe(
|
||||
filter((node) => node && node.id === this.nodeId &&
|
||||
(node.name !== this.fileName ||
|
||||
this.getNodeVersionProperty(this.nodeEntry.entry) !== this.getNodeVersionProperty(node))),
|
||||
|
Loading…
x
Reference in New Issue
Block a user