mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -0,0 +1,3 @@
|
||||
adf-create-process-attachment ::ng-deep button {
|
||||
float: right;
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<div id="attachment-process-list" *ngIf="processId">
|
||||
<h5>Attachments</h5>
|
||||
<div class="adf-no-form-container">
|
||||
<adf-upload-drag-area
|
||||
[parentId]="processId"
|
||||
[disabled]="isCompletedProcess()"
|
||||
[showNotificationBar]="false">
|
||||
<adf-process-attachment-list #processAttachList
|
||||
*ngIf="processId"
|
||||
[disabled]="isCompletedProcess()"
|
||||
[processInstanceId]="processId"
|
||||
(attachmentClick)="onAttachmentClick($event)">
|
||||
</adf-process-attachment-list>
|
||||
</adf-upload-drag-area>
|
||||
|
||||
<adf-create-process-attachment
|
||||
*ngIf="!isCompletedProcess()"
|
||||
[processInstanceId]="processId"
|
||||
(success)="onFileUploadComplete($event)">
|
||||
</adf-create-process-attachment>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="fileShowed">
|
||||
<adf-viewer
|
||||
[(showViewer)]="fileShowed"
|
||||
[blobFile]="content"
|
||||
[displayName]="contentName"
|
||||
[overlayMode]="true">
|
||||
</adf-viewer>
|
||||
</div>
|
@@ -0,0 +1,74 @@
|
||||
/*!
|
||||
* @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, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
|
||||
import { ProcessInstance, ProcessService ,
|
||||
ProcessAttachmentListComponent, ProcessUploadService } from '@alfresco/process-services';
|
||||
import { UploadService } from '@alfresco/core';
|
||||
|
||||
@Component({
|
||||
selector: 'activiti-process-attachments',
|
||||
templateUrl: './activiti-process-attachments.component.html',
|
||||
styleUrls: ['./activiti-process-attachments.component.css'],
|
||||
providers: [
|
||||
{provide: UploadService, useClass: ProcessUploadService}
|
||||
]
|
||||
})
|
||||
|
||||
export class ActivitiProcessAttachmentsComponent implements OnInit, OnChanges {
|
||||
|
||||
@Input()
|
||||
processId: string;
|
||||
|
||||
@ViewChild(ProcessAttachmentListComponent)
|
||||
processAttachList: ProcessAttachmentListComponent;
|
||||
|
||||
fileShowed: boolean = false;
|
||||
content: Blob;
|
||||
contentName: string;
|
||||
processInstance: ProcessInstance;
|
||||
|
||||
constructor(private uploadService: UploadService, private processService: ProcessService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
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) {
|
||||
this.processAttachList.add(content);
|
||||
}
|
||||
|
||||
onAttachmentClick(content: any): void {
|
||||
this.fileShowed = true;
|
||||
this.content = content.contentBlob;
|
||||
this.contentName = content.name;
|
||||
}
|
||||
|
||||
isCompletedProcess(): boolean {
|
||||
return this.processInstance && this.processInstance.ended !== undefined && this.processInstance.ended !== null;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
<div>
|
||||
<button mat-mini-fab (click)="onClickBack()" ><mat-icon>keyboard_backspace</mat-icon></button>
|
||||
<adf-diagram [processInstanceId]="processDefinitionId"></adf-diagram>
|
||||
</div>
|
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* @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 } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'activiti-show-diagram',
|
||||
templateUrl: './activiti-show-diagram.component.html',
|
||||
styleUrls: ['./activiti-show-diagram.component.css']
|
||||
})
|
||||
export class ActivitiShowDiagramComponent {
|
||||
|
||||
processDefinitionId: string;
|
||||
appId: string;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.params.subscribe(params => {
|
||||
this.processDefinitionId = params['processDefinitionId'];
|
||||
this.appId = params['appId'];
|
||||
});
|
||||
}
|
||||
|
||||
onClickBack() {
|
||||
this.router.navigate(['/activiti/apps/' + this.appId + '/processes']);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
adf-create-task-attachment ::ng-deep button {
|
||||
float: right;
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<div id="attachment-task-list" *ngIf="taskId">
|
||||
<h5>Attachments</h5>
|
||||
<div class="adf-no-form-container">
|
||||
<adf-upload-drag-area
|
||||
[parentId]="taskId"
|
||||
[disabled]="isCompletedTask()"
|
||||
[showNotificationBar]="false">
|
||||
<adf-task-attachment-list #taskAttachList
|
||||
*ngIf="taskId"
|
||||
[taskId]="taskId"
|
||||
[disabled]="isCompletedTask()"
|
||||
(attachmentClick)="onAttachmentClick($event)">
|
||||
</adf-task-attachment-list>
|
||||
</adf-upload-drag-area>
|
||||
|
||||
<adf-create-task-attachment
|
||||
*ngIf="!isCompletedTask()"
|
||||
[taskId]="taskId"
|
||||
(success)="onFileUploadComplete($event)">
|
||||
</adf-create-task-attachment>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="fileShowed">
|
||||
<adf-viewer
|
||||
[(showViewer)]="fileShowed"
|
||||
[blobFile]="content"
|
||||
[displayName]="contentName"
|
||||
[overlayMode]="true">
|
||||
</adf-viewer>
|
||||
</div>
|
@@ -0,0 +1,76 @@
|
||||
/*!
|
||||
* @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, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
|
||||
import { ProcessUploadService, TaskListService, TaskAttachmentListComponent } from '@alfresco/process-services';
|
||||
import { UploadService } from '@alfresco/core';
|
||||
|
||||
@Component({
|
||||
selector: 'activiti-task-attachments',
|
||||
templateUrl: './activiti-task-attachments.component.html',
|
||||
styleUrls: ['./activiti-task-attachments.component.css'],
|
||||
providers: [
|
||||
{ provide: UploadService, useClass: ProcessUploadService }
|
||||
]
|
||||
})
|
||||
|
||||
export class ActivitiTaskAttachmentsComponent implements OnInit, OnChanges {
|
||||
|
||||
@Input()
|
||||
taskId: string;
|
||||
|
||||
@ViewChild(TaskAttachmentListComponent)
|
||||
taskAttachList: TaskAttachmentListComponent;
|
||||
|
||||
fileShowed: boolean = false;
|
||||
content: Blob;
|
||||
contentName: string;
|
||||
|
||||
taskDetails: any;
|
||||
|
||||
constructor(private uploadService: UploadService,
|
||||
private activitiTaskList: TaskListService) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.uploadService.fileUploadComplete.subscribe(value => this.onFileUploadComplete(value.data));
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
if (this.taskId) {
|
||||
this.activitiTaskList.getTaskDetails(this.taskId).map((res) => res).subscribe(
|
||||
(res: any) => {
|
||||
this.taskDetails = res;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onFileUploadComplete(content: any) {
|
||||
this.taskAttachList.add(content);
|
||||
}
|
||||
|
||||
onAttachmentClick(content: any): void {
|
||||
this.fileShowed = true;
|
||||
this.content = content.contentBlob;
|
||||
this.contentName = content.name;
|
||||
}
|
||||
|
||||
isCompletedTask(): boolean {
|
||||
return this.taskDetails && this.taskDetails.endDate !== undefined && this.taskDetails.endDate !== null;
|
||||
}
|
||||
}
|
232
demo-shell/src/app/components/activiti/activiti.component.html
Normal file
232
demo-shell/src/app/components/activiti/activiti.component.html
Normal file
@@ -0,0 +1,232 @@
|
||||
<mat-tab-group [(selectedIndex)]="activeTab">
|
||||
<mat-tab id="tasks-header" href="#tasks" label="{{'PS-TAB.TASKS-TAB' | translate}}">
|
||||
<div class="page-content">
|
||||
<div class="activiti-grid" fxLayout="row" fxLayout.lt-lg="column" fxLayoutAlign="stretch">
|
||||
<div class="activiti-grid-item activiti-tasks-menu" fxFlex.gt-md="225px">
|
||||
<div class="activiti-list-buttons">
|
||||
<button color="primary" mat-raised-button data-automation-id="btn-start-task" class="activiti-list-buttons-start" (click)="navigateStartTask()">
|
||||
<mat-icon>add</mat-icon>
|
||||
<span>{{'PS-TAB.START-TASK' | translate}}</span>
|
||||
</button>
|
||||
</div>
|
||||
<adf-accordion>
|
||||
<adf-accordion-group [heading]="'Tasks'" [isSelected]="true" [isOpen]="true"
|
||||
[headingIcon]="'assignment'">
|
||||
<adf-filters
|
||||
[filterParam]="{name:'MY tasks'}"
|
||||
[appId]="appId"
|
||||
[hasIcon]="false"
|
||||
(filterClick)="onTaskFilterClick($event)"
|
||||
(success)="onSuccessTaskFilterList($event)"
|
||||
#activitifilter>
|
||||
</adf-filters>
|
||||
</adf-accordion-group>
|
||||
</adf-accordion>
|
||||
</div>
|
||||
<div class="activiti-grid-item activiti-tasks-list" fxFlex.gt-md="335px" [ngClass.gt-md]="{'small-pagination': true}"
|
||||
*ngIf="taskFilter && !isStartTaskMode()">
|
||||
<adf-tasklist
|
||||
[appId]="taskFilter?.appId"
|
||||
[presetColumn]="presetColoum"
|
||||
[page]="taskPage"
|
||||
[size]="taskPagination.maxItems"
|
||||
[processDefinitionKey]="taskFilter?.filter?.processDefinitionKey"
|
||||
[name]="taskFilter?.filter?.name"
|
||||
[assignment]="taskFilter?.filter?.assignment"
|
||||
[state]="taskFilter?.filter?.state"
|
||||
[sort]="taskFilter?.filter?.sort"
|
||||
[data]="dataTasks"
|
||||
[landingTaskId]="currentTaskId"
|
||||
(rowClick)="onTaskRowClick($event)"
|
||||
(success)="onSuccessTaskList($event)"
|
||||
(row-click)="onRowClick($event)"
|
||||
(row-dblclick)="onTaskRowDblClick($event)"
|
||||
#activititasklist>
|
||||
<!-- Custom column definition demo -->
|
||||
|
||||
<!-- <data-columns>
|
||||
<data-column key="name" title="{{'ADF_TASK_LIST.PROPERTIES.NAME' | translate}}" class="full-width name-column"></data-column>
|
||||
<data-column key="created" title="{{'ADF_TASK_LIST.PROPERTIES.CREATED' | translate}}" class="hidden"></data-column>
|
||||
</data-columns> -->
|
||||
|
||||
</adf-tasklist>
|
||||
|
||||
<adf-pagination
|
||||
(changePageNumber)="onChangePageNumber($event)"
|
||||
(changePageSize)="onChangePageSize($event)"
|
||||
(nextPage)="onNextPage($event)"
|
||||
(prevPage)="onPrevPage($event)"
|
||||
[pagination]="taskPagination"
|
||||
[supportedPageSizes]="[2, 4, 6, 8, 10, 12]">
|
||||
</adf-pagination>
|
||||
</div>
|
||||
<div class="activiti-grid-item activiti-tasks-details" *ngIf="!isStartTaskMode()" fxFlex.gt-md="1 1 auto">
|
||||
<adf-task-details #activitidetails
|
||||
[debugMode]="true"
|
||||
[taskId]="currentTaskId"
|
||||
[fieldValidators]="fieldValidators"
|
||||
(formCompleted)="onFormCompleted($event)"
|
||||
(formContentClicked)="onFormContentClick($event)"
|
||||
(taskCreated)="onTaskCreated($event)"
|
||||
(assignTask)="onAssignTask()"
|
||||
(taskDeleted)="onTaskDeleted($event)">
|
||||
</adf-task-details>
|
||||
<hr>
|
||||
<div *ngIf="currentTaskId">
|
||||
{{'PS-TAB.AUDIT-LOG' | translate}}
|
||||
<button
|
||||
adf-task-audit
|
||||
[task-id]="currentTaskId"
|
||||
[download]="true"
|
||||
mat-icon-button (clicked)="onAuditClick($event)" (error)="onAuditError($event)">
|
||||
<mat-icon>assignment_ind</mat-icon>
|
||||
</button>
|
||||
<hr>
|
||||
</div>
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<adf-task-attachment-list
|
||||
[taskId]="currentTaskId">
|
||||
</adf-task-attachment-list>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="activiti-grid-item activiti-tasks-start" *ngIf="isStartTaskMode()" fxFlex.gt-md="1 1 auto">
|
||||
<adf-start-task
|
||||
[appId]="appId"
|
||||
(success)="onStartTaskSuccess($event)"
|
||||
(cancel)="onCancelStartTask()">
|
||||
</adf-start-task>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab id="processes-header" href="#processes"
|
||||
label="{{'PS-TAB.PROCESSES-TAB' | translate}}">
|
||||
<div class="page-content">
|
||||
<div class="activiti-grid" fxLayout="row" fxLayout.lt-lg="column" fxLayoutAlign="stretch">
|
||||
<div class="activiti-grid-item activiti-processes-menu" fxFlex.gt-md="225px">
|
||||
<div class="activiti-list-buttons">
|
||||
<button
|
||||
color="primary"
|
||||
mat-raised-button
|
||||
class="activiti-list-buttons-start"
|
||||
data-automation-id="btn-start-process"
|
||||
(click)="navigateStartProcess()">
|
||||
<mat-icon>add</mat-icon>
|
||||
<span>{{'PS-TAB.START-PROCESS' | translate}}</span>
|
||||
</button>
|
||||
</div>
|
||||
<adf-accordion>
|
||||
<adf-accordion-group [heading]="'Processes'" [isSelected]="true" [isOpen]="true"
|
||||
[headingIcon]="'assessment'">
|
||||
<adf-process-instance-filters
|
||||
[filterParam]="{index: 0}"
|
||||
[appId]="appId"
|
||||
(filterClick)="onProcessFilterClick($event)"
|
||||
(success)="onSuccessProcessFilterList($event)">
|
||||
</adf-process-instance-filters>
|
||||
</adf-accordion-group>
|
||||
</adf-accordion>
|
||||
</div>
|
||||
<div class="activiti-grid-item activiti-processes-list activiti-list" fxFlex.gt-md="335px" [ngClass.gt-md]="{'small-pagination': true}"
|
||||
*ngIf="processFilter && !isStartProcessMode()">
|
||||
<adf-process-instance-list
|
||||
*ngIf="processFilter?.hasFilter()" [appId]="processFilter.appId"
|
||||
[processDefinitionKey]="processFilter.filter.processDefinitionKey"
|
||||
[name]="processFilter.filter.name"
|
||||
[presetColumn]="presetColoum"
|
||||
[state]="processFilter.filter.state"
|
||||
[sort]="processFilter.filter.sort"
|
||||
[data]="dataProcesses"
|
||||
(rowClick)="onProcessRowClick($event)"
|
||||
(row-dblclick)="onProcessRowDblClick($event)"
|
||||
(success)="onSuccessProcessList($event)">
|
||||
<!-- Custom column definition demo -->
|
||||
|
||||
<!-- <data-columns>
|
||||
<data-column key="name" title="ADF_PROCESS_LIST.PROPERTIES.NAME" class="full-width name-column"></data-column>
|
||||
<data-column key="created" title="ADF_PROCESS_LIST.PROPERTIES.CREATED" class="hidden"></data-column>
|
||||
</data-columns> -->
|
||||
|
||||
</adf-process-instance-list>
|
||||
</div>
|
||||
<div class="activiti-grid-item activiti-processes-details" *ngIf="!isStartProcessMode()" fxFlex.gt-md="1 1 auto">
|
||||
<adf-process-instance-details
|
||||
[processInstanceId]="currentProcessInstanceId"
|
||||
(processCancelled)="processCancelled()"
|
||||
(showProcessDiagram)="onShowProcessDiagram($event)"
|
||||
(taskClick)="onProcessDetailsTaskClick($event)">
|
||||
</adf-process-instance-details>
|
||||
<hr>
|
||||
<div *ngIf="currentProcessInstanceId">
|
||||
{{'PS-TAB.AUDIT-LOG' | translate}}
|
||||
<button adf-process-audit
|
||||
[process-id]="currentProcessInstanceId"
|
||||
[download]="true" mat-icon-button
|
||||
[format]="'pdf'"
|
||||
(clicked)="onAuditClick($event)"
|
||||
(error)="onAuditError($event)">
|
||||
<mat-icon>assignment_ind</mat-icon>
|
||||
</button>
|
||||
<hr>
|
||||
</div>
|
||||
<mat-card>
|
||||
|
||||
<mat-card-content>
|
||||
<adf-process-attachment-list
|
||||
[processInstanceId]="currentProcessInstanceId">
|
||||
</adf-process-attachment-list>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="activiti-grid-item activiti-processes-start" fxFlex.gt-md="1 1 auto"
|
||||
*ngIf="isStartProcessMode()">
|
||||
<adf-start-process
|
||||
[appId]="appId"
|
||||
(start)="onStartProcessInstance($event)"
|
||||
(cancel)="onCancelProcessInstance()">
|
||||
</adf-start-process>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab id="report-header" href="#report"
|
||||
label="{{'PS-TAB.REPORTS-TAB' | translate}}">
|
||||
<div class="activiti-grid" fxLayout="row" fxLayout.lt-lg="column" fxLayoutAlign="stretch">
|
||||
<div class="activiti-grid-item activiti-reports-menu" fxFlex.gt-md="300px">
|
||||
<span><h5>Report List</h5></span>
|
||||
<hr>
|
||||
<analytics-report-list
|
||||
[appId]="appId"
|
||||
[selectFirst]="selectFirstReport"
|
||||
(reportClick)="onReportClick($event)"
|
||||
#analyticsreportlist>
|
||||
</analytics-report-list>
|
||||
</div>
|
||||
<div class="activiti-grid-item activiti-reports-details" fxFlex.gt-md="1 1 auto">
|
||||
<adf-analytics
|
||||
*ngIf="report"
|
||||
[appId]="appId"
|
||||
[reportId]="report.id"
|
||||
[hideParameters]="false"
|
||||
(editReport)="onEditReport($event)"
|
||||
(reportSaved)="onReportSaved($event)"
|
||||
(reportDeleted)="onReportDeleted()">
|
||||
</adf-analytics>
|
||||
<div *ngIf="!report">
|
||||
<span>{{'ANALYTICS_REPORT.NO_REPORT_MESSAGE' | translate}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
|
||||
<div *ngIf="fileShowed">
|
||||
<adf-viewer
|
||||
[(showViewer)]="fileShowed"
|
||||
[blobFile]="content"
|
||||
[displayName]="contentName"
|
||||
[overlayMode]="true">
|
||||
</adf-viewer>
|
||||
</div>
|
106
demo-shell/src/app/components/activiti/activiti.component.scss
Normal file
106
demo-shell/src/app/components/activiti/activiti.component.scss
Normal file
@@ -0,0 +1,106 @@
|
||||
|
||||
.adf-no-form-container {
|
||||
text-align: center;
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.activiti-grid {
|
||||
|
||||
.activiti-grid-item {
|
||||
margin: 4px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.activiti-list-buttons {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.activiti-list-buttons-start {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.activiti-tasks-list.small-pagination,
|
||||
.activiti-processes-list.small-pagination {
|
||||
.adf-pagination {
|
||||
|
||||
flex-wrap: wrap;
|
||||
padding-bottom: 24px;
|
||||
padding-top: 8px;
|
||||
|
||||
&__block {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
&__range-block.adf-pagination__block:first-child {
|
||||
order: 1;
|
||||
width: 60%;
|
||||
flex: 0 0 auto;
|
||||
box-sizing: border-box;
|
||||
padding-left: 2px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
&__perpage-block {
|
||||
order: 3;
|
||||
width: 60%;
|
||||
box-sizing: border-box;
|
||||
padding-left: 2px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
&__actualinfo-block {
|
||||
order: 2;
|
||||
width: 40%;
|
||||
box-sizing: border-box;
|
||||
padding-right: 2px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
&__controls-block {
|
||||
order: 4;
|
||||
width: 40%;
|
||||
box-sizing: border-box;
|
||||
padding-right: 2px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.activiti-list {
|
||||
.adf-data-table {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.adf-data-table tr,
|
||||
.adf-data-table td {
|
||||
height: 36px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.adf-data-table td {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.adf-data-table th {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
height: 40px;
|
||||
vertical-align: middle;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1279px) {
|
||||
container-widget .grid-list {
|
||||
flex-direction: column;
|
||||
|
||||
.grid-list-item {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
483
demo-shell/src/app/components/activiti/activiti.component.ts
Normal file
483
demo-shell/src/app/components/activiti/activiti.component.ts
Normal file
@@ -0,0 +1,483 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
// tslint:disable-next-line:adf-file-name
|
||||
import {
|
||||
AfterViewInit,
|
||||
Component,
|
||||
ElementRef,
|
||||
Input,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
ViewChild,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Pagination, ProcessInstanceFilterRepresentation } from 'alfresco-js-api';
|
||||
import {
|
||||
FORM_FIELD_VALIDATORS, FormEvent, FormFieldEvent, FormRenderingService, FormService,
|
||||
DynamicTableRow, ValidateDynamicTableRowEvent
|
||||
} from '@alfresco/core';
|
||||
|
||||
import { AnalyticsReportListComponent } from '@alfresco/insights';
|
||||
|
||||
import {
|
||||
ProcessFiltersComponent,
|
||||
ProcessInstance,
|
||||
ProcessInstanceDetailsComponent,
|
||||
ProcessInstanceListComponent,
|
||||
StartProcessInstanceComponent
|
||||
} from '@alfresco/process-services';
|
||||
import {
|
||||
AppsListComponent,
|
||||
FilterRepresentationModel,
|
||||
TaskDetailsComponent,
|
||||
TaskDetailsEvent,
|
||||
TaskFiltersComponent,
|
||||
TaskListComponent,
|
||||
TaskListService
|
||||
} from '@alfresco/process-services';
|
||||
import { LogService } from '@alfresco/core';
|
||||
import { AlfrescoApiService } from '@alfresco/core';
|
||||
import {
|
||||
DataSorting,
|
||||
ObjectDataRow,
|
||||
ObjectDataTableAdapter
|
||||
} from '@alfresco/core';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
import { /*CustomEditorComponent*/ CustomStencil01 } from './custom-editor/custom-editor.component';
|
||||
import { DemoFieldValidator } from './demo-field-validator';
|
||||
|
||||
const currentProcessIdNew = '__NEW__';
|
||||
const currentTaskIdNew = '__NEW__';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-activiti',
|
||||
templateUrl: './activiti.component.html',
|
||||
styleUrls: ['./activiti.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ActivitiComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||
|
||||
@ViewChild(TaskFiltersComponent)
|
||||
activitifilter: TaskFiltersComponent;
|
||||
|
||||
@ViewChild(TaskListComponent)
|
||||
taskList: TaskListComponent;
|
||||
|
||||
@ViewChild(ProcessFiltersComponent)
|
||||
activitiprocessfilter: ProcessFiltersComponent;
|
||||
|
||||
@ViewChild(ProcessInstanceListComponent)
|
||||
processList: ProcessInstanceListComponent;
|
||||
|
||||
@ViewChild(ProcessInstanceDetailsComponent)
|
||||
activitiprocessdetails: ProcessInstanceDetailsComponent;
|
||||
|
||||
@ViewChild(TaskDetailsComponent)
|
||||
activitidetails: TaskDetailsComponent;
|
||||
|
||||
@ViewChild(StartProcessInstanceComponent)
|
||||
activitiStartProcess: StartProcessInstanceComponent;
|
||||
|
||||
@ViewChild(AnalyticsReportListComponent)
|
||||
analyticsreportlist: AnalyticsReportListComponent;
|
||||
|
||||
@Input()
|
||||
appId: number = null;
|
||||
|
||||
fileShowed: boolean = false;
|
||||
selectFirstReport: boolean = false;
|
||||
|
||||
private tabs = { tasks: 0, processes: 1, reports: 2 };
|
||||
|
||||
content: Blob;
|
||||
contentName: string;
|
||||
|
||||
layoutType: string;
|
||||
currentTaskId: string;
|
||||
currentProcessInstanceId: string;
|
||||
|
||||
taskSchemaColumns: any[] = [];
|
||||
taskPagination: Pagination = {
|
||||
skipCount: 0,
|
||||
maxItems: 10,
|
||||
totalItems: 0
|
||||
};
|
||||
taskPage: number = 0;
|
||||
processSchemaColumns: any[] = [];
|
||||
|
||||
activeTab: number = this.tabs.tasks; // tasks|processes|reports
|
||||
|
||||
taskFilter: FilterRepresentationModel;
|
||||
report: any;
|
||||
processFilter: ProcessInstanceFilterRepresentation;
|
||||
|
||||
sub: Subscription;
|
||||
blobFile: any;
|
||||
flag: boolean = true;
|
||||
|
||||
dataTasks: ObjectDataTableAdapter;
|
||||
dataProcesses: ObjectDataTableAdapter;
|
||||
presetColoum: string = 'default';
|
||||
|
||||
fieldValidators = [
|
||||
...FORM_FIELD_VALIDATORS,
|
||||
new DemoFieldValidator()
|
||||
];
|
||||
|
||||
constructor(private elementRef: ElementRef,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private taskListService: TaskListService,
|
||||
private apiService: AlfrescoApiService,
|
||||
private logService: LogService,
|
||||
formRenderingService: FormRenderingService,
|
||||
formService: FormService) {
|
||||
this.dataTasks = new ObjectDataTableAdapter();
|
||||
this.dataTasks.setSorting(new DataSorting('created', 'desc'));
|
||||
|
||||
// Uncomment this line to replace all 'text' field editors with custom component
|
||||
// formRenderingService.setComponentTypeResolver('text', () => CustomEditorComponent, true);
|
||||
|
||||
// Uncomment this line to map 'custom_stencil_01' to local editor component
|
||||
formRenderingService.setComponentTypeResolver('custom_stencil_01', () => CustomStencil01, true);
|
||||
|
||||
formService.formLoaded.subscribe((e: FormEvent) => {
|
||||
this.logService.log(`Form loaded: ${e.form.id}`);
|
||||
});
|
||||
|
||||
formService.formFieldValueChanged.subscribe((e: FormFieldEvent) => {
|
||||
this.logService.log(`Field value changed. Form: ${e.form.id}, Field: ${e.field.id}, Value: ${e.field.value}`);
|
||||
});
|
||||
|
||||
formService.validateDynamicTableRow.subscribe(
|
||||
(e: ValidateDynamicTableRowEvent) => {
|
||||
const row: DynamicTableRow = e.row;
|
||||
if (row && row.value && row.value.name === 'admin') {
|
||||
e.summary.isValid = false;
|
||||
e.summary.text = 'Sorry, wrong value. You cannot use "admin".';
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Uncomment this block to see form event handling in action
|
||||
/*
|
||||
formService.formEvents.subscribe((event: Event) => {
|
||||
this.logService.log('Event fired:' + event.type);
|
||||
this.logService.log('Event Target:' + event.target);
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
onPrevPage(pagination: Pagination): void {
|
||||
this.taskPagination.skipCount = pagination.skipCount;
|
||||
this.taskPage--;
|
||||
}
|
||||
|
||||
onNextPage(pagination: Pagination): void {
|
||||
this.taskPagination.skipCount = pagination.skipCount;
|
||||
this.taskPage++;
|
||||
}
|
||||
|
||||
onChangePageSize(pagination: Pagination): void {
|
||||
const { skipCount, maxItems } = pagination;
|
||||
this.taskPage = this.currentPage(skipCount, maxItems);
|
||||
this.taskPagination.maxItems = maxItems;
|
||||
this.taskPagination.skipCount = skipCount;
|
||||
}
|
||||
|
||||
onChangePageNumber(pagination: Pagination): void {
|
||||
const { maxItems, skipCount } = pagination;
|
||||
this.taskPage = this.currentPage(skipCount, maxItems);
|
||||
this.taskPagination.maxItems = maxItems;
|
||||
this.taskPagination.skipCount = skipCount;
|
||||
}
|
||||
|
||||
currentPage(skipCount: number, maxItems: number): number {
|
||||
return (skipCount && maxItems) ? Math.floor(skipCount / maxItems) : 0;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.taskListService.tasksList$.subscribe(
|
||||
(tasks) => {
|
||||
this.taskPagination = {
|
||||
count: tasks.data.length,
|
||||
maxItems: this.taskPagination.maxItems,
|
||||
skipCount: this.taskPagination.skipCount,
|
||||
totalItems: tasks.total
|
||||
};
|
||||
this.logService.log({
|
||||
count: tasks.data.length,
|
||||
maxItems: this.taskPagination.maxItems,
|
||||
skipCount: this.taskPagination.skipCount,
|
||||
totalItems: tasks.total
|
||||
});
|
||||
}, (err) => {
|
||||
this.logService.log('err' + err);
|
||||
});
|
||||
|
||||
if (this.router.url.includes('processes')) {
|
||||
this.activeTab = this.tabs.processes;
|
||||
}
|
||||
this.sub = this.route.params.subscribe(params => {
|
||||
let applicationId = params['appId'];
|
||||
if (applicationId && applicationId !== '0') {
|
||||
this.appId = params['appId'];
|
||||
}
|
||||
|
||||
this.taskFilter = null;
|
||||
this.currentTaskId = null;
|
||||
this.processFilter = null;
|
||||
this.currentProcessInstanceId = null;
|
||||
});
|
||||
this.layoutType = AppsListComponent.LAYOUT_GRID;
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
this.taskListService.tasksList$.subscribe();
|
||||
}
|
||||
|
||||
onTaskFilterClick(filter: FilterRepresentationModel): void {
|
||||
this.applyTaskFilter(filter);
|
||||
}
|
||||
|
||||
onReportClick(event: any): void {
|
||||
this.report = event;
|
||||
}
|
||||
|
||||
onSuccessTaskFilterList(event: any): void {
|
||||
this.applyTaskFilter(this.activitifilter.getCurrentFilter());
|
||||
}
|
||||
|
||||
applyTaskFilter(filter: FilterRepresentationModel) {
|
||||
this.taskFilter = filter;
|
||||
if (filter && this.taskList) {
|
||||
this.taskList.hasCustomDataSource = false;
|
||||
}
|
||||
}
|
||||
|
||||
onStartTaskSuccess(event: any): void {
|
||||
this.activitifilter.selectFilterWithTask(event.id);
|
||||
this.currentTaskId = event.id;
|
||||
}
|
||||
|
||||
onCancelStartTask() {
|
||||
this.currentTaskId = null;
|
||||
this.reloadTaskFilters();
|
||||
}
|
||||
|
||||
onSuccessTaskList(event: FilterRepresentationModel) {
|
||||
this.currentTaskId = this.taskList.getCurrentId();
|
||||
}
|
||||
|
||||
onProcessFilterClick(event: ProcessInstanceFilterRepresentation): void {
|
||||
this.currentProcessInstanceId = null;
|
||||
this.processFilter = event;
|
||||
}
|
||||
|
||||
onSuccessProcessFilterList(event: ProcessInstanceFilterRepresentation[]): void {
|
||||
this.processFilter = this.activitiprocessfilter.getCurrentFilter();
|
||||
}
|
||||
|
||||
onSuccessProcessList(event: any): void {
|
||||
this.currentProcessInstanceId = this.processList.getCurrentId();
|
||||
}
|
||||
|
||||
onTaskRowClick(taskId): void {
|
||||
this.currentTaskId = taskId;
|
||||
}
|
||||
|
||||
onTaskRowDblClick(event: CustomEvent) {
|
||||
const taskId = event.detail.value.obj.id;
|
||||
this.currentTaskId = taskId;
|
||||
}
|
||||
|
||||
onProcessRowDblClick(event: CustomEvent) {
|
||||
const processInstanceId = event.detail.value.obj.id;
|
||||
this.currentProcessInstanceId = processInstanceId;
|
||||
}
|
||||
|
||||
onProcessRowClick(processInstanceId): void {
|
||||
this.currentProcessInstanceId = processInstanceId;
|
||||
}
|
||||
|
||||
onEditReport(name: string): void {
|
||||
this.analyticsreportlist.reload();
|
||||
}
|
||||
|
||||
onReportSaved(reportId): void {
|
||||
this.analyticsreportlist.reload(reportId);
|
||||
}
|
||||
|
||||
onReportDeleted(): void {
|
||||
this.analyticsreportlist.reload();
|
||||
this.analyticsreportlist.selectReport(null);
|
||||
}
|
||||
|
||||
navigateStartProcess(): void {
|
||||
this.resetProcessFilters();
|
||||
this.reloadProcessFilters();
|
||||
this.currentProcessInstanceId = currentProcessIdNew;
|
||||
}
|
||||
|
||||
navigateStartTask(): void {
|
||||
this.resetTaskFilters();
|
||||
this.reloadTaskFilters();
|
||||
this.currentTaskId = currentTaskIdNew;
|
||||
}
|
||||
|
||||
onStartProcessInstance(instance: ProcessInstance): void {
|
||||
this.currentProcessInstanceId = instance.id;
|
||||
this.activitiStartProcess.reset();
|
||||
this.activitiprocessfilter.selectRunningFilter();
|
||||
}
|
||||
|
||||
onCancelProcessInstance() {
|
||||
this.currentProcessInstanceId = null;
|
||||
this.reloadProcessFilters();
|
||||
}
|
||||
|
||||
isStartProcessMode(): boolean {
|
||||
return this.currentProcessInstanceId === currentProcessIdNew;
|
||||
}
|
||||
|
||||
isStartTaskMode(): boolean {
|
||||
return this.currentTaskId === currentTaskIdNew;
|
||||
}
|
||||
|
||||
processCancelled(data: any): void {
|
||||
this.currentProcessInstanceId = null;
|
||||
this.processList.reload();
|
||||
}
|
||||
|
||||
onSuccessNewProcess(data: any): void {
|
||||
this.processList.reload();
|
||||
}
|
||||
|
||||
onFormCompleted(form): void {
|
||||
this.currentTaskId = null;
|
||||
this.taskPagination.totalItems--;
|
||||
const { skipCount, maxItems, totalItems } = this.taskPagination;
|
||||
if (totalItems > 0 && (skipCount >= totalItems)) {
|
||||
this.taskPagination.skipCount -= maxItems;
|
||||
}
|
||||
this.taskPage = this.currentPage(this.taskPagination.skipCount, maxItems);
|
||||
if (this.taskList) {
|
||||
this.taskList.reload();
|
||||
}
|
||||
if (this.processList) {
|
||||
this.processList.reload();
|
||||
}
|
||||
}
|
||||
|
||||
onFormContentClick(content: any): void {
|
||||
this.fileShowed = true;
|
||||
this.content = content.contentBlob;
|
||||
this.contentName = content.name;
|
||||
}
|
||||
|
||||
onAuditClick(event: any) {
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
onAuditError(event: any): void {
|
||||
this.logService.error('My custom error message' + event);
|
||||
}
|
||||
|
||||
onTaskCreated(data: any): void {
|
||||
this.currentTaskId = data.parentTaskId;
|
||||
this.taskList.reload();
|
||||
}
|
||||
|
||||
onTaskDeleted(data: any): void {
|
||||
this.taskList.reload();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.loadStencilScriptsInPageFromActiviti();
|
||||
}
|
||||
|
||||
loadStencilScriptsInPageFromActiviti() {
|
||||
this.apiService.getInstance().activiti.scriptFileApi.getControllers().then(response => {
|
||||
if (response) {
|
||||
let s = document.createElement('script');
|
||||
s.type = 'text/javascript';
|
||||
s.text = response;
|
||||
this.elementRef.nativeElement.appendChild(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onShowProcessDiagram(event: any): void {
|
||||
this.router.navigate(['/activiti/apps/' + this.appId + '/diagram/' + event.value]);
|
||||
}
|
||||
|
||||
onProcessDetailsTaskClick(event: TaskDetailsEvent): void {
|
||||
event.preventDefault();
|
||||
this.activeTab = this.tabs.tasks;
|
||||
|
||||
const taskId = event.value.id;
|
||||
const processTaskDataRow = new ObjectDataRow({
|
||||
id: taskId,
|
||||
name: event.value.name || 'No name',
|
||||
created: event.value.created
|
||||
});
|
||||
this.activitifilter.selectFilter(null);
|
||||
if (this.taskList) {
|
||||
this.taskList.setCustomDataSource([processTaskDataRow]);
|
||||
this.taskList.selectTask(taskId);
|
||||
}
|
||||
this.currentTaskId = taskId;
|
||||
}
|
||||
|
||||
private resetProcessFilters(): void {
|
||||
this.processFilter = null;
|
||||
}
|
||||
|
||||
private resetTaskFilters(): void {
|
||||
this.taskFilter = null;
|
||||
}
|
||||
|
||||
private reloadProcessFilters(): void {
|
||||
this.activitiprocessfilter.selectFilter(this.activitiprocessfilter.getCurrentFilter());
|
||||
}
|
||||
|
||||
private reloadTaskFilters(): void {
|
||||
this.activitifilter.selectFilter(this.activitifilter.getCurrentFilter());
|
||||
}
|
||||
|
||||
onRowClick(event): void {
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
onRowDblClick(event): void {
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
isTaskCompleted(): boolean {
|
||||
return this.activitidetails.isCompletedTask();
|
||||
}
|
||||
|
||||
onAssignTask() {
|
||||
this.taskList.reload();
|
||||
this.currentTaskId = null;
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<adf-apps (appClick)="onAppClicked($event)"></adf-apps>
|
@@ -0,0 +1,35 @@
|
||||
/*!
|
||||
* @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 } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AppDefinitionRepresentationModel } from '@alfresco/process-services';
|
||||
|
||||
@Component({
|
||||
selector: 'activiti-apps-view',
|
||||
templateUrl: './apps-view.component.html'
|
||||
})
|
||||
export class ActivitiAppsViewComponent {
|
||||
|
||||
constructor(private router: Router) {
|
||||
}
|
||||
|
||||
onAppClicked(app: AppDefinitionRepresentationModel) {
|
||||
this.router.navigate(['/activiti/apps', app.id || 0, 'tasks']);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { WidgetComponent } from '@alfresco/core';
|
||||
|
||||
@Component({
|
||||
selector: 'custom-editor',
|
||||
template: `
|
||||
<div style="color: red">Look, I'm a custom editor!</div>
|
||||
`
|
||||
})
|
||||
export class CustomEditorComponent extends WidgetComponent {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'custom-stencil-01',
|
||||
template: `<div style="color: green">ADF version of custom Activiti stencil</div>`
|
||||
})
|
||||
export class CustomStencil01 extends WidgetComponent {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [ CustomEditorComponent, CustomStencil01 ],
|
||||
exports: [ CustomEditorComponent, CustomStencil01 ],
|
||||
entryComponents: [ CustomEditorComponent, CustomStencil01 ]
|
||||
})
|
||||
export class CustomEditorsModule {
|
||||
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* @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 { FormFieldModel, FormFieldTypes, FormFieldValidator } from '@alfresco/core';
|
||||
|
||||
export class DemoFieldValidator implements FormFieldValidator {
|
||||
|
||||
isSupported(field: FormFieldModel): boolean {
|
||||
return field && field.type === FormFieldTypes.TEXT;
|
||||
}
|
||||
|
||||
validate(field: FormFieldModel): boolean {
|
||||
if (this.isSupported(field)) {
|
||||
if (field.value && field.value.toLowerCase() === 'admin') {
|
||||
field.validationSummary.message = 'Sorry, the value cannot be "admin".';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
.activiti-form-viewer {
|
||||
margin: 10px;
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
<div class="activiti-form-viewer" *ngIf="nodeId">
|
||||
<adf-form [nodeId]="nodeId"
|
||||
[saveMetadata]="true"
|
||||
[path]="'/Sites/swsdp/documentLibrary'">
|
||||
</adf-form>
|
||||
</div>
|
@@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* @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, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
|
||||
@Component({
|
||||
selector: 'form-node-viewer',
|
||||
templateUrl: './form-node-viewer.component.html',
|
||||
styleUrls: ['./form-node-viewer.component.css']
|
||||
})
|
||||
export class FormNodeViewerComponent implements OnInit, OnDestroy {
|
||||
|
||||
nodeId: string;
|
||||
|
||||
private sub: Subscription;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.params.subscribe(params => {
|
||||
this.nodeId = params['id'];
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
.activiti-form-viewer {
|
||||
margin: 10px;
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
<div class="activiti-form-viewer" *ngIf="taskId">
|
||||
<adf-form [taskId]="taskId"></adf-form>
|
||||
<!--<adf-form [formName]="'activitiForms:patientFolder'"-->
|
||||
<!--[saveMetadata]="true"-->
|
||||
<!--[path]="'/Sites/swsdp/documentLibrary'"-->
|
||||
<!--[nameNode]="'test'"></adf-form>-->
|
||||
<!--<adf-form [nodeId]="'e280be3a-6584-45a1-8bb5-89bfe070262e'"-->
|
||||
<!--[saveMetadata]="true"-->
|
||||
<!--[path]="'/Sites/swsdp/documentLibrary'">-->
|
||||
<!--</adf-form>-->
|
||||
</div>
|
@@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* @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, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
|
||||
@Component({
|
||||
selector: 'form-viewer',
|
||||
templateUrl: './form-viewer.component.html',
|
||||
styleUrls: ['./form-viewer.component.css']
|
||||
})
|
||||
export class FormViewerComponent implements OnInit, OnDestroy {
|
||||
|
||||
taskId: string;
|
||||
|
||||
private sub: Subscription;
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.params.subscribe(params => {
|
||||
this.taskId = params['id'];
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user