Adjust ADF to latest JS-API version (#8882)

* Bump js-api version

* Fix imports

* Fix content-services unit tests

* Fix process-services unit tests

* [ci:force] Trigger CI

* Fix code smells

* Fix orderBy param

* Fix code smells

* Fix failing unit tests

* Bump js-api version and align with new changes

* Remove dangling coma

* Fix delete return type

* Add correct date format in task filters e2es

* Fix typing in task filter sorting

* Fix activiti content api import

* Add null check for has avatar

* Make User class instead of type

* Fix user type in comment model

* Fix sonar cloud issue

* Type fixes

* Update js-api version
This commit is contained in:
MichalKinas
2023-09-07 13:29:42 +02:00
committed by GitHub
parent 876ca7a0a7
commit 76e2870c66
64 changed files with 628 additions and 884 deletions

View File

@@ -21,7 +21,7 @@
"@angular/platform-browser": ">=14.1.3",
"@angular/platform-browser-dynamic": ">=14.1.3",
"@angular/router": ">=14.1.3",
"@alfresco/js-api": ">=6.3.0-1108",
"@alfresco/js-api": ">=6.3.0-1271",
"@alfresco/adf-core": ">=6.2.0",
"@alfresco/adf-content-services": ">=6.2.0",
"@ngx-translate/core": ">=14.0.0",

View File

@@ -64,7 +64,7 @@ export class ActivitiContentService {
* @param tenantId
* @param includeAccount
*/
getAlfrescoRepositories(tenantId?: number, includeAccount?: boolean): Observable<any> {
getAlfrescoRepositories(tenantId?: string, includeAccount?: boolean): Observable<any> {
const opts = {
tenantId,
includeAccounts: includeAccount ? includeAccount : true

View File

@@ -25,7 +25,7 @@ import { 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';
import { Node, SiteEntry, NodeEntry, SitePaging } from '@alfresco/js-api';
import { Node, SiteEntry, NodeEntry, SitePaging, SitePagingList } from '@alfresco/js-api';
import { TranslateModule } from '@ngx-translate/core';
describe('AttachFileWidgetDialogComponent', () => {
@@ -78,7 +78,7 @@ describe('AttachFileWidgetDialogComponent', () => {
spyOn(nodeService, 'getNode').and.returnValue(of(new Node({ id: 'fake-node', path: { elements: [{ nodeType: 'st:site', name: 'fake-site'}] } })));
spyOn(siteService, 'getSite').and.returnValue(of(fakeSite));
spyOn(siteService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
spyOn(siteService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
spyOn(widget, 'isLoggedIn').and.callFake(() => isLogged);
});

View File

@@ -34,7 +34,7 @@ import { ProcessContentService } from '../../services/process-content.service';
const fakePngAnswer = new RelatedContentRepresentation({
id: 1155,
name: 'a_png_file.png',
created: '2017-07-25T17:17:37.099Z',
created: new Date('2017-07-25T17:17:37.099Z'),
createdBy: {id: 1001, firstName: 'Admin', lastName: 'admin', email: 'admin'},
relatedContent: false,
contentAvailable: true,

View File

@@ -15,10 +15,10 @@
* limitations under the License.
*/
import { CommentModel } from '@alfresco/adf-core';
import { CommentModel, User } from '@alfresco/adf-core';
export const mockProcessInstanceComments = [
new CommentModel({ message: 'Test1', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} }),
new CommentModel({ message: 'Test2', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} }),
new CommentModel({ message: 'Test3', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} })
new CommentModel({ message: 'Test1', created: new Date(), createdBy: new User({firstName: 'Admin', lastName: 'User'}) }),
new CommentModel({ message: 'Test2', created: new Date(), createdBy: new User({firstName: 'Admin', lastName: 'User'}) }),
new CommentModel({ message: 'Test3', created: new Date(), createdBy: new User({firstName: 'Admin', lastName: 'User'}) })
];

View File

@@ -911,8 +911,8 @@ export const fakeUser = new UserRepresentation({
password: null,
type: 'enterprise',
status: 'active',
created: '2020-08-14T09:21:52.306Z',
lastUpdate: '2020-08-14T09:22:48.147Z',
created: new Date('2020-08-14T09:21:52.306Z'),
lastUpdate: new Date('2020-08-14T09:22:48.147Z'),
tenantId: 310,
groups: [
{

View File

@@ -17,7 +17,7 @@
import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs';
import { CommentModel, AlfrescoApiService, LogService, CommentsService } from '@alfresco/adf-core';
import { CommentModel, AlfrescoApiService, LogService, CommentsService, User } from '@alfresco/adf-core';
import { map, catchError } from 'rxjs/operators';
import { ActivitiCommentsApi } from '@alfresco/js-api';
import { PeopleProcessService } from '../../common/services/people-process.service';
@@ -57,7 +57,7 @@ export class CommentProcessService implements CommentsService {
id: comment.id,
message: comment.message,
created: comment.created,
createdBy: user
createdBy: new User(user)
}));
});
return comments;
@@ -81,7 +81,7 @@ export class CommentProcessService implements CommentsService {
id: response.id,
message: response.message,
created: response.created,
createdBy: response.createdBy
createdBy: new User(response.createdBy)
})),
catchError((err: any) => this.handleError(err))
);
@@ -92,7 +92,7 @@ export class CommentProcessService implements CommentsService {
return throwError(error || 'Server error');
}
getUserImage(user: any): string {
getUserImage(user: UserProcessModel): string {
return this.peopleProcessService.getUserImage(user);
}
}

View File

@@ -16,7 +16,7 @@
*/
import {
ProcessFilterRequestRepresentation,
ProcessInstanceQueryRepresentation,
ProcessInstanceFilterRepresentation,
UserProcessInstanceFilterRepresentation
} from '@alfresco/js-api';
@@ -50,7 +50,7 @@ export class FilterProcessRepresentationModel implements UserProcessInstanceFilt
/**
* This object represent the parameters of a process filter.
*/
export class ProcessFilterParamRepresentationModel implements ProcessFilterRequestRepresentation {
export class ProcessFilterParamRepresentationModel implements ProcessInstanceQueryRepresentation {
processDefinitionId?: string;
processInstanceId?: string;

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { AlfrescoApiService, CommentModel, CommentsService } from '@alfresco/adf-core';
import { AlfrescoApiService, CommentModel, CommentsService, User } from '@alfresco/adf-core';
import { ActivitiCommentsApi, CommentRepresentation } from '@alfresco/js-api';
import { Injectable } from '@angular/core';
import { from, Observable, throwError } from 'rxjs';
@@ -100,7 +100,7 @@ export class TaskCommentsService implements CommentsService {
id: representation.id,
message: representation.message,
created: representation.created,
createdBy: representation.createdBy
createdBy: new User(representation.createdBy)
});
}

View File

@@ -24,7 +24,8 @@ import {
FormOutcomeEvent,
FormOutcomeModel,
LogService,
CommentModel
CommentModel,
User
} from '@alfresco/adf-core';
import { TaskDetailsModel } from '../models/task-details.model';
import {
@@ -101,9 +102,9 @@ describe('TaskDetailsComponent', () => {
taskCommentsService = TestBed.inject(TaskCommentsService);
spyOn(taskCommentsService, 'get').and.returnValue(of([
new CommentModel({ message: 'Test1', created: Date.now(), createdBy: { firstName: 'Admin', lastName: 'User' } }),
new CommentModel({ message: 'Test2', created: Date.now(), createdBy: { firstName: 'Admin', lastName: 'User' } }),
new CommentModel({ message: 'Test3', created: Date.now(), createdBy: { firstName: 'Admin', lastName: 'User' } })
new CommentModel({ message: 'Test1', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }),
new CommentModel({ message: 'Test2', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }),
new CommentModel({ message: 'Test3', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) })
]));
fixture = TestBed.createComponent(TaskDetailsComponent);