From fcb15868f8a423108701b1a8c68b3927ea594f11 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 19 Dec 2025 12:07:20 +0000 Subject: [PATCH] ACS-7579 Remove unused process audit directive (#11474) --- docs/README.md | 1 - .../images/adf-process-audit-directive.png | Bin 7652 -> 0 bytes .../directives/process-audit.directive.md | 43 ---- .../process-comments.component.ts | 3 +- .../process-audit.directive.spec.ts | 216 ------------------ .../process-audit/process-audit.directive.ts | 109 --------- .../src/lib/process-list/public-api.ts | 6 +- .../process-list/services/process.service.ts | 2 + 8 files changed, 4 insertions(+), 376 deletions(-) delete mode 100644 docs/docassets/images/adf-process-audit-directive.png delete mode 100644 docs/process-services/directives/process-audit.directive.md delete mode 100644 lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.spec.ts delete mode 100644 lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.ts diff --git a/docs/README.md b/docs/README.md index 6cb106f313..48d4d5f9a8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -441,7 +441,6 @@ for more information about installing and using the source code. | Name | Description | Source link | | ---- | ----------- | ----------- | | [Claim Task Directive](process-services/directives/claim-task.directive.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Claims a task | [Source](../lib/process-services/src/lib/task-list/components/task-form/claim-task.directive.ts) | -| [Process Audit Directive](process-services/directives/process-audit.directive.md) | Fetches the Process Audit information in PDF or JSON format. | [Source](../lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.ts) | | [Unclaim Task Directive](process-services/directives/unclaim-task.directive.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Unclaims a task | [Source](../lib/process-services/src/lib/task-list/components/task-form/unclaim-task.directive.ts) | ### Services diff --git a/docs/docassets/images/adf-process-audit-directive.png b/docs/docassets/images/adf-process-audit-directive.png deleted file mode 100644 index 6f0c918e0781709aff3f0536dd9ef2a21901707a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7652 zcmd5=1ydbivc0$y+(NM6c5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P7UkD<&FJ?!$*%#2@)UgM38%~ZA~lYP+-5!aacq=S9< zpw<29GP;TLw+`(vlz{9mEN!VZZlp%-&Ib_^HA=qNJ&zmRU@X5n={xBpQovc}g+gud z_f2YEDNxVSN*9|vrM8h#RR+8^HsG^Ba{y5M9c?d>kw0p83P=ezN*ejJVfR%vH94$o z^BsfB0CK9Gu1E7JiyW`g6Sx2Sm$|t)EhFz~_k`Vi3Z3ASjvF#LF|w?OAS?jjRW1RL kVE_OS0O0rk+Vy-S2jm#nV67sN{r%4(C#57=2{QKo9~1W&3jhEB diff --git a/docs/process-services/directives/process-audit.directive.md b/docs/process-services/directives/process-audit.directive.md deleted file mode 100644 index 006a4fc107..0000000000 --- a/docs/process-services/directives/process-audit.directive.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -Title: Process Audit Directive -Added: v2.0.0 -Status: Active -Last reviewed: 2019-01-14 ---- - -# [Process Audit Directive](../../../lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.ts "Defined in process-audit.directive.ts") - -Fetches the Process Audit information in PDF or JSON format. - -![adf-process-audit-directive](../../docassets/images/adf-process-audit-directive.png) - -## Basic Usage - -```html - -``` - -## Class members - -### Properties - -| Name | Type | Default value | Description | -| ---- | ---- | ------------- | ----------- | -| download | `boolean` | true | Enables downloading of the audit file on clicking. | -| fileName | `string` | "Audit" | Name of the file to download (for PDF downloads). | -| format | `string` | "pdf" | Format for the audit information (can be "pdf" or "json"). | -| processId | `string` | | ID of the process. | - -### Events - -| Name | Type | Description | -| ---- | ---- | ----------- | -| clicked | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the decorated element is clicked. | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when an error occurs. | diff --git a/lib/process-services/src/lib/process-comments/process-comments.component.ts b/lib/process-services/src/lib/process-comments/process-comments.component.ts index 0d49751e5c..5cf75999d8 100644 --- a/lib/process-services/src/lib/process-comments/process-comments.component.ts +++ b/lib/process-services/src/lib/process-comments/process-comments.component.ts @@ -18,11 +18,10 @@ import { ADF_COMMENTS_SERVICE, CommentsComponent } from '@alfresco/adf-core'; import { CommentProcessService } from './services/comment-process.service'; import { Component, Input, ViewEncapsulation } from '@angular/core'; -import { CommonModule } from '@angular/common'; @Component({ selector: 'adf-process-instance-comments', - imports: [CommonModule, CommentsComponent], + imports: [CommentsComponent], providers: [ { provide: ADF_COMMENTS_SERVICE, diff --git a/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.spec.ts b/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.spec.ts deleted file mode 100644 index 1a481078de..0000000000 --- a/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.spec.ts +++ /dev/null @@ -1,216 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * 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 { Component } from '@angular/core'; -import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; -import { of, throwError } from 'rxjs'; -import { ProcessService } from '../../services/process.service'; -import { DownloadService } from '@alfresco/adf-core'; -import { ProcessInstanceAuditInfoRepresentation } from '@alfresco/js-api'; -import { ProcessAuditDirective } from './process-audit.directive'; - -@Component({ - selector: 'adf-basic-button', - imports: [ProcessAuditDirective], - template: ` ` -}) -class BasicButtonComponent { - download: boolean = false; - fileName: string; - format: string; - - onAuditClick(_event: any) { - /* do nothing */ - } - onAuditError(_event: any) { - /* do nothing */ - } -} - -describe('ProcessAuditDirective', () => { - let fixture: ComponentFixture; - let component: BasicButtonComponent; - let service: ProcessService; - - const createFakePdfBlob = (): Blob => { - const pdfData = atob( - 'JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' + - 'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' + - 'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' + - 'Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg' + - 'L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+' + - 'PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u' + - 'dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq' + - 'Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU' + - 'CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu' + - 'ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g' + - 'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' + - 'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' + - 'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G' - ); - return new Blob([pdfData], { type: 'application/pdf' }); - }; - - const blob = createFakePdfBlob(); - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [BasicButtonComponent] - }); - fixture = TestBed.createComponent(BasicButtonComponent); - component = fixture.componentInstance; - service = TestBed.inject(ProcessService); - }); - - afterEach(() => fixture.destroy()); - - it('should fetch the pdf Blob when the format is pdf', fakeAsync(() => { - component.fileName = 'FakeAuditName'; - component.format = 'pdf'; - spyOn(service, 'fetchProcessAuditPdfById').and.returnValue(of(blob)); - spyOn(component, 'onAuditClick').and.callThrough(); - - fixture.detectChanges(); - - const button = fixture.nativeElement.querySelector('#auditButton'); - - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(component.onAuditClick).toHaveBeenCalledWith({ format: 'pdf', value: blob, fileName: 'FakeAuditName' }); - }); - - button.click(); - })); - - it('should download the audit in PDF format (default mode)', fakeAsync(() => { - component.fileName = 'FakeAuditName'; - component.download = true; - const downloadService = TestBed.inject(DownloadService); - spyOn(service, 'fetchProcessAuditPdfById').and.returnValue(of(blob)); - spyOn(downloadService, 'downloadBlob').and.stub(); - - fixture.detectChanges(); - const button = fixture.nativeElement.querySelector('#auditButton'); - - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(downloadService.downloadBlob).toHaveBeenCalledWith(blob, 'FakeAuditName.pdf'); - }); - - button.click(); - })); - - it('should throw error if download audit failed', fakeAsync(() => { - const expectedError = 'Failed to get audit'; - spyOn(service, 'fetchProcessAuditPdfById').and.returnValue(throwError(expectedError)); - spyOn(component, 'onAuditError').and.stub(); - - fixture.detectChanges(); - const button = fixture.nativeElement.querySelector('#auditButton'); - - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(component.onAuditError).toHaveBeenCalledWith(expectedError); - }); - - button.click(); - })); - - it('should fetch the json info when the format is json', fakeAsync(() => { - component.fileName = 'FakeAuditName'; - component.format = 'json'; - component.download = true; - const auditJson: ProcessInstanceAuditInfoRepresentation = { - processInstanceId: '42516', - processInstanceName: 'Fake Process - August 3rd 2017', - processDefinitionName: 'Claim Approval Process', - processDefinitionVersion: '1', - processInstanceStartTime: 'Thu Aug 03 15:32:47 UTC 2017', - processInstanceEndTime: null, - // eslint-disable-next-line @cspell/spellchecker - processInstanceDurationInMillis: null, - processInstanceInitiator: 'MyName MyLastname', - entries: [ - { - index: 1, - type: 'startForm', - selectedOutcome: null, - formData: [ - { - fieldName: 'User Name', - fieldId: 'username', - value: 'dsassd' - }, - { fieldName: 'Claim Amount', fieldId: 'claimamount', value: '22' } - ], - taskName: null, - taskAssignee: null, - activityId: null, - // eslint-disable-next-line @cspell/spellchecker - activityName: null, - activityType: null, - startTime: null, - endTime: null, - durationInMillis: null - } - ], - decisionInfo: { calculatedValues: [], appliedRules: [] } - }; - spyOn(service, 'fetchProcessAuditJsonById').and.returnValue(of(auditJson)); - spyOn(component, 'onAuditClick').and.callThrough(); - - fixture.detectChanges(); - - const button = fixture.nativeElement.querySelector('#auditButton'); - - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(component.onAuditClick).toHaveBeenCalledWith({ format: 'json', value: auditJson, fileName: 'FakeAuditName' }); - }); - - button.click(); - })); - - it('should fetch the pdf Blob as default when the format is UNKNOW', fakeAsync(() => { - component.fileName = 'FakeAuditName'; - component.format = 'fakeFormat'; - spyOn(service, 'fetchProcessAuditPdfById').and.returnValue(of(blob)); - spyOn(component, 'onAuditClick').and.callThrough(); - - fixture.detectChanges(); - - const button = fixture.nativeElement.querySelector('#auditButton'); - - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(component.onAuditClick).toHaveBeenCalledWith({ format: 'pdf', value: blob, fileName: 'FakeAuditName' }); - }); - - button.click(); - })); -}); diff --git a/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.ts b/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.ts deleted file mode 100644 index 722fc9b80a..0000000000 --- a/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.ts +++ /dev/null @@ -1,109 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * 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. - */ - -/* eslint-disable @angular-eslint/no-input-rename */ - -import { DownloadService } from '@alfresco/adf-core'; -import { Directive, EventEmitter, Input, OnChanges, Output } from '@angular/core'; -import { ProcessService } from '../../services/process.service'; - -const JSON_FORMAT: string = 'json'; -const PDF_FORMAT: string = 'pdf'; - -@Directive({ - // eslint-disable-next-line @angular-eslint/directive-selector - selector: 'button[adf-process-audit]', - host: { - role: 'button', - '(click)': 'onClickAudit()' - } -}) -export class ProcessAuditDirective implements OnChanges { - /** ID of the process. */ - @Input('process-id') - processId: string; - - /** Name of the file to download (for PDF downloads). */ - @Input() - fileName: string = 'Audit'; - - /** Format for the audit information (can be "pdf" or "json"). */ - @Input() - format: string = 'pdf'; - - /** Enables downloading of the audit file on clicking. */ - @Input() - download: boolean = true; - - /** Emitted when the decorated element is clicked. */ - @Output() - clicked: EventEmitter = new EventEmitter(); - - /** Emitted when an error occurs. */ - @Output() - error: EventEmitter = new EventEmitter(); - - constructor(private downloadService: DownloadService, private processListService: ProcessService) {} - - ngOnChanges(): void { - if (!this.isValidType()) { - this.setDefaultFormatType(); - } - } - - isValidType() { - return this.format && (this.isJsonFormat() || this.isPdfFormat()); - } - - setDefaultFormatType(): void { - this.format = PDF_FORMAT; - } - - /** - * fetch the audit information in the requested format - */ - fetchAuditInfo(): void { - if (this.isPdfFormat()) { - this.processListService.fetchProcessAuditPdfById(this.processId).subscribe( - (blob: Blob) => { - if (this.download) { - this.downloadService.downloadBlob(blob, this.fileName + '.pdf'); - } - this.clicked.emit({ format: this.format, value: blob, fileName: this.fileName }); - }, - (err) => this.error.emit(err) - ); - } else { - this.processListService.fetchProcessAuditJsonById(this.processId).subscribe( - (res) => this.clicked.emit({ format: this.format, value: res, fileName: this.fileName }), - (err) => this.error.emit(err) - ); - } - } - - onClickAudit() { - this.fetchAuditInfo(); - } - - isJsonFormat() { - return this.format === JSON_FORMAT; - } - - isPdfFormat() { - return this.format === PDF_FORMAT; - } -} diff --git a/lib/process-services/src/lib/process-list/public-api.ts b/lib/process-services/src/lib/process-list/public-api.ts index 7647d976f8..bb70a384b7 100644 --- a/lib/process-services/src/lib/process-list/public-api.ts +++ b/lib/process-services/src/lib/process-list/public-api.ts @@ -15,29 +15,25 @@ * limitations under the License. */ -// component import { ProcessInstanceListComponent } from './components/process-list/process-list.component'; import { ProcessFiltersComponent } from './components/process-filters/process-filters.component'; import { ProcessInstanceDetailsComponent } from './components/process-instance-details/process-instance-details.component'; import { ProcessInstanceHeaderComponent } from './components/process-instance-header/process-instance-header.component'; import { ProcessInstanceTasksComponent } from './components/process-instance-tasks/process-instance-tasks.component'; import { StartProcessInstanceComponent } from './components/start-process/start-process.component'; -import { ProcessAuditDirective } from './components/process-audit/process-audit.directive'; export * from './components/process-filters/process-filters.component'; export * from './components/process-instance-details/process-instance-details.component'; -export * from './components/process-audit/process-audit.directive'; export * from './components/process-instance-header/process-instance-header.component'; export * from './components/process-instance-tasks/process-instance-tasks.component'; export * from './components/process-list/process-list.component'; export * from './components/start-process/start-process.component'; -// services export * from './services/process.service'; export * from './services/process-filter.service'; +/* @deprecated use individual exports */ export const PROCESS_LIST_DIRECTIVES = [ - ProcessAuditDirective, ProcessInstanceListComponent, ProcessFiltersComponent, ProcessInstanceDetailsComponent, diff --git a/lib/process-services/src/lib/process-list/services/process.service.ts b/lib/process-services/src/lib/process-list/services/process.service.ts index 0ea28f43cd..d59cee6ebb 100644 --- a/lib/process-services/src/lib/process-list/services/process.service.ts +++ b/lib/process-services/src/lib/process-list/services/process.service.ts @@ -106,6 +106,7 @@ export class ProcessService { } /** + * @deprecated This api is no longer used and will be removed in future releases. * Fetches the Process Audit information as a PDF. * * @param processId ID of the target process @@ -116,6 +117,7 @@ export class ProcessService { } /** + * @deprecated This api is no longer used and will be removed in future releases. * Fetches the Process Audit information in a JSON format. * * @param processId ID of the target process