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
@@ -239,7 +239,7 @@ describe('TaskAttachmentList', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not show the empty list component when the attachments list is not empty for completed task', async(() => {
|
||||
it('should not show the empty list component when the attachments list is not empty for completed task', (done) => {
|
||||
getTaskRelatedContentSpy.and.returnValue(of(mockAttachment));
|
||||
let change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({ 'taskId': change });
|
||||
@@ -248,8 +248,9 @@ describe('TaskAttachmentList', () => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('div[adf-empty-list-header]')).toBeNull();
|
||||
done();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
it('loading should be false by default', () => {
|
||||
expect(component.isLoading).toBeFalsy();
|
||||
|
@@ -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;
|
||||
|
@@ -41,10 +41,11 @@ module.exports = function (config) {
|
||||
],
|
||||
frameworks: ['jasmine-ajax', 'jasmine', '@angular-devkit/build-angular'],
|
||||
proxies: {
|
||||
'/assets/': '/base/lib/process-services/assets/',
|
||||
'/base/assets/': '/base/lib/process-services/assets/',
|
||||
'/assets/adf-core/i18n/en.json': '/base/lib/core/i18n/en.json',
|
||||
'/assets/adf-content-services/i18n/en.json': '/base/lib/content-services/i18n/en.json',
|
||||
'/assets/adf-process-services/i18n/en.json': '/base/lib/process-services/i18n/en.json',
|
||||
'/assets/adf-process-services/i18n/en-GB.json': '/base/lib/process-services/i18n/en.json',
|
||||
'/app.config.json': '/base/lib/config/app.config.json'
|
||||
},
|
||||
plugins: [
|
||||
|
@@ -9,7 +9,7 @@
|
||||
"entryFile": "./public-api.ts",
|
||||
"flatModuleFile": "adf-process-services",
|
||||
"umdModuleIds": {
|
||||
"alfresco-js-api": "alfresco-js-api",
|
||||
"@alfresco/js-api": "@alfresco/js-ap",
|
||||
"minimatch": "minimatch",
|
||||
"@angular/platform-browser/animations": "@angular/platform-browser/animations",
|
||||
"@angular/material": "@angular/material",
|
||||
|
@@ -29,7 +29,7 @@
|
||||
"rxjs": ">=6.2.2",
|
||||
"@alfresco/adf-core": ">=2.7.0-beta5",
|
||||
"@alfresco/adf-content-services": ">=2.7.0-beta5",
|
||||
"@ngx-translate/core": ">=10.0.2",
|
||||
"@ngx-translate/core": ">=11.0.0",
|
||||
"core-js": ">=2.5.4",
|
||||
"hammerjs": ">=2.0.8",
|
||||
"moment": ">=2.22.2",
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { AppsProcessService } from '@alfresco/adf-core';
|
||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { ProcessInstanceFilterRepresentation, UserProcessInstanceFilterRepresentation } from 'alfresco-js-api';
|
||||
import { ProcessInstanceFilterRepresentation, UserProcessInstanceFilterRepresentation } from '@alfresco/js-api';
|
||||
import { Observable } from 'rxjs';
|
||||
import { FilterProcessRepresentationModel } from '../models/filter-process.model';
|
||||
import { ProcessFilterService } from './../services/process-filter.service';
|
||||
|
@@ -15,12 +15,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ProcessFilterRequestRepresentation, ProcessInstanceFilterRepresentation, UserProcessInstanceFilterRepresentation } from 'alfresco-js-api';
|
||||
import {
|
||||
ProcessFilterRequestRepresentation,
|
||||
ProcessInstanceFilterRepresentation,
|
||||
UserProcessInstanceFilterRepresentation
|
||||
} from '@alfresco/js-api';
|
||||
|
||||
export class FilterProcessRepresentationModel implements UserProcessInstanceFilterRepresentation {
|
||||
appId: number;
|
||||
filter: ProcessInstanceFilterRepresentation;
|
||||
icon: number;
|
||||
icon: string;
|
||||
id: number;
|
||||
index: number;
|
||||
name: string;
|
||||
@@ -48,11 +52,11 @@ export class FilterProcessRepresentationModel implements UserProcessInstanceFilt
|
||||
*/
|
||||
export class ProcessFilterParamRepresentationModel implements ProcessFilterRequestRepresentation {
|
||||
|
||||
processDefinitionId?: number;
|
||||
processInstanceId?: number|string;
|
||||
processDefinitionId?: string;
|
||||
processInstanceId?: string;
|
||||
appDefinitionId?: number;
|
||||
state?: string;
|
||||
sort?: string;
|
||||
state?: any;
|
||||
sort?: any;
|
||||
page?: number;
|
||||
size?: number;
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { RestVariable } from 'alfresco-js-api';
|
||||
import { RestVariable } from '@alfresco/js-api';
|
||||
|
||||
export class ProcessInstanceVariable implements RestVariable {
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { LightUserRepresentation, ProcessInstanceRepresentation, RestVariable } from 'alfresco-js-api';
|
||||
import { LightUserRepresentation, ProcessInstanceRepresentation, RestVariable } from '@alfresco/js-api';
|
||||
|
||||
export class ProcessInstance implements ProcessInstanceRepresentation {
|
||||
|
||||
|
@@ -121,7 +121,7 @@ describe('Process filter', () => {
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({
|
||||
appId: 1001, id: '111', name: 'Running', icon: 'fake-icon', recent: false
|
||||
appId: 1001, id: 111, name: 'Running', icon: 'fake-icon', recent: false
|
||||
})
|
||||
});
|
||||
|
||||
@@ -129,7 +129,7 @@ describe('Process filter', () => {
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({
|
||||
appId: 1001, id: '222', name: 'Completed', icon: 'fake-icon', recent: false
|
||||
appId: 1001, id: 222, name: 'Completed', icon: 'fake-icon', recent: false
|
||||
})
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ describe('Process filter', () => {
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({
|
||||
appId: 1001, id: '333', name: 'All', icon: 'fake-icon', recent: false
|
||||
appId: 1001, id: 333, name: 'All', icon: 'fake-icon', recent: false
|
||||
})
|
||||
});
|
||||
});
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
import { AlfrescoApiService, FormValues } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { RestVariable } from '@alfresco/js-api';
|
||||
import { Observable, from, throwError, of } from 'rxjs';
|
||||
import { TaskDetailsModel } from '../../task-list';
|
||||
import { ProcessFilterParamRepresentationModel } from '../models/filter-process.model';
|
||||
@@ -203,7 +204,7 @@ export class ProcessService {
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId)
|
||||
)
|
||||
.pipe(
|
||||
map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd))),
|
||||
map((processVars: any[]) => processVars.map((currentProcessVar) => new ProcessInstanceVariable(currentProcessVar))),
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
@@ -214,11 +215,10 @@ export class ProcessService {
|
||||
* @param variables Variables to update
|
||||
* @returns Array of instance variable info
|
||||
*/
|
||||
createOrUpdateProcessInstanceVariables(processInstanceId: string, variables: ProcessInstanceVariable[]): Observable<ProcessInstanceVariable[]> {
|
||||
return from<ProcessInstanceVariable[]>(
|
||||
createOrUpdateProcessInstanceVariables(processInstanceId: string, variables: RestVariable[]): Observable<ProcessInstanceVariable[]> {
|
||||
return from(
|
||||
this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processInstanceId, variables)
|
||||
)
|
||||
.pipe(
|
||||
).pipe(
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
@@ -104,8 +104,8 @@ export class AttachFormComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
private loadFormsTask(): void {
|
||||
this.taskService.getFormList().subscribe((res: Form[]) => {
|
||||
this.forms = res;
|
||||
this.taskService.getFormList().subscribe((form: Form[]) => {
|
||||
this.forms = form;
|
||||
},
|
||||
(err) => {
|
||||
this.error.emit(err);
|
||||
|
@@ -108,9 +108,9 @@ export class ChecklistComponent implements OnChanges {
|
||||
assignee: { id: this.assignee }
|
||||
});
|
||||
this.activitiTaskList.addTask(newTask).subscribe(
|
||||
(res: TaskDetailsModel) => {
|
||||
this.checklist.push(res);
|
||||
this.checklistTaskCreated.emit(res);
|
||||
(taskDetailsModel: TaskDetailsModel) => {
|
||||
this.checklist.push(taskDetailsModel);
|
||||
this.checklistTaskCreated.emit(taskDetailsModel);
|
||||
this.taskName = '';
|
||||
},
|
||||
(error) => {
|
||||
|
@@ -145,27 +145,19 @@ describe('TaskDetailsComponent', () => {
|
||||
expect(fixture.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.MESSAGES.NONE');
|
||||
});
|
||||
|
||||
it('shoud display a form when the task has an associated form', (done) => {
|
||||
it('should display a form when the task has an associated form', async(() => {
|
||||
component.taskId = '123';
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.query(By.css('adf-form'))).not.toBeNull();
|
||||
done();
|
||||
});
|
||||
});
|
||||
expect(fixture.debugElement.query(By.css('adf-form'))).not.toBeNull();
|
||||
}));
|
||||
|
||||
it('shoud display a form in readonly when the task has an associated form and readOnlyForm is true', (done) => {
|
||||
it('should display a form in readonly when the task has an associated form and readOnlyForm is true', async((done) => {
|
||||
component.readOnlyForm = true;
|
||||
component.taskId = '123';
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.query(By.css('adf-form'))).not.toBeNull();
|
||||
expect(fixture.debugElement.query(By.css('.adf-readonly-form'))).not.toBeNull();
|
||||
done();
|
||||
});
|
||||
});
|
||||
expect(fixture.debugElement.query(By.css('adf-form'))).not.toBeNull();
|
||||
expect(fixture.debugElement.query(By.css('.adf-readonly-form'))).not.toBeNull();
|
||||
}));
|
||||
|
||||
it('should not display a form when the task does not have an associated form', async(() => {
|
||||
component.taskId = '123';
|
||||
|
@@ -43,7 +43,7 @@ import { TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListService } from './../services/tasklist.service';
|
||||
import { AttachFileWidgetComponent, AttachFolderWidgetComponent } from '../../content-widget';
|
||||
import { UserRepresentation } from 'alfresco-js-api';
|
||||
import { UserRepresentation } from '@alfresco/js-api';
|
||||
import { share } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
|
@@ -264,7 +264,7 @@ describe('TaskListComponent', () => {
|
||||
expect(component.rows[0]['processInstanceId']).toEqual(2511);
|
||||
expect(component.rows[0]['endDate']).toBeDefined();
|
||||
expect(component.rows[1]['name']).toEqual('No name');
|
||||
expect(component.rows[1]['endDate']).toBeNull();
|
||||
expect(component.rows[1]['endDate']).toBeUndefined();
|
||||
done();
|
||||
});
|
||||
|
||||
|
@@ -124,7 +124,7 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft
|
||||
|
||||
/** Starting point of the */
|
||||
@Input()
|
||||
start: number = 0;
|
||||
start: number;
|
||||
|
||||
/** Emitted when a task in the list is clicked */
|
||||
@Output()
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TaskQueryRequestRepresentation, UserTaskFilterRepresentation } from 'alfresco-js-api';
|
||||
import { TaskFilterRepresentation, UserTaskFilterRepresentation, TaskQueryRepresentation } from '@alfresco/js-api';
|
||||
|
||||
export class AppDefinitionRepresentationModel {
|
||||
defaultAppId: string;
|
||||
@@ -57,37 +57,13 @@ export class FilterParamsModel {
|
||||
}
|
||||
}
|
||||
|
||||
export class FilterParamRepresentationModel {
|
||||
processDefinitionId: string;
|
||||
processDefinitionKey: string;
|
||||
name: string;
|
||||
state: string;
|
||||
sort: string;
|
||||
assignment: string;
|
||||
dueAfter: Date;
|
||||
dueBefore: Date;
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
this.processDefinitionId = obj.processDefinitionId || null;
|
||||
this.processDefinitionKey = obj.processDefinitionKey || null;
|
||||
this.name = obj.name || null;
|
||||
this.state = obj.state || null;
|
||||
this.sort = obj.sort || null;
|
||||
this.assignment = obj.assignment || null;
|
||||
this.dueAfter = obj.dueAfter || null;
|
||||
this.dueBefore = obj.dueBefore || null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class FilterRepresentationModel implements UserTaskFilterRepresentation {
|
||||
id: number;
|
||||
appId: number;
|
||||
name: string;
|
||||
recent: boolean;
|
||||
icon: string;
|
||||
filter: FilterParamRepresentationModel;
|
||||
filter: TaskFilterRepresentation;
|
||||
index: number;
|
||||
|
||||
constructor(obj?: any) {
|
||||
@@ -97,7 +73,7 @@ export class FilterRepresentationModel implements UserTaskFilterRepresentation {
|
||||
this.name = obj.name || null;
|
||||
this.recent = !!obj.recent;
|
||||
this.icon = obj.icon || null;
|
||||
this.filter = new FilterParamRepresentationModel(obj.filter);
|
||||
this.filter = new UserTaskFilterRepresentation(obj.filter);
|
||||
this.index = obj.index;
|
||||
}
|
||||
}
|
||||
@@ -107,38 +83,6 @@ export class FilterRepresentationModel implements UserTaskFilterRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
export class TaskQueryRequestRepresentationModel implements TaskQueryRequestRepresentation {
|
||||
appDefinitionId: string;
|
||||
dueAfter: string;
|
||||
dueBefore: string;
|
||||
processInstanceId: string;
|
||||
processDefinitionId: string;
|
||||
text: string;
|
||||
assignment: string;
|
||||
state: string;
|
||||
start: string;
|
||||
sort: string;
|
||||
page: number;
|
||||
size: number;
|
||||
taskId: string;
|
||||
includeProcessInstance: boolean;
|
||||
export class TaskQueryRequestRepresentationModel extends TaskQueryRepresentation {
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
this.appDefinitionId = obj.appDefinitionId || null;
|
||||
this.dueAfter = obj.dueAfter || null;
|
||||
this.dueBefore = obj.dueBefore || null;
|
||||
this.processInstanceId = obj.processInstanceId || null;
|
||||
this.processDefinitionId = obj.processDefinitionId || null;
|
||||
this.text = obj.text || null;
|
||||
this.assignment = obj.assignment || null;
|
||||
this.state = obj.state || null;
|
||||
this.start = obj.start || null;
|
||||
this.sort = obj.sort || null;
|
||||
this.page = obj.page || 0;
|
||||
this.size = obj.size || 25;
|
||||
this.taskId = obj.taskId || null;
|
||||
this.includeProcessInstance = obj.includeProcessInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,43 +19,43 @@
|
||||
* This object represent the details of a task.
|
||||
*/
|
||||
import { UserProcessModel } from '@alfresco/adf-core';
|
||||
import { TaskRepresentation } from 'alfresco-js-api';
|
||||
import { TaskRepresentation } from '@alfresco/js-api';
|
||||
import { UserGroupModel } from './user-group.model';
|
||||
|
||||
export class TaskDetailsModel implements TaskRepresentation {
|
||||
id: string;
|
||||
name: string;
|
||||
assignee: UserProcessModel;
|
||||
priority: number;
|
||||
adhocTaskCanBeReassigned: boolean;
|
||||
category: string;
|
||||
created: Date;
|
||||
description: string;
|
||||
parentName: string;
|
||||
dueDate: Date;
|
||||
duration: number;
|
||||
endDate: Date;
|
||||
executionId: string;
|
||||
formKey: string;
|
||||
initiatorCanCompleteTask: boolean;
|
||||
managerOfCandidateGroup: boolean;
|
||||
memberOfCandidateGroup: boolean;
|
||||
memberOfCandidateUsers: boolean;
|
||||
involvedGroups: UserGroupModel [];
|
||||
involvedPeople: UserProcessModel [];
|
||||
parentTaskId: string;
|
||||
parentTaskName: string;
|
||||
processDefinitionCategory: string;
|
||||
processDefinitionDeploymentId: string;
|
||||
processDefinitionDescription: string;
|
||||
processDefinitionId: string;
|
||||
processDefinitionKey: string;
|
||||
processDefinitionName: string;
|
||||
processDefinitionVersion: number = 0;
|
||||
processInstanceId: string;
|
||||
processInstanceName: string;
|
||||
processInstanceStartUserId: string;
|
||||
taskDefinitionKey: string;
|
||||
id?: string;
|
||||
name?: string;
|
||||
assignee?: UserProcessModel;
|
||||
priority?: number;
|
||||
adhocTaskCanBeReassigned?: boolean;
|
||||
category?: string;
|
||||
created?: Date;
|
||||
description?: string;
|
||||
parentName?: string;
|
||||
dueDate?: Date;
|
||||
duration?: number;
|
||||
endDate?: Date;
|
||||
executionId?: string;
|
||||
formKey?: string;
|
||||
initiatorCanCompleteTask?: boolean;
|
||||
managerOfCandidateGroup?: boolean;
|
||||
memberOfCandidateGroup?: boolean;
|
||||
memberOfCandidateUsers?: boolean;
|
||||
involvedGroups?: UserGroupModel [];
|
||||
involvedPeople?: UserProcessModel [];
|
||||
parentTaskId?: string;
|
||||
parentTaskName?: string;
|
||||
processDefinitionCategory?: string;
|
||||
processDefinitionDeploymentId?: string;
|
||||
processDefinitionDescription?: string;
|
||||
processDefinitionId?: string;
|
||||
processDefinitionKey?: string;
|
||||
processDefinitionName?: string;
|
||||
processDefinitionVersion?: number = 0;
|
||||
processInstanceId?: string;
|
||||
processInstanceName?: string;
|
||||
processInstanceStartUserId?: string;
|
||||
taskDefinitionKey?: string;
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
|
@@ -17,13 +17,21 @@
|
||||
|
||||
import { TaskDetailsModel } from './task-details.model';
|
||||
|
||||
export class TaskListModel {
|
||||
size: number;
|
||||
total: number;
|
||||
start: number;
|
||||
length: number;
|
||||
data: TaskDetailsModel[] = [];
|
||||
export class TaskListModel {
|
||||
size?: number;
|
||||
total?: number;
|
||||
start?: number;
|
||||
length?: number;
|
||||
data?: TaskDetailsModel[] = [];
|
||||
|
||||
constructor() {
|
||||
constructor(input?: any) {
|
||||
if (input) {
|
||||
Object.assign(this, input);
|
||||
if (input.data) {
|
||||
this.data = input.data.map((item: any) => {
|
||||
return new TaskDetailsModel(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,11 +20,11 @@
|
||||
*/
|
||||
|
||||
export class UserGroupModel {
|
||||
id: number;
|
||||
name: string;
|
||||
externalId: string;
|
||||
status: string;
|
||||
groups: any = {};
|
||||
id?: number;
|
||||
name?: string;
|
||||
externalId?: string;
|
||||
status?: string;
|
||||
groups?: any = {};
|
||||
|
||||
constructor(obj?: any) {
|
||||
this.id = obj && obj.id;
|
||||
|
@@ -142,7 +142,7 @@ describe('Activiti Task filter Service', () => {
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({
|
||||
appId: 1001, id: '111', name: 'Involved Tasks', icon: 'fake-icon', recent: false
|
||||
appId: 1001, id: 111, name: 'Involved Tasks', icon: 'fake-icon', recent: false
|
||||
})
|
||||
});
|
||||
|
||||
@@ -150,7 +150,7 @@ describe('Activiti Task filter Service', () => {
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({
|
||||
appId: 1001, id: '222', name: 'My Tasks', icon: 'fake-icon', recent: false
|
||||
appId: 1001, id: 222, name: 'My Tasks', icon: 'fake-icon', recent: false
|
||||
})
|
||||
});
|
||||
|
||||
@@ -158,7 +158,7 @@ describe('Activiti Task filter Service', () => {
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({
|
||||
appId: 1001, id: '333', name: 'Queued Tasks', icon: 'fake-icon', recent: false
|
||||
appId: 1001, id: 333, name: 'Queued Tasks', icon: 'fake-icon', recent: false
|
||||
})
|
||||
});
|
||||
|
||||
@@ -166,7 +166,7 @@ describe('Activiti Task filter Service', () => {
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({
|
||||
appId: 1001, id: '444', name: 'Completed Tasks', icon: 'fake-icon', recent: false
|
||||
appId: 1001, id: 444, name: 'Completed Tasks', icon: 'fake-icon', recent: false
|
||||
})
|
||||
});
|
||||
});
|
||||
|
@@ -390,7 +390,7 @@ describe('Activiti TaskList Service', () => {
|
||||
|
||||
it('should assign task to a userId', (done) => {
|
||||
let testTaskId = '8888';
|
||||
service.assignTaskByUserId(testTaskId, fakeUser2.id).subscribe((res: TaskDetailsModel) => {
|
||||
service.assignTaskByUserId(testTaskId, fakeUser2.id.toString()).subscribe((res: TaskDetailsModel) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).toEqual(testTaskId);
|
||||
expect(res.name).toEqual('FakeNameTask');
|
||||
|
@@ -23,6 +23,10 @@ import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '
|
||||
import { Form } from '../models/form.model';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListModel } from '../models/task-list.model';
|
||||
import {
|
||||
TaskQueryRepresentation,
|
||||
AssigneeIdentifierRepresentation
|
||||
} from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -85,7 +89,7 @@ export class TaskListService {
|
||||
* @returns List of tasks
|
||||
*/
|
||||
getTasks(requestNode: TaskQueryRequestRepresentationModel): Observable<TaskListModel> {
|
||||
return from<TaskListModel>(this.callApiTasksFiltered(requestNode))
|
||||
return from(this.callApiTasksFiltered(requestNode))
|
||||
.pipe(
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
@@ -318,8 +322,8 @@ export class TaskListService {
|
||||
* @param userId ID of the user to assign the task to
|
||||
* @returns Details of the assigned task
|
||||
*/
|
||||
assignTaskByUserId(taskId: string, userId: number): Observable<TaskDetailsModel> {
|
||||
const assignee = { assignee: userId };
|
||||
assignTaskByUserId(taskId: string, userId: string): Observable<TaskDetailsModel> {
|
||||
const assignee = <AssigneeIdentifierRepresentation> { assignee: userId };
|
||||
return from(this.callApiAssignTask(taskId, assignee))
|
||||
.pipe(
|
||||
map((response: TaskDetailsModel) => {
|
||||
@@ -392,35 +396,35 @@ export class TaskListService {
|
||||
);
|
||||
}
|
||||
|
||||
private callApiTasksFiltered(requestNode: TaskQueryRequestRepresentationModel) {
|
||||
private callApiTasksFiltered(requestNode: TaskQueryRepresentation): Promise<TaskListModel> {
|
||||
return this.apiService.taskApi.listTasks(requestNode);
|
||||
}
|
||||
|
||||
private callApiTaskDetails(taskId: string) {
|
||||
private callApiTaskDetails(taskId: string): Promise<TaskDetailsModel> {
|
||||
return this.apiService.taskApi.getTask(taskId);
|
||||
}
|
||||
|
||||
private callApiAddTask(task: TaskDetailsModel) {
|
||||
private callApiAddTask(task: TaskDetailsModel): Promise<TaskDetailsModel> {
|
||||
return this.apiService.taskApi.addSubtask(task.parentTaskId, task);
|
||||
}
|
||||
|
||||
private callApiDeleteTask(taskId: string) {
|
||||
private callApiDeleteTask(taskId: string): Promise<any> {
|
||||
return this.apiService.taskApi.deleteTask(taskId);
|
||||
}
|
||||
|
||||
private callApiDeleteForm(taskId: string) {
|
||||
private callApiDeleteForm(taskId: string): Promise<any> {
|
||||
return this.apiService.taskApi.removeForm(taskId);
|
||||
}
|
||||
|
||||
private callApiTaskChecklist(taskId: string) {
|
||||
private callApiTaskChecklist(taskId: string): Promise<TaskListModel> {
|
||||
return this.apiService.taskApi.getChecklist(taskId);
|
||||
}
|
||||
|
||||
private callApiCreateTask(task: TaskDetailsModel) {
|
||||
private callApiCreateTask(task: TaskDetailsModel): Promise<TaskDetailsModel> {
|
||||
return this.apiService.taskApi.createNewTask(task);
|
||||
}
|
||||
|
||||
private callApiAssignTask(taskId: string, requestNode: any) {
|
||||
private callApiAssignTask(taskId: string, requestNode: AssigneeIdentifierRepresentation): Promise<TaskDetailsModel> {
|
||||
return this.apiService.taskApi.assignTask(taskId, requestNode);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user