disable upload content for completed task (#2332)

use primary color for upload button in proccess attachment and task attachment
This commit is contained in:
Eugenio Romano 2017-09-13 18:22:30 +01:00 committed by Popovics András
parent 1fd23cfd40
commit d1d3e02c33
6 changed files with 26 additions and 8 deletions

View File

@ -3,8 +3,6 @@
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
font-size: 18px; font-size: 18px;
font-family: Muli;
padding: 16px;
} }
.activiti-demo-grid { .activiti-demo-grid {

View File

@ -12,6 +12,7 @@
</adf-upload-drag-area> </adf-upload-drag-area>
<adf-create-process-attachment <adf-create-process-attachment
*ngIf="isRunning()"
[processInstanceId]="processId" [processInstanceId]="processId"
(success)="onFileUploadComplete($event)"> (success)="onFileUploadComplete($event)">
</adf-create-process-attachment> </adf-create-process-attachment>

View File

@ -15,8 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
import { Component, Input, OnInit, ViewChild } from '@angular/core'; import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
import { ProcessAttachmentListComponent, ProcessUploadService } from 'ng2-activiti-processlist'; import { ProcessAttachmentListComponent, ProcessUploadService } from 'ng2-activiti-processlist';
import { ProcessInstance, ProcessService } from 'ng2-activiti-processlist';
import { UploadService } from 'ng2-alfresco-core'; import { UploadService } from 'ng2-alfresco-core';
@Component({ @Component({
@ -24,11 +25,11 @@ import { UploadService } from 'ng2-alfresco-core';
templateUrl: './activiti-process-attachments.component.html', templateUrl: './activiti-process-attachments.component.html',
styleUrls: ['./activiti-process-attachments.component.css'], styleUrls: ['./activiti-process-attachments.component.css'],
providers: [ providers: [
{ provide: UploadService, useClass: ProcessUploadService } {provide: UploadService, useClass: ProcessUploadService}
] ]
}) })
export class ActivitiProcessAttachmentsComponent implements OnInit { export class ActivitiProcessAttachmentsComponent implements OnInit, OnChanges {
@Input() @Input()
processId: string; processId: string;
@ -39,15 +40,23 @@ export class ActivitiProcessAttachmentsComponent implements OnInit {
fileShowed: boolean = false; fileShowed: boolean = false;
content: Blob; content: Blob;
contentName: string; contentName: string;
processInstance: ProcessInstance;
constructor(private uploadService: UploadService) { constructor(private uploadService: UploadService, private processService: ProcessService) {
} }
ngOnInit() { ngOnInit() {
this.uploadService.fileUploadComplete.subscribe(value => this.onFileUploadComplete(value.data)); this.uploadService.fileUploadComplete.subscribe(value => this.onFileUploadComplete(value.data));
} }
ngOnChanges() {
if (this.processId) {
this.processService.getProcess(this.processId).subscribe((processInstance: ProcessInstance) => {
this.processInstance = processInstance;
});
}
}
onFileUploadComplete(content: any) { onFileUploadComplete(content: any) {
this.processAttachList.add(content); this.processAttachList.add(content);
} }
@ -58,4 +67,8 @@ export class ActivitiProcessAttachmentsComponent implements OnInit {
this.contentName = content.name; this.contentName = content.name;
} }
isRunning(): boolean {
return this.processInstance && !this.processInstance.ended;
}
} }

View File

@ -1,5 +1,6 @@
<button <button
id="add_new_process_content_button" id="add_new_process_content_button"
color="primary"
md-button md-button
md-raised-button md-raised-button
md-icon-button md-icon-button

View File

@ -1,5 +1,6 @@
<adf-datatable [rows]="attachments" [actions]="true" [loading]="isLoading" (rowDblClick)="openContent($event)" (showRowActionsMenu)="onShowRowActionsMenu($event)" <adf-datatable [rows]="attachments" [actions]="true" [loading]="isLoading" (rowDblClick)="openContent($event)" (showRowActionsMenu)="onShowRowActionsMenu($event)"
(executeRowAction)="onExecuteRowAction($event)"> (executeRowAction)="onExecuteRowAction($event)">
<adf-empty-list *ngIf="isEmpty()"> <adf-empty-list *ngIf="isEmpty()">
<div adf-empty-list-header class="adf-empty-list-header"> {{'PROCESS-ATTACHMENT.EMPTY.HEADER' | translate}} </div> <div adf-empty-list-header class="adf-empty-list-header"> {{'PROCESS-ATTACHMENT.EMPTY.HEADER' | translate}} </div>
<div adf-empty-list-body *ngIf="!isDisabled()"> <div adf-empty-list-body *ngIf="!isDisabled()">
@ -10,11 +11,13 @@
<img class="adf-empty-list__empty_doc_lib" [src]="emptyListImageUrl"> <img class="adf-empty-list__empty_doc_lib" [src]="emptyListImageUrl">
</div> </div>
</adf-empty-list> </adf-empty-list>
<data-columns> <data-columns>
<data-column key="icon" type="icon" srTitle="Thumbnail" [sortable]="false"></data-column> <data-column key="icon" type="icon" srTitle="Thumbnail" [sortable]="false"></data-column>
<data-column key="name" type="text" title="Name" class="full-width ellipsis-cell" [sortable]="true"></data-column> <data-column key="name" type="text" title="Name" class="full-width ellipsis-cell" [sortable]="true"></data-column>
<data-column key="created" type="date" format="shortDate" title="Created On"></data-column> <data-column key="created" type="date" format="shortDate" title="Created On"></data-column>
</data-columns> </data-columns>
<loading-content-template> <loading-content-template>
<ng-template> <ng-template>
<!--Add your custom loading template here--> <!--Add your custom loading template here-->
@ -22,4 +25,5 @@
</md-progress-spinner> </md-progress-spinner>
</ng-template> </ng-template>
</loading-content-template> </loading-content-template>
</adf-datatable>
</adf-datatable>

View File

@ -1,4 +1,5 @@
<button <button
color="primary"
md-button md-button
md-raised-button md-raised-button
md-icon-button md-icon-button