diff --git a/demo-shell/resources/i18n/en.json b/demo-shell/resources/i18n/en.json index 4dfb60398e..ef357baaf8 100644 --- a/demo-shell/resources/i18n/en.json +++ b/demo-shell/resources/i18n/en.json @@ -57,6 +57,7 @@ "BREADCRUMB": "Breadcrumb", "NOTIFICATIONS": "Notifications", "TASK_LIST": "Task List", + "PROCESS_LIST": "Process List", "CARD_VIEW": "CardView", "PROCESS_SERVICES": "Process Services", "LOGIN": "Login", @@ -210,5 +211,9 @@ "TASK_LIST_DEMO": { "APP_ID_REQUIRED_ERROR": "Insert App Id", "APP_ID_TYPE_ERROR": "App Id must be a number" + }, + "PROCESS_LIST_DEMO": { + "APP_ID_REQUIRED_ERROR": "Insert App Id", + "APP_ID_TYPE_ERROR": "App Id must be a number" } } diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index ace782d328..8501665ed1 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -53,12 +53,14 @@ import { DemoPermissionComponent } from './components/permissions/demo-permissio import { PreviewService } from './services/preview.service'; import { BreadcrumbDemoComponent } from './components/breadcrumb-demo/breadcrumb-demo.component'; import { TaskListDemoComponent } from './components/task-list-demo/task-list-demo.component'; +import { ProcessListDemoComponent } from './components/process-list-demo/process-list-demo.component'; import { ContentNodeSelectorComponent } from './components/content-node-selector/content-node-selector.component'; import { NotificationsComponent } from './components/notifications/notifications.component'; import { ReportIssueComponent } from './components/report-issue/report-issue.component'; import { CardViewComponent } from './components/card-view/card-view.component'; import { HeaderDataComponent } from './components/header-data/header-data.component'; import { HeaderDataService } from './components/header-data/header-data.service'; + @NgModule({ imports: [ BrowserModule, @@ -116,6 +118,7 @@ import { HeaderDataService } from './components/header-data/header-data.service' ContentNodeSelectorComponent, ReportIssueComponent, TaskListDemoComponent, + ProcessListDemoComponent, HeaderDataComponent ], providers: [ diff --git a/demo-shell/src/app/app.routes.ts b/demo-shell/src/app/app.routes.ts index 5b81d80af4..e387aebfa3 100644 --- a/demo-shell/src/app/app.routes.ts +++ b/demo-shell/src/app/app.routes.ts @@ -50,6 +50,7 @@ import { DemoPermissionComponent } from './components/permissions/demo-permissio import { BlobPreviewComponent } from './components/blob-preview/blob-preview.component'; import { BreadcrumbDemoComponent } from './components/breadcrumb-demo/breadcrumb-demo.component'; import { TaskListDemoComponent } from './components/task-list-demo/task-list-demo.component'; +import { ProcessListDemoComponent } from './components/process-list-demo/process-list-demo.component'; import { NotificationsComponent } from './components/notifications/notifications.component'; import { CardViewComponent } from './components/card-view/card-view.component'; import { ContentNodeSelectorComponent } from './components/content-node-selector/content-node-selector.component'; @@ -263,6 +264,16 @@ export const appRoutes: Routes = [ component: TaskListDemoComponent, canActivate: [AuthGuardBpm] }, + { + path: 'process-list', + component: ProcessListDemoComponent, + canActivate: [AuthGuardBpm] + }, + { + path: 'process-list/:id', + component: ProcessListDemoComponent, + canActivate: [AuthGuardBpm] + }, { path: 'error/:id', component: ErrorContentComponent diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.ts b/demo-shell/src/app/components/app-layout/app-layout.component.ts index ad56c139be..d049127f13 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.ts +++ b/demo-shell/src/app/components/app-layout/app-layout.component.ts @@ -40,6 +40,7 @@ export class AppLayoutComponent implements OnInit { { href: '/header-data', icon: 'edit', title: 'APP_LAYOUT.HEADER_DATA'}, { href: '/node-selector', icon: 'attachment', title: 'APP_LAYOUT.NODE-SELECTOR' }, { href: '/task-list', icon: 'assignment', title: 'APP_LAYOUT.TASK_LIST' }, + { href: '/process-list', icon: 'assignment', title: 'APP_LAYOUT.PROCESS_LIST' }, { href: '/activiti', icon: 'device_hub', title: 'APP_LAYOUT.PROCESS_SERVICES' }, { href: '/login', icon: 'vpn_key', title: 'APP_LAYOUT.LOGIN' }, { href: '/trashcan', icon: 'delete', title: 'APP_LAYOUT.TRASHCAN' }, diff --git a/demo-shell/src/app/components/process-list-demo/process-list-demo.component.html b/demo-shell/src/app/components/process-list-demo/process-list-demo.component.html new file mode 100644 index 0000000000..85cd1a6d3e --- /dev/null +++ b/demo-shell/src/app/components/process-list-demo/process-list-demo.component.html @@ -0,0 +1,73 @@ +
+ +
+ + App Id + + + {{ 'PROCESS_LIST_DEMO.APP_ID_REQUIRED_ERROR' | translate }} + + + {{ 'PROCESS_LIST_DEMO.APP_ID_TYPE_ERROR' | translate }} + + + + + Process Name + + + + + ProcessDefinitionId + + SimpleProcess:1:2 + + + + State + + {{ stateOption.title }} + + + + + Sort + + {{ sortOption.title }} + + + +
+ +
+
+
+ +
+ + + + + +
+ diff --git a/demo-shell/src/app/components/process-list-demo/process-list-demo.component.scss b/demo-shell/src/app/components/process-list-demo/process-list-demo.component.scss new file mode 100644 index 0000000000..8ce7a126c9 --- /dev/null +++ b/demo-shell/src/app/components/process-list-demo/process-list-demo.component.scss @@ -0,0 +1,17 @@ +.process-list-inputs { + margin-top: 100px; + margin-bottom: 50px; + display: flex; + justify-content: space-evenly; +} + +.adf-reset-button { + margin-top: 50px; + display: flex; + justify-content: center; +} + +.process-list-error-message { + color: red; + text-align: center; +} diff --git a/demo-shell/src/app/components/process-list-demo/process-list-demo.component.ts b/demo-shell/src/app/components/process-list-demo/process-list-demo.component.ts new file mode 100644 index 0000000000..b479edb310 --- /dev/null +++ b/demo-shell/src/app/components/process-list-demo/process-list-demo.component.ts @@ -0,0 +1,124 @@ +/*! + * @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 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * distributed under the License is distributed on an "AS IS" BASIS, + * limitations under the License. + */ + +import { Component, OnInit } from '@angular/core'; +import { FormGroup, FormBuilder, Validators, FormControl, AbstractControl } from '@angular/forms'; +import { ActivatedRoute, Params } from '@angular/router'; + + +@Component({ + templateUrl: './process-list-demo.component.html', + styleUrls: [`./process-list-demo.component.scss`], +}) + +export class ProcessListDemoComponent implements OnInit { + + processListForm: FormGroup; + + defaultAppId: number; + + appId: number; + + name: string; + + processDefId: string; + + state: string; + + sort: string; + + stateOptions = [ + {value: 'all', title: 'All'}, + {value: 'active', title: 'Active'}, + {value: 'completed', title: 'Completed'} + ]; + + sortOptions = [ + {value: 'created-asc', title: 'Created (asc)'}, + {value: 'created-desc', title: 'Created (desc)'}, + {value: 'due-asc', title: 'Due (asc)'}, + {value: 'due-desc', title: 'Due (desc)'} + ]; + + constructor(private route: ActivatedRoute, + private formBuilder: FormBuilder) {} + + ngOnInit() { + if (this.route) { + this.route.params.forEach((params: Params) => { + this.defaultAppId = params['id'] ? +params['id'] : 0; + }); + } + this.appId = this.defaultAppId; + this.buildForm(); + } + + buildForm() { + this.processListForm = this.formBuilder.group({ + processAppId: new FormControl(this.defaultAppId, [Validators.required, Validators.pattern('^[0-9]*$')]), + processName: new FormControl(''), + processDefinitionId: new FormControl(''), + processState: new FormControl(''), + processSort: new FormControl('') + }); + + this.processListForm.valueChanges + .debounceTime(500) + .subscribe(processFilter => { + if (this.isFormValid()) { + this.filterProcesses(processFilter); + } + }); + + } + + filterProcesses(processFilter: any) { + this.appId = processFilter.processAppId; + this.name = processFilter.processName; + this.processDefId = processFilter.processDefinitionId; + this.state = processFilter.processState; + this.sort = processFilter.processSort; + } + + isFormValid() { + return this.processListForm && this.processListForm.dirty && this.processListForm.valid; + } + + resetProcessForm() { + this.processListForm.reset(); + } + + get processAppId(): AbstractControl { + return this.processListForm.get('processAppId'); + } + + get processName(): AbstractControl { + return this.processListForm.get('processName'); + } + + get processDefinitionId(): AbstractControl { + return this.processListForm.get('processDefinitionId'); + } + + get processState(): AbstractControl { + return this.processListForm.get('processState'); + } + + get processSort(): AbstractControl { + return this.processListForm.get('processSort'); + } +} diff --git a/docs/process-services/process-list.component.md b/docs/process-services/process-list.component.md index a7b42b8a60..91ce057a3c 100644 --- a/docs/process-services/process-list.component.md +++ b/docs/process-services/process-list.component.md @@ -49,6 +49,7 @@ Renders a list containing all the process instances matched by the parameters sp | page | `number` | 0 | The page number of the processes to fetch. | | presetColumn | `string` | | Name of a custom schema to fetch from `app.config.json`. | | processDefinitionKey | `string` | | The processDefinitionKey of the process. | +| processDefinitionId | `string` | | The Definition Id of the process. | | selectFirstRow | `boolean` | true | Toggles default selection of the first row | | selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | | size | `number` | [`PaginationComponent`](../core/pagination.component.md).DEFAULT_PAGINATION.maxItems | The number of processes to fetch in each page. | diff --git a/lib/process-services/process-list/components/process-list.component.ts b/lib/process-services/process-list/components/process-list.component.ts index ec0285ec31..f1d52e4e88 100644 --- a/lib/process-services/process-list/components/process-list.component.ts +++ b/lib/process-services/process-list/components/process-list.component.ts @@ -154,7 +154,7 @@ export class ProcessInstanceListComponent implements OnChanges, AfterContentInit this.loadLayoutPresets(); this.setupSchema(); - if (this.appId) { + if (this.appId != null) { this.reload(); } }