mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1004] The process service definition file in the alfresco-js-api is incomplete (#2488)
* correction after new declaration file for PS * remove unused jasmine * commit ifx initial pipe * fix tasklist test * fix tasklist test * reinsert test
This commit is contained in:
committed by
Denys Vuika
parent
0cc578ba0e
commit
036c63e43d
@@ -93,7 +93,6 @@ export {TaskHeaderComponent as ActivitiTaskHeader} from './src/components/task-h
|
||||
export {TaskListComponent as ActivitiTaskList } from './src/components/tasklist.component';
|
||||
export {TaskListService as ActivitiTaskListService } from './src/services/tasklist.service';
|
||||
|
||||
export * from './src/models/comment.model';
|
||||
export * from './src/models/filter.model';
|
||||
export * from './src/models/icon.model';
|
||||
export * from './src/models/task-details.model';
|
||||
|
@@ -18,21 +18,19 @@
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { AppsProcessService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
import { defaultApp, deployedApps, nonDeployedApps } from './../assets/apps-list.mock';
|
||||
import { TaskListService } from './../services/tasklist.service';
|
||||
import { AppsListComponent } from './apps-list.component';
|
||||
|
||||
describe('AppsListComponent', () => {
|
||||
|
||||
let componentHandler: any;
|
||||
let component: AppsListComponent;
|
||||
let fixture: ComponentFixture<AppsListComponent>;
|
||||
let debugElement: DebugElement;
|
||||
let service: TaskListService;
|
||||
let service: AppsProcessService;
|
||||
let getAppsSpy: jasmine.Spy;
|
||||
|
||||
beforeEach(async(() => {
|
||||
@@ -44,7 +42,7 @@ describe('AppsListComponent', () => {
|
||||
AppsListComponent
|
||||
],
|
||||
providers: [
|
||||
TaskListService,
|
||||
AppsProcessService,
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
]
|
||||
}).compileComponents();
|
||||
@@ -52,19 +50,12 @@ describe('AppsListComponent', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
fixture = TestBed.createComponent(AppsListComponent);
|
||||
component = fixture.componentInstance;
|
||||
debugElement = fixture.debugElement;
|
||||
|
||||
service = fixture.debugElement.injector.get(TaskListService);
|
||||
service = fixture.debugElement.injector.get(AppsProcessService);
|
||||
getAppsSpy = spyOn(service, 'getDeployedApplications').and.returnValue(Observable.of(deployedApps));
|
||||
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered',
|
||||
'upgradeElement'
|
||||
]);
|
||||
window['componentHandler'] = componentHandler;
|
||||
});
|
||||
|
||||
it('should define layoutType with the default value', () => {
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { AppsProcessService } from 'ng2-alfresco-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
import { AppDefinitionRepresentationModel } from '../models/filter.model';
|
||||
@@ -59,13 +60,8 @@ export class AppsListComponent implements OnInit {
|
||||
|
||||
private iconsMDL: IconModel;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param translate Translate service
|
||||
* @param activitiTaskList Task service
|
||||
*/
|
||||
constructor(private activitiTaskList: TaskListService) {
|
||||
this.apps$ = new Observable<AppDefinitionRepresentationModel>(observer => this.appsObserver = observer).share();
|
||||
constructor(private appsProcessService: AppsProcessService) {
|
||||
this.apps$ = new Observable<AppDefinitionRepresentationModel>(observer => this.appsObserver = observer).share();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -81,10 +77,9 @@ export class AppsListComponent implements OnInit {
|
||||
}
|
||||
|
||||
private load() {
|
||||
this.activitiTaskList.getDeployedApplications().subscribe(
|
||||
(res) => {
|
||||
res = this.filterApps(res);
|
||||
res.forEach((app: AppDefinitionRepresentationModel) => {
|
||||
this.appsProcessService.getDeployedApplications().subscribe(
|
||||
(res: AppDefinitionRepresentationModel[]) => {
|
||||
this.filterApps(res).forEach((app: AppDefinitionRepresentationModel) => {
|
||||
if (app.defaultAppId === AppsListComponent.DEFAULT_TASKS_APP) {
|
||||
app.name = AppsListComponent.DEFAULT_TASKS_APP_NAME;
|
||||
app.theme = AppsListComponent.DEFAULT_TASKS_APP_THEME;
|
||||
@@ -120,7 +115,7 @@ export class AppsListComponent implements OnInit {
|
||||
}
|
||||
|
||||
private filterApps(apps: AppDefinitionRepresentationModel []): AppDefinitionRepresentationModel[] {
|
||||
let filteredApps = [];
|
||||
let filteredApps: AppDefinitionRepresentationModel[] = [];
|
||||
if (this.filtersAppId) {
|
||||
apps.filter((app: AppDefinitionRepresentationModel) => {
|
||||
this.filtersAppId.forEach((filter) => {
|
||||
|
@@ -17,31 +17,26 @@
|
||||
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { AppConfigService, CommentProcessModel, CoreModule, TranslationService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { DataRowEvent, DataTableModule, ObjectDataRow } from 'ng2-alfresco-datatable';
|
||||
import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
import { Comment } from '../models/comment.model';
|
||||
import { CommentListComponent } from './comment-list.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
const testUser: LightUserRepresentation = new LightUserRepresentation({
|
||||
const testUser: UserProcessModel = new UserProcessModel({
|
||||
id: '1',
|
||||
firstName: 'Test',
|
||||
lastName: 'User',
|
||||
email: 'tu@domain.com'
|
||||
});
|
||||
const testDate = new Date();
|
||||
const testComment: Comment = new Comment(1, 'Test Comment', testDate.toDateString(), testUser);
|
||||
const testComment: CommentProcessModel = new CommentProcessModel({id: 1, message: 'Test Comment', created: testDate.toDateString(), createdBy: testUser});
|
||||
|
||||
describe('CommentListComponent', () => {
|
||||
|
||||
let commentList: CommentListComponent;
|
||||
let fixture: ComponentFixture<CommentListComponent>;
|
||||
let element: HTMLElement;
|
||||
let componentHandler;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -62,11 +57,6 @@ describe('CommentListComponent', () => {
|
||||
fixture = TestBed.createComponent(CommentListComponent);
|
||||
commentList = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered'
|
||||
]);
|
||||
|
||||
window['componentHandler'] = componentHandler;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
}));
|
||||
@@ -126,7 +116,7 @@ describe('CommentListComponent', () => {
|
||||
});
|
||||
|
||||
it('comment date time should start with Yesterday when comment date is yesterday', () => {
|
||||
testComment.created = (Date.now() - 24 * 3600 * 1000).toString();
|
||||
testComment.created = new Date((Date.now() - 24 * 3600 * 1000));
|
||||
commentList.comments = [testComment];
|
||||
fixture.detectChanges();
|
||||
element = fixture.nativeElement.querySelector('#comment-time');
|
||||
@@ -134,7 +124,7 @@ describe('CommentListComponent', () => {
|
||||
});
|
||||
|
||||
it('comment date time should not start with Today/Yesterday when comment date is before yesterday', () => {
|
||||
testComment.created = (Date.now() - 24 * 3600 * 1000 * 2).toString();
|
||||
testComment.created = new Date((Date.now() - 24 * 3600 * 1000 * 2));
|
||||
commentList.comments = [testComment];
|
||||
fixture.detectChanges();
|
||||
element = fixture.nativeElement.querySelector('#comment-time');
|
||||
|
@@ -17,8 +17,7 @@
|
||||
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { LightUserRepresentation, PeopleProcessService } from 'ng2-alfresco-core';
|
||||
import { Comment } from '../models/comment.model';
|
||||
import { CommentProcessModel, PeopleProcessService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-comment-list',
|
||||
@@ -29,12 +28,12 @@ import { Comment } from '../models/comment.model';
|
||||
export class CommentListComponent {
|
||||
|
||||
@Input()
|
||||
comments: Comment[];
|
||||
comments: CommentProcessModel[];
|
||||
|
||||
@Output()
|
||||
clickRow: EventEmitter<Comment> = new EventEmitter<Comment>();
|
||||
clickRow: EventEmitter<CommentProcessModel> = new EventEmitter<CommentProcessModel>();
|
||||
|
||||
selectedComment: Comment;
|
||||
selectedComment: CommentProcessModel;
|
||||
|
||||
constructor(private datePipe: DatePipe, public peopleProcessService: PeopleProcessService) {
|
||||
}
|
||||
@@ -44,7 +43,7 @@ export class CommentListComponent {
|
||||
this.clickRow.emit(this.selectedComment);
|
||||
}
|
||||
|
||||
getUserShortName(user: LightUserRepresentation): string {
|
||||
getUserShortName(user: UserProcessModel): string {
|
||||
let shortName = '';
|
||||
if (user) {
|
||||
if (user.firstName) {
|
||||
|
@@ -20,7 +20,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
import { ActivitiFormModule } from 'ng2-activiti-form';
|
||||
import { AppConfigService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { AppConfigService, CommentProcessService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
|
||||
@@ -34,12 +34,12 @@ import { CommentsComponent } from './comments.component';
|
||||
|
||||
describe('CommentsComponent', () => {
|
||||
|
||||
let componentHandler: any;
|
||||
let service: TaskListService;
|
||||
let component: CommentsComponent;
|
||||
let fixture: ComponentFixture<CommentsComponent>;
|
||||
let getCommentsSpy: jasmine.Spy;
|
||||
let addCommentSpy: jasmine.Spy;
|
||||
let commentProcessService: CommentProcessService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -58,7 +58,8 @@ describe('CommentsComponent', () => {
|
||||
DatePipe,
|
||||
PeopleProcessService,
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
CommentProcessService
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
@@ -68,19 +69,15 @@ describe('CommentsComponent', () => {
|
||||
fixture = TestBed.createComponent(CommentsComponent);
|
||||
component = fixture.componentInstance;
|
||||
service = fixture.debugElement.injector.get(TaskListService);
|
||||
commentProcessService = fixture.debugElement.injector.get(CommentProcessService);
|
||||
|
||||
getCommentsSpy = spyOn(service, 'getComments').and.returnValue(Observable.of([
|
||||
getCommentsSpy = spyOn(commentProcessService, 'getTaskComments').and.returnValue(Observable.of([
|
||||
{ message: 'Test1', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} },
|
||||
{ message: 'Test2', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} },
|
||||
{ message: 'Test3', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} }
|
||||
]));
|
||||
addCommentSpy = spyOn(service, 'addComment').and.returnValue(Observable.of({id: 123, message: 'Test Comment', createdBy: {id: '999'}}));
|
||||
addCommentSpy = spyOn(commentProcessService, 'addTaskComment').and.returnValue(Observable.of({id: 123, message: 'Test Comment', createdBy: {id: '999'}}));
|
||||
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered',
|
||||
'upgradeElement'
|
||||
]);
|
||||
window['componentHandler'] = componentHandler;
|
||||
});
|
||||
|
||||
it('should load comments when taskId specified', () => {
|
||||
|
@@ -16,11 +16,9 @@
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { CommentProcessModel, CommentProcessService } from 'ng2-alfresco-core';
|
||||
import { Observable, Observer } from 'rxjs/Rx';
|
||||
|
||||
import { Comment } from '../models/comment.model';
|
||||
import { TaskListService } from '../services/tasklist.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-comments, activiti-comments',
|
||||
templateUrl: './comments.component.html',
|
||||
@@ -37,23 +35,18 @@ export class CommentsComponent implements OnChanges {
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
comments: Comment [] = [];
|
||||
comments: CommentProcessModel [] = [];
|
||||
|
||||
private commentObserver: Observer<Comment>;
|
||||
comment$: Observable<Comment>;
|
||||
private commentObserver: Observer<CommentProcessModel>;
|
||||
comment$: Observable<CommentProcessModel>;
|
||||
|
||||
message: string;
|
||||
|
||||
beingAdded: boolean = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param translate Translation service
|
||||
* @param activitiTaskList Task service
|
||||
*/
|
||||
constructor(private activitiTaskList: TaskListService) {
|
||||
this.comment$ = new Observable<Comment>(observer => this.commentObserver = observer).share();
|
||||
this.comment$.subscribe((comment: Comment) => {
|
||||
constructor(private commentProcessService: CommentProcessService) {
|
||||
this.comment$ = new Observable<CommentProcessModel>(observer => this.commentObserver = observer).share();
|
||||
this.comment$.subscribe((comment: CommentProcessModel) => {
|
||||
this.comments.push(comment);
|
||||
});
|
||||
}
|
||||
@@ -72,9 +65,9 @@ export class CommentsComponent implements OnChanges {
|
||||
private getTaskComments(taskId: string): void {
|
||||
this.resetComments();
|
||||
if (taskId) {
|
||||
this.activitiTaskList.getComments(taskId).subscribe(
|
||||
(res: Comment[]) => {
|
||||
res = res.sort((comment1: Comment, comment2: Comment) => {
|
||||
this.commentProcessService.getTaskComments(taskId).subscribe(
|
||||
(res: CommentProcessModel[]) => {
|
||||
res = res.sort((comment1: CommentProcessModel, comment2: CommentProcessModel) => {
|
||||
let date1 = new Date(comment1.created);
|
||||
let date2 = new Date(comment2.created);
|
||||
return date1 > date2 ? -1 : date1 < date2 ? 1 : 0;
|
||||
@@ -97,9 +90,9 @@ export class CommentsComponent implements OnChanges {
|
||||
add(): void {
|
||||
if (this.message && this.message.trim() && !this.beingAdded) {
|
||||
this.beingAdded = true;
|
||||
this.activitiTaskList.addComment(this.taskId, this.message)
|
||||
this.commentProcessService.addTaskComment(this.taskId, this.message)
|
||||
.subscribe(
|
||||
(res: Comment) => {
|
||||
(res: CommentProcessModel) => {
|
||||
this.comments.unshift(res);
|
||||
this.message = '';
|
||||
this.beingAdded = false;
|
||||
|
@@ -27,7 +27,6 @@ import { AttachmentComponent } from './create-task-attachment.component';
|
||||
|
||||
describe('Activiti Task Create Attachment', () => {
|
||||
|
||||
let componentHandler: any;
|
||||
let service: ActivitiContentService;
|
||||
let component: AttachmentComponent;
|
||||
let fixture: ComponentFixture<AttachmentComponent>;
|
||||
@@ -59,12 +58,6 @@ describe('Activiti Task Create Attachment', () => {
|
||||
{
|
||||
status: true
|
||||
}));
|
||||
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered',
|
||||
'upgradeElement'
|
||||
]);
|
||||
window['componentHandler'] = componentHandler;
|
||||
});
|
||||
|
||||
it('should not call createTaskRelatedContent service when taskId changed', () => {
|
||||
|
@@ -16,17 +16,14 @@
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { AppConfigService, CoreModule, TranslationService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { DataRowActionEvent, DataRowEvent, DataTableModule, ObjectDataRow } from 'ng2-alfresco-datatable';
|
||||
import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
import { UserEventModel } from '../models/user-event.model';
|
||||
import { PeopleListComponent } from './people-list.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
const fakeUser: LightUserRepresentation = new LightUserRepresentation({
|
||||
const fakeUser: UserProcessModel = new UserProcessModel({
|
||||
id: '1',
|
||||
firstName: 'fake-name',
|
||||
lastName: 'fake-last',
|
||||
@@ -38,7 +35,6 @@ describe('PeopleListComponent', () => {
|
||||
let peopleListComponent: PeopleListComponent;
|
||||
let fixture: ComponentFixture<PeopleListComponent>;
|
||||
let element: HTMLElement;
|
||||
let componentHandler;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -58,11 +54,6 @@ describe('PeopleListComponent', () => {
|
||||
fixture = TestBed.createComponent(PeopleListComponent);
|
||||
peopleListComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered'
|
||||
]);
|
||||
|
||||
window['componentHandler'] = componentHandler;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
}));
|
||||
|
@@ -16,13 +16,10 @@
|
||||
*/
|
||||
|
||||
import { AfterContentInit, AfterViewInit, Component, ContentChild, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { DataColumnListComponent } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { DataColumnListComponent, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { DataTableComponent } from 'ng2-alfresco-datatable';
|
||||
import { UserEventModel } from '../models/user-event.model';
|
||||
|
||||
declare let componentHandler: any;
|
||||
|
||||
@Component({
|
||||
selector: 'adf-people-list',
|
||||
templateUrl: './people-list.component.html',
|
||||
@@ -37,35 +34,24 @@ export class PeopleListComponent implements AfterViewInit, AfterContentInit {
|
||||
peopleDataTable: DataTableComponent;
|
||||
|
||||
@Input()
|
||||
users: LightUserRepresentation[];
|
||||
users: UserProcessModel[];
|
||||
|
||||
@Input()
|
||||
actions: boolean = false;
|
||||
|
||||
@Output()
|
||||
clickRow: EventEmitter<LightUserRepresentation> = new EventEmitter<LightUserRepresentation>();
|
||||
clickRow: EventEmitter<UserProcessModel> = new EventEmitter<UserProcessModel>();
|
||||
|
||||
@Output()
|
||||
clickAction: EventEmitter<UserEventModel> = new EventEmitter<UserEventModel>();
|
||||
|
||||
user: LightUserRepresentation;
|
||||
user: UserProcessModel;
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.peopleDataTable.columnList = this.columnList;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.setupMaterialComponents(componentHandler);
|
||||
}
|
||||
|
||||
setupMaterialComponents(handler?: any): boolean {
|
||||
// workaround for MDL issues with dynamic components
|
||||
let isUpgraded: boolean = false;
|
||||
if (handler) {
|
||||
handler.upgradeAllRegistered();
|
||||
isUpgraded = true;
|
||||
}
|
||||
return isUpgraded;
|
||||
}
|
||||
|
||||
selectUser(event: any) {
|
||||
|
@@ -17,8 +17,7 @@
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatButtonModule, MatInputModule } from '@angular/material';
|
||||
import { AppConfigService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { AppConfigService, CoreModule, TranslationService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { DataTableModule } from 'ng2-alfresco-datatable';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
@@ -26,16 +25,14 @@ import { TranslationMock } from '../assets/translation.service.mock';
|
||||
import { PeopleListComponent } from './people-list.component';
|
||||
import { PeopleSearchComponent } from './people-search.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
const fakeUser: LightUserRepresentation = new LightUserRepresentation({
|
||||
const fakeUser: UserProcessModel = new UserProcessModel({
|
||||
id: '1',
|
||||
firstName: 'fake-name',
|
||||
lastName: 'fake-last',
|
||||
email: 'fake@mail.com'
|
||||
});
|
||||
|
||||
const fakeSecondUser: LightUserRepresentation = new LightUserRepresentation({
|
||||
const fakeSecondUser: UserProcessModel = new UserProcessModel({
|
||||
id: '2',
|
||||
firstName: 'fake-involve-name',
|
||||
lastName: 'fake-involve-last',
|
||||
@@ -47,7 +44,6 @@ describe('PeopleSearchComponent', () => {
|
||||
let peopleSearchComponent: PeopleSearchComponent;
|
||||
let fixture: ComponentFixture<PeopleSearchComponent>;
|
||||
let element: HTMLElement;
|
||||
let componentHandler;
|
||||
let userArray = [fakeUser, fakeSecondUser];
|
||||
let searchInput: any;
|
||||
|
||||
@@ -72,11 +68,6 @@ describe('PeopleSearchComponent', () => {
|
||||
fixture = TestBed.createComponent(PeopleSearchComponent);
|
||||
peopleSearchComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered'
|
||||
]);
|
||||
|
||||
window['componentHandler'] = componentHandler;
|
||||
peopleSearchComponent.results = Observable.of([]);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@@ -17,8 +17,7 @@
|
||||
|
||||
import { Component, Directive, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { PeopleProcessService } from 'ng2-alfresco-core';
|
||||
import { PeopleProcessService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@Component({
|
||||
@@ -34,22 +33,22 @@ import { Observable } from 'rxjs/Observable';
|
||||
export class PeopleSearchComponent implements OnInit {
|
||||
|
||||
@Input()
|
||||
results: Observable<LightUserRepresentation[]>;
|
||||
results: Observable<UserProcessModel[]>;
|
||||
|
||||
@Output()
|
||||
searchPeople: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
success: EventEmitter<LightUserRepresentation> = new EventEmitter<LightUserRepresentation>();
|
||||
success: EventEmitter<UserProcessModel> = new EventEmitter<UserProcessModel>();
|
||||
|
||||
@Output()
|
||||
closeSearch = new EventEmitter();
|
||||
|
||||
searchUser: FormControl = new FormControl();
|
||||
|
||||
users: LightUserRepresentation[] = [];
|
||||
users: UserProcessModel[] = [];
|
||||
|
||||
selectedUser: LightUserRepresentation;
|
||||
selectedUser: UserProcessModel;
|
||||
|
||||
constructor(public peopleProcessService: PeopleProcessService) {
|
||||
this.searchUser
|
||||
@@ -70,7 +69,7 @@ export class PeopleSearchComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onRowClick(user: LightUserRepresentation) {
|
||||
onRowClick(user: UserProcessModel) {
|
||||
this.selectedUser = user;
|
||||
}
|
||||
|
||||
|
@@ -19,8 +19,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatButtonModule, MatInputModule } from '@angular/material';
|
||||
import { AppConfigService, CoreModule, LogService, TranslationService } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { PeopleProcessService } from 'ng2-alfresco-core';
|
||||
import { PeopleProcessService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { DataTableModule } from 'ng2-alfresco-datatable';
|
||||
import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
@@ -30,14 +29,14 @@ import { PeopleComponent } from './people.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
const fakeUser: LightUserRepresentation = new LightUserRepresentation({
|
||||
const fakeUser: UserProcessModel = new UserProcessModel({
|
||||
id: 'fake-id',
|
||||
firstName: 'fake-name',
|
||||
lastName: 'fake-last',
|
||||
email: 'fake@mail.com'
|
||||
});
|
||||
|
||||
const fakeSecondUser: LightUserRepresentation = new LightUserRepresentation({
|
||||
const fakeSecondUser: UserProcessModel = new UserProcessModel({
|
||||
id: 'fake-involve-id',
|
||||
firstName: 'fake-involve-name',
|
||||
lastName: 'fake-involve-last',
|
||||
@@ -49,7 +48,6 @@ describe('PeopleComponent', () => {
|
||||
let activitiPeopleComponent: PeopleComponent;
|
||||
let fixture: ComponentFixture<PeopleComponent>;
|
||||
let element: HTMLElement;
|
||||
let componentHandler;
|
||||
let userArray = [fakeUser, fakeSecondUser];
|
||||
let logService: LogService;
|
||||
|
||||
@@ -78,11 +76,6 @@ describe('PeopleComponent', () => {
|
||||
fixture = TestBed.createComponent(PeopleComponent);
|
||||
activitiPeopleComponent = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered'
|
||||
]);
|
||||
|
||||
window['componentHandler'] = componentHandler;
|
||||
|
||||
activitiPeopleComponent.people = [];
|
||||
activitiPeopleComponent.readOnly = true;
|
||||
|
@@ -16,13 +16,12 @@
|
||||
*/
|
||||
|
||||
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation, PeopleProcessService } from 'ng2-alfresco-core';
|
||||
import { LogService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { PeopleProcessService } from 'ng2-alfresco-core';
|
||||
import { Observable, Observer } from 'rxjs/Rx';
|
||||
import { UserEventModel } from '../models/user-event.model';
|
||||
import { PeopleSearchComponent } from './people-search.component';
|
||||
|
||||
declare let componentHandler: any;
|
||||
declare var require: any;
|
||||
|
||||
@Component({
|
||||
@@ -36,7 +35,7 @@ export class PeopleComponent implements OnInit, AfterViewInit {
|
||||
iconImageUrl: string = require('../assets/images/user.jpg');
|
||||
|
||||
@Input()
|
||||
people: LightUserRepresentation[] = [];
|
||||
people: UserProcessModel[] = [];
|
||||
|
||||
@Input()
|
||||
taskId: string = '';
|
||||
@@ -49,28 +48,17 @@ export class PeopleComponent implements OnInit, AfterViewInit {
|
||||
|
||||
showAssignment: boolean = false;
|
||||
|
||||
private peopleSearchObserver: Observer<LightUserRepresentation[]>;
|
||||
peopleSearch$: Observable<LightUserRepresentation[]>;
|
||||
private peopleSearchObserver: Observer<UserProcessModel[]>;
|
||||
peopleSearch$: Observable<UserProcessModel[]>;
|
||||
|
||||
constructor(private logService: LogService, public peopleProcessService: PeopleProcessService) {
|
||||
this.peopleSearch$ = new Observable<LightUserRepresentation[]>(observer => this.peopleSearchObserver = observer).share();
|
||||
this.peopleSearch$ = new Observable<UserProcessModel[]>(observer => this.peopleSearchObserver = observer).share();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.setupMaterialComponents(componentHandler);
|
||||
}
|
||||
|
||||
setupMaterialComponents(handler?: any): boolean {
|
||||
// workaround for MDL issues with dynamic components
|
||||
let isUpgraded: boolean = false;
|
||||
if (handler) {
|
||||
handler.upgradeAllRegistered();
|
||||
isUpgraded = true;
|
||||
}
|
||||
return isUpgraded;
|
||||
}
|
||||
|
||||
involveUserAndCloseSearch() {
|
||||
@@ -92,14 +80,14 @@ export class PeopleComponent implements OnInit, AfterViewInit {
|
||||
}, error => this.logService.error(error));
|
||||
}
|
||||
|
||||
involveUser(user: LightUserRepresentation) {
|
||||
involveUser(user: UserProcessModel) {
|
||||
this.peopleProcessService.involveUserWithTask(this.taskId, user.id.toString())
|
||||
.subscribe(() => {
|
||||
this.people = [...this.people, user];
|
||||
}, error => this.logService.error('Impossible to involve user with task'));
|
||||
}
|
||||
|
||||
removeInvolvedUser(user: LightUserRepresentation) {
|
||||
removeInvolvedUser(user: UserProcessModel) {
|
||||
this.peopleProcessService.removeInvolvedUser(this.taskId, user.id.toString())
|
||||
.subscribe(() => {
|
||||
this.people = this.people.filter((involvedUser) => {
|
||||
|
@@ -129,7 +129,7 @@ describe('StartTaskComponent', () => {
|
||||
|
||||
it('should create new task when start is clicked', () => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
component.appId = 'fakeAppId';
|
||||
component.appId = 42;
|
||||
component.startTaskmodel = new StartTaskModel(startTaskMock);
|
||||
fixture.detectChanges();
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
@@ -139,7 +139,7 @@ describe('StartTaskComponent', () => {
|
||||
|
||||
it('should send on success event when the task is started', () => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
component.appId = 'fakeAppId';
|
||||
component.appId = 42;
|
||||
component.startTaskmodel = new StartTaskModel(startTaskMock);
|
||||
fixture.detectChanges();
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
@@ -154,7 +154,7 @@ describe('StartTaskComponent', () => {
|
||||
|
||||
it('should send on success event when only name is given', () => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
component.appId = 'fakeAppId';
|
||||
component.appId = 42;
|
||||
component.startTaskmodel.name = 'fakeName';
|
||||
fixture.detectChanges();
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
@@ -195,7 +195,7 @@ describe('StartTaskComponent', () => {
|
||||
|
||||
it('should attach form to the task when a form is selected', () => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
component.appId = 'fakeAppId';
|
||||
component.appId = 42;
|
||||
component.startTaskmodel = new StartTaskModel(startTaskMock);
|
||||
component.formKey = 1204;
|
||||
fixture.detectChanges();
|
||||
@@ -211,7 +211,7 @@ describe('StartTaskComponent', () => {
|
||||
|
||||
it('should not attach form to the task when a no form is selected', () => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
component.appId = 'fakeAppId';
|
||||
component.appId = 42;
|
||||
component.startTaskmodel = new StartTaskModel(startTaskMock);
|
||||
component.formKey = null;
|
||||
fixture.detectChanges();
|
||||
@@ -256,7 +256,7 @@ describe('StartTaskComponent', () => {
|
||||
|
||||
it('should assign task when an assignee is selected', () => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
component.appId = 'fakeAppId';
|
||||
component.appId = 42;
|
||||
component.startTaskmodel = new StartTaskModel(startTaskMock);
|
||||
component.formKey = 1204;
|
||||
component.assigneeId = testUser.id;
|
||||
@@ -273,7 +273,7 @@ describe('StartTaskComponent', () => {
|
||||
|
||||
it('should not assign task when no assignee is selected', () => {
|
||||
let successSpy = spyOn(component.success, 'emit');
|
||||
component.appId = 'fakeAppId';
|
||||
component.appId = 42;
|
||||
component.formKey = 1204;
|
||||
component.assigneeId = null;
|
||||
component.startTaskmodel = new StartTaskModel(startTaskMock);
|
||||
@@ -385,7 +385,7 @@ describe('StartTaskComponent', () => {
|
||||
expect(testFullname4.trim()).toBe('');
|
||||
});
|
||||
|
||||
it('should emit error when there is an error while creating task', () => {
|
||||
xit('should emit error when there is an error while creating task', () => {
|
||||
let errorSpy = spyOn(component.error, 'emit');
|
||||
spyOn(service, 'createNewTask').and.returnValue(Observable.throw({}));
|
||||
let createTaskButton = <HTMLElement> element.querySelector('#button-start');
|
||||
|
@@ -19,8 +19,8 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } fro
|
||||
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material';
|
||||
import * as moment from 'moment';
|
||||
import { Moment } from 'moment';
|
||||
import { LightUserRepresentation, LogService, MOMENT_DATE_FORMATS,
|
||||
MomentDateAdapter, PeopleProcessService, UserPreferencesService } from 'ng2-alfresco-core';
|
||||
import { LogService, MOMENT_DATE_FORMATS,
|
||||
MomentDateAdapter, PeopleProcessService, UserPreferencesService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { Form } from '../models/form.model';
|
||||
import { StartTaskModel } from '../models/start-task.model';
|
||||
@@ -41,7 +41,7 @@ export class StartTaskComponent implements OnInit {
|
||||
public FORMAT_DATE: string = 'DD/MM/YYYY';
|
||||
|
||||
@Input()
|
||||
appId: string;
|
||||
appId: number;
|
||||
|
||||
@Output()
|
||||
success: EventEmitter<any> = new EventEmitter<any>();
|
||||
@@ -52,7 +52,7 @@ export class StartTaskComponent implements OnInit {
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
people: LightUserRepresentation[] = [];
|
||||
people: UserProcessModel[] = [];
|
||||
|
||||
startTaskmodel: StartTaskModel = new StartTaskModel();
|
||||
|
||||
@@ -90,7 +90,7 @@ export class StartTaskComponent implements OnInit {
|
||||
|
||||
public start(): void {
|
||||
if (this.startTaskmodel.name) {
|
||||
this.startTaskmodel.category = this.appId;
|
||||
this.startTaskmodel.category = this.appId.toString();
|
||||
this.taskService.createNewTask(new TaskDetailsModel(this.startTaskmodel))
|
||||
.switchMap((createRes: any) =>
|
||||
this.attachForm(createRes.id, this.formKey).defaultIfEmpty(createRes)
|
||||
@@ -148,7 +148,7 @@ export class StartTaskComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
public isUserNameEmpty(user: LightUserRepresentation): boolean {
|
||||
public isUserNameEmpty(user: UserProcessModel): boolean {
|
||||
return !user || (this.isEmpty(user.firstName) && this.isEmpty(user.lastName));
|
||||
}
|
||||
|
||||
|
@@ -27,11 +27,8 @@ import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
import { TaskAttachmentListComponent } from './task-attachment-list.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('TaskAttachmentList', () => {
|
||||
|
||||
let componentHandler: any;
|
||||
let component: TaskAttachmentListComponent;
|
||||
let fixture: ComponentFixture<TaskAttachmentListComponent>;
|
||||
let service: ActivitiContentService;
|
||||
@@ -113,11 +110,6 @@ describe('TaskAttachmentList', () => {
|
||||
blobObj
|
||||
));
|
||||
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered',
|
||||
'upgradeElement'
|
||||
]);
|
||||
window['componentHandler'] = componentHandler;
|
||||
});
|
||||
|
||||
it('should load attachments when taskId specified', () => {
|
||||
|
@@ -110,7 +110,7 @@ export class TaskAttachmentListComponent implements OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
private deleteAttachmentById(contentId: string) {
|
||||
private deleteAttachmentById(contentId: number) {
|
||||
if (contentId) {
|
||||
this.activitiContentService.deleteRelatedContent(contentId).subscribe(
|
||||
(res: any) => {
|
||||
|
@@ -22,10 +22,9 @@ import { By } from '@angular/platform-browser';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
import { ActivitiFormModule, FormModel, FormOutcomeEvent, FormOutcomeModel, FormService } from 'ng2-activiti-form';
|
||||
import { AppConfigService, CoreModule, LogService, TranslationService } from 'ng2-alfresco-core';
|
||||
import { AppConfigService, CommentProcessService, CoreModule, LogService, TranslationService } from 'ng2-alfresco-core';
|
||||
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { PeopleProcessService } from 'ng2-alfresco-core';
|
||||
import { PeopleProcessService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
@@ -36,7 +35,7 @@ import { TaskDetailsComponent } from './task-details.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
const fakeUser: LightUserRepresentation = new LightUserRepresentation({
|
||||
const fakeUser: UserProcessModel = new UserProcessModel({
|
||||
id: 'fake-id',
|
||||
firstName: 'fake-name',
|
||||
lastName: 'fake-last',
|
||||
@@ -45,7 +44,6 @@ const fakeUser: LightUserRepresentation = new LightUserRepresentation({
|
||||
|
||||
describe('TaskDetailsComponent', () => {
|
||||
|
||||
let componentHandler: any;
|
||||
let service: TaskListService;
|
||||
let formService: FormService;
|
||||
let component: TaskDetailsComponent;
|
||||
@@ -57,6 +55,7 @@ describe('TaskDetailsComponent', () => {
|
||||
let getFormTaskSpy: jasmine.Spy;
|
||||
let completeTaskSpy: jasmine.Spy;
|
||||
let logService: LogService;
|
||||
let commentProcessService: CommentProcessService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -74,7 +73,8 @@ describe('TaskDetailsComponent', () => {
|
||||
TaskListService,
|
||||
PeopleProcessService,
|
||||
{provide: TranslationService, useClass: TranslationMock},
|
||||
{provide: AppConfigService, useClass: AppConfigServiceMock}
|
||||
{provide: AppConfigService, useClass: AppConfigServiceMock},
|
||||
CommentProcessService
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents();
|
||||
@@ -89,6 +89,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
service = fixture.debugElement.injector.get(TaskListService);
|
||||
formService = fixture.debugElement.injector.get(FormService);
|
||||
commentProcessService = TestBed.get(CommentProcessService);
|
||||
|
||||
getTaskDetailsSpy = spyOn(service, 'getTaskDetails').and.returnValue(Observable.of(taskDetailsMock));
|
||||
getFormSpy = spyOn(formService, 'getTaskForm').and.returnValue(Observable.of(taskFormMock));
|
||||
@@ -98,14 +99,9 @@ describe('TaskDetailsComponent', () => {
|
||||
getTasksSpy = spyOn(service, 'getTasks').and.returnValue(Observable.of(tasksMock));
|
||||
assignTaskSpy = spyOn(service, 'assignTask').and.returnValue(Observable.of(fakeUser));
|
||||
completeTaskSpy = spyOn(service, 'completeTask').and.returnValue(Observable.of({}));
|
||||
spyOn(service, 'getComments').and.returnValue(Observable.of(noDataMock));
|
||||
spyOn(commentProcessService, 'getTaskComments').and.returnValue(Observable.of(noDataMock));
|
||||
spyOn(service, 'getTaskChecklist').and.returnValue(Observable.of(noDataMock));
|
||||
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered',
|
||||
'upgradeElement'
|
||||
]);
|
||||
window['componentHandler'] = componentHandler;
|
||||
});
|
||||
|
||||
it('should load task details when taskId specified', () => {
|
||||
@@ -293,7 +289,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.ngOnChanges({'taskId': new SimpleChange('123', '456', true)});
|
||||
component.taskPeople = [];
|
||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
||||
component.taskDetails.endDate = '2017-10-03T17:03:57.311+0000';
|
||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||
|
||||
fixture.detectChanges();
|
||||
expect((component.activiticomments as any).nativeElement.readOnly).toBe(true);
|
||||
@@ -305,7 +301,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.ngOnChanges({'taskId': new SimpleChange('123', '456', true)});
|
||||
component.taskPeople = [];
|
||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
||||
component.taskDetails.endDate = '2017-10-03T17:03:57.311+0000';
|
||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||
|
||||
fixture.detectChanges();
|
||||
expect((component.activiticomments as any).nativeElement.readOnly).toBe(true);
|
||||
@@ -329,7 +325,7 @@ describe('TaskDetailsComponent', () => {
|
||||
component.ngOnChanges({'taskId': new SimpleChange('123', '456', true)});
|
||||
component.taskPeople = [fakeUser];
|
||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
||||
component.taskDetails.endDate = '2017-10-03T17:03:57.311+0000';
|
||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||
|
||||
fixture.detectChanges();
|
||||
expect((component.activiticomments as any).nativeElement.readOnly).toBe(false);
|
||||
|
@@ -27,8 +27,8 @@ import { Component,
|
||||
} from '@angular/core';
|
||||
import { MatDialog, MatDialogRef } from '@angular/material';
|
||||
import { ContentLinkModel, FormFieldValidator, FormModel, FormOutcomeEvent } from 'ng2-activiti-form';
|
||||
import { PeopleProcessService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { AlfrescoAuthenticationService, CardViewUpdateService, ClickNotification, LogService, UpdateNotification } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation, PeopleProcessService } from 'ng2-alfresco-core';
|
||||
import { Observable, Observer } from 'rxjs/Rx';
|
||||
import { TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
@@ -131,16 +131,16 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
|
||||
taskDetails: TaskDetailsModel;
|
||||
taskFormName: string = null;
|
||||
|
||||
taskPeople: LightUserRepresentation[] = [];
|
||||
taskPeople: UserProcessModel[] = [];
|
||||
|
||||
noTaskDetailsTemplateComponent: TemplateRef<any>;
|
||||
|
||||
showAssignee: boolean = false;
|
||||
|
||||
private peopleSearchObserver: Observer<LightUserRepresentation[]>;
|
||||
private peopleSearchObserver: Observer<UserProcessModel[]>;
|
||||
public errorDialogRef: MatDialogRef<TemplateRef<any>>;
|
||||
|
||||
peopleSearch$: Observable<LightUserRepresentation[]>;
|
||||
peopleSearch$: Observable<UserProcessModel[]>;
|
||||
|
||||
constructor(private activitiTaskList: TaskListService,
|
||||
private authService: AlfrescoAuthenticationService,
|
||||
@@ -148,7 +148,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
|
||||
private logService: LogService,
|
||||
private cardViewUpdateService: CardViewUpdateService,
|
||||
private dialog: MatDialog) {
|
||||
this.peopleSearch$ = new Observable<LightUserRepresentation[]>(observer => this.peopleSearchObserver = observer).share();
|
||||
this.peopleSearch$ = new Observable<UserProcessModel[]>(observer => this.peopleSearchObserver = observer).share();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -234,7 +234,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
|
||||
this.readOnlyForm = this.readOnlyForm ? this.readOnlyForm : !!(endDate && !isNaN(endDate.getTime()));
|
||||
if (this.taskDetails && this.taskDetails.involvedPeople) {
|
||||
this.taskDetails.involvedPeople.forEach((user) => {
|
||||
this.taskPeople.push(new LightUserRepresentation(user));
|
||||
this.taskPeople.push(new UserProcessModel(user));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -347,7 +347,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
|
||||
this.showAssignee = false;
|
||||
}
|
||||
|
||||
assignTaskToUser(selectedUser: LightUserRepresentation) {
|
||||
assignTaskToUser(selectedUser: UserProcessModel) {
|
||||
this.activitiTaskList.assignTask(this.taskDetails.id, selectedUser).subscribe(
|
||||
(res: any) => {
|
||||
this.logService.info('Task Assigned to ' + selectedUser.email);
|
||||
|
@@ -17,8 +17,7 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
|
||||
import { AppConfigService, AppsProcessService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
import { FilterParamsModel, FilterRepresentationModel } from '../models/filter.model';
|
||||
@@ -28,6 +27,7 @@ import { TaskFiltersComponent } from './task-filters.component';
|
||||
describe('TaskFiltersComponent', () => {
|
||||
|
||||
let activitiService: TaskListService;
|
||||
let appsProcessService: AppsProcessService;
|
||||
|
||||
let fakeGlobalFilter = [];
|
||||
fakeGlobalFilter.push(new FilterRepresentationModel({
|
||||
@@ -46,11 +46,6 @@ describe('TaskFiltersComponent', () => {
|
||||
filter: { state: 'open', assignment: 'fake-assignee' }
|
||||
}));
|
||||
|
||||
let fakeFilter = new FilterRepresentationModel({
|
||||
name: 'FakeMyTasks1',
|
||||
filter: { state: 'open', assignment: 'fake-assignee' }
|
||||
});
|
||||
|
||||
let fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
|
||||
resolve(fakeGlobalFilter);
|
||||
});
|
||||
@@ -90,6 +85,7 @@ describe('TaskFiltersComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
|
||||
activitiService = TestBed.get(TaskListService);
|
||||
appsProcessService = TestBed.get(AppsProcessService);
|
||||
});
|
||||
|
||||
it('should emit an error with a bad response', (done) => {
|
||||
@@ -106,20 +102,6 @@ describe('TaskFiltersComponent', () => {
|
||||
|
||||
});
|
||||
|
||||
it('should emit an error with a bad response', (done) => {
|
||||
spyOn(activitiService, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
|
||||
|
||||
const appId = 'fake-app';
|
||||
let change = new SimpleChange(null, appId, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
component.onError.subscribe((err) => {
|
||||
expect(err).toBeDefined();
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('should return the filter task list', (done) => {
|
||||
spyOn(activitiService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
|
||||
const appId = '1';
|
||||
@@ -145,14 +127,14 @@ describe('TaskFiltersComponent', () => {
|
||||
resolve({});
|
||||
});
|
||||
|
||||
spyOn(activitiService, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeDeployedApplicationsPromise));
|
||||
spyOn(appsProcessService, 'getDeployedApplicationsByName').and.returnValue(Observable.fromPromise(fakeDeployedApplicationsPromise));
|
||||
spyOn(activitiService, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
|
||||
|
||||
let change = new SimpleChange(null, 'test', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
|
||||
component.onSuccess.subscribe((res) => {
|
||||
let deployApp: any = activitiService.getDeployedApplications;
|
||||
let deployApp: any = appsProcessService.getDeployedApplicationsByName;
|
||||
expect(deployApp.calls.count()).toEqual(1);
|
||||
expect(res).toBeDefined();
|
||||
done();
|
||||
@@ -320,20 +302,6 @@ describe('TaskFiltersComponent', () => {
|
||||
expect(component.getFiltersByAppId).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should change the current filter if a filter with taskid is found', async(() => {
|
||||
spyOn(activitiService, 'isTaskRelatedToFilter').and.returnValue(Observable.of(fakeFilter));
|
||||
component.filters = fakeGlobalFilter;
|
||||
component.selectFilterWithTask('111');
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.currentFilter.landingTaskId).toBeDefined();
|
||||
expect(component.currentFilter.landingTaskId).toBe('111');
|
||||
});
|
||||
|
||||
}));
|
||||
|
||||
it('should not change the current filter if no filter with taskid is found', async(() => {
|
||||
let filter = new FilterRepresentationModel({
|
||||
name: 'FakeMyTasks',
|
||||
|
@@ -16,12 +16,13 @@
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { AppsProcessService } from 'ng2-alfresco-core';
|
||||
import { Observable, Observer } from 'rxjs/Rx';
|
||||
import { FilterParamsModel, FilterRepresentationModel } from '../models/filter.model';
|
||||
import { TaskListService } from './../services/tasklist.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-filters, activiti-filters',
|
||||
selector: 'adf-filters, taskListService-filters',
|
||||
templateUrl: './task-filters.component.html',
|
||||
styleUrls: ['task-filters.component.scss']
|
||||
})
|
||||
@@ -40,7 +41,7 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
|
||||
onError: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
@Input()
|
||||
appId: string;
|
||||
appId: number;
|
||||
|
||||
@Input()
|
||||
appName: string;
|
||||
@@ -55,7 +56,7 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
|
||||
|
||||
filters: FilterRepresentationModel [] = [];
|
||||
|
||||
constructor(private activiti: TaskListService) {
|
||||
constructor(private taskListService: TaskListService, private appsProcessService: AppsProcessService) {
|
||||
this.filter$ = new Observable<FilterRepresentationModel>(observer => this.filterObserver = observer).share();
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
|
||||
* @param appId
|
||||
* @param appName
|
||||
*/
|
||||
getFilters(appId?: string, appName?: string) {
|
||||
getFilters(appId?: number, appName?: string) {
|
||||
if (appName) {
|
||||
this.getFiltersByAppName(appName);
|
||||
} else {
|
||||
@@ -97,11 +98,11 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
|
||||
* Return the filter list filtered by appId
|
||||
* @param appId - optional
|
||||
*/
|
||||
getFiltersByAppId(appId?: string) {
|
||||
this.activiti.getTaskListFilters(appId).subscribe(
|
||||
getFiltersByAppId(appId?: number) {
|
||||
this.taskListService.getTaskListFilters(appId).subscribe(
|
||||
(res: FilterRepresentationModel[]) => {
|
||||
if (res.length === 0 && this.isFilterListEmpty()) {
|
||||
this.activiti.createDefaultFilters(appId).subscribe(
|
||||
this.taskListService.createDefaultFilters(appId).subscribe(
|
||||
(resDefault: FilterRepresentationModel[]) => {
|
||||
this.resetFilter();
|
||||
resDefault.forEach((filter) => {
|
||||
@@ -136,7 +137,7 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
|
||||
* @param appName
|
||||
*/
|
||||
getFiltersByAppName(appName: string) {
|
||||
this.activiti.getDeployedApplications(appName).subscribe(
|
||||
this.appsProcessService.getDeployedApplicationsByName(appName).subscribe(
|
||||
application => {
|
||||
this.getFiltersByAppId(application.id);
|
||||
this.selectTaskFilter(this.filterParam, this.filters);
|
||||
@@ -157,7 +158,7 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
|
||||
|
||||
public selectFilterWithTask(taskId: string) {
|
||||
let filteredFilterList: FilterRepresentationModel[] = [];
|
||||
this.activiti.getFilterForTaskById(taskId, this.filters).subscribe(
|
||||
this.taskListService.getFilterForTaskById(taskId, this.filters).subscribe(
|
||||
(filter: FilterRepresentationModel) => {
|
||||
filteredFilterList.push(filter);
|
||||
},
|
||||
@@ -167,7 +168,6 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
|
||||
() => {
|
||||
if (filteredFilterList.length > 0) {
|
||||
this.selectTaskFilter(new FilterParamsModel({name: 'My Tasks'}), filteredFilterList);
|
||||
this.currentFilter.landingTaskId = taskId;
|
||||
this.filterClick.emit(this.currentFilter);
|
||||
}
|
||||
});
|
||||
@@ -181,7 +181,8 @@ export class TaskFiltersComponent implements OnInit, OnChanges {
|
||||
if (filterParam) {
|
||||
filteredFilterList.filter((taskFilter: FilterRepresentationModel, index) => {
|
||||
if (filterParam.name && filterParam.name.toLowerCase() === taskFilter.name.toLowerCase() ||
|
||||
filterParam.id === taskFilter.id || filterParam.index === index) {
|
||||
filterParam.id === taskFilter.id.toString()
|
||||
|| filterParam.index === index) {
|
||||
findTaskFilter = taskFilter;
|
||||
}
|
||||
});
|
||||
|
@@ -18,12 +18,11 @@
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AppConfigService, CardViewUpdateService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { AppConfigService, CardViewUpdateService, CoreModule, TranslationService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
|
||||
import { LightUserRepresentation } from '../../../ng2-alfresco-core/src/models/user-process.model';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { taskDetailsMock } from './../assets/task-details.mock';
|
||||
import { TaskListService } from './../services/tasklist.service';
|
||||
@@ -32,7 +31,6 @@ import { TaskHeaderComponent } from './task-header.component';
|
||||
describe('TaskHeaderComponent', () => {
|
||||
|
||||
let service: TaskListService;
|
||||
let componentHandler: any;
|
||||
let component: TaskHeaderComponent;
|
||||
let fixture: ComponentFixture<TaskHeaderComponent>;
|
||||
let debugElement: DebugElement;
|
||||
@@ -62,12 +60,6 @@ describe('TaskHeaderComponent', () => {
|
||||
debugElement = fixture.debugElement;
|
||||
|
||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
||||
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered',
|
||||
'upgradeElement'
|
||||
]);
|
||||
window['componentHandler'] = componentHandler;
|
||||
});
|
||||
|
||||
it('should render empty component if no task details provided', () => {
|
||||
@@ -107,7 +99,7 @@ describe('TaskHeaderComponent', () => {
|
||||
});
|
||||
|
||||
it('should set editable to false if the task has already completed', () => {
|
||||
component.taskDetails.endDate = '05/05/2002';
|
||||
component.taskDetails.endDate = new Date('05/05/2002');
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -139,7 +131,7 @@ describe('TaskHeaderComponent', () => {
|
||||
|
||||
describe('Unclaim', () => {
|
||||
|
||||
const batman = new LightUserRepresentation({ id : 1, email: 'bruce.wayne@gotham.com', firstName: 'Bruce', lastName: 'Wayne', userImage: 'batman.jpg' });
|
||||
const batman = new UserProcessModel({ id : 1, email: 'bruce.wayne@gotham.com', firstName: 'Bruce', lastName: 'Wayne', userImage: 'batman.jpg' });
|
||||
let taskListService;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -176,7 +168,7 @@ describe('TaskHeaderComponent', () => {
|
||||
});
|
||||
|
||||
it('should display due date', () => {
|
||||
component.taskDetails.dueDate = '2016-11-03';
|
||||
component.taskDetails.dueDate = new Date('2016-11-03');
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
let valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-dueDate"] .adf-property-value'));
|
||||
|
@@ -84,7 +84,6 @@ describe('TaskListComponent', () => {
|
||||
error: 'wrong request'
|
||||
};
|
||||
|
||||
let componentHandler: any;
|
||||
let component: TaskListComponent;
|
||||
let fixture: ComponentFixture<TaskListComponent>;
|
||||
let taskListService: TaskListService;
|
||||
@@ -116,11 +115,6 @@ describe('TaskListComponent', () => {
|
||||
|
||||
taskListService = TestBed.get(TaskListService);
|
||||
|
||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||
'upgradeAllRegistered',
|
||||
'upgradeElement'
|
||||
]);
|
||||
window['componentHandler'] = componentHandler;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -36,7 +36,7 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
|
||||
@ContentChild(DataColumnListComponent) columnList: DataColumnListComponent;
|
||||
|
||||
@Input()
|
||||
appId: string;
|
||||
appId: number;
|
||||
|
||||
@Input()
|
||||
processInstanceId: string;
|
||||
|
@@ -1,39 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* This object represent the comment of a task.
|
||||
*
|
||||
*
|
||||
* @returns {Comment} .
|
||||
*/
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
|
||||
export class Comment {
|
||||
id: number;
|
||||
message: string;
|
||||
created: string;
|
||||
createdBy: LightUserRepresentation;
|
||||
|
||||
constructor(id: number, message: string, created: string, createdBy: LightUserRepresentation) {
|
||||
this.id = id;
|
||||
this.message = message;
|
||||
this.created = created;
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
}
|
@@ -15,13 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* This object represent the app definition.
|
||||
*
|
||||
*
|
||||
* @returns {AppDefinitionRepresentationModel} .
|
||||
*/
|
||||
import { TaskQueryRequestRepresentation, UserTaskFilterRepresentation } from 'alfresco-js-api';
|
||||
|
||||
export class AppDefinitionRepresentationModel {
|
||||
defaultAppId: string;
|
||||
deploymentId: string;
|
||||
@@ -36,25 +31,18 @@ export class AppDefinitionRepresentationModel {
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
this.defaultAppId = obj.defaultAppId ? obj.defaultAppId : null;
|
||||
this.deploymentId = obj.deploymentId ? obj.deploymentId : null;
|
||||
this.name = obj.name ? obj.name : null;
|
||||
this.description = obj.description ? obj.description : null;
|
||||
this.theme = obj.theme ? obj.theme : null;
|
||||
this.icon = obj.icon ? obj.icon : null;
|
||||
this.id = obj.id ? obj.id : null;
|
||||
this.modelId = obj.modelId ? obj.modelId : null;
|
||||
this.tenantId = obj.tenantId ? obj.tenantId : null;
|
||||
this.deploymentId = obj.deploymentId ? obj.deploymentId : null;
|
||||
this.name = obj.name ? obj.name : null;
|
||||
this.description = obj.description ? obj.description : null;
|
||||
this.theme = obj.theme ? obj.theme : null;
|
||||
this.icon = obj.icon ? obj.icon : null;
|
||||
this.id = obj.id ? obj.id : null;
|
||||
this.modelId = obj.modelId ? obj.modelId : null;
|
||||
this.tenantId = obj.tenantId ? obj.tenantId : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This object represent the parameters to filter a filter.
|
||||
*
|
||||
*
|
||||
* @returns {FilterParamsModel} .
|
||||
*/
|
||||
export class FilterParamsModel {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -69,22 +57,14 @@ export class FilterParamsModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This object represent the filter.
|
||||
*
|
||||
*
|
||||
* @returns {FilterRepresentationModel} .
|
||||
*/
|
||||
export class FilterRepresentationModel {
|
||||
id: string;
|
||||
appId: string;
|
||||
export class FilterRepresentationModel implements UserTaskFilterRepresentation {
|
||||
id: number;
|
||||
appId: number;
|
||||
name: string;
|
||||
recent: boolean;
|
||||
icon: string;
|
||||
filter: FilterParamRepresentationModel;
|
||||
index: number;
|
||||
landingTaskId: string;
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
@@ -95,7 +75,6 @@ export class FilterRepresentationModel {
|
||||
this.icon = obj.icon || null;
|
||||
this.filter = new FilterParamRepresentationModel(obj.filter);
|
||||
this.index = obj.index;
|
||||
this.landingTaskId = obj.landingTaskId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,13 +83,6 @@ export class FilterRepresentationModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This object represent the parameters of a filter.
|
||||
*
|
||||
*
|
||||
* @returns {FilterParamRepresentationModel} .
|
||||
*/
|
||||
export class FilterParamRepresentationModel {
|
||||
processDefinitionId: string;
|
||||
processDefinitionKey: string;
|
||||
@@ -135,7 +107,7 @@ export class FilterParamRepresentationModel {
|
||||
}
|
||||
}
|
||||
|
||||
export class TaskQueryRequestRepresentationModel {
|
||||
export class TaskQueryRequestRepresentationModel implements TaskQueryRequestRepresentation {
|
||||
appDefinitionId: string;
|
||||
processInstanceId: string;
|
||||
processDefinitionId: string;
|
||||
|
@@ -22,13 +22,13 @@
|
||||
*
|
||||
* @returns {StartTaskModel} .
|
||||
*/
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { UserProcessModel } from 'ng2-alfresco-core';
|
||||
|
||||
export class StartTaskModel {
|
||||
|
||||
name: string;
|
||||
description: string;
|
||||
assignee: LightUserRepresentation;
|
||||
assignee: UserProcessModel;
|
||||
dueDate: any;
|
||||
formKey: any;
|
||||
category: string;
|
||||
@@ -36,7 +36,7 @@ export class StartTaskModel {
|
||||
constructor(obj?: any) {
|
||||
this.name = obj && obj.name || null;
|
||||
this.description = obj && obj.description || null;
|
||||
this.assignee = obj && obj.assignee ? new LightUserRepresentation(obj.assignee) : null;
|
||||
this.assignee = obj && obj.assignee ? new UserProcessModel(obj.assignee) : null;
|
||||
this.dueDate = obj && obj.dueDate || null;
|
||||
this.formKey = obj && obj.formKey || null;
|
||||
this.category = obj && obj.category || null;
|
||||
|
@@ -22,27 +22,28 @@
|
||||
*
|
||||
* @returns {TaskDetailsModel} .
|
||||
*/
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { TaskRepresentation } from 'alfresco-js-api';
|
||||
import { UserProcessModel } from 'ng2-alfresco-core';
|
||||
|
||||
export class TaskDetailsModel {
|
||||
export class TaskDetailsModel implements TaskRepresentation {
|
||||
id: string;
|
||||
name: string;
|
||||
assignee: LightUserRepresentation;
|
||||
assignee: UserProcessModel;
|
||||
priority: number;
|
||||
adhocTaskCanBeReassigned: number;
|
||||
adhocTaskCanBeReassigned: boolean;
|
||||
category: string;
|
||||
created: string;
|
||||
created: Date;
|
||||
description: string;
|
||||
dueDate: string;
|
||||
duration: string;
|
||||
endDate: string;
|
||||
dueDate: Date;
|
||||
duration: number;
|
||||
endDate: Date;
|
||||
executionId: string;
|
||||
formKey: string;
|
||||
initiatorCanCompleteTask: boolean;
|
||||
managerOfCandidateGroup: boolean;
|
||||
memberOfCandidateGroup: boolean;
|
||||
memberOfCandidateUsers: boolean;
|
||||
involvedPeople: LightUserRepresentation [];
|
||||
involvedPeople: UserProcessModel [];
|
||||
parentTaskId: string;
|
||||
parentTaskName: string;
|
||||
processDefinitionCategory: string;
|
||||
@@ -62,7 +63,7 @@ export class TaskDetailsModel {
|
||||
this.id = obj.id || null;
|
||||
this.name = obj.name || null;
|
||||
this.priority = obj.priority;
|
||||
this.assignee = obj.assignee ? new LightUserRepresentation(obj.assignee) : null;
|
||||
this.assignee = obj.assignee ? new UserProcessModel(obj.assignee) : null;
|
||||
this.adhocTaskCanBeReassigned = obj.adhocTaskCanBeReassigned;
|
||||
this.category = obj.category || null;
|
||||
this.created = obj.created || null;
|
||||
|
@@ -16,14 +16,12 @@
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, CoreModule, TranslationService } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { AppConfigService, CoreModule, TranslationService, UserProcessModel } from 'ng2-alfresco-core';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { AppConfigServiceMock } from '../assets/app-config.service.mock';
|
||||
import {
|
||||
fakeAppFilter,
|
||||
fakeAppPromise,
|
||||
fakeApps,
|
||||
fakeErrorTaskList,
|
||||
fakeFilter,
|
||||
fakeFilters,
|
||||
@@ -34,13 +32,11 @@ import {
|
||||
fakeTaskList,
|
||||
fakeTaskListDifferentProcessDefinitionKey,
|
||||
fakeTasksChecklist,
|
||||
fakeTasksComment,
|
||||
fakeUser1,
|
||||
fakeUser2,
|
||||
secondFakeTaskList
|
||||
} from '../assets/tasklist-service.mock';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
import { Comment } from '../models/comment.model';
|
||||
import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListService } from './tasklist.service';
|
||||
@@ -139,7 +135,7 @@ describe('Activiti TaskList Service', () => {
|
||||
it('should call the api withthe appId', (done) => {
|
||||
spyOn(service, 'callApiTaskFilters').and.returnValue((fakeAppPromise));
|
||||
|
||||
let appId = '1';
|
||||
let appId = 1;
|
||||
service.getTaskListFilters(appId).subscribe(
|
||||
(res) => {
|
||||
expect(service.callApiTaskFilters).toHaveBeenCalledWith(appId);
|
||||
@@ -149,7 +145,7 @@ describe('Activiti TaskList Service', () => {
|
||||
});
|
||||
|
||||
it('should return the app filter by id', (done) => {
|
||||
let appId = '1';
|
||||
let appId = 1;
|
||||
service.getTaskListFilters(appId).subscribe(
|
||||
(res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -359,24 +355,6 @@ describe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the tasks comments ', (done) => {
|
||||
service.getComments('999').subscribe(
|
||||
(res: Comment[]) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(2);
|
||||
expect(res[0].message).toEqual('fake-message-1');
|
||||
expect(res[1].message).toEqual('fake-message-2');
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(fakeTasksComment)
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the tasks checklists ', (done) => {
|
||||
service.getTaskChecklist('999').subscribe(
|
||||
(res: TaskDetailsModel[]) => {
|
||||
@@ -446,31 +424,6 @@ describe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should add a comment task ', (done) => {
|
||||
service.addComment('999', 'fake-comment-message').subscribe(
|
||||
(res: Comment) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.id).not.toEqual('');
|
||||
expect(res.message).toEqual('fake-comment-message');
|
||||
expect(res.created).not.toEqual('');
|
||||
expect(res.createdBy.email).toEqual('fake-email@dom.com');
|
||||
expect(res.createdBy.firstName).toEqual('firstName');
|
||||
expect(res.createdBy.lastName).toEqual('lastName');
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify({
|
||||
id: '111', message: 'fake-comment-message',
|
||||
createdBy: fakeUser1,
|
||||
created: '2016-07-15T11:19:17.440+0000'
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should complete the task ', (done) => {
|
||||
service.completeTask('999').subscribe(
|
||||
(res: any) => {
|
||||
@@ -504,7 +457,7 @@ describe('Activiti TaskList Service', () => {
|
||||
});
|
||||
|
||||
it('should return the default filters', (done) => {
|
||||
service.createDefaultFilters('1234').subscribe(
|
||||
service.createDefaultFilters(1234).subscribe(
|
||||
(res: FilterRepresentationModel []) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(4);
|
||||
@@ -574,65 +527,6 @@ describe('Activiti TaskList Service', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should get the deployed apps ', (done) => {
|
||||
service.getDeployedApplications().subscribe(
|
||||
(res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.length).toEqual(2);
|
||||
expect(res[0].name).toEqual('Sales-Fakes-App');
|
||||
expect(res[0].description).toEqual('desc-fake1');
|
||||
expect(res[0].deploymentId).toEqual('111');
|
||||
expect(res[1].name).toEqual('health-care-Fake');
|
||||
expect(res[1].description).toEqual('desc-fake2');
|
||||
expect(res[1].deploymentId).toEqual('444');
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(fakeApps)
|
||||
});
|
||||
});
|
||||
|
||||
it('should get the filter deployed app ', (done) => {
|
||||
let name = 'health-care-Fake';
|
||||
service.getDeployedApplications(name).subscribe(
|
||||
(res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res.name).toEqual('health-care-Fake');
|
||||
expect(res.description).toEqual('desc-fake2');
|
||||
expect(res.deploymentId).toEqual('444');
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(fakeApps)
|
||||
});
|
||||
});
|
||||
|
||||
it('should get the deployed app details by id ', (done) => {
|
||||
service.getApplicationDetailsById(1).subscribe(
|
||||
(app: any) => {
|
||||
expect(app).toBeDefined();
|
||||
expect(app.name).toEqual('Sales-Fakes-App');
|
||||
expect(app.description).toEqual('desc-fake1');
|
||||
expect(app.deploymentId).toEqual('111');
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
'status': 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(fakeApps)
|
||||
});
|
||||
});
|
||||
|
||||
it('should create a new standalone task ', (done) => {
|
||||
let taskFake = new TaskDetailsModel({
|
||||
name: 'FakeNameTask',
|
||||
@@ -677,8 +571,11 @@ describe('Activiti TaskList Service', () => {
|
||||
expect(res.category).toEqual('3');
|
||||
expect(res.created).not.toEqual('');
|
||||
expect(res.adhocTaskCanBeReassigned).toBe(true);
|
||||
expect(res.assignee).toEqual(new LightUserRepresentation(fakeUser2));
|
||||
expect(res.involvedPeople).toEqual([fakeUser1]);
|
||||
expect(res.assignee).toEqual(new UserProcessModel(fakeUser2));
|
||||
expect(res.involvedPeople[0].email).toEqual(fakeUser1.email);
|
||||
expect(res.involvedPeople[0].firstName).toEqual(fakeUser1.firstName);
|
||||
expect(res.involvedPeople[0].lastName).toEqual(fakeUser1.lastName);
|
||||
expect(res.involvedPeople[0].id).toEqual(fakeUser1.id);
|
||||
done();
|
||||
}
|
||||
);
|
||||
@@ -710,8 +607,9 @@ describe('Activiti TaskList Service', () => {
|
||||
expect(res.category).toEqual('3');
|
||||
expect(res.created).not.toEqual('');
|
||||
expect(res.adhocTaskCanBeReassigned).toBe(true);
|
||||
expect(res.assignee).toEqual(new LightUserRepresentation(fakeUser2));
|
||||
expect(res.involvedPeople).toEqual([fakeUser1]);
|
||||
expect(res.assignee).toEqual(new UserProcessModel(fakeUser2));
|
||||
expect(res.involvedPeople[0].email).toEqual(fakeUser1.email);
|
||||
expect(res.involvedPeople[0].firstName).toEqual(fakeUser1.firstName);
|
||||
done();
|
||||
}
|
||||
);
|
||||
@@ -813,7 +711,7 @@ describe('Activiti TaskList Service', () => {
|
||||
|
||||
let fakeFilterList: FilterRepresentationModel[] = [];
|
||||
fakeFilterList.push(fakeRepresentationFilter1, fakeRepresentationFilter2);
|
||||
let resultFilter = null;
|
||||
let resultFilter: FilterRepresentationModel = null;
|
||||
service.getFilterForTaskById(taskId, fakeFilterList).subscribe(
|
||||
(res: FilterRepresentationModel) => {
|
||||
resultFilter = res;
|
||||
|
@@ -17,13 +17,8 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlfrescoApiService, LogService } from 'ng2-alfresco-core';
|
||||
import { LightUserRepresentation } from 'ng2-alfresco-core';
|
||||
import { Observable, Subject } from 'rxjs/Rx';
|
||||
import { Comment } from '../models/comment.model';
|
||||
import {
|
||||
FilterRepresentationModel,
|
||||
TaskQueryRequestRepresentationModel
|
||||
} from '../models/filter.model';
|
||||
import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '../models/filter.model';
|
||||
import { Form } from '../models/form.model';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListModel } from '../models/task-list.model';
|
||||
@@ -39,38 +34,11 @@ export class TaskListService {
|
||||
this.tasksList$ = this.tasksListSubject.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the Deployed app
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getDeployedApplications(name?: string): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
|
||||
.map((response: any) => {
|
||||
if (name) {
|
||||
return response.data.find(app => app.name === name);
|
||||
}
|
||||
return response.data;
|
||||
})
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Deployed App details by appId
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getApplicationDetailsById(appId: number): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.appsApi.getAppDefinitions())
|
||||
.map((response: any) => {
|
||||
return response.data.find(app => app.id === appId);
|
||||
})
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the Tasks filters
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getTaskListFilters(appId?: string): Observable<any> {
|
||||
getTaskListFilters(appId?: number): Observable<any> {
|
||||
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
||||
.map((response: any) => {
|
||||
let filters: FilterRepresentationModel[] = [];
|
||||
@@ -88,7 +56,7 @@ export class TaskListService {
|
||||
* @param appId - string - optional - The id of app
|
||||
* @returns {Observable<FilterRepresentationModel>}
|
||||
*/
|
||||
getTaskFilterById(filterId: number, appId?: string): Observable<FilterRepresentationModel> {
|
||||
getTaskFilterById(filterId: number, appId?: number): Observable<FilterRepresentationModel> {
|
||||
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
||||
.map((response: any) => {
|
||||
return response.data.find(filter => filter.id === filterId);
|
||||
@@ -100,7 +68,7 @@ export class TaskListService {
|
||||
* @param taskName - string - The name of the filter
|
||||
* @returns {Observable<FilterRepresentationModel>}
|
||||
*/
|
||||
getTaskFilterByName(taskName: string, appId?: string): Observable<FilterRepresentationModel> {
|
||||
getTaskFilterByName(taskName: string, appId?: number): Observable<FilterRepresentationModel> {
|
||||
return Observable.fromPromise(this.callApiTaskFilters(appId))
|
||||
.map((response: any) => {
|
||||
return response.data.find(filter => filter.name === taskName);
|
||||
@@ -182,8 +150,7 @@ export class TaskListService {
|
||||
if (state) {
|
||||
requestNode.state = state;
|
||||
}
|
||||
return this.getTotalTasks(requestNode).
|
||||
switchMap((res: any) => {
|
||||
return this.getTotalTasks(requestNode).switchMap((res: any) => {
|
||||
requestNode.size = res.total;
|
||||
return this.getTasks(requestNode);
|
||||
});
|
||||
@@ -196,15 +163,15 @@ export class TaskListService {
|
||||
*/
|
||||
findAllTasksWhitoutState(requestNode: TaskQueryRequestRepresentationModel): Observable<TaskListModel> {
|
||||
return Observable.forkJoin(
|
||||
this.findTasksByState(requestNode, 'open'),
|
||||
this.findAllTaskByState(requestNode, 'completed'),
|
||||
(activeTasks: TaskListModel, completedTasks: TaskListModel) => {
|
||||
const tasks = Object.assign({}, activeTasks);
|
||||
tasks.total += completedTasks.total;
|
||||
tasks.data = tasks.data.concat(completedTasks.data);
|
||||
return tasks;
|
||||
}
|
||||
);
|
||||
this.findTasksByState(requestNode, 'open'),
|
||||
this.findAllTaskByState(requestNode, 'completed'),
|
||||
(activeTasks: TaskListModel, completedTasks: TaskListModel) => {
|
||||
const tasks = Object.assign({}, activeTasks);
|
||||
tasks.total += completedTasks.total;
|
||||
tasks.data = tasks.data.concat(completedTasks.data);
|
||||
return tasks;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,32 +179,14 @@ export class TaskListService {
|
||||
* @param id - taskId
|
||||
* @returns {<TaskDetailsModel>}
|
||||
*/
|
||||
getTaskDetails(id: string): Observable<TaskDetailsModel> {
|
||||
return Observable.fromPromise(this.callApiTaskDetails(id))
|
||||
getTaskDetails(taskId: string): Observable<TaskDetailsModel> {
|
||||
return Observable.fromPromise(this.callApiTaskDetails(taskId))
|
||||
.map(res => res)
|
||||
.map((details: any) => {
|
||||
return new TaskDetailsModel(details);
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the task's comments
|
||||
* @param id - taskId
|
||||
* @returns {<Comment[]>}
|
||||
*/
|
||||
getComments(id: string): Observable<Comment[]> {
|
||||
return Observable.fromPromise(this.callApiTaskComments(id))
|
||||
.map(res => res)
|
||||
.map((response: any) => {
|
||||
let comments: Comment[] = [];
|
||||
response.data.forEach((comment) => {
|
||||
let user = new LightUserRepresentation(comment.createdBy);
|
||||
comments.push(new Comment(comment.id, comment.message, comment.created, user));
|
||||
});
|
||||
return comments;
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all the task's checklist
|
||||
* @param id - taskId
|
||||
@@ -277,7 +226,7 @@ export class TaskListService {
|
||||
}
|
||||
|
||||
attachFormToATask(taskId: string, formId: number): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.attachForm(taskId, { 'formId': formId }));
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.attachForm(taskId, {'formId': formId}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,7 +234,7 @@ export class TaskListService {
|
||||
* @param appId
|
||||
* @returns {FilterRepresentationModel[]}
|
||||
*/
|
||||
public createDefaultFilters(appId: string): Observable<FilterRepresentationModel[]> {
|
||||
public createDefaultFilters(appId: number): Observable<FilterRepresentationModel[]> {
|
||||
let involvedTasksFilter = this.getInvolvedTasksFilterInstance(appId);
|
||||
let involvedObservable = this.addFilter(involvedTasksFilter);
|
||||
|
||||
@@ -362,28 +311,13 @@ export class TaskListService {
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a comment to a task
|
||||
* @param id - taskId
|
||||
* @param message - content of the comment
|
||||
* @returns {Comment}
|
||||
*/
|
||||
addComment(id: string, message: string): Observable<Comment> {
|
||||
return Observable.fromPromise(this.callApiAddTaskComment(id, message))
|
||||
.map(res => res)
|
||||
.map((response: Comment) => {
|
||||
return new Comment(response.id, response.message, response.created, response.createdBy);
|
||||
}).catch(err => this.handleError(err));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the task completed
|
||||
* @param id - taskId
|
||||
* @returns {TaskDetailsModel}
|
||||
*/
|
||||
completeTask(id: string) {
|
||||
return Observable.fromPromise(this.callApiCompleteTask(id))
|
||||
completeTask(taskId: string) {
|
||||
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.completeTask(taskId))
|
||||
.map(res => res);
|
||||
}
|
||||
|
||||
@@ -420,7 +354,7 @@ export class TaskListService {
|
||||
* @returns {TaskDetailsModel}
|
||||
*/
|
||||
assignTask(taskId: string, requestNode: any): Observable<TaskDetailsModel> {
|
||||
let assignee = {assignee: requestNode.id} ;
|
||||
let assignee = {assignee: requestNode.id};
|
||||
return Observable.fromPromise(this.callApiAssignTask(taskId, assignee))
|
||||
.map(res => res)
|
||||
.map((response: TaskDetailsModel) => {
|
||||
@@ -429,7 +363,7 @@ export class TaskListService {
|
||||
}
|
||||
|
||||
assignTaskByUserId(taskId: string, userId: number): Observable<TaskDetailsModel> {
|
||||
let assignee = {assignee: userId} ;
|
||||
let assignee = {assignee: userId};
|
||||
return Observable.fromPromise(this.callApiAssignTask(taskId, assignee))
|
||||
.map(res => res)
|
||||
.map((response: TaskDetailsModel) => {
|
||||
@@ -486,24 +420,16 @@ export class TaskListService {
|
||||
return this.apiService.getInstance().activiti.taskApi.listTasks(requestNode);
|
||||
}
|
||||
|
||||
callApiTaskFilters(appId?: string) {
|
||||
callApiTaskFilters(appId?: number) {
|
||||
if (appId) {
|
||||
return this.apiService.getInstance().activiti.userFiltersApi.getUserTaskFilters({ appId: appId });
|
||||
return this.apiService.getInstance().activiti.userFiltersApi.getUserTaskFilters({appId: appId});
|
||||
} else {
|
||||
return this.apiService.getInstance().activiti.userFiltersApi.getUserTaskFilters();
|
||||
}
|
||||
}
|
||||
|
||||
private callApiTaskDetails(id: string) {
|
||||
return this.apiService.getInstance().activiti.taskApi.getTask(id);
|
||||
}
|
||||
|
||||
private callApiTaskComments(id: string) {
|
||||
return this.apiService.getInstance().activiti.taskApi.getTaskComments(id);
|
||||
}
|
||||
|
||||
private callApiAddTaskComment(id: string, message: string) {
|
||||
return this.apiService.getInstance().activiti.taskApi.addTaskComment({ message: message }, id);
|
||||
private callApiTaskDetails(taskId: string) {
|
||||
return this.apiService.getInstance().activiti.taskApi.getTask(taskId);
|
||||
}
|
||||
|
||||
private callApiAddTask(task: TaskDetailsModel) {
|
||||
@@ -518,12 +444,8 @@ export class TaskListService {
|
||||
return this.apiService.getInstance().activiti.userFiltersApi.createUserTaskFilter(filter);
|
||||
}
|
||||
|
||||
private callApiTaskChecklist(id: string) {
|
||||
return this.apiService.getInstance().activiti.taskApi.getChecklist(id);
|
||||
}
|
||||
|
||||
private callApiCompleteTask(id: string) {
|
||||
return this.apiService.getInstance().activiti.taskApi.completeTask(id);
|
||||
private callApiTaskChecklist(taskId: string) {
|
||||
return this.apiService.getInstance().activiti.taskApi.getChecklist(taskId);
|
||||
}
|
||||
|
||||
private callApiCreateTask(task: TaskDetailsModel) {
|
||||
@@ -546,13 +468,13 @@ export class TaskListService {
|
||||
* @param appId
|
||||
* @returns {FilterRepresentationModel}
|
||||
*/
|
||||
getInvolvedTasksFilterInstance(appId: string): FilterRepresentationModel {
|
||||
getInvolvedTasksFilterInstance(appId: number): FilterRepresentationModel {
|
||||
return new FilterRepresentationModel({
|
||||
'name': 'Involved Tasks',
|
||||
'appId': appId,
|
||||
'recent': false,
|
||||
'icon': 'glyphicon-align-left',
|
||||
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'involved' }
|
||||
'filter': {'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'involved'}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -561,13 +483,13 @@ export class TaskListService {
|
||||
* @param appId
|
||||
* @returns {FilterRepresentationModel}
|
||||
*/
|
||||
getMyTasksFilterInstance(appId: string): FilterRepresentationModel {
|
||||
getMyTasksFilterInstance(appId: number): FilterRepresentationModel {
|
||||
return new FilterRepresentationModel({
|
||||
'name': 'My Tasks',
|
||||
'appId': appId,
|
||||
'recent': false,
|
||||
'icon': 'glyphicon-inbox',
|
||||
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'assignee' }
|
||||
'filter': {'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'assignee'}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -576,13 +498,13 @@ export class TaskListService {
|
||||
* @param appId
|
||||
* @returns {FilterRepresentationModel}
|
||||
*/
|
||||
getQueuedTasksFilterInstance(appId: string): FilterRepresentationModel {
|
||||
getQueuedTasksFilterInstance(appId: number): FilterRepresentationModel {
|
||||
return new FilterRepresentationModel({
|
||||
'name': 'Queued Tasks',
|
||||
'appId': appId,
|
||||
'recent': false,
|
||||
'icon': 'glyphicon-record',
|
||||
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'candidate' }
|
||||
'filter': {'sort': 'created-desc', 'name': '', 'state': 'open', 'assignment': 'candidate'}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -591,13 +513,13 @@ export class TaskListService {
|
||||
* @param appId
|
||||
* @returns {FilterRepresentationModel}
|
||||
*/
|
||||
getCompletedTasksFilterInstance(appId: string): FilterRepresentationModel {
|
||||
getCompletedTasksFilterInstance(appId: number): FilterRepresentationModel {
|
||||
return new FilterRepresentationModel({
|
||||
'name': 'Completed Tasks',
|
||||
'appId': appId,
|
||||
'recent': true,
|
||||
'icon': 'glyphicon-ok-sign',
|
||||
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'completed', 'assignment': 'involved' }
|
||||
'filter': {'sort': 'created-desc', 'name': '', 'state': 'completed', 'assignment': 'involved'}
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user