mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-] update library to use new js-api 3.0.0 (#4097)
This commit is contained in:
committed by
Eugenio Romano
parent
2acd1b4e26
commit
3ef7d3b7ea
@@ -16,13 +16,13 @@
|
||||
*/
|
||||
|
||||
import { Subject } from 'rxjs';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
export interface AttachFileWidgetDialogComponentData {
|
||||
title: string;
|
||||
actionName?: string;
|
||||
selected: Subject<MinimalNodeEntryEntity[]>;
|
||||
selected: Subject<Node[]>;
|
||||
ecmHost: string;
|
||||
context?: string;
|
||||
isSelectionValid?: (entry: MinimalNodeEntryEntity) => boolean;
|
||||
isSelectionValid?: (entry: Node) => boolean;
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
describe('AttachFileWidgetDialogComponent', () => {
|
||||
|
||||
@@ -131,12 +131,12 @@ describe('AttachFileWidgetDialogComponent', () => {
|
||||
});
|
||||
|
||||
it('should be able to select a file', (done) => {
|
||||
data.selected.subscribe((nodeList: MinimalNodeEntryEntity[]) => {
|
||||
data.selected.subscribe((nodeList: Node[]) => {
|
||||
expect(nodeList[0].id).toBe('fake');
|
||||
expect(nodeList[0].isFile).toBeTruthy();
|
||||
done();
|
||||
});
|
||||
let fakeNode: MinimalNodeEntryEntity = { id: 'fake', isFile: true};
|
||||
let fakeNode: Node = new Node({ id: 'fake', isFile: true});
|
||||
contentNodePanel.componentInstance.select.emit([fakeNode]);
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
|
@@ -20,7 +20,7 @@ import { MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { ExternalAlfrescoApiService, AlfrescoApiService, AuthenticationService, LoginDialogPanelComponent, SitesService, SearchService } from '@alfresco/adf-core';
|
||||
import { DocumentListService, ContentNodeSelectorService } from '@alfresco/adf-content-services';
|
||||
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-attach-file-widget-dialog',
|
||||
@@ -39,7 +39,7 @@ export class AttachFileWidgetDialogComponent {
|
||||
@ViewChild('adfLoginPanel')
|
||||
loginPanel: LoginDialogPanelComponent;
|
||||
|
||||
chosenNode: MinimalNodeEntryEntity[];
|
||||
chosenNode: Node[];
|
||||
buttonActionName;
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) public data: AttachFileWidgetDialogComponentData,
|
||||
@@ -60,7 +60,7 @@ export class AttachFileWidgetDialogComponent {
|
||||
this.data.selected.complete();
|
||||
}
|
||||
|
||||
onSelect(nodeList: MinimalNodeEntryEntity[]) {
|
||||
onSelect(nodeList: Node[]) {
|
||||
if (nodeList && nodeList[0].isFile) {
|
||||
this.chosenNode = nodeList;
|
||||
} else {
|
||||
|
@@ -19,7 +19,7 @@ import { MatDialog } from '@angular/material';
|
||||
import { EventEmitter, Injectable, Output } from '@angular/core';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component';
|
||||
|
||||
@Injectable({
|
||||
@@ -40,9 +40,9 @@ export class AttachFileWidgetDialogService {
|
||||
* @param contentEntry Item to upload
|
||||
* @returns Information about the chosen file(s)
|
||||
*/
|
||||
openLogin(ecmHost: string, actionName?: string, context?: string): Observable<MinimalNodeEntryEntity[]> {
|
||||
openLogin(ecmHost: string, actionName?: string, context?: string): Observable<Node[]> {
|
||||
let titleString: string = `Please log in for ${ecmHost}`;
|
||||
const selected = new Subject<MinimalNodeEntryEntity[]>();
|
||||
const selected = new Subject<Node[]>();
|
||||
selected.subscribe({
|
||||
complete: this.close.bind(this)
|
||||
});
|
||||
@@ -69,7 +69,7 @@ export class AttachFileWidgetDialogService {
|
||||
this.dialog.closeAll();
|
||||
}
|
||||
|
||||
private isNodeFile(entry: MinimalNodeEntryEntity): boolean {
|
||||
private isNodeFile(entry: Node): boolean {
|
||||
return entry.isFile;
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ import {
|
||||
AppConfigService
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { from, zip, of } from 'rxjs';
|
||||
import { mergeMap } from 'rxjs/operators';
|
||||
import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service';
|
||||
@@ -133,7 +133,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
let params = this.field.params;
|
||||
if (this.isDefinedSourceFolder()) {
|
||||
this.contentDialog.openFileBrowseDialogByFolderId(params.fileSource.selectedFolder.pathId).subscribe(
|
||||
(selections: MinimalNodeEntryEntity[]) => {
|
||||
(selections: Node[]) => {
|
||||
this.tempFilesList.push(...selections);
|
||||
this.uploadFileFromCS(selections,
|
||||
this.field.params.fileSource.selectedFolder.accountId,
|
||||
@@ -195,7 +195,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
});
|
||||
} else {
|
||||
this.contentDialog.openFileBrowseDialogBySite().subscribe(
|
||||
(selections: MinimalNodeEntryEntity[]) => {
|
||||
(selections: Node[]) => {
|
||||
this.tempFilesList.push(...selections);
|
||||
this.uploadFileFromCS(selections, accountIdentifier);
|
||||
});
|
||||
|
@@ -31,7 +31,7 @@ import {
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentNodeDialogService, ContentModule } from '@alfresco/adf-content-services';
|
||||
import { of } from 'rxjs';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { ProcessTestingModule } from '../testing/process.testing.module';
|
||||
|
||||
const fakeRepositoryListAnswer = [
|
||||
@@ -72,7 +72,7 @@ const definedSourceParams = {
|
||||
}
|
||||
};
|
||||
|
||||
const fakeMinimalNode: MinimalNodeEntryEntity = <MinimalNodeEntryEntity> {
|
||||
const fakeMinimalNode: Node = <Node> {
|
||||
id: 'fake',
|
||||
name: 'fake-name',
|
||||
content: {
|
||||
|
@@ -26,10 +26,10 @@ import {
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
|
||||
import { of } from 'rxjs';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { ProcessTestingModule } from '../testing/process.testing.module';
|
||||
|
||||
const fakeMinimalNode: MinimalNodeEntryEntity = <MinimalNodeEntryEntity> {
|
||||
const fakeMinimalNode: Node = <Node> {
|
||||
id: 'fake',
|
||||
name: 'fake-name'
|
||||
};
|
||||
|
@@ -24,7 +24,7 @@ import {
|
||||
NodesApiService
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
selector: 'attach-folder-widget',
|
||||
@@ -58,7 +58,7 @@ export class AttachFolderWidgetComponent extends WidgetComponent implements OnIn
|
||||
if (this.field &&
|
||||
this.field.value) {
|
||||
this.hasFolder = true;
|
||||
this.nodeService.getNode(this.field.value).subscribe((node: MinimalNodeEntryEntity) => {
|
||||
this.nodeService.getNode(this.field.value).subscribe((node: Node) => {
|
||||
this.selectedFolderName = node.name;
|
||||
});
|
||||
}
|
||||
@@ -74,14 +74,14 @@ export class AttachFolderWidgetComponent extends WidgetComponent implements OnIn
|
||||
let params = this.field.params;
|
||||
if (this.isDefinedSourceFolder()) {
|
||||
this.contentDialog.openFolderBrowseDialogByFolderId(params.folderSource.selectedFolder.pathId).subscribe(
|
||||
(selections: MinimalNodeEntryEntity[]) => {
|
||||
(selections: Node[]) => {
|
||||
this.selectedFolderName = selections[0].name;
|
||||
this.field.value = selections[0].id;
|
||||
this.hasFolder = true;
|
||||
});
|
||||
} else {
|
||||
this.contentDialog.openFolderBrowseDialogBySite().subscribe(
|
||||
(selections: MinimalNodeEntryEntity[]) => {
|
||||
(selections: Node[]) => {
|
||||
this.selectedFolderName = selections[0].name;
|
||||
this.field.value = selections[0].id;
|
||||
this.hasFolder = true;
|
||||
|
Reference in New Issue
Block a user