From c445b6a4dff38b4e6de7d27d35618cc51630e757 Mon Sep 17 00:00:00 2001 From: Infad Kachancheri Date: Thu, 1 Jun 2017 20:43:19 +0530 Subject: [PATCH] [ADF-710] Create an Process Attachment List component (#1919) * added new component to list the process attachments with view, download and delete functionality * added unit test cases for activit-process-attachment-list component * exported new process attachment list component * added documentation for process-attachment-list component --- .../ng2-activiti-processlist/README.md | 24 ++ .../docs/assets/process-attachment-list.png | Bin 0 -> 16319 bytes .../ng2-activiti-processlist/index.ts | 7 +- ...viti-process-attachment-list.component.css | 17 ++ ...iti-process-attachment-list.component.html | 15 ++ ...-process-attachment-list.component.spec.ts | 210 ++++++++++++++++++ ...iviti-process-attachment-list.component.ts | 163 ++++++++++++++ .../src/components/index.ts | 1 + 8 files changed, 435 insertions(+), 2 deletions(-) create mode 100644 ng2-components/ng2-activiti-processlist/docs/assets/process-attachment-list.png create mode 100644 ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.css create mode 100644 ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.html create mode 100644 ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.spec.ts create mode 100644 ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.ts diff --git a/ng2-components/ng2-activiti-processlist/README.md b/ng2-components/ng2-activiti-processlist/README.md index 3c5bcae34a..ab523f7adc 100644 --- a/ng2-components/ng2-activiti-processlist/README.md +++ b/ng2-components/ng2-activiti-processlist/README.md @@ -381,6 +381,30 @@ Displays comments associated with a particular process instances and allows the No events are emitted by this component +### Process Attachment List component + +This component displays attached documents on a specified process instance + +```html + +``` +![process-attachment-list-sample](docs/assets/process-attachment-list.png) + +#### Options + + +| Name | Description | +| --- | --- | +| `processInstanceId` | (required): The numeric ID of the process instance to display | + +#### Events + + +| Name | Description | +| --- | --- | +| `attachmentClick` | Emitted when the attachment double clicked or selected view option from context menu by the user from within the component | + ## Build from sources Alternatively you can build component from sources with the following commands: diff --git a/ng2-components/ng2-activiti-processlist/docs/assets/process-attachment-list.png b/ng2-components/ng2-activiti-processlist/docs/assets/process-attachment-list.png new file mode 100644 index 0000000000000000000000000000000000000000..23d902bfb4de586ecd665756581208184f7d75cd GIT binary patch literal 16319 zcmd6Oc{rAB*r&IZ%93P{9wZ@q5uy;1t?YaD?6NQ6t)55}CD}q*5<;@?m9*KiFNN$x zWZ#*e_nVnx=9^>YnBzOX`M&W-FVD;K-1l`|=Xw6NJ6K&+fqWn1J`xfV@{5XcS4c>9 zX5jk_(jEAhXYp7o{;sn}(B>o2RLZC5g48lY`|+S92Fj zOGnphPHxjXtE5Osj*?uIJFn^W^mmW9p@zZ82--Vlwn4|Z7;I3CcHu+=iO zlW=r!$ZAndE6DO#7hgPORCz=qUfk$NO=@AXgV95yW6%CRc=zwgIL^zo4@phQZ*o*g zH{6)!zx{W6hFJaRhR#%d$>`HvkJf&SN-YJpwY12R5{N%a-9vDZBqZyMU0q#Gdna?_ z_iq3AHu=LTLuXf4rcCecA4w!RTuPpLhfeZu|3H6`ShfA%t8!GE+c*CA!Sl=ew_lLo z)&HOO3;hokcKOGbmX>bLMpeDmeU)WUq;Fs#JfWeXk(ZaJlcj%{nOQQhWha)KIObOR z^y$+_kEm0xj1LXXw`!<)dwEHA5`27o>gwwQ+Bt`Zhx`239ByoXt-mH8a#`uhvp&3U zcU=AA>};%r=hX7dAnON79-T8OxvTPqFANS{UzeKtBVUu zojsPHC46ylF_K58y{)Z2_LN;;rJs$BjmeFf3yO+&wKM(xPNq40xJMyKlEo<{O=@K* z;;iptbaeFkxLSbHrAwETlzbN2bPDu;Z>=|OrM!5t`R2>5gXb4LlDCeexKUEr@rPJm{-vj<=iNKg&NF?**VzRHAJ&-p zE%kWTU2MG=!C6vVT)wgRoi$*6=II&NjLb|*7D@WUhueC3j0_CyEG-KxzEG>FH3n_? zzYm}zR#hkGP9GyDoXFunHnhohRY#{IT_cS}%=zkQL;Q5bQg66*j$z3gkKf%54FRK3 zp3}Wq+L_hW)uN6+b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aHcCOr68o0xQ@bY3=?^3Dvc%qucSC{`R1nE#P$<7$n@UaiCKvVIYmf~t&PnJ9yZy2 zPER6$ih`6-=P-!JDVB2r@#w@=<H)cEOLPM*6L|&e{A+u~AFd7tOuqNT0 zE59%zWt2Q?Y|T!iJH2w2-zVB2XxmF5`N3M<-4|rA{x)Q>pnhw4>i0jdvXB|B?%DqC zKlK6b|HU%N?!RTo$NJx%K;QA-+?$oK$^ZHBm{-@&E&i*gU$!WDTFGV-FZcf3zO9QF LROPZ|uHO1D;?MQ` literal 0 HcmV?d00001 diff --git a/ng2-components/ng2-activiti-processlist/index.ts b/ng2-components/ng2-activiti-processlist/index.ts index 055737baaa..f779eb0e8e 100644 --- a/ng2-components/ng2-activiti-processlist/index.ts +++ b/ng2-components/ng2-activiti-processlist/index.ts @@ -29,7 +29,8 @@ import { ActivitiProcessInstanceVariables, ActivitiProcessComments, ActivitiProcessInstanceDetails, - ActivitiStartProcessInstance + ActivitiStartProcessInstance, + ActivitiProcessAttachmentListComponent } from './src/components/index'; import { ActivitiProcessService } from './src/services/activiti-process.service'; @@ -39,6 +40,7 @@ export * from './src/components/activiti-processlist.component'; export * from './src/components/activiti-filters.component'; export * from './src/components/activiti-process-instance-details.component'; export * from './src/components/activiti-start-process.component'; +export * from './src/components/activiti-process-attachment-list.component'; // models export * from './src/models/index'; @@ -54,7 +56,8 @@ export const ACTIVITI_PROCESSLIST_DIRECTIVES: [any] = [ ActivitiProcessInstanceTasks, ActivitiProcessInstanceVariables, ActivitiProcessComments, - ActivitiStartProcessInstance + ActivitiStartProcessInstance, + ActivitiProcessAttachmentListComponent ]; export const ACTIVITI_PROCESSLIST_PROVIDERS: [any] = [ diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.css b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.css new file mode 100644 index 0000000000..170e76fd6c --- /dev/null +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.css @@ -0,0 +1,17 @@ +alfresco-datatable >>> .column-header { + color: #232323; + font-size: 15px; +} + +alfresco-datatable >>> .data-cell { + cursor: pointer !important; +} + +.no-attachment-message { + border: 1px solid rgb(224, 224, 224); + background: #fff; + text-align: left; + border-top: none; + padding: 10px; + text-align: center; +} diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.html b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.html new file mode 100644 index 0000000000..3613ae89f9 --- /dev/null +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.html @@ -0,0 +1,15 @@ +

+ No Attachments Found +
+ + + + + + + \ No newline at end of file diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.spec.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.spec.ts new file mode 100644 index 0000000000..cc0c99e4bb --- /dev/null +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.spec.ts @@ -0,0 +1,210 @@ +/*! + * @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. + */ + +import { SimpleChange } from '@angular/core'; +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { Observable } from 'rxjs/Rx'; + +import { AlfrescoTranslationService, CoreModule } from 'ng2-alfresco-core'; +import { ActivitiContentService } from 'ng2-activiti-form'; +import { DataTableModule, ObjectDataRow, DataRowEvent, ObjectDataTableAdapter, DataSorting } from 'ng2-alfresco-datatable'; + +import { ActivitiProcessAttachmentListComponent } from './activiti-process-attachment-list.component'; +import { TranslationMock } from './../assets/translation.service.mock'; + +describe('Activiti Process Instance Attachment List', () => { + + let componentHandler: any; + let service: ActivitiContentService; + let component: ActivitiProcessAttachmentListComponent; + let fixture: ComponentFixture; + let getProcessRelatedContentSpy: jasmine.Spy; + let deleteContentSpy: jasmine.Spy; + let getFileRawContentSpy: jasmine.Spy; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [ + CoreModule.forRoot(), + DataTableModule.forRoot() + ], + declarations: [ + ActivitiProcessAttachmentListComponent + ], + providers: [ + { provide: AlfrescoTranslationService, useClass: TranslationMock }, + ActivitiContentService + ] + }).compileComponents(); + })); + + beforeEach(() => { + + fixture = TestBed.createComponent(ActivitiProcessAttachmentListComponent); + component = fixture.componentInstance; + service = fixture.debugElement.injector.get(ActivitiContentService); + + getProcessRelatedContentSpy = spyOn(service, 'getProcessRelatedContent').and.returnValue(Observable.of( + { + 'size': 2, + 'total': 2, + 'start': 0, + 'data': [{ + 'id': 4001, + 'name': 'Invoice01.pdf', + 'created': '2017-05-12T12:50:05.522+0000', + 'createdBy': { + 'id': 1, + 'firstName': 'Apps', + 'lastName': 'Administrator', + 'email': 'admin@app.activiti.com', + 'company': 'Alfresco.com', + 'pictureId': 3003 + }, + 'relatedContent': true, + 'contentAvailable': true, + 'link': false, + 'mimeType': 'application/pdf', + 'simpleType': 'pdf', + 'previewStatus': 'created', + 'thumbnailStatus': 'created' + }, + { + 'id': 4002, + 'name': 'Invoice02.pdf', + 'created': '2017-05-12T12:50:05.522+0000', + 'createdBy': { + 'id': 1, + 'firstName': 'Apps', + 'lastName': 'Administrator', + 'email': 'admin@app.activiti.com', + 'company': 'Alfresco.com', + 'pictureId': 3003 + }, + 'relatedContent': true, + 'contentAvailable': true, + 'link': false, + 'mimeType': 'application/pdf', + 'simpleType': 'pdf', + 'previewStatus': 'created', + 'thumbnailStatus': 'created' + }] + })); + + deleteContentSpy = spyOn(service, 'deleteRelatedContent').and.returnValue(Observable.of({successCode: true})); + + let blobObj = new Blob(); + getFileRawContentSpy = spyOn(service, 'getFileRawContent').and.returnValue(Observable.of( + blobObj + )); + + componentHandler = jasmine.createSpyObj('componentHandler', [ + 'upgradeAllRegistered', + 'upgradeElement' + ]); + window['componentHandler'] = componentHandler; + }); + + it('should load attachments when processInstanceId specified', () => { + let change = new SimpleChange(null, '123', true); + component.ngOnChanges({ 'processInstanceId': change }); + expect(getProcessRelatedContentSpy).toHaveBeenCalled(); + }); + + it('should emit an error when an error occurs loading attachments', () => { + let emitSpy = spyOn(component.error, 'emit'); + getProcessRelatedContentSpy.and.returnValue(Observable.throw({})); + let change = new SimpleChange(null, '123', true); + component.ngOnChanges({ 'processInstanceId': change }); + expect(emitSpy).toHaveBeenCalled(); + }); + + it('should not attach when no processInstanceId is specified', () => { + fixture.detectChanges(); + expect(getProcessRelatedContentSpy).not.toHaveBeenCalled(); + }); + + it('should display attachments when the process has attachments', async(() => { + let change = new SimpleChange(null, '123', true); + component.ngOnChanges({ 'processInstanceId': change }); + + fixture.whenStable().then(() => { + fixture.detectChanges(); + expect(fixture.debugElement.queryAll(By.css('alfresco-datatable tbody tr')).length).toBe(2); + }); + })); + + it('should not display attachments when the process has no attachments', async(() => { + component.processInstanceId = '123'; + getProcessRelatedContentSpy.and.returnValue(Observable.of({ + 'size': 0, + 'total': 0, + 'start': 0, + 'data': [] + })); + fixture.detectChanges(); + fixture.whenStable().then(() => { + fixture.detectChanges(); + expect(fixture.debugElement.queryAll(By.css('alfresco-datatable tbody tr')).length).toBe(0); + }); + })); + + describe('change detection', () => { + + let change = new SimpleChange('123', '456', true); + let nullChange = new SimpleChange('123', null, true); + + beforeEach(async(() => { + component.processInstanceId = '123'; + fixture.detectChanges(); + fixture.whenStable().then(() => { + getProcessRelatedContentSpy.calls.reset(); + }); + })); + + it('should fetch new attachments when processInstanceId changed', () => { + component.ngOnChanges({ 'processInstanceId': change }); + expect(getProcessRelatedContentSpy).toHaveBeenCalledWith('456'); + }); + + it('should NOT fetch new attachments when empty changeset made', () => { + component.ngOnChanges({}); + expect(getProcessRelatedContentSpy).not.toHaveBeenCalled(); + }); + + it('should NOT fetch new attachments when processInstanceId changed to null', () => { + component.ngOnChanges({ 'processInstanceId': nullChange }); + expect(getProcessRelatedContentSpy).not.toHaveBeenCalled(); + }); + }); + + describe('Delete attachments', () => { + + beforeEach(async(() => { + component.processInstanceId = '123'; + fixture.detectChanges(); + fixture.whenStable(); + })); + + it('should display a dialog to the user when the Add button clicked', () => { + expect(true).toBe(true); + }); + + }); + +}); diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.ts new file mode 100644 index 0000000000..16139580e1 --- /dev/null +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-attachment-list.component.ts @@ -0,0 +1,163 @@ +/*! + * @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. + */ + +import { Component, OnChanges, Input, SimpleChanges, Output, EventEmitter } from '@angular/core'; +import { AlfrescoTranslationService, ContentService } from 'ng2-alfresco-core'; +import { ActivitiContentService } from 'ng2-activiti-form'; + +@Component({ + selector: 'activiti-process-attachment-list', + styleUrls: ['./activiti-process-attachment-list.component.css'], + templateUrl: './activiti-process-attachment-list.component.html' +}) +export class ActivitiProcessAttachmentListComponent implements OnChanges { + + @Input() + processInstanceId: string; + + @Output() + attachmentClick = new EventEmitter(); + + @Output() + error: EventEmitter = new EventEmitter(); + + attachments: any[] = []; + + constructor(private translateService: AlfrescoTranslationService, + private activitiContentService: ActivitiContentService, + private contentService: ContentService) { + + if (translateService) { + translateService.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src'); + } + } + + ngOnChanges(changes: SimpleChanges) { + if (changes['processInstanceId'] && changes['processInstanceId'].currentValue) { + this.processInstanceId = changes['processInstanceId'].currentValue; + this.loadAttachmentsByProcessInstanceId(this.processInstanceId); + } + } + + reset () { + this.attachments = []; + } + + private loadAttachmentsByProcessInstanceId(processInstanceId: string) { + if (processInstanceId) { + this.reset(); + this.activitiContentService.getProcessRelatedContent(processInstanceId).subscribe( + (res: any) => { + res.data.forEach(content => { + this.attachments.push({ + id: content.id, + name: content.name, + created: content.created, + createdBy: content.createdBy.firstName + ' ' + content.createdBy.lastName, + icon: this.activitiContentService.getMimeTypeIcon(content.mimeType) + }); + }); + + }, + (err) => { + this.error.emit(err); + }); + } + } + + private deleteAttachmentById(contentId: string) { + if (contentId) { + this.activitiContentService.deleteRelatedContent(contentId).subscribe( + (res: any) => { + this.attachments = this.attachments.filter(content => { + return content.id !== contentId; + }); + }, + (err) => { + this.error.emit(err); + }); + } + } + + isEmpty(): boolean { + return this.attachments && this.attachments.length === 0; + } + + onShowRowActionsMenu(event: any) { + let viewAction = { + title: 'View', + name: 'view' + }; + + let removeAction = { + title: 'Remove', + name: 'remove' + }; + + let downloadAction = { + title: 'Download', + name: 'download' + }; + + event.value.actions = [ + viewAction, + removeAction, + downloadAction + ]; + } + + onExecuteRowAction(event: any) { + let args = event.value; + let action = args.action; + if (action.name === 'view') { + this.emitDocumentContent(args.row.obj); + } else if (action.name === 'remove') { + this.deleteAttachmentById(args.row.obj.id); + } else if (action.name === 'download') { + this.downloadContent(args.row.obj); + } + } + + openContent(event: any): void { + let content = event.value.obj; + this.emitDocumentContent(content); + } + + emitDocumentContent(content: any) { + this.activitiContentService.getFileRawContent(content.id).subscribe( + (blob: Blob) => { + content.contentBlob = blob; + this.attachmentClick.emit(content); + }, + (err) => { + this.error.emit(err); + } + ); + } + + /** + * Invoke content download. + */ + downloadContent(content: any): void { + this.activitiContentService.getFileRawContent(content.id).subscribe( + (blob: Blob) => this.contentService.downloadBlob(blob, content.name), + (err) => { + this.error.emit(err); + } + ); + } +} diff --git a/ng2-components/ng2-activiti-processlist/src/components/index.ts b/ng2-components/ng2-activiti-processlist/src/components/index.ts index f25e4eff86..ab3d5f1a07 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/index.ts +++ b/ng2-components/ng2-activiti-processlist/src/components/index.ts @@ -23,3 +23,4 @@ export * from './activiti-process-instance-variables.component'; export * from './activiti-process-comments.component'; export * from './activiti-process-instance-details.component'; export * from './activiti-start-process.component'; +export * from './activiti-process-attachment-list.component';