[AAE-10777] Move services from Core in Content the right place (#8242)

Clean core services and directive
This commit is contained in:
Eugenio Romano
2023-03-10 09:28:24 +01:00
committed by GitHub
parent 112e272ce7
commit 2590e7d0a9
263 changed files with 884 additions and 3393 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { ContentService, EmptyListComponent, ThumbnailService } from '@alfresco/adf-core';
import { DownloadService, EmptyListComponent, ThumbnailService } from '@alfresco/adf-core';
import {
AfterContentInit,
ContentChild,
@@ -75,7 +75,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
isLoading: boolean = false;
constructor(private activitiContentService: ProcessContentService,
private contentService: ContentService,
private downloadService: DownloadService,
private thumbnailService: ThumbnailService,
private ngZone: NgZone) {
}
@@ -179,7 +179,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
downloadContent(content: any): void {
this.activitiContentService.getFileRawContent(content.id).subscribe(
(blob: Blob) => this.contentService.downloadBlob(blob, content.name),
(blob: Blob) => this.downloadService.downloadBlob(blob, content.name),
(err) => {
this.error.emit(err);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { ContentService, ThumbnailService, EmptyListComponent } from '@alfresco/adf-core';
import { ThumbnailService, EmptyListComponent, DownloadService } from '@alfresco/adf-core';
import {
AfterContentInit,
ContentChild,
@@ -72,7 +72,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
isLoading: boolean = false;
constructor(private activitiContentService: ProcessContentService,
private contentService: ContentService,
private downloadService: DownloadService,
private thumbnailService: ThumbnailService,
private ngZone: NgZone) {
}
@@ -188,7 +188,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
downloadContent(content: any): void {
this.activitiContentService.getFileRawContent(content.id).subscribe(
(blob: Blob) => this.contentService.downloadBlob(blob, content.name),
(blob: Blob) => this.downloadService.downloadBlob(blob, content.name),
(err) => {
this.error.emit(err);
}

View File

@@ -0,0 +1,18 @@
/*!
* @license
* Copyright 2019 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.
*/
export * from './public-api';

View File

@@ -0,0 +1,66 @@
/*!
* @license
* Copyright 2019 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.
*/
import { UserRepresentation } from '@alfresco/js-api';
export class BpmUserModel implements UserRepresentation {
apps: any;
capabilities: string[];
company: string;
created: Date;
email: string;
externalId: string;
firstName: string;
lastName: string;
fullname: string;
groups: any;
id: number;
lastUpdate: Date;
latestSyncTimeStamp: Date;
password: string;
pictureId: number;
status: string;
tenantId: number;
tenantName: string;
tenantPictureId: number;
type: string;
constructor(input?: any) {
if (input) {
this.apps = input.apps;
this.capabilities = input.capabilities;
this.company = input.company;
this.created = input.created;
this.email = input.email;
this.externalId = input.externalId;
this.firstName = input.firstName;
this.lastName = input.lastName;
this.fullname = input.fullname;
this.groups = input.groups;
this.id = input.id;
this.lastUpdate = input.lastUpdate;
this.latestSyncTimeStamp = input.latestSyncTimeStamp;
this.password = input.password;
this.pictureId = input.pictureId;
this.status = input.status;
this.tenantId = input.tenantId;
this.tenantName = input.tenantName;
this.tenantPictureId = input.tenantPictureId;
this.type = input.type;
}
}
}

View File

@@ -0,0 +1,45 @@
/*!
* @license
* Copyright 2019 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 process service user.*
*/
import { LightUserRepresentation } from '@alfresco/js-api';
export class UserProcessModel implements LightUserRepresentation {
id?: number;
email?: string;
firstName?: string;
lastName?: string;
pictureId?: number;
externalId?: string;
userImage?: string;
constructor(input?: any) {
if (input) {
this.id = input.id;
this.email = input.email || null;
this.firstName = input.firstName || null;
this.lastName = input.lastName || null;
this.pictureId = input.pictureId || null;
this.externalId = input.externalId || null;
this.userImage = input.userImage;
}
}
}

View File

@@ -0,0 +1,21 @@
/*!
* @license
* Copyright 2019 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.
*/
export * from './services/people-process.service';
export * from './models/bpm-user.model';
export * from './models/user-process.model';

View File

@@ -0,0 +1,180 @@
/*!
* @license
* Copyright 2019 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.
*/
import { fakeAsync, TestBed } from '@angular/core/testing';
import { UserProcessModel } from '../models/user-process.model';
import { PeopleProcessService } from './people-process.service';
import { setupTestBed, CoreTestingModule } from '@alfresco/adf-core';
import { TranslateModule } from '@ngx-translate/core';
declare let jasmine: any;
const firstInvolvedUser: UserProcessModel = new UserProcessModel({
id: 1,
email: 'fake-user1@fake.com',
firstName: 'fakeName1',
lastName: 'fakeLast1'
});
const secondInvolvedUser: UserProcessModel = new UserProcessModel({
id: 2,
email: 'fake-user2@fake.com',
firstName: 'fakeName2',
lastName: 'fakeLast2'
});
const fakeInvolveUserList: UserProcessModel[] = [firstInvolvedUser, secondInvolvedUser];
const errorResponse = { error: new Error('Unsuccessful HTTP response') };
describe('PeopleProcessService', () => {
let service: PeopleProcessService;
setupTestBed({
imports: [
TranslateModule.forRoot(),
CoreTestingModule
]
});
beforeEach(() => {
service = TestBed.inject(PeopleProcessService);
});
describe('when user is logged in', () => {
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('should be able to retrieve people to involve in the task', fakeAsync(() => {
service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe(
(users: UserProcessModel[]) => {
expect(users).toBeDefined();
expect(users.length).toBe(2);
expect(users[0].id).toEqual(1);
expect(users[0].email).toEqual('fake-user1@fake.com');
expect(users[0].firstName).toEqual('fakeName1');
expect(users[0].lastName).toEqual('fakeLast1');
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {data: fakeInvolveUserList}
});
}));
it('should be able to get people images for people retrieved', fakeAsync(() => {
service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe(
(users: UserProcessModel[]) => {
expect(users).toBeDefined();
expect(users.length).toBe(2);
expect(service.getUserImage(users[0])).toContain('/users/' + users[0].id + '/picture');
expect(service.getUserImage(users[1])).toContain('/users/' + users[1].id + '/picture');
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {data: fakeInvolveUserList}
});
}));
it('should return user image url', () => {
const url = service.getUserImage(firstInvolvedUser);
expect(url).toContain('/users/' + firstInvolvedUser.id + '/picture');
});
it('should return empty list when there are no users to involve', fakeAsync(() => {
service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe(
(users: UserProcessModel[]) => {
expect(users).toBeDefined();
expect(users.length).toBe(0);
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {}
});
}));
it('getWorkflowUsers catch errors call', fakeAsync(() => {
service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe(() => {
}, (error) => {
expect(error).toEqual(errorResponse);
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 403
});
}));
it('should be able to involve people in the task', fakeAsync(() => {
service.involveUserWithTask('fake-task-id', 'fake-user-id').subscribe(
() => {
expect(jasmine.Ajax.requests.mostRecent().method).toBe('PUT');
expect(jasmine.Ajax.requests.mostRecent().url).toContain('tasks/fake-task-id/action/involve');
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200
});
}));
it('involveUserWithTask catch errors call', fakeAsync(() => {
service.involveUserWithTask('fake-task-id', 'fake-user-id').subscribe(() => {
}, (error) => {
expect(error).toEqual(errorResponse);
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 403
});
}));
it('should be able to remove involved people from task', fakeAsync(() => {
service.removeInvolvedUser('fake-task-id', 'fake-user-id').subscribe(
() => {
expect(jasmine.Ajax.requests.mostRecent().method).toBe('PUT');
expect(jasmine.Ajax.requests.mostRecent().url).toContain('tasks/fake-task-id/action/remove-involved');
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200
});
}));
it('removeInvolvedUser catch errors call', fakeAsync(() => {
service.removeInvolvedUser('fake-task-id', 'fake-user-id').subscribe(() => {
}, (error) => {
expect(error).toEqual(errorResponse);
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 403
});
}));
});
});

View File

@@ -0,0 +1,186 @@
/*!
* @license
* Copyright 2019 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.
*/
import { Injectable } from '@angular/core';
import { Observable, from, throwError, of } from 'rxjs';
import { AlfrescoApiService, LogService, GroupModel } from '@alfresco/adf-core';
import { BpmUserModel } from '../models/bpm-user.model';
import { UserProcessModel } from '../models/user-process.model';
import { catchError, combineAll, defaultIfEmpty, map, switchMap } from 'rxjs/operators';
import {
TaskActionsApi,
UsersApi,
ResultListDataRepresentationLightUserRepresentation, ActivitiGroupsApi, UserProfileApi
} from '@alfresco/js-api';
@Injectable({
providedIn: 'root'
})
export class PeopleProcessService {
private _taskActionsApi: TaskActionsApi;
get taskActionsApi(): TaskActionsApi {
this._taskActionsApi = this._taskActionsApi ?? new TaskActionsApi(this.apiService.getInstance());
return this._taskActionsApi;
}
private _userApi: UsersApi;
get userApi(): UsersApi {
this._userApi = this._userApi ?? new UsersApi(this.apiService.getInstance());
return this._userApi;
}
private _groupsApi: ActivitiGroupsApi;
get groupsApi(): ActivitiGroupsApi {
this._groupsApi = this._groupsApi ?? new ActivitiGroupsApi(this.apiService.getInstance());
return this._groupsApi;
}
private _profileApi: UserProfileApi;
get profileApi(): UserProfileApi {
this._profileApi = this._profileApi ?? new UserProfileApi(this.apiService.getInstance());
return this._profileApi;
}
constructor(private apiService: AlfrescoApiService,
private logService: LogService) {
}
/**
* Gets information about the current user.
*
* @returns User information object
*/
getCurrentUserInfo(): Observable<BpmUserModel> {
return from(this.profileApi.getProfile())
.pipe(
map((userRepresentation) => new BpmUserModel(userRepresentation)),
catchError((err) => this.handleError(err))
);
}
/**
* Gets the current user's profile image as a URL.
*
* @returns URL string
*/
getCurrentUserProfileImage(): string {
return this.profileApi.getProfilePictureUrl();
}
/**
* Gets a list of groups in a workflow.
*
* @param filter Filter to select specific groups
* @param groupId Group ID for the search
* @returns Array of groups
*/
getWorkflowGroups(filter: string, groupId?: string): Observable<GroupModel[]> {
const option: any = { filter };
if (groupId) {
option.groupId = groupId;
}
return from(this.groupsApi.getGroups(option))
.pipe(
map((response: any) => response.data || []),
catchError((err) => this.handleError(err))
);
}
/**
* Gets information about users across all tasks.
*
* @param taskId ID of the task
* @param searchWord Filter text to search for
* @returns Array of user information objects
*/
getWorkflowUsers(taskId?: string, searchWord?: string, groupId?: string): Observable<UserProcessModel[]> {
const option = { excludeTaskId: taskId, filter: searchWord, groupId };
return from(this.getWorkflowUserApi(option))
.pipe(
switchMap(response => response.data as UserProcessModel[] || []),
map((user) => {
user.userImage = this.getUserProfileImageApi(user.id.toString());
return of(user);
}),
combineAll(),
defaultIfEmpty([]),
catchError((err) => this.handleError(err))
);
}
/**
* Gets the profile picture URL for the specified user.
*
* @param user The target user
* @returns Profile picture URL
*/
getUserImage(user: UserProcessModel): string {
return this.getUserProfileImageApi(user.id.toString());
}
/**
* Sets a user to be involved with a task.
*
* @param taskId ID of the target task
* @param idToInvolve ID of the user to involve
* @returns Empty response when the update completes
*/
involveUserWithTask(taskId: string, idToInvolve: string): Observable<UserProcessModel[]> {
const node = { userId: idToInvolve };
return from(this.involveUserToTaskApi(taskId, node))
.pipe(
catchError((err) => this.handleError(err))
);
}
/**
* Removes a user who is currently involved with a task.
*
* @param taskId ID of the target task
* @param idToRemove ID of the user to remove
* @returns Empty response when the update completes
*/
removeInvolvedUser(taskId: string, idToRemove: string): Observable<UserProcessModel[]> {
const node = { userId: idToRemove };
return from(this.removeInvolvedUserFromTaskApi(taskId, node))
.pipe(
catchError((err) => this.handleError(err))
);
}
private getWorkflowUserApi(options: any): Promise<ResultListDataRepresentationLightUserRepresentation> {
return this.userApi.getUsers(options);
}
private involveUserToTaskApi(taskId: string, node: any) {
return this.taskActionsApi.involveUser(taskId, node);
}
private removeInvolvedUserFromTaskApi(taskId: string, node: any) {
return this.taskActionsApi.removeInvolvedUser(taskId, node);
}
private getUserProfileImageApi(userId: string): string {
return this.userApi.getUserProfilePictureUrl(userId);
}
private handleError(error: any) {
this.logService.error(error);
return throwError(error || 'Server error');
}
}

View File

@@ -30,10 +30,9 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
import { Observable, of, throwError } from 'rxjs';
import {
FormFieldModel, FormFieldTypes, FormModel, FormOutcomeEvent, FormOutcomeModel,
FormService, WidgetVisibilityService, ContainerModel, fakeForm,
setupTestBed,
NodeMetadata, NodesApiService
FormService, WidgetVisibilityService, ContainerModel, fakeForm, setupTestBed
} from '@alfresco/adf-core';
import{ NodeMetadata, NodesApiService } from '@alfresco/adf-content-services';
import { FormComponent } from './form.component';
import { ProcessFormRenderingService } from './process-form-rendering.service';
import { ProcessTestingModule } from '../testing/process.testing.module';

View File

@@ -38,8 +38,6 @@ import {
FormOutcomeEvent,
FormValues,
ContentLinkModel,
NodesApiService,
FormDefinitionModel,
TaskProcessVariableModel
} from '@alfresco/adf-core';
import { from, Observable, of, Subject } from 'rxjs';
@@ -50,6 +48,8 @@ import { EditorService } from './services/editor.service';
import { TaskService } from './services/task.service';
import { TaskFormService } from './services/task-form.service';
import { TaskRepresentation } from '@alfresco/js-api';
import { NodesApiService } from '@alfresco/adf-content-services';
import { FormDefinitionModel } from './model/form-definition.model';
@Component({
selector: 'adf-form',

View File

@@ -0,0 +1,97 @@
/*!
* @license
* Copyright 2019 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.
*/
import { FormSaveRepresentation } from '@alfresco/js-api';
export class FormDefinitionModel extends FormSaveRepresentation {
reusable: boolean = false;
newVersion: boolean = false;
formRepresentation: any;
formImageBase64: string = '';
constructor(id: string, name: any, lastUpdatedByFullName: string, lastUpdated: string, metadata: any) {
super();
this.formRepresentation = {
id,
name,
description: '',
version: 1,
lastUpdatedBy: 1,
lastUpdatedByFullName,
lastUpdated,
stencilSetId: 0,
referenceId: null,
formDefinition: {
fields: [{
name: 'Label',
type: 'container',
fieldType: 'ContainerRepresentation',
numberOfColumns: 2,
required: false,
readOnly: false,
sizeX: 2,
sizeY: 1,
row: -1,
col: -1,
fields: {1: this.metadataToFields(metadata)}
}],
gridsterForm: false,
javascriptEvents: [],
metadata: {},
outcomes: [],
className: '',
style: '',
tabs: [],
variables: []
}
};
}
private metadataToFields(metadata: any): any[] {
const fields = [];
if (metadata) {
metadata.forEach((property) => {
if (property) {
const field = {
type: 'text',
id: property.name,
name: property.name,
required: false,
readOnly: false,
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
colspan: 1,
params: {
existingColspan: 1,
maxColspan: 2
},
layout: {
colspan: 1,
row: -1,
column: -1
}
};
fields.push(field);
}
});
}
return fields;
}
}

View File

@@ -30,6 +30,8 @@ export * from './process-form-rendering.service';
export * from './events/validate-dynamic-table-row.event';
export * from './model/form-definition.model';
export * from './form-list/form-list.component';
export * from './form.component';

View File

@@ -15,11 +15,12 @@
* limitations under the License.
*/
import { AlfrescoApiService, FormDefinitionModel, LogService } from '@alfresco/adf-core';
import { AlfrescoApiService, LogService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs';
import { FormModelsApi } from '@alfresco/js-api';
import { catchError, map } from 'rxjs/operators';
import { FormDefinitionModel } from '../model/form-definition.model';
@Injectable({
providedIn: 'root'

View File

@@ -17,11 +17,11 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { ContentModule, ContentNodeSelectorPanelComponent, DocumentListService, SitesService } from '@alfresco/adf-content-services';
import { ContentModule, ContentNodeSelectorPanelComponent, DocumentListService, SitesService, NodesApiService } from '@alfresco/adf-content-services';
import { EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core';
import { ProcessTestingModule } from '../../../testing/process.testing.module';
import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component';
import { setupTestBed, AuthenticationService, AlfrescoApiService, NodesApiService } from '@alfresco/adf-core';
import { setupTestBed, AuthenticationService, AlfrescoApiService } from '@alfresco/adf-core';
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
import { of, throwError } from 'rxjs';
import { By } from '@angular/platform-browser';

View File

@@ -21,13 +21,12 @@ import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import {
AppConfigService,
AppConfigValues,
ContentService,
DownloadService,
FormService,
LogService,
ThumbnailService
} from '@alfresco/adf-core';
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
import { ContentNodeDialogService, ContentService } from '@alfresco/adf-content-services';
import {
AlfrescoEndpointRepresentation,
Node,

View File

@@ -21,10 +21,9 @@ import { AttachFolderWidgetComponent } from './attach-folder-widget.component';
import {
FormFieldModel,
FormModel,
NodesApiService,
setupTestBed
} from '@alfresco/adf-core';
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
import { ContentNodeDialogService, NodesApiService } from '@alfresco/adf-content-services';
import { of } from 'rxjs';
import { Node } from '@alfresco/js-api';
import { ProcessTestingModule } from '../../../testing/process.testing.module';

View File

@@ -20,10 +20,9 @@
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import {
WidgetComponent,
FormService,
NodesApiService
FormService
} from '@alfresco/adf-core';
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
import { ContentNodeDialogService, NodesApiService } from '@alfresco/adf-content-services';
import { Node } from '@alfresco/js-api';
@Component({

View File

@@ -19,10 +19,10 @@ import { SimpleChange } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import {
ContentService,
ContentLinkModel,
CoreTestingModule,
setupTestBed
setupTestBed,
DownloadService
} from '@alfresco/adf-core';
import { of } from 'rxjs';
import { ContentWidgetComponent } from './content.widget';
@@ -38,7 +38,7 @@ describe('ContentWidgetComponent', () => {
let element: HTMLElement;
let processContentService: ProcessContentService;
let serviceContent: ContentService;
let downloadService: DownloadService;
const createFakeImageBlob = () => {
const data = atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
@@ -71,7 +71,7 @@ describe('ContentWidgetComponent', () => {
});
beforeEach(() => {
serviceContent = TestBed.inject(ContentService);
downloadService = TestBed.inject(DownloadService);
processContentService = TestBed.inject(ProcessContentService);
});
@@ -253,7 +253,7 @@ describe('ContentWidgetComponent', () => {
it('should download the pdf when the download button is clicked', () => {
const blob = createFakePdfBlob();
spyOn(processContentService, 'getFileRawContent').and.returnValue(of(blob));
spyOn(serviceContent, 'downloadBlob').and.callThrough();
spyOn(downloadService, 'downloadBlob').and.callThrough();
component.content = new ContentLinkModel({
id: 4004,
@@ -278,7 +278,7 @@ describe('ContentWidgetComponent', () => {
const downloadButton: any = element.querySelector('#download');
downloadButton.click();
expect(serviceContent.downloadBlob).toHaveBeenCalledWith(blob, 'FakeBlob.pdf');
expect(downloadService.downloadBlob).toHaveBeenCalledWith(blob, 'FakeBlob.pdf');
});
});
});

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { ContentService, LogService, ContentLinkModel, FormService } from '@alfresco/adf-core';
import { UrlService, LogService, ContentLinkModel, FormService, DownloadService } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { Observable } from 'rxjs';
import { ProcessContentService } from '../../services/process-content.service';
@@ -56,7 +56,8 @@ export class ContentWidgetComponent implements OnChanges {
constructor(protected formService: FormService,
private logService: LogService,
private contentService: ContentService,
private downloadService: DownloadService,
private urlService: UrlService,
private processContentService: ProcessContentService) {
}
@@ -95,7 +96,7 @@ export class ContentWidgetComponent implements OnChanges {
if (observable) {
observable.subscribe(
(response: Blob) => {
this.content.thumbnailUrl = this.contentService.createTrustedUrl(response);
this.content.thumbnailUrl = this.urlService.createTrustedUrl(response);
this.thumbnailLoaded.emit(this.content.thumbnailUrl);
},
(error) => {
@@ -130,7 +131,7 @@ export class ContentWidgetComponent implements OnChanges {
*/
download(content: ContentLinkModel): void {
this.processContentService.getFileRawContent(content.id).subscribe(
(blob: Blob) => this.contentService.downloadBlob(blob, content.name),
(blob: Blob) => this.downloadService.downloadBlob(blob, content.name),
(error) => {
this.error.emit(error);
}

View File

@@ -22,12 +22,12 @@ import {
GroupModel,
CoreTestingModule,
setupTestBed,
FormFieldTypes,
PeopleProcessService
FormFieldTypes
} from '@alfresco/adf-core';
import { FunctionalGroupWidgetComponent } from './functional-group.widget';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { PeopleProcessService } from '../../../common/services/people-process.service';
describe('FunctionalGroupWidgetComponent', () => {
let fixture: ComponentFixture<FunctionalGroupWidgetComponent>;

View File

@@ -18,10 +18,11 @@
/* eslint-disable @angular-eslint/component-selector */
import { Component, ElementRef, OnInit, ViewEncapsulation } from '@angular/core';
import { FormService, GroupModel, PeopleProcessService, WidgetComponent } from '@alfresco/adf-core';
import { FormService, GroupModel, WidgetComponent } from '@alfresco/adf-core';
import { catchError, debounceTime, filter, switchMap, tap } from 'rxjs/operators';
import { merge, of } from 'rxjs';
import { UntypedFormControl } from '@angular/forms';
import { PeopleProcessService } from '../../../common/services/people-process.service';
@Component({
selector: 'functional-group-widget',

View File

@@ -18,16 +18,17 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import {
UserProcessModel,
FormFieldTypes,
FormFieldModel,
FormModel,
setupTestBed,
CoreTestingModule, PeopleProcessService
CoreTestingModule
} from '@alfresco/adf-core';
import { Observable, of } from 'rxjs';
import { PeopleWidgetComponent } from './people.widget';
import { TranslateService, TranslateModule } from '@ngx-translate/core';
import { PeopleProcessService } from '../../../common/services/people-process.service';
import { UserProcessModel } from '../../../common/models/user-process.model';
describe('PeopleWidgetComponent', () => {

View File

@@ -17,7 +17,7 @@
/* eslint-disable @angular-eslint/component-selector */
import { UserProcessModel, PeopleProcessService, FormService, WidgetComponent } from '@alfresco/adf-core';
import { FormService, WidgetComponent } from '@alfresco/adf-core';
import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import { Observable, of } from 'rxjs';
@@ -28,6 +28,8 @@ import {
switchMap,
tap
} from 'rxjs/operators';
import { UserProcessModel } from '../../../common/models/user-process.model';
import { PeopleProcessService } from '../../../common/services/people-process.service';
@Component({
selector: 'people-widget',

View File

@@ -16,11 +16,12 @@
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserProcessModel, setupTestBed, DataRowActionEvent, DataRowEvent, ObjectDataRow } from '@alfresco/adf-core';
import { setupTestBed, DataRowActionEvent, DataRowEvent, ObjectDataRow } from '@alfresco/adf-core';
import { TranslateModule } from '@ngx-translate/core';
import { UserEventModel } from '../../../task-list/models/user-event.model';
import { PeopleListComponent } from './people-list.component';
import { ProcessTestingModule } from '../../../testing/process.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { UserProcessModel } from '../../../common/models/user-process.model';
const fakeUser: UserProcessModel = new UserProcessModel({
id: 1,

View File

@@ -15,8 +15,9 @@
* limitations under the License.
*/
import { DataTableComponent, DataCellEvent, DataColumnListComponent, UserProcessModel, ShowHeaderMode } from '@alfresco/adf-core';
import { DataTableComponent, DataCellEvent, DataColumnListComponent, ShowHeaderMode } from '@alfresco/adf-core';
import { AfterContentInit, Component, ContentChild, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { UserProcessModel } from '../../../common/models/user-process.model';
import { UserEventModel } from '../../../task-list/models/user-event.model';
@Component({

View File

@@ -15,13 +15,15 @@
* limitations under the License.
*/
import { UserProcessModel, TranslationService, PeopleProcessService } from '@alfresco/adf-core';
import { TranslationService } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import { debounceTime, switchMap } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
import { PerformSearchCallback } from '../../interfaces/perform-search-callback.interface';
import { getDisplayUser } from '../../helpers/get-display-user';
import { PeopleProcessService } from '../../../common/services/people-process.service';
import { UserProcessModel } from '../../../common/models/user-process.model';
@Component({
selector: 'adf-people-search-field',

View File

@@ -16,11 +16,12 @@
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserProcessModel, setupTestBed } from '@alfresco/adf-core';
import { setupTestBed } from '@alfresco/adf-core';
import { of } from 'rxjs';
import { TranslateModule } from '@ngx-translate/core';
import { PeopleSearchComponent } from './people-search.component';
import { ProcessTestingModule } from '../../../testing/process.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { UserProcessModel } from '../../../common/models/user-process.model';
const fakeUser: UserProcessModel = new UserProcessModel({
id: '1',

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { UserProcessModel } from '@alfresco/adf-core';
import { UserProcessModel } from '../../../common/models/user-process.model';
import { Component, EventEmitter, OnInit, Input, Output, ViewEncapsulation } from '@angular/core';
import { Observable } from 'rxjs';
import { PerformSearchCallback } from '../../interfaces/perform-search-callback.interface';

View File

@@ -16,12 +16,13 @@
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LogService, PeopleProcessService, setupTestBed } from '@alfresco/adf-core';
import { LogService, setupTestBed } from '@alfresco/adf-core';
import { PeopleSelectorComponent } from './people-selector.component';
import { of, throwError } from 'rxjs';
import { By } from '@angular/platform-browser';
import { ProcessTestingModule } from '../../../testing/process.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { PeopleProcessService } from '../../../common/services/people-process.service';
describe('PeopleSelectorComponent', () => {

View File

@@ -17,11 +17,13 @@
import { Component, ViewChild, ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core';
import { PerformSearchCallback } from '../../interfaces/perform-search-callback.interface';
import { PeopleProcessService, UserProcessModel, LogService, TranslationService } from '@alfresco/adf-core';
import { LogService, TranslationService } from '@alfresco/adf-core';
import { PeopleSearchFieldComponent } from '../people-search-field/people-search-field.component';
import { getDisplayUser } from '../../helpers/get-display-user';
import { Observable, of } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { PeopleProcessService } from '../../../common/services/people-process.service';
import { UserProcessModel } from '../../../common/models/user-process.model';
const DEFAULT_ASSIGNEE_PLACEHOLDER = 'ADF_TASK_LIST.PEOPLE.ASSIGNEE';

View File

@@ -16,11 +16,13 @@
*/
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
import { LogService, PeopleProcessService, setupTestBed, UserProcessModel } from '@alfresco/adf-core';
import { LogService, setupTestBed } from '@alfresco/adf-core';
import { PeopleComponent } from './people.component';
import { ProcessTestingModule } from '../../../testing/process.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { throwError } from 'rxjs';
import { UserProcessModel } from '../../../common/models/user-process.model';
import { PeopleProcessService } from '../../../common/services/people-process.service';
declare let jasmine: any;

View File

@@ -15,12 +15,14 @@
* limitations under the License.
*/
import { LogService, UserProcessModel, PeopleProcessService } from '@alfresco/adf-core';
import { LogService } from '@alfresco/adf-core';
import { Component, Input, ViewChild, ViewEncapsulation } from '@angular/core';
import { Observable, Observer } from 'rxjs';
import { UserEventModel } from '../../../task-list/models/user-event.model';
import { PeopleSearchComponent } from '../people-search/people-search.component';
import { share } from 'rxjs/operators';
import { UserProcessModel } from '../../../common/models/user-process.model';
import { PeopleProcessService } from '../../../common/services/people-process.service';
@Component({
selector: 'adf-people',

View File

@@ -16,6 +16,6 @@
*/
import { Observable } from 'rxjs';
import { UserProcessModel } from '@alfresco/adf-core';
import { UserProcessModel } from '../../common/models/user-process.model';
export type PerformSearchCallback = (searchWord: string) => Observable<UserProcessModel[]>;

View File

@@ -17,9 +17,11 @@
import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs';
import { CommentModel, UserProcessModel, AlfrescoApiService, LogService, CommentsService, PeopleProcessService } from '@alfresco/adf-core';
import { CommentModel, AlfrescoApiService, LogService, CommentsService } from '@alfresco/adf-core';
import { map, catchError } from 'rxjs/operators';
import { ActivitiCommentsApi } from '@alfresco/js-api';
import { PeopleProcessService } from '../../common/services/people-process.service';
import { UserProcessModel } from '../../common/models/user-process.model';
@Injectable({
providedIn: 'root'

View File

@@ -0,0 +1,84 @@
/*!
* @license
* Copyright 2019 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.
*/
import { BpmUserModel } from '../../common/models/bpm-user.model';
export const fakeBpmUserNoImage = {
apps: [],
capabilities: 'fake-capability',
company: 'fake-company',
created: 'fake-create-date',
email: 'fakeBpm@fake.com',
externalId: 'fake-external-id',
firstName: 'fake-first-name',
lastName: 'fake-last-name',
groups: [],
id: 'fake-id',
lastUpdate: 'fake-update-date',
latestSyncTimeStamp: 'fake-timestamp',
password: 'fake-password',
pictureId: undefined,
status: 'fake-status',
tenantId: 'fake-tenant-id',
tenantName: 'fake-tenant-name',
tenantPictureId: 'fake-tenant-picture-id',
type: 'fake-type'
};
export const fakeBpmUser = new BpmUserModel({
apps: [],
capabilities: null,
company: 'fake-company',
created: 'fake-create-date',
email: 'fakeBpm@fake.com',
externalId: 'fake-external-id',
firstName: 'fake-bpm-first-name',
lastName: 'fake-bpm-last-name',
groups: [],
id: 'fake-id',
lastUpdate: 'fake-update-date',
latestSyncTimeStamp: 'fake-timestamp',
password: 'fake-password',
pictureId: 12,
status: 'fake-status',
tenantId: 'fake-tenant-id',
tenantName: 'fake-tenant-name',
tenantPictureId: 'fake-tenant-picture-id',
type: 'fake-type'
});
export const fakeBpmEditedUser = {
apps: [],
capabilities: 'fake-capability',
company: 'fake-company',
created: 'fake-create-date',
email: 'fakeBpm@fake.com',
externalId: 'fake-external-id',
firstName: 'fake-first-name',
lastName: 'fake-last-name',
groups: [],
id: 'fake-id',
lastUpdate: 'fake-update-date',
latestSyncTimeStamp: 'fake-timestamp',
password: 'fake-password',
pictureId: 'src/assets/images/bpmImg.gif',
status: 'fake-status',
tenantId: 'fake-tenant-id',
tenantName: 'fake-tenant-name',
tenantPictureId: 'fake-tenant-picture-id',
type: 'fake-type'
};

View File

@@ -1,8 +1,8 @@
<div
id="userinfo_container"
[class.adf-userinfo-name-right]="showOnRight"
<div
id="userinfo_container"
[class.adf-userinfo-name-right]="showOnRight"
(keyup)="onKeyPress($event)"
class="adf-userinfo-container"
class="adf-userinfo-container"
*ngIf="canShow"
>
<span *ngIf="showName" id="adf-userinfo-bpm-name-display" class="adf-userinfo-name">
@@ -37,41 +37,41 @@
[overlapTrigger]="false" class="adf-userinfo-menu">
<mat-tab-group id="tab-group-env" (click)="stopClosing($event)" selectedIndex="0" role="menuitem"
class="adf-userinfo-tab" [class.adf-hide-tab]="!ecmUser">
<mat-tab label="{{ 'USER_PROFILE.TAB.CS' | translate }}" role="dialog"
*ngIf="mode===userInfoMode.ALL">
<mat-card class="adf-userinfo-card" *ngIf="ecmUser">
<mat-card-header class="adf-userinfo-card-header"
[style.background-image]="'url(' + ecmBackgroundImage + ')'">
<div *ngIf="ecmUser.avatarId; else initialTemplate"
class="adf-userinfo-profile-container adf-hide-small">
<img class="adf-userinfo-profile-picture" id="ecm-user-detail-image"
alt="ecm-profile-image" [src]="getEcmAvatar(ecmUser.avatarId)"/>
</div>
<ng-template #initialTemplate>
<div
[outerHTML]="ecmUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'"></div>
</ng-template>
<div class="adf-userinfo-title" id="ecm-username">{{ecmUser | fullName}}</div>
</mat-card-header>
<mat-card-content>
<div class="adf-userinfo-supporting-text">
<div class="adf-userinfo-detail">
<mat-tab label="{{ 'USER_PROFILE.TAB.CS' | translate }}" role="dialog"
*ngIf="mode===userInfoMode.ALL">
<mat-card class="adf-userinfo-card" *ngIf="ecmUser">
<mat-card-header class="adf-userinfo-card-header"
[style.background-image]="'url(' + ecmBackgroundImage + ')'">
<div *ngIf="ecmUser.avatarId; else initialTemplate"
class="adf-userinfo-profile-container adf-hide-small">
<img class="adf-userinfo-profile-picture" id="ecm-user-detail-image"
alt="ecm-profile-image" [src]="getEcmAvatar(ecmUser.avatarId)"/>
</div>
<ng-template #initialTemplate>
<div
[outerHTML]="ecmUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'"></div>
</ng-template>
<div class="adf-userinfo-title" id="ecm-username">{{ecmUser | fullName}}</div>
</mat-card-header>
<mat-card-content>
<div class="adf-userinfo-supporting-text">
<div class="adf-userinfo-detail">
<span id="ecm-full-name"
class="adf-userinfo__detail-title">{{ecmUser | fullName}}</span>
<span class="adf-userinfo__detail-profile" id="ecm-email"> {{ecmUser.email}} </span>
</div>
<div class="adf-userinfo-detail">
<span class="adf-userinfo__detail-profile" id="ecm-email"> {{ecmUser.email}} </span>
</div>
<div class="adf-userinfo-detail">
<span class="adf-userinfo__secondary-info" id="ecm-job-title-label">
{{ 'USER_PROFILE.LABELS.ECM.JOB_TITLE' | translate }}
<span id="ecm-job-title"
class="adf-userinfo__detail-profile"> {{ ecmUser.jobTitle ? ecmUser.jobTitle : 'N/A' }} </span>
</span>
</div>
</div>
</mat-card-content>
</mat-card>
</mat-tab>
</div>
</div>
</mat-card-content>
</mat-card>
</mat-tab>
<mat-tab id="bpm-panel" label="{{ 'USER_PROFILE.TAB.PS' | translate }}" role="dialog"
*ngIf="mode===userInfoMode.PROCESS || mode===userInfoMode.ALL">
<mat-card class="adf-userinfo-card">

View File

@@ -17,19 +17,18 @@
import {
CoreTestingModule,
fakeBpmUser,
BpmUserModel,
setupTestBed,
fakeEcmUser,
fakeEcmUserNoImage,
UserInfoMode
} from '@alfresco/adf-core';
import { fakeEcmUser, fakeEcmUserNoImage } from '@alfresco/adf-content-services';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatMenuModule } from '@angular/material/menu';
import { By } from '@angular/platform-browser';
import { TranslateModule } from '@ngx-translate/core';
import { BpmUserModel } from '../common/models/bpm-user.model';
import { ProcessUserInfoComponent } from './process-user-info.component';
import { fakeBpmUser } from './mocks/bpm-user.service.mock';
describe('ProcessUserInfoComponent', () => {
const profilePictureUrl = 'alfresco-logo.svg';

View File

@@ -15,10 +15,13 @@
* limitations under the License.
*/
import { BpmUserModel, BpmUserService, EcmUserModel, PeopleContentService, UserInfoMode } from '@alfresco/adf-core';
import { UserInfoMode } from '@alfresco/adf-core';
import { EcmUserModel, PeopleContentService } from '@alfresco/adf-content-services';
import { Component, Input, OnDestroy, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatMenuTrigger, MenuPositionX, MenuPositionY } from '@angular/material/menu';
import { Subject } from 'rxjs';
import { PeopleProcessService } from '../common/services/people-process.service';
import { BpmUserModel } from '../common/models/bpm-user.model';
@Component({
selector: 'adf-process-user-info',
@@ -72,7 +75,7 @@ export class ProcessUserInfoComponent implements OnDestroy {
private destroy$ = new Subject();
constructor(private bpmUserService: BpmUserService, private peopleContentService: PeopleContentService) {
constructor(private peopleProcessService: PeopleProcessService, private peopleContentService: PeopleContentService) {
}
ngOnDestroy(): void {
@@ -95,7 +98,7 @@ export class ProcessUserInfoComponent implements OnDestroy {
}
getBpmUserImage(): string {
return this.bpmUserService.getCurrentUserProfileImage();
return this.peopleProcessService.getCurrentUserProfileImage();
}
getEcmAvatar(avatarId: string): string {

View File

@@ -15,11 +15,13 @@
* limitations under the License.
*/
import { AlfrescoApiService, CommentModel, CommentsService, PeopleProcessService, UserProcessModel } from '@alfresco/adf-core';
import { AlfrescoApiService, CommentModel, CommentsService } from '@alfresco/adf-core';
import { ActivitiCommentsApi, CommentRepresentation } from '@alfresco/js-api';
import { Injectable } from '@angular/core';
import { from, Observable, throwError } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { UserProcessModel } from '../../common/models/user-process.model';
import { PeopleProcessService } from '../../common/services/people-process.service';
@Injectable({
providedIn: 'root'

View File

@@ -16,7 +16,7 @@
*/
import {
LogService, UserPreferencesService, UserPreferenceValues, UserProcessModel, FormFieldModel, FormModel,
LogService, UserPreferencesService, UserPreferenceValues, FormFieldModel, FormModel,
MOMENT_DATE_FORMATS, MomentDateAdapter
} from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy } from '@angular/core';
@@ -28,6 +28,7 @@ import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './../services/tasklist.service';
import { switchMap, defaultIfEmpty, takeUntil } from 'rxjs/operators';
import { UntypedFormBuilder, AbstractControl, Validators, UntypedFormGroup, UntypedFormControl } from '@angular/forms';
import { UserProcessModel } from '../../common/models/user-process.model';
const FORMAT_DATE = 'DD/MM/YYYY';
const MAX_LENGTH = 255;

View File

@@ -17,7 +17,7 @@
/* eslint-disable @angular-eslint/no-input-rename */
import { ContentService } from '@alfresco/adf-core';
import { DownloadService } from '@alfresco/adf-core';
import { Directive, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { TaskListService } from './../services/tasklist.service';
@@ -60,7 +60,7 @@ export class TaskAuditDirective implements OnChanges {
public audit: any;
constructor(private contentService: ContentService,
constructor(private downloadService: DownloadService,
private taskListService: TaskListService) {
}
@@ -87,7 +87,7 @@ export class TaskAuditDirective implements OnChanges {
(blob: Blob) => {
this.audit = blob;
if (this.download) {
this.contentService.downloadBlob(this.audit, this.fileName + '.pdf');
this.downloadService.downloadBlob(this.audit, this.fileName + '.pdf');
}
this.clicked.emit({ format: this.format, value: this.audit, fileName: this.fileName });
},

View File

@@ -24,10 +24,7 @@ import {
FormOutcomeEvent,
FormOutcomeModel,
setupTestBed,
BpmUserService,
LogService,
UserProcessModel,
PeopleProcessService,
CommentModel
} from '@alfresco/adf-core';
import { TaskDetailsModel } from '../models/task-details.model';
@@ -45,6 +42,8 @@ import { TranslateModule } from '@ngx-translate/core';
import { TaskService } from '../../form/services/task.service';
import { TaskFormService } from '../../form/services/task-form.service';
import { TaskCommentsService } from '../../task-comments/services/task-comments.service';
import { UserProcessModel } from '../../common/models/user-process.model';
import { PeopleProcessService } from '../../common/services/people-process.service';
const fakeUser = new UserProcessModel({
id: 'fake-id',
@@ -73,7 +72,6 @@ describe('TaskDetailsComponent', () => {
let logService: LogService;
let taskCommentsService: TaskCommentsService;
let peopleProcessService: PeopleProcessService;
let bpmUserService: BpmUserService;
setupTestBed({
imports: [
@@ -85,9 +83,9 @@ describe('TaskDetailsComponent', () => {
beforeEach(() => {
logService = TestBed.inject(LogService);
peopleProcessService = TestBed.inject(PeopleProcessService);
bpmUserService = TestBed.inject(BpmUserService);
spyOn(bpmUserService, 'getCurrentUserInfo').and.returnValue(of(<any>{ email: 'fake-email' }));
spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of(<any>{ email: 'fake-email' }));
taskListService = TestBed.inject(TaskListService);
spyOn(taskListService, 'getTaskChecklist').and.returnValue(of(noDataMock));

View File

@@ -16,7 +16,6 @@
*/
import {
PeopleProcessService, UserProcessModel,
CardViewUpdateService,
ClickNotification,
LogService,
@@ -43,6 +42,8 @@ import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './../services/tasklist.service';
import { catchError, share, takeUntil } from 'rxjs/operators';
import { TaskFormComponent } from './task-form/task-form.component';
import { UserProcessModel } from '../../common/models/user-process.model';
import { PeopleProcessService } from '../../common/services/people-process.service';
@Component({
selector: 'adf-task-details',

View File

@@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TaskFormComponent } from './task-form.component';
import {
BpmUserService,
FormModel,
FormOutcomeEvent,
FormOutcomeModel,
@@ -53,6 +52,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { By } from '@angular/platform-browser';
import { TaskFormService } from '../../../form/services/task-form.service';
import { TaskService } from '../../../form/services/task.service';
import { PeopleProcessService } from '../../../common/services/people-process.service';
describe('TaskFormComponent', () => {
let component: TaskFormComponent;
@@ -63,7 +63,7 @@ describe('TaskFormComponent', () => {
let getTaskDetailsSpy: jasmine.Spy;
let completeTaskSpy: jasmine.Spy;
let element: HTMLElement;
let bpmUserService: BpmUserService;
let peopleProcessService: PeopleProcessService;
let getBpmLoggedUserSpy: jasmine.Spy;
setupTestBed({
@@ -88,8 +88,8 @@ describe('TaskFormComponent', () => {
spyOn(taskFormService, 'getTaskForm').and.returnValue(of(taskFormMock));
taskDetailsMock.processDefinitionId = null;
spyOn(taskService, 'getTask').and.returnValue(of(taskDetailsMock));
bpmUserService = TestBed.inject(BpmUserService);
getBpmLoggedUserSpy = spyOn(bpmUserService, 'getCurrentUserInfo').and.returnValue(of(<any>fakeUser));
peopleProcessService = TestBed.inject(PeopleProcessService);
getBpmLoggedUserSpy = spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of(<any>fakeUser));
});
afterEach(async () => {

View File

@@ -22,13 +22,13 @@ import {
FormFieldValidator,
FormOutcomeEvent,
TranslationService,
FormFieldModel,
BpmUserService
FormFieldModel
} from '@alfresco/adf-core';
import { TaskDetailsModel } from '../../models/task-details.model';
import { TaskListService } from '../../services/tasklist.service';
import { UserRepresentation, LightGroupRepresentation, LightUserRepresentation } from '@alfresco/js-api';
import { Observable } from 'rxjs';
import { PeopleProcessService } from '../../../common/services/people-process.service';
@Component({
selector: 'adf-task-form',
@@ -134,13 +134,13 @@ export class TaskFormComponent implements OnInit, OnChanges {
constructor(
private taskListService: TaskListService,
private bpmUserService: BpmUserService,
private peopleProcessService: PeopleProcessService,
private translationService: TranslationService
) {
}
ngOnInit() {
this.bpmUserService.getCurrentUserInfo().subscribe(user => {
this.peopleProcessService.getCurrentUserInfo().subscribe(user => {
this.currentLoggedUser = user;
});
this.loadTask(this.taskId);

View File

@@ -17,7 +17,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { AppConfigService, setupTestBed, BpmUserService, BpmUserModel } from '@alfresco/adf-core';
import { AppConfigService, setupTestBed } from '@alfresco/adf-core';
import { of } from 'rxjs';
import {
completedTaskDetailsMock,
@@ -33,13 +33,15 @@ import { TaskListService } from './../services/tasklist.service';
import { TaskHeaderComponent } from './task-header.component';
import { ProcessTestingModule } from '../../testing/process.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { PeopleProcessService } from '../../common/services/people-process.service';
import { BpmUserModel } from '../../common/models/bpm-user.model';
describe('TaskHeaderComponent', () => {
let service: TaskListService;
let component: TaskHeaderComponent;
let fixture: ComponentFixture<TaskHeaderComponent>;
let userBpmService: BpmUserService;
let peopleProcessService: PeopleProcessService;
let appConfigService: AppConfigService;
const fakeBpmAssignedUser = new BpmUserModel({
@@ -67,8 +69,8 @@ describe('TaskHeaderComponent', () => {
fixture = TestBed.createComponent(TaskHeaderComponent);
component = fixture.componentInstance;
service = TestBed.inject(TaskListService);
userBpmService = TestBed.inject(BpmUserService);
spyOn(userBpmService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmAssignedUser));
peopleProcessService = TestBed.inject(PeopleProcessService);
spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmAssignedUser));
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
appConfigService = TestBed.inject(AppConfigService);
});

View File

@@ -17,7 +17,6 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
import {
BpmUserService,
CardViewDateItemModel,
CardViewMapItemModel,
CardViewTextItemModel,
@@ -28,6 +27,7 @@ import {
CardViewItemLengthValidator
} from '@alfresco/adf-core';
import { TaskDetailsModel } from '../models/task-details.model';
import { PeopleProcessService } from '../../common/services/people-process.service';
import { TaskDescriptionValidator } from '../validators/task-description.validator';
@Component({
@@ -66,7 +66,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
private currentUserId: number;
constructor(private bpmUserService: BpmUserService,
constructor(private peopleProcessService: PeopleProcessService,
private translationService: TranslationService,
private appConfig: AppConfigService) {
this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat');
@@ -328,7 +328,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
* Loads current bpm userId
*/
private loadCurrentBpmUserId(): void {
this.bpmUserService.getCurrentUserInfo().subscribe((res) => {
this.peopleProcessService.getCurrentUserInfo().subscribe((res) => {
this.currentUserId = res ? +res.id : null;
});
}

View File

@@ -18,7 +18,7 @@
/**
* This object represent of the StartTaskModel.
*/
import { UserProcessModel } from '@alfresco/adf-core';
import { UserProcessModel } from '../../common/models/user-process.model';
export class StartTaskModel {

View File

@@ -18,8 +18,8 @@
/**
* This object represent the details of a task.
*/
import { UserProcessModel } from '@alfresco/adf-core';
import { TaskRepresentation } from '@alfresco/js-api';
import { UserProcessModel } from '../../common/models/user-process.model';
import { UserGroupModel } from './user-group.model';
export class TaskDetailsModel implements TaskRepresentation {

View File

@@ -15,7 +15,8 @@
* limitations under the License.
*/
import { AlfrescoApiService, AppConfigService, DiscoveryApiService, UploadService } from '@alfresco/adf-core';
import { AlfrescoApiService, AppConfigService} from '@alfresco/adf-core';
import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
import { ActivitiContentApi } from '@alfresco/js-api';
import { Injectable } from '@angular/core';
import { throwError } from 'rxjs';

View File

@@ -15,7 +15,8 @@
* limitations under the License.
*/
import { AlfrescoApiService, AppConfigService, DiscoveryApiService, UploadService } from '@alfresco/adf-core';
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
import { Injectable } from '@angular/core';
import { throwError } from 'rxjs';
import { ActivitiContentApi } from '@alfresco/js-api';

View File

@@ -16,7 +16,7 @@
*/
import { TestBed } from '@angular/core/testing';
import { UserProcessModel, setupTestBed, CoreModule } from '@alfresco/adf-core';
import { setupTestBed, CoreModule } from '@alfresco/adf-core';
import { of } from 'rxjs';
import {
fakeCompletedTaskList,
@@ -35,6 +35,7 @@ import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './tasklist.service';
import { TaskRepresentation, TaskUpdateRepresentation } from '@alfresco/js-api';
import { ProcessTestingModule } from '../../testing/process.testing.module';
import { UserProcessModel } from '../../common/models/user-process.model';
declare let jasmine: any;

View File

@@ -15,6 +15,7 @@
* limitations under the License.
*/
export * from './lib/common/index';
export * from './lib/process-list/index';
export * from './lib/task-list/index';
export * from './lib/app-list/index';