mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-23 18:05:09 +00:00
[ADF-4055] ProcessAttachmentListComponent- add opt parameter on process-instances api call (#4292)
* [ADF-4055] ProcessAttachmentListComponent - add opts parameter on load attachments api call * [ADF-4055] fix lint * [ADF-4055] - fix unit test * [ADF-4055] - change opt parameter format * [ADF-4055] remove useless unit test from process-content
This commit is contained in:
parent
c55cba5514
commit
0683c4d226
@ -196,5 +196,4 @@ describe('ProcessContentService', () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -128,10 +128,11 @@ export class ProcessContentService {
|
||||
/**
|
||||
* Gets related content items for a process instance.
|
||||
* @param processId ID of the target process
|
||||
* @param opts Options supported by JS-API
|
||||
* @returns Metadata for the content
|
||||
*/
|
||||
getProcessRelatedContent(processId: string): Observable<any> {
|
||||
return from(this.contentApi.getRelatedContentForProcessInstance(processId))
|
||||
getProcessRelatedContent(processId: string, opts?: any): Observable<any> {
|
||||
return from(this.contentApi.getRelatedContentForProcessInstance(processId, opts))
|
||||
.pipe(catchError((err) => this.handleError(err)));
|
||||
}
|
||||
|
||||
|
@ -240,6 +240,15 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should call getProcessRelatedContent with opt isRelatedContent=true', () => {
|
||||
getProcessRelatedContentSpy.and.returnValue(of(mockAttachment));
|
||||
const change = new SimpleChange(null, '123', true);
|
||||
const isRelatedContent = 'true';
|
||||
component.ngOnChanges({'processInstanceId': change});
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalled();
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalledWith('123', isRelatedContent);
|
||||
});
|
||||
|
||||
describe('change detection', () => {
|
||||
|
||||
let change = new SimpleChange('123', '456', true);
|
||||
@ -254,7 +263,7 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
|
||||
it('should fetch new attachments when processInstanceId changed', () => {
|
||||
component.ngOnChanges({ 'processInstanceId': change });
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalledWith('456');
|
||||
expect(getProcessRelatedContentSpy).toHaveBeenCalledWith('456', 'true');
|
||||
});
|
||||
|
||||
it('should NOT fetch new attachments when empty changeset made', () => {
|
||||
|
@ -111,7 +111,8 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
|
||||
if (processInstanceId) {
|
||||
this.reset();
|
||||
this.isLoading = true;
|
||||
this.activitiContentService.getProcessRelatedContent(processInstanceId).subscribe(
|
||||
const opts: string = 'true';
|
||||
this.activitiContentService.getProcessRelatedContent(processInstanceId, opts).subscribe(
|
||||
(res: any) => {
|
||||
res.data.forEach((content) => {
|
||||
this.attachments.push({
|
||||
|
Loading…
x
Reference in New Issue
Block a user