* fix upload area snackbar behaviour

* SASS support for components

ability to use '.scss' files from within components

* [ADF-610] Upload button and DnD area should not upload hidden files and folders (#1908)

[ADF-610]  upload cleanup
- more strongly typing
- api improvements

* Upload cleanup and api improvements

- remove old unused settings (formFields variable)
- individual options for uploaded files (i.e. versioning)
- upload button and drag-and-drop area now set individual settings for file versioning

* exclude hidden files from upload

* [ADF-640] reload document list on folder upload (#1895)

* reload document list on folder upload

- extend UploadService with 'folderCreated' event to be able reacting on folder uploads globally
- extend Demo Shell to reload document list on UploadService events (folderCreated)

* readme updates

* [ADF-621] show drop effect on folders only (#1897)

* show drop effect on folders only

- fix `hasValue` api for data rows (avoid 'false' value to be evaluated as missing value)
- support for evaluating drop support for rows
- document list enables upload zones for folders only

* api improvements as per code review

* [ADF-242] Fixed behaviour for saving/deleting reports (#1905)

* [ADF-242] - fix for deleting - saving a report

* [ADF - 242] added test for fixed feature on reports save - delete

* Added translation key

* [ADF-604] Upgrade @angular/material to latest version (#1909)

* update dependencies and module imports

* fix template warnings and fix import issues

* migrate Activiti Form to MdTabsModule

* fix unit tests

* fix tests

* fix unit tests

* fix unit tests

* disable test that fails only on travis

* upgrade activiti form component to angular/material

* fix test (remove MDL class check)

* [ADF-613] Add plain text viewer (#1873)

* add plain text viewer

* different devices optimizations

* returns types

* [ADF-573] support for toggling enabled state (#1912)

* [ADF-602] Accordion component - Add basic documentation (#1913)

* Add basic documentation Accordion component

* Update README.md

* [ADF-680] Added previous page check when page has no more elements (#1911)

* [ADF-242] - fix for deleting - saving a report

* [ADF - 242] added test for fixed feature on reports save - delete

* [ADF-680] - Fixed behaviour when deleting all files on last page of document list

* Start adding test for documentlist check

* Added test for check double page load

* [ADF-680] - removed commented test code

* [ADF-680] Added changes from peer review

* [ADF-680] added return type

* [ADF-667] selection mode and row styles (#1914)

* selection mode and row styles

- single/multiple/none selection modes for DataTable component (and Document List)
- support for custom row styles (inline and classname values)
- fix karma config (material themes)
- readme updates
- package-lock.json files for NPM5 support
- updated DataTable demo to demonstrate selection modes and row styles

* remove package lock files

* move demo projects to webpack (#1915)

* wav and Mp3 enabling viewer (#1916)

* add option only demo shell version change for update version script

* ADF-402 add the show diagram button (#1917)

* [ADF-707] Ability to select a row on a dynamic table (#1921)

* [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

* [ADF-712] Task Attachment - Provide a way to attach a new content (#1898)

* create button, download, view functionality added in task attachment list component

* created sevice to attach document to task

* added new component to create/uplaod attachment to task

* added new component to create/uplaod attachment to task

* added test case for create task attachment component

* added test case for create task attachment component

* added input to block upload document  to ECM

* fixed create task attachment spec file issue

* changed alfresco-upload to alfresco-core upload directive

* removed attachCreate button and emitter from task-attachment-list

* removed uploadToEcm input and checkValidity method from alfresco-upload

* added documentation for task-attachment-list and create-task-attachment components

* [ADF-696] Entire accordion group header should be clickable (#1918)

* #ADF-696 Added new input to show/hide expand icon, click event is activated for the complete heading

* #ADF-696 tslint fix

* #ADF-696 Added documentation for new input and removed unwanted div

* [ADF-721] Fix translation reference for dev task (#1923)

* move translation files in the bundles folder

* fix after review
ripristinate tslint and remove override tsconfig

* [ADF-709] add autofocus when a new row is added on dynamic table widget (#1927)

* [ADF-709] add autofocus when a new row is added on dynamic table widget

* [ADF-709] removed wrong reference for template

* [ADF-713] Process Attachment - Provide a way to attach a new content (#1920)

* added service to get all the related content of the process instance

* added new component to create/upload attachment for process instance

* added unit test cases for create-process-attachment component

* exported create-process-attachment component

* added documentation for create-process-attachment component

* Add data-automation-id to multi select checkbox (#1924)

* [ADF-571] upload feature rework (#1922)

* upload feature rework

lots of improvements for upload dialog and underlying services

* readme update

- readme cleanup
- remove some old comments from code
- update readme with new events for Upload Service

* restore prerequisites section in readme

* fix i18n issue with webpack

* exported report and chart models (#1925)

* fix file upload bug (#1928)

- proper extraction of File objects from the FileList

* lock files for npm 5 (#1930)

add lock files for npm v5; does nothing for earlier versions, so is not harmful

* Source Mapping is not working on test debugging (#1931)

* coverage single components run fix

* remove spec.ts from coverage

* make the coverage and the istanbul-instrumenter-loader works only over the console test because a problem on the remapping for the browser test

* move tslint on the main folder of any component

* remove build:w from readme

* stop build tslint error also in spec files

* clear karma file from unnecessary files

* add set -f for build all script in order to accept *

* fix lint problem and failing tests

* fix failing test search component

* add loader test for viewer

* fix tslint error userinfo

* --max_old_space_size=2048 remove

* fix tslint error uploader unused EventEmitter

* remove spec|index|.*mock|.*model|.*event from coverage

* move coverage separate file and get component to calculate coverage as input

* remove old 'banned' demo from login screen (#1929)

* add sleep time flag in publish script

* rollback demo tag

* fix pacakge.json tag

* [ADF-686] add blobFile as input (#1933)

* coverage fix (#1934)

* [ADF-702] Task/Process Filter - Provide a way to change the default filter (#1932)

* [ADF-702] Task/Process Filter - Provide a way to change the default filter

* Provide a way to select a custom menu filter

* Improve activiti process filter

* Add internal link

* Change link name

* add link

* [ADF-744] Attachment List is not displayed within Processes. (#1937)

* Use the adf process attachment list indise demo shell

* Change documentation

* support for healdess chrome (#1939)

* #ADF-696 Now accordion opens/closes on click of group header along with emitting heading click event (#1936)

* add info and link on current last git commit (#1940)

* [ADF-754] toolbar component (#1938)

* toolbar component

- simple toolbar component (core lib)
- readme updates (core lib)
- update demo shell with toolbar component demo (document list)

* update unit tests

* [ADF-763] Add Chrome default browser for karma chrome launcher for Chrome versi… (#1941)

* Add Chrome default browser for karma chrome launcher for Chrome version<59

* Fixing intermittently failing test in ng2-activiti-analytics component

* Adding new icon (sent) for Bootstrap to Material icon mapping (#1943)

* fix blob input in text viewer (#1942)

* GitHub issue & pull request template change (#1945)

* Update ISSUE_TEMPLATE.md

* Update PULL_REQUEST_TEMPLATE.md

* [ADF-689] Fix alfresco-document-menu-action styling (z-index) (#1944)

* fix translation wrong folder creation issue

* [ADF-773] Fix datatable custom template render (#1947)

* [ADF-780] centralised call for process filters api (#1950)

* [ADF-780] centralised call for process filters api

* [ADF-780] updated conversion to string

* [ADF-741] Add the create task attachment component to the demo shell (#1946)

* Add the create task attachment component to the demo shell

* Add translation keys

* Add return to methods

* fix thumbnail task process list (#1951)

* [ADF-643] upload enhancements (#1949)

* rework folder uploading

- flatterns hierarchy on folder upload
- performs a single traversal for the entire folder heirarchy and ends with a comple file list
- allows now dropping folders on existing folders
- overall code improvements

* fix unit tests

* readme updates

* clean old and unused code

* code cleanup

* limit concurrent uploads

* update code as per review

* fix upload button for Safari

* fixes for Safari

- Safari compatibility
- code updates based on review

* fix code

* fix unit tests

* [ADF-589] Login component different bug fixes (#1953)

* Basic style changes

* Further design changes

* Responsive design fixes

* Different sign in button style for the different login steps

* #ADF-780 Fixed getProcessFilterByName to get the correct filter for the given appId and name (#1952)

* fix issues with the require keyword (angular cli) (#1954)

* [ADF-799] add HappyPack to webpack conf (#1956)

* update npm5 lock files

* [ADF-740] Add button for process attachment list (#1955)

* [ADF-740] adding button to allow user to upload related content on process instance

* [ADF-740] add button for attachment content list for process

* changed locatin for translation

* [ADF-740] added test for add button for process attach

* [ADF-740] added PR request changes

* [ADF-802] fix error on uploading file to attachment list (#1957)

* [ADF-802] fix error on uploading file to attachment list

* [ADF-802] improved for loop

* [ADF-797] remove dist folder from npm distributed package , leave src and bundles (#1961)

* [ADF-804] webpack proxy setup to avoid CORS problem (#1960)

* package lock update

* update travis to node 8 (#1965)

* upload service exposes created nodes (#1964)

* [ADF-591] documentation refinements (#1959)

* refine ng2-activiti-analytics

* refine ng2-activiti-diagrams docs

* refine ng2-activiti-form

* refine ng2-activiti-processlist

* refine ng2-activiti-tasklist

* refine ng2-alfresco-core

* refine ng2-alfresco-datatable

* refine ng2-alfresco-datatable

* refine gn2-alfresco-login

* refine ng2-alfresco-search

* refine ng2-alfresco-social

* refine ng2-alfresco-tag

* refine ng2-alfresco-upload

* refine ng2-alfresco-userinfo

* refine ng2-alfresco-viewer

* refine ng2-alfresco-webscript

* various readme cleanups

* fix builds related to node-sass library (#1966)

* update dependencies and remove old lock files

* update sass loader

* updated lock files

* [ADF-578] Remember me functionality (#1962)

* Remember me functionality

* Happy pack to ng2-components' package.json

* Build fix

* Adding tabindices to viewer control elements (#1968)

* karma conf all single browser

* Fix current page number issue (#1970)

* [ADF-524] Datatable loading state (#1958)

* loading state datatable

* modify readme after review

* [ADF-78]  Update CORS help (#1973)

* Fix host configuration in demo-shell when no port is present (#1971)

* remove brachet

* [ADF-494] fixed readonly rendering for forms (#1972)

* [ADF-494] improved disabling for form

* [ADF-494] fixed readonly rendering for forms

* [ADF-814] application configuration service (#1969)

* app configuration service

* api improvements and readme update

* extend readme and add defaults

* unit tests for app config service

* [ADF-716] Task Header - Use a custom view inside the component (#1967)

* Use a generic custom view inside the task header

* Move the component into core component and change name

* Missing file

* Fix unit test

* fix unit test component name

* fix issue with shared Code settings

- remove obsolete rules for .js/.ts
- hide .happypack folder in the project tree

* [ADF-810] fix default value radio button (#1975)

* [ADF-510] Drag&Drop check permission to allow user to upload a file (#1948)

* [ADF-510] added permission check for drag&drop

* Improved code for drag and drop side

* Added test for drag and drop upload area changes

* Added test for document list permissions check

* [ADF-510] rebased branch after changes applied to upload

* [ADF-510] rebased branch and fixed tests

* [ADF-717] upgrade i18n and charting dependencies (#1976)

* remove app-specific polyfill dependencies

remove polyfill dependencies never used by component libraries

* upgrade i18n dependencies

* upgrade ng2-charts dependency

* fix unit tests

* update demo projects

* [ADF-524] Fix empty state after the loading introduction (#1980)

* fix empty state after the loading introduction

* Update document-list.component.spec.ts

remove typo

* [ADF-838] Table of content automatic creation (#1981)

* readonly value set

* Table of content automatic creation (#1982)

* add missing intl dependency for demo shell (#1984)

* [ADF-833] DataTable -  improve the single and double click event (#1979)

* Improve the single and double click event

* Fix unit test

* Task header basic documentation (#1985)

* Disable upload attachment when the task is completed (#1987)

* [ADF-847] upgrade to use application configuration service (#1986)

* migrate core lib to use server-side app config

* fix unit tests

* update Search tests

- update tests
- upgrade tests to use TestBed

* update UserInfo tests

* update Social tests

* update tests

* update unit tests

* cleanup old code

* update about page

* update demo shell readme

* dev and prod configurations

* updated package-lock file and removed duplicates in package.json

* [ADF-851] execute-outcome event for form service (#1989)

* execute-outcome event for form service

* readme updates

* fix loading state excluding other state during the loading (#1991)

* Fix compilation error (#1993)

* [ADF-883] Fix build errors (#1992)

* [ADF-793] Ability to create PDF renditions in case of non supported formats (#1994)

* Style changes and button

* Convert to PDF button

* Convert to PDF button part II.

* Convert within the Not Supported Format component

* Rendition loading skeleton

* Conversion is working.

* Convert button behaviour tests

* Rebasing fix.

* app settings page (#1997)

- custom app setttings service to use isolated storage (demo shell)
- restore settings UI
- redirect angular and rxjs to the same version as components use.

* [ADF-822] Added the npm-prepublish script (#1978)

* added the npm prepublish script

* changed permissions to prepublish script

* changed to npm run prepublish

* prepare the pr

* removed useless code to the script

* remove flags lib from demo shell (#1983)

* remove flags lib from demo shell

greatly reduce demo shell webpack resources by switching off flags (only 3 icons were displayed in the past)

* merge package.json

* add icons

* Fix typo error

* [ADF-794] Add people assignment component (#1977)

* Add people component

* exported people service

* added people-list component to show the involved user list

* changed people-search component layout

* changed people-list usage in people component

* changed people-list data table from custom template to data adapter

* changes people-search component related to people-list

* changes in activiti-people related to people-list and people-search component

* changed data adapter to direct data column setting to data-table

* removed ngChanges and added User and UserEvent models

* added User and UserEvent model in emitter and other emitter handler

* added user event model

* changed activiti-people component with latest UX changes

* addedand changed translate keys to the components

* added hasUser method to check the condition in html

* fixed tslint issue and test case issue in activiti-people component

* added test case for actviti-people-list component

* test case added for activiti-people-search component

* changed activiti-people test cases according to latest UX changes

* added description for activiti-people component

* changed test case to fix component.upgradeElement issue

* changes requested by Vito Albano #1

* splitted getDisplayUser into getDisplayUser and getInitialUsername

* introduce check type definition

* [ADF-897] - ActivitiPeopleList - use the adf prefix (#2001)

* Use the adf as prexif instead of activiti

* Fix typo

* Fix wrong import

* support binding [form] data directly (#1996)

- ability to bind [form] data directly inside `<activiti-form>` component
- ability to parse forms with FormService
- demo of the custom form in demo shell

* [ADF-778] cancel window for upload dialog shows only on complete (#2003)

* [ADF-778] Added new behaviour to upload dialog

* [ADF-778] cancel window for upload dialog shows only on complete

* [ADF-778] changed variable name to showCloseButton

* Create task/process attachment Compilation error (#2004)

* fix tslint errors

minor fix for "Unnecessary semicolon" TSLint rule

* [ADF-842] Fixed type for taskdetails (#2009)

* fix type definition (#2002)

* Use the activiti people with the new look and feel inside the demo shell (#2008)

* add rxjs and @angular in tsconfig.json

* [ADF-843] Form events bus (#1990)

* form events bus

* event test bus fix

* fix test after code review

* fix types errors

* change to public formservice

* make optional formservice

* [ADF-915] Add option to change the JS-API with different version in the update package

* Missing keys (#2011)

* [ADF-845] breadcrumb root option added and style review (#1999)

* breadcrumb root option added and style review

* new breadcrumbs

* split onchange in a method

* update readme with a note for old pefix tag

* fix tslint errors

* fix breadcrumb test

* [ADF-922] Regenerate package-lock.json files for every package and create script for doing that in the future (#2012)

* Updated package-lock.json files

* npm-relock-pkgs.sh

* Update README.md

* Fix ng2-alfresco-search sass problem

* SASS version update (#2013)

* sass update

* update sass loader

* vjsapi option prepublish

* prepublish script deprecation in favour of prepublishOnly node 8 (#2010)

* modify prePublish script with preoPublishOnly

* install rimraf globally

* fix clean scripts demo folders

* move appveyor to node 8

* Appveyor test (#1998)

* reduce memory

* remove max-old-space

* remove increase memory

* create new TaskDetailsModel in loadNextTask (#2017)

* Fix readme document list

* [ADF-907] - Form reacts to data added in input (#2016)

* [ADF-907] Enable activiti form to react on value data changes

* [ADF-907] - Form reacts to data added in input]

* [ADF - 907] added mock json for form

* [ADF-907] added new event of the form to the event list

* [ADF - 907] Added return column to README

* [ADF - 907] Added return column to README

* Script add pkg and clean update

* install globally pkg pre build

* Fix upload related content (#2019)

* regeneration TOC and add automatic list component generator (#2022)

* Fix upload process attachment (#2024)

* update typescript (#2026)

* update viewer readme

* fix type definition variables

* NgZone type passed parameter

* fix tslint error in tasklist

* Add screenshot (#2028)

* fix search miss typing

* bump version 1.6.0 (#2027)
This commit is contained in:
Eugenio Romano
2017-06-29 15:57:37 +01:00
committed by GitHub
parent c6f6227da7
commit b15ab3b988
822 changed files with 168022 additions and 13865 deletions

View File

@@ -8,7 +8,6 @@ dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts
index.js
@@ -18,3 +17,4 @@ index.js.map
/package/
/bundles/
index.d.ts
/.happypack

View File

@@ -4,6 +4,7 @@ npm-debug.log
coverage/
demo/
dist/
node_modules
typings/
fonts/
@@ -15,3 +16,4 @@ fonts/
/karma.conf.js
/gulpfile.ts
/.npmignore
/.happypack

View File

@@ -1,205 +1,86 @@
# Activiti Process List Component for Angular 2
<p>
<a title='Build Status Travis' href="https://travis-ci.org/Alfresco/alfresco-ng2-components">
<img src='https://travis-ci.org/Alfresco/alfresco-ng2-components.svg?branch=master' alt='travis
Status' />
</a>
<a title='Build Status AppVeyor' href="https://ci.appveyor.com/project/alfresco/alfresco-ng2-components">
<img src='https://ci.appveyor.com/api/projects/status/github/Alfresco/alfresco-ng2-components' alt='travis
Status' />
</a>
<a href='https://codecov.io/gh/Alfresco/alfresco-ng2-components'>
<img src='https://img.shields.io/codecov/c/github/Alfresco/alfresco-ng2-components/master.svg?maxAge=2592000' alt='Coverage Status' />
</a>
<a href='https://www.npmjs.com/package/ng2-activiti-processlist'>
<img src='https://img.shields.io/npm/dt/ng2-activiti-processlist.svg' alt='npm downloads' />
</a>
<a href='https://github.com/Alfresco/alfresco-ng2-components/blob/master/LICENSE'>
<img src='https://img.shields.io/hexpm/l/plug.svg' alt='license' />
</a>
<a href='https://www.alfresco.com/'>
<img src='https://img.shields.io/badge/style-component-green.svg?label=alfresco' alt='alfresco component' />
</a>
<a href='https://angular.io/'>
<img src='https://img.shields.io/badge/style-2-red.svg?label=angular' alt='angular 2' />
</a>
<a href='https://www.typescriptlang.org/docs/tutorial.html'>
<img src='https://img.shields.io/badge/style-lang-blue.svg?label=typescript' alt='typescript' />
</a>
<a href='https://www.alfresco.com/'>
<img src='https://img.shields.io/badge/style-%3E5.0.0-blue.svg?label=node%20version' alt='node version' />
</a>
</p>
# Activiti Process List Component
Displays lists of process instances both active and completed, using any defined process filter, and
render details of any chosen instance.
<!-- markdown-toc start - Don't edit this section. npm run toc to generate it-->
<!-- toc -->
- [Prerequisites](#prerequisites)
- [Install](#install)
- [Activiti Process Instance List](#activiti-process-instance-list)
* [Properties](#properties)
* [Events](#events)
- [Process Filters Component](#process-filters-component)
* [Properties](#properties-1)
* [Events](#events-1)
* [How filter the activiti process filters](#how-filter-the-activiti-process-filters)
- [FilterParamsModel](#filterparamsmodel)
* [How to create an accordion menu with the processes filter](#how-to-create-an-accordion-menu-with-the-processes-filter)
- [Start Process component](#start-process-component)
* [Properties](#properties-2)
* [Events](#events-2)
- [Process Details component](#process-details-component)
* [Properties](#properties-3)
* [Events](#events-3)
- [Process Instance Details Header component](#process-instance-details-header-component)
* [Properties](#properties-4)
* [Events](#events-4)
- [Process Instance Tasks component](#process-instance-tasks-component)
* [Properties](#properties-5)
* [Events](#events-5)
- [Process Instance Comments component](#process-instance-comments-component)
* [Properties](#properties-6)
- [Process Attachment List component](#process-attachment-list-component)
* [Properties](#properties-7)
* [Events](#events-6)
- [Create Process Attachment component](#create-process-attachment-component)
* [Properties](#properties-8)
* [Events](#events-7)
- [Build from sources](#build-from-sources)
- [NPM scripts](#npm-scripts)
- [Demo](#demo)
- [License](#license)
<!-- tocstop -->
<!-- markdown-toc end -->
Displays lists of process instances both active and completed, using any defined process filter, and renders details for any chosen instance.
## Prerequisites
Before you start using this development framework, make sure you have installed all required software and done all the
necessary configuration [prerequisites](https://github.com/Alfresco/alfresco-ng2-components/blob/master/PREREQUISITES.md).
> If you plan using this component with projects generated by Angular CLI, please refer to the following article: [Using ADF with Angular CLI](https://github.com/Alfresco/alfresco-ng2-components/wiki/Angular-CLI)
## Install
Follow the 3 steps below:
```sh
npm install ng2-activiti-processlist
```
1. Npm
```sh
npm install ng2-activiti-processlist --save
```
2. Html
Include these dependencies in your index.html page:
```html
<!-- Moment js -->
<script src="node_modules/moment/min/moment.min.js"></script>
<!-- Date picker -->
<script src="node_modules/md-date-time-picker/dist/js/mdDateTimePicker.min.js"></script>
<script src="node_modules/md-date-time-picker/dist/js/draggabilly.pkgd.min.js"></script>
<link rel="stylesheet" href="node_modules/md-date-time-picker/dist/css/mdDateTimePicker.css" media="all">
<!-- Google Material Design Lite -->
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
<script src="node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
<!-- Load the Angular Material 2 stylesheet -->
<link href="node_modules/@angular/material/core/theming/prebuilt/deeppurple-amber.css" rel="stylesheet">
<!-- Polyfill(s) for Safari (pre-10.x) -->
<script src="node_modules/intl/dist/Intl.min.js"></script>
<script src="node_modules/intl/locale-data/jsonp/en.js"></script>
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/dom4/1.8.3/dom4.js"></script>
<script src="node_modules/element.scrollintoviewifneeded-polyfill/index.js"></script>
<!-- Polyfill(s) for dialogs -->
<script src="node_modules/dialog-polyfill/dialog-polyfill.js"></script>
<link rel="stylesheet" type="text/css" href="node_modules/dialog-polyfill/dialog-polyfill.css" />
<style>._dialog_overlay { position: static !important; } </style>
<!-- Modules -->
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
```
3. SystemJs
Add the following components to your systemjs.config.js file:
- ng2-translate
- alfresco-js-api
- ng2-alfresco-core
- ng2-activiti-form
- ng2-alfresco-datatable
- ng2-activiti-tasklist
- ng2-activiti-processlist
Please refer to the following example file: [systemjs.config.js](demo/systemjs.config.js) .
## Basic usage
### Activiti Process Instance List
## Activiti Process Instance List
This component renders a list containing all the process instances matched by the parameters specified.
**app.component.html**
```html
<activiti-process-instance-list [appId]="'1'" [state]="'open'"></activiti-process-instance-list>
<activiti-process-instance-list
[appId]="'1'"
[state]="'open'">
</activiti-process-instance-list>
```
Usage example of this component :
**main.ts**
```ts
import { NgModule, Component } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { FilterRepresentationModel } from 'ng2-activiti-tasklist';
import { CoreModule } from 'ng2-alfresco-core';
import { ActivitiProcessListModule } from 'ng2-activiti-processlist';
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
import { ObjectDataTableAdapter, DataSorting } from 'ng2-alfresco-datatable';
@Component({
selector: 'alfresco-app-demo',
template: `<activiti-process-instance-list [appId]="appId" [state]="state" [data]="dataProcesses"
#activitiprocesslist></activiti-process-instance-list>`
})
class MyDemoApp {
dataProcesses: ObjectDataTableAdapter;
appId: string = '1';
state: string = 'open';
constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) {
settingsService.bpmHost = 'http://localhost:9999';
this.authService.login('admin', 'admin').subscribe(
ticket => {
console.log(ticket);
},
error => {
console.log(error);
});
this.dataProcesses = new ObjectDataTableAdapter([], [
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true},
{type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true}
]
);
this.dataProcesses.setSorting(new DataSorting('started', 'desc'));
this.filterRepresentationModel = new FilterRepresentationModel({
appId: '3003',
filter: {
processDefinitionKey: null,
name: null,
state: 'running',
sort: 'created-desc'
}
});
}
}
@NgModule({
imports: [
BrowserModule,
CoreModule.forRoot(),
ActivitiProcessListModule
],
declarations: [MyDemoApp],
bootstrap: [MyDemoApp]
})
export class AppModule {
}
platformBrowserDynamic().bootstrapModule(AppModule);
```
#### Options
### Properties
| Name | Description |
| --- | --- |
|`appId`| { appId } The id of the app. |
|`processDefinitionKey`| { processDefinitionKey } The processDefinitionKey of the process. |
|`state`| { state } Define state of the processes. Possible values are running, completed and all |
|`sort`| { sort } Define sort of the processes. Possible values are created-desc, created-asc, ended-desc, ended-asc |
|`schemaColumn`| {any} List of columns to display in the process instances datatable |
| appId | The id of the app. |
| processDefinitionKey | The processDefinitionKey of the process. |
| state | Define state of the processes. Possible values are `running`, `completed` and `all` |
| sort | Define sort of the processes. Possible values are `created-desc`, `created-asc`, `ended-desc`, `ended-asc` |
| schemaColumn | List of columns to display in the process instances datatable |
Example:
@@ -212,13 +93,13 @@ Example:
]
```
#### Events
### Events
- **rowClick**: Emitted when a row in the process list is clicked
- **onSuccess**: Emitted when the list of process instances has been loaded successfully from the server
- **onError**: Emitted when an error is encountered loading the list of process instances from the server
### Process Filters component
## Process Filters Component
Process filters are a collection of criteria used to filter process instances, which may be customized
by users. This component displays a list of available filters and allows the user to select any given
@@ -228,25 +109,55 @@ The most common usage is in driving a process instance list in order to allow th
process instances are displayed in the list.
```html
<activiti-process-instance-filters appId="1001"></activiti-process-instance-filters>
<activiti-process-instance-filters
appId="1001">
</activiti-process-instance-filters>
```
#### Options
### Properties
| Name | Description |
| --- | --- |
| `appId` | Display filters available to the current user for the application with the specified ID |
| `appName` | Display filters available to the current user for the application with the specified name |
| Name | Type | Description |
| --- | --- | --- | --- |
| filterParam | [FilterParamsModel](#filterparamsmodel) | The params to filter the task filter. If there is no match the default one (first filter of the list) is selected |
| appId | string | Display filters available to the current user for the application with the specified ID. |
| appName | string | Display filters available to the current user for the application with the specified name. |
| hasIcon | boolean | Toggle to show or not the filter's icon. |
If both `appId` and `appName` are specified then `appName` will take precedence and `appId` will be ignored.
#### Events
### Events
| Name | Description |
| --- | --- |
| `onSuccess` | Emitted when the list of filters hase been successfully loaded from the server |
| `onError` | Emitted when an error occurs |
| `ilterClick` | Emitted when the user selects a filter from the list |
| onSuccess | Raised when the list of filters hase been successfully loaded from the server |
| onError | Raised when an error occurs |
| filterClick | Raised when the user selects a filter from the list |
### How filter the activiti process filters
```html
<activiti-process-instance-filters
[filterParam]="{index: 0}">
</activiti-filters>
```
You can use inside the filterParam one of the following property.
## FilterParamsModel
```json
{
"id": "number",
"name": "string",
"index": "number"
}
```
| Name | Type | Description |
| --- | --- | --- |
| id | string | The id of the task filter. |
| name | string | The name of the task filter, lowercase is checked. |
| index | number | Zero-based position of the filter in the array. |
### How to create an accordion menu with the processes filter
@@ -255,7 +166,10 @@ The AccordionComponent is exposed by the alfresco-core.
```html
<adf-accordion>
<adf-accordion-group [heading]="'Processes'" [isSelected]="true" [headingIcon]="'assessment'">
<adf-accordion-group
[heading]="'Processes'"
[isSelected]="true"
[headingIcon]="'assessment'">
<activiti-process-instance-filters
[appId]="appId"
(filterClick)="onProcessFilterClick($event)"
@@ -267,164 +181,184 @@ The AccordionComponent is exposed by the alfresco-core.
![how-create-accordion-menu](docs/assets/how-to-create-accordion-menu.png)
### Start Process component
## Start Process component
Displays a button which in turn displays a dialog when clicked, allowing the user
to specify some basic details needed to start a new process instance.
```html
<activiti-start-process appId="YOUR_APP_ID" ></activiti-start-process>
<activiti-start-process
appId="YOUR_APP_ID" >
</activiti-start-process>
```
#### Options
### Properties
| Name | Description |
| --- | --- |
| `appId` | (required): Limit the list of processes which can be started to those contained in the specified app |
| `variables` | Variables in input to the process [RestVariable]**](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-activiti-rest-api/docs/RestVariable.md)|
| appId | (required): Limit the list of processes which can be started to those contained in the specified app |
| variables | Variables in input to the process [RestVariable]**](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-activiti-rest-api/docs/RestVariable.md)|
#### Events
### Events
| Name | Description |
| --- | --- |
| `start` | The event is emitted when the process start |
| `error` | The event is emitted when the start process fail |
| start | Raised when the process start |
| error | Raised when the start process fail |
### Process Details component
## Process Details component
This component displays detailed information on a specified process instance
```html
<activiti-process-instance-details processInstanceId="YOUR_PROCESS_INSTANCE_ID"></activiti-process-instance-details>
<activiti-process-instance-details
processInstanceId="YOUR_PROCESS_INSTANCE_ID">
</activiti-process-instance-details>
```
#### Options
### Properties
| Name | Type | Description |
| --- | --- | --- |
| processInstanceId | string | (required): The numeric ID of the process instance to display |
### Events
| Name | Description |
| --- | --- |
| `processInstanceId` | (required): The numeric ID of the process instance to display |
| processCancelledEmitter | Raised when the current process is cancelled by the user from within the component |
| taskFormCompletedEmitter | Raised when the form associated with an active task is completed from within the component |
| showProcessDiagram | Raised when the show diagram button is clicked |
#### Events
| Name | Description |
| --- | --- |
| `processCancelledEmitter` | Emitted when the current process is cancelled by the user from within the component |
| `taskFormCompletedEmitter` | Emitted when the form associated with an active task is completed from within the component |
### Process Instance Details Header component
## Process Instance Details Header component
This is a sub-component of the process details component, which renders some general information about the selected process.
```html
<activiti-process-instance-header processInstance="localProcessDetails"></activiti-process-instance-details>
<activiti-process-instance-header
processInstance="localProcessDetails">
</activiti-process-instance-details>
```
#### Options
### Properties
| Name | Type| Description |
| --- | --- | --- |
| processInstance | string | (**required**): Full details of the process instance to display information about |
| showDiagram | boolean | If the value is true the button show diagram is shown |
### Events
| Name | Description |
| --- | --- |
| `processInstance` | (required): Full details of the process instance to display information about |
| showProcessDiagram | Raised when the show diagram button is clicked |
#### Events
| Name | Description |
| --- | --- |
| `processCancelled` | Emitted when the Cancel Process button shown by the component is clicked |
### Process Instance Tasks component
## Process Instance Tasks component
Lists both the active and completed tasks associated with a particular process instance
```html
<activiti-process-instance-tasks processInstanceId="YOUR_PROCESS_INSTANCE_ID" showRefreshButton="true"></activiti-process-instance-tasks>
<activiti-process-instance-tasks
processInstanceId="YOUR_PROCESS_INSTANCE_ID"
showRefreshButton="true">
</activiti-process-instance-tasks>
```
#### Options
### Properties
| Name | Type | Description |
| --- | --- | --- |
| processInstanceId | string | (**required**): The ID of the process instance to display tasks for |
| showRefreshButton | boolean | (default: `true`): Whether to show a refresh button next to the list of tasks to allow this to be updated from the server |
### Events
| Name | Description |
| --- | --- |
| `processInstanceId` | (required): The numeric ID of the process instance to display tasks for |
| `showRefreshButton` | (default: `true`): Whether to show a refresh button next to the list of tasks to allow this to be updated from the server |
| taskFormCompletedEmitter | Raised when the form associated with an active task is completed from within the component |
#### Events
| Name | Description |
| --- | --- |
| `taskFormCompletedEmitter` | Emitted when the form associated with an active task is completed from within the component |
### Process Instance Comments component
## Process Instance Comments component
Displays comments associated with a particular process instances and allows the user to add new comments
```html
<activiti-process-instance-comments processInstanceId="YOUR_PROCESS_INSTANCE_ID"></activiti-process-instance-comments>
<activiti-process-instance-comments
processInstanceId="YOUR_PROCESS_INSTANCE_ID">
</activiti-process-instance-comments>
```
#### Options
### Properties
| Name | Type | Description |
| --- | --- | --- |
| processInstanceId | string | (**required**): The numeric ID of the process instance to display comments for |
## Process Attachment List component
This component displays attached documents on a specified process instance
```html
<adf-process-attachment-list
[processInstanceId]="YOUR_PROCESS_INSTANCE_ID"
(attachmentClick="YOUR_ATTACHMENT_CLICK_EMITTER_HANDLER">
</adf-process-attachment-list>
```
![process-attachment-list-sample](docs/assets/process-attachment-list.png)
### Properties
| Name | Type | Description |
| --- | --- | -- |
| processInstanceId | string | (**required**): The ID of the process instance to display |
### Events
| Name | Description |
| --- | --- |
| `processInstanceId` | (required): The numeric ID of the process instance to display comments for |
| attachmentClick | Raised when the attachment double clicked or selected view option from context menu by the user from within the component and return a Blob obj of the object clicker|
| success | Raised when the attachment list fetch all the attach and return a list of attachments |
| error | Raised when the attachment list is not able to fetch the attachments for example network error |
#### Events
## Create Process Attachment component
No events are emitted by this component
This component displays Upload Component(Drag and Click) to upload the attachment to a specified process instance
```html
<activiti-create-process-attachment
[processInstanceId]="YOUR_PROCESS_INSTANCE_ID"
(error)="YOUR_CREATE_ATTACHMENT_ERROR_HANDLER"
(success)="YOUR_CREATE_ATTACHMENT_SUCCESS_HANDLER">
</activiti-create-process-attachment>
```
![process-create-attachment](docs/assets/process-create-attachment.png)
### Properties
| Name | Type | Description |
| --- | --- | --- |
| processInstanceId | string | (**required**): The ID of the process instance to display |
### Events
| Name | Description |
| --- | --- |
| error | Raised when the error occured while creating/uploading the attachment by the user from within the component |
| success | Raised when the attachement created/uploaded successfully from within the component |
## Build from sources
Alternatively you can build component from sources with the following commands:
You can build component from sources with the following commands:
```sh
npm install
npm run build
```
### Build the files and keep watching for changes
```sh
$ npm run build:w
```
## Running unit tests
```sh
npm test
```
### Running unit tests in browser
```sh
npm test-browser
```
This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing.
### Code coverage
```sh
npm run coverage
```
## Demo
If you want have a demo of how the component works, please check the demo folder :
```sh
cd demo
npm install
npm start
```
> The `build` task rebuilds all the code, runs tslint, license checks
> and other quality check tools before performing unit testing.
## NPM scripts
@@ -435,6 +369,16 @@ npm start
| npm run test-browser | Run unit tests in the browser
| npm run coverage | Run unit tests and display code coverage report |
## Demo
Please check the demo folder for a demo project
```sh
cd demo
npm install
npm start
```
## License
[Apache Version 2.0](https://github.com/Alfresco/alfresco-ng2-components/blob/master/LICENSE)

View File

@@ -0,0 +1,35 @@
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
module.exports = webpackMerge(commonConfig, {
devtool: 'cheap-module-source-map',
externals: [
/^\@angular\//,
/^rxjs\//,
'moment',
'raphael',
'ng2-charts',
'alfresco-js-api',
'ng2-alfresco-core',
'ng2-alfresco-datatable',
'ng2-activiti-analytics',
'ng2-activiti-diagrams',
'ng2-activiti-form',
"ng2-activiti-tasklist",
'ng2-alfresco-documentlist'
],
output: {
filename: './bundles/[name].js',
library: '[name]',
libraryTarget: 'umd',
chunkFilename: '[id].chunk.js'
},
entry: {
"ng2-activiti-processlist": "./index.ts"
}
});

View File

@@ -2,6 +2,11 @@ const webpack = require('webpack');
const helpers = require('./helpers');
const fs = require('fs');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
var HappyPack = require('happypack');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
module.exports = {
@@ -12,22 +17,17 @@ module.exports = {
}
},
// require those dependencies but don't bundle them
externals: [
/^\@angular\//,
/^rxjs\//,
'moment',
'raphael',
'ng2-charts',
'alfresco-js-api',
'ng2-alfresco-core',
'ng2-alfresco-datatable',
'ng2-activiti-analytics',
'ng2-activiti-diagrams',
'ng2-activiti-form',
"ng2-activiti-tasklist",
'ng2-alfresco-documentlist'
],
resolve: {
alias: {
"ng2-alfresco-core": helpers.root('../ng2-alfresco-core/index.ts'),
"ng2-alfresco-datatable": helpers.root('../ng2-alfresco-datatable/index.ts'),
"ng2-activiti-tasklist": helpers.root('../ng2-activiti-tasklist/index.ts'),
"ng2-activiti-form": helpers.root('../ng2-activiti-form/index.ts')
},
extensions: ['.ts', '.js'],
symlinks: false,
modules: [helpers.root('../../ng2-components'), helpers.root('node_modules')]
},
module: {
rules: [
@@ -37,25 +37,19 @@ module.exports = {
loader: 'source-map-loader',
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
enforce: 'pre',
test: /\.ts$/,
use: 'source-map-loader',
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
enforce: 'pre',
test: /\.ts$/,
loader: 'tslint-loader',
options: {
emitErrors: true,
configFile: path.resolve(__dirname, './assets/tslint.json')
failOnHint: true
},
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
test: /\.ts$/,
use: ['ts-loader', 'angular2-template-loader'],
loader: ['happypack/loader?id=ts', 'angular2-template-loader'],
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
@@ -67,7 +61,13 @@ module.exports = {
test: /\.css$/,
loader: ['to-string-loader', 'css-loader'],
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},{
},
{
test: /\.component.scss$/,
use: ['to-string-loader', 'raw-loader', 'sass-loader'],
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
enforce: 'pre',
test: /\.ts$/,
loader: 'license-check',
@@ -95,15 +95,29 @@ module.exports = {
]
},
resolve: {
extensions: ['.ts', '.js'],
symlinks: false,
modules: [
'../ng2-components', 'node_modules'
]
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
new HappyPack({
id: 'ts',
threads: 8,
loaders: [
{
path: 'ts-loader',
query: {
happyPackMode: true,
"compilerOptions": {
"paths": {}
}
}
}
]
}),
new CopyWebpackPlugin([{
from: `src/i18n/`,
to: `bundles/assets/${path.basename(helpers.root(''))}/i18n/`
}]),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.BannerPlugin(fs.readFileSync(path.resolve(__dirname, './assets/license_header_add.txt'), 'utf8')),
@@ -112,11 +126,19 @@ module.exports = {
/angular(\\|\/)core(\\|\/)@angular/,
helpers.root('./src'),
{}
)
),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV)
}
}),
new webpack.LoaderOptionsPlugin({
htmlLoader: {
minimize: false // workaround for ng2
}
})
],
devtool: 'cheap-module-source-map',
node: {
fs: 'empty',
module: false

View File

@@ -0,0 +1,22 @@
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const testConfig = require('./webpack.test.js');
const helpers = require('./helpers');
module.exports = webpackMerge(testConfig, {
module: {
rules: [
{
enforce: 'post',
test: /^(?!(.*spec|index|.*mock|.*model|.*event)).*\.ts?$/,
include: [helpers.root('src')],
loader: 'istanbul-instrumenter-loader',
exclude: [
/node_modules/,
/test/
]
}
]
}
});

View File

@@ -1,85 +1,8 @@
const webpack = require('webpack');
const helpers = require('./helpers');
const webpackMerge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
module.exports = webpackMerge(commonConfig, {
module.exports = {
devtool: 'inline-source-map',
resolve: {
extensions: ['.ts', '.js'],
symlinks: false,
modules: [helpers.root('../ng2-components'), helpers.root('node_modules')]
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader',
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
test: /\.ts$/,
loaders: ['ts-loader?' + JSON.stringify({ transpileOnly: true}), 'angular2-template-loader'],
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
test: /\.html$/,
loader: 'html-loader',
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
test: /\.css$/,
loader: ['to-string-loader', 'css-loader'],
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico|pdf)$/,
loader: 'file-loader',
query: {
name: '[path][name].[ext]',
outputPath: (url)=> {
return url.replace('src', 'dist');
}
}
},
{
enforce: 'post',
test: /\.ts$/,
loader: 'istanbul-instrumenter-loader',
exclude: [
/node_modules/,
/test/
]
}
]
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
helpers.root('./src'),
{}
),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV)
}
}),
new webpack.LoaderOptionsPlugin({
htmlLoader: {
minimize: false // workaround for ng2
}
})
],
node: {
fs: 'empty',
module: false
}
};
devtool: 'inline-source-map'
});

View File

@@ -0,0 +1,10 @@
var path = require('path');
var _root = path.resolve(__dirname, '..');
function root(args) {
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [_root].concat(args));
}
exports.root = root;

View File

@@ -0,0 +1,129 @@
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const helpers = require('./helpers');
const path = require('path');
const alfrescoLibs = [
'ng2-activiti-processlist',
'ng2-activiti-tasklist',
'ng2-alfresco-core',
'ng2-alfresco-datatable'
];
module.exports = {
entry: {
'polyfills': './src/polyfills.ts',
'vendor': './src/vendor.ts',
'dist': './src/main.ts'
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
include: [helpers.root('src'), helpers.root('../ng2-components')],
loader: 'source-map-loader',
exclude: [ /node_modules/, /public/, /resources/, /dist/]
},
{
test: /\.ts$/,
include: [helpers.root('src'), helpers.root('..')],
loader: [
'ts-loader',
'angular2-template-loader'
],
exclude: [ /node_modules/, /public/, /resources/, /dist/]
},
{
enforce: 'pre',
test: /\.ts$/,
loader: 'tslint-loader',
include: [helpers.root('src')],
options: {
emitErrors: true
},
exclude: [ /node_modules/, /public/, /resources/, /dist/]
},
{
enforce: 'pre',
test: /\.ts$/,
use: 'source-map-loader',
exclude: [ /public/, /resources/, /dist/]
},
{
test: /\.html$/,
loader: 'html-loader',
exclude: [ /node_modules/, /public/, /resources/, /dist/]
},
{
test: /\.css$/,
exclude: [helpers.root('src'), helpers.root('../ng2-components')],
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader?sourceMap'
})
},
{
test: /\.css$/,
include: [helpers.root('src'), helpers.root('../ng2-components')],
loader: 'raw-loader'
},
{
test: /\.component.scss$/,
use: ['to-string-loader', 'raw-loader', 'sass-loader']
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'file-loader?name=assets/[name].[hash].[ext]'
}
]
},
plugins: [
// Workaround for angular/angular#11580
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)@angular/,
helpers.root('./src'), // location of your src
{} // a map of your routes
),
new HtmlWebpackPlugin({
template: './index.html'
}),
new CopyWebpackPlugin([
... alfrescoLibs.map(lib => {
return {
context: `../ng2-components/${lib}/bundles/assets/` ,
from: '**/*',
to: `assets/`
}
}),
{
context: 'resources/i18n',
from: '**/*.json',
to: 'resources/i18n'
}
]),
new webpack.optimize.CommonsChunkPlugin({
name: ['src', 'vendor', 'polyfills']
})
],
devServer: {
contentBase: helpers.root('dist'),
compress: true,
port: 3000,
historyApiFallback: true,
host: '0.0.0.0',
inline: true
},
node: {
fs: 'empty'
}
};

View File

@@ -0,0 +1,38 @@
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const commonConfig = require('./webpack.common.js');
const helpers = require('./helpers');
const path = require('path');
module.exports = webpackMerge(commonConfig, {
devtool: 'cheap-module-eval-source-map',
output: {
path: helpers.root('dist'),
filename: '[name].js',
chunkFilename: '[id].chunk.js'
},
resolve: {
alias: {
"ng2-alfresco-core$": path.resolve(__dirname, '../../ng2-alfresco-core/index.ts'),
"ng2-alfresco-datatable$": path.resolve(__dirname, '../../ng2-alfresco-datatable/index.ts'),
"ng2-activiti-processlist$": path.resolve(__dirname, '../../ng2-activiti-processlist/index.ts'),
"ng2-activiti-tasklist$": path.resolve(__dirname, '../../ng2-activiti-tasklist/index.ts')
},
extensions: ['.ts', '.js'],
modules: [path.resolve(__dirname, '../node_modules')]
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new ExtractTextPlugin('[name].[hash].css'),
new webpack.LoaderOptionsPlugin({
htmlLoader: {
minimize: false // workaround for ng2
}
})
]
});

View File

@@ -0,0 +1,68 @@
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const commonConfig = require('./webpack.common.js');
const helpers = require('./helpers');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
const alfrescoLibs = [
'ng2-activiti-processlist',
'ng2-activiti-tasklist',
'ng2-alfresco-core',
'ng2-alfresco-datatable'
];
module.exports = webpackMerge(commonConfig, {
devtool: 'source-map',
output: {
path: helpers.root('dist'),
publicPath: '/',
filename: '[name].[hash].js',
chunkFilename: '[id].[hash].chunk.js'
},
resolve: {
extensions: ['.ts', '.js'],
modules: [helpers.root('node_modules')]
},
plugins: [
new CopyWebpackPlugin([
... alfrescoLibs.map(lib => {
return {
context: `node_modules/${lib}/bundles/assets/` ,
from: '**/*',
to: `assets/`
}
})
]),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
mangle: {
keep_fnames: true
},
compress: {
warnings: false
},
output: {
comments: false
},
sourceMap: true
}),
new ExtractTextPlugin('[name].[hash].css'),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV)
}
}),
new webpack.LoaderOptionsPlugin({
htmlLoader: {
minimize: false // workaround for ng2
}
})
]
});

View File

@@ -6,47 +6,8 @@
<title>Alfresco Angular 2 Activiti Process - Demo</title>
<base href="./">
<!-- Moment js -->
<script src="node_modules/moment/min/moment.min.js"></script>
<!-- Date picker -->
<script src="node_modules/md-date-time-picker/dist/js/mdDateTimePicker.min.js"></script>
<script src="node_modules/md-date-time-picker/dist/js/draggabilly.pkgd.min.js"></script>
<link rel="stylesheet" href="node_modules/md-date-time-picker/dist/css/mdDateTimePicker.css" media="all">
<!-- Google Material Design Lite -->
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
<script src="node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
<!-- Polyfill(s) for Safari (pre-10.x) -->
<script src="node_modules/intl/dist/Intl.min.js"></script>
<script src="node_modules/intl/locale-data/jsonp/en.js"></script>
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/dom4/1.8.3/dom4.js"></script>
<script src="node_modules/element.scrollintoviewifneeded-polyfill/index.js"></script>
<!-- Polyfill(s) for dialogs -->
<script src="node_modules/dialog-polyfill/dialog-polyfill.js"></script>
<link rel="stylesheet" type="text/css" href="node_modules/dialog-polyfill/dialog-polyfill.css" />
<style>._dialog_overlay { position: static !important; } </style>
<!-- Modules -->
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<style> .chart {display: block; width: 100%;}</style>
<body>
<alfresco-app-demo></alfresco-app-demo>

View File

@@ -0,0 +1,79 @@
{
"name": "ng2-activiti-processlist-demo",
"version": "0.1.0",
"lockfileVersion": 1,
"dependencies": {
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"brace-expansion": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"dev": true
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
"dev": true
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"rimraf": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz",
"integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=",
"dev": true
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
}
}
}

View File

@@ -3,19 +3,16 @@
"description": "Show available processes from the Activiti Process Services suite - Demo",
"version": "0.1.0",
"author": "Will Abson",
"main": "index.js",
"scripts": {
"clean": "npm run clean-build && rimraf dist node_modules typings dist",
"clean-build" : "rimraf 'src/{,**/}**.js' 'src/{,**/}**.js.map' 'src/{,**/}**.d.ts'",
"postinstall": "npm run build",
"start": "npm run build && concurrently \"npm run tsc:w\" \"npm run server\" ",
"server": "wsrv -o -s -l",
"build": "npm run tslint && npm run clean-build && npm run tsc",
"build:w": "npm run tslint && rimraf dist && npm run tsc:w",
"travis": "npm link ng2-alfresco-core ng2-alfresco-datatable ng2-activiti-form ng2-activiti-tasklist ng2-activiti-processlist",
"tsc": "tsc",
"tsc:w": "tsc -w",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts -e '{,**/}**.d.ts'"
"build": "rimraf dist && npm run webpack -- --config config/webpack.prod.js --progress --profile --bail",
"build:dev": "rimraf dist && npm run webpack -- --config config/webpack.dev.js --progress --profile --bail",
"start:dist": "wsrv -s dist/ -p 3000 -a 0.0.0.0",
"start": "npm run webpack-dev-server -- --config config/webpack.prod.js --progress --content-base app/",
"start:dev": "npm run webpack-dev-server -- --config config/webpack.dev.js --progress --content-base app/",
"clean": "npm run clean-build && rimraf dist node_modules typings dist",
"clean-build": "rimraf 'app/{,**/}**.js' 'app/{,**/}**.js.map' 'app/{,**/}**.d.ts'",
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"webpack": "webpack"
},
"keywords": [
"ng2",
@@ -34,18 +31,16 @@
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"@angular/material": "2.0.0-beta.1",
"alfresco-js-api": "~1.5.0",
"alfresco-js-api": "~1.6.0",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
"ng2-alfresco-core": "1.5.0",
"ng2-translate": "5.0.0",
"ng2-alfresco-core": "1.6.0",
"@ngx-translate/core": "^7.0.0",
"reflect-metadata": "0.1.10",
"rxjs": "5.1.0",
"systemjs": "0.19.27",
"zone.js": "0.7.6",
"intl": "1.2.4",
"dialog-polyfill": "0.4.7",
"element.scrollintoviewifneeded-polyfill": "1.0.1",
@@ -53,17 +48,62 @@
"material-design-lite": "1.2.1",
"moment": "2.15.1",
"md-date-time-picker": "2.2.0",
"ng2-activiti-tasklist": "1.5.0",
"ng2-alfresco-datatable": "1.5.0",
"ng2-activiti-processlist": "1.5.0"
"ng2-activiti-tasklist": "1.6.0",
"ng2-alfresco-datatable": "1.6.0",
"ng2-activiti-processlist": "1.6.0"
},
"devDependencies": {
"@types/jasmine": "^2.2.33",
"@types/node": "^6.0.42",
"concurrently": "^2.2.0",
"rimraf": "2.5.2",
"tslint": "^3.8.1",
"typescript": "^2.0.3",
"wsrv": "^0.1.5"
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "2.5.35",
"@types/node": "6.0.45",
"angular2-template-loader": "^0.6.2",
"autoprefixer": "^6.5.4",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.23.1",
"css-to-string-loader": "^0.1.2",
"cssnano": "^3.8.1",
"extract-text-webpack-plugin": "^2.0.0-rc.3",
"file-loader": "0.11.1",
"html-loader": "^0.4.4",
"html-webpack-plugin": "^2.28.0",
"istanbul-instrumenter-loader": "0.2.0",
"jasmine-ajax": "^3.2.0",
"jasmine-core": "2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "~1.0.1",
"karma-coverage": "^1.1.1",
"karma-jasmine": "~1.0.2",
"karma-jasmine-ajax": "^0.1.13",
"karma-jasmine-html-reporter": "0.2.0",
"karma-mocha-reporter": "^2.2.2",
"karma-remap-istanbul": "^0.6.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-systemjs": "^0.16.0",
"karma-webpack": "^2.0.2",
"loader-utils": "^1.1.0",
"merge-stream": "^1.0.1",
"node-sass": "^3.13.1",
"null-loader": "^0.1.1",
"package-json-merge": "0.0.1",
"raw-loader": "^0.5.1",
"remap-istanbul": "^0.6.3",
"rimraf": "^2.6.1",
"run-sequence": "^1.2.2",
"sass-loader": "6.0.2",
"script-loader": "0.7.0",
"source-map-loader": "^0.1.6",
"style-loader": "^0.13.1",
"systemjs-builder": "^0.15.34",
"to-string-loader": "^1.1.4",
"traceur": "^0.0.91",
"ts-loader": "^2.0.0",
"ts-node": "^1.7.0",
"tslint": "^4.4.2",
"tslint-loader": "^3.3.0",
"typescript": "^2.1.6",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0",
"webpack-merge": "2.6.1",
"wsrv": "^0.1.7"
}
}

View File

@@ -0,0 +1,17 @@
import 'core-js/es6';
import 'core-js/es7/reflect';
import 'intl';
require('zone.js/dist/zone'); // IE 8-11
require('element.scrollintoviewifneeded-polyfill'); // IE/FF
if (process.env.ENV === 'production') {
// Production
} else {
// Development
Error['stackTraceLimit'] = Infinity;
require('zone.js/dist/long-stack-trace-zone');
}

View File

@@ -0,0 +1,26 @@
// Angular
import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/common';
import '@angular/http';
import '@angular/router';
// RxJS
import 'rxjs';
// hammerjs
import 'hammerjs';
// Alfresco
import 'alfresco-js-api';
import 'ng2-activiti-processlist';
// Google Material Design Lite
import 'material-design-lite/material.js';
import 'material-design-lite/dist/material.orange-blue.min.css';
import 'material-design-icons/iconfont/material-icons.css';
// Polyfill(s) for dialogs
require('script-loader!dialog-polyfill/dialog-polyfill');
import 'dialog-polyfill/dialog-polyfill.css';

View File

@@ -1,59 +0,0 @@
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'src',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/material': 'npm:@angular/material/bundles/material.umd.js',
'@angular/animations': 'npm:@angular/animations/bundles/animations.umd.min.js',
'@angular/animations/browser':'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
// other libraries
'moment' : 'npm:moment/min/moment.min.js',
'rxjs': 'npm:rxjs',
'ng2-translate': 'npm:ng2-translate',
'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core',
'ng2-alfresco-datatable': 'npm:ng2-alfresco-datatable',
'ng2-activiti-form': 'npm:ng2-activiti-form',
'ng2-activiti-tasklist': 'npm:ng2-activiti-tasklist',
'ng2-activiti-processlist': 'npm:ng2-activiti-processlist'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'moment': { defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},
'ng2-alfresco-core': { main: './bundles/ng2-alfresco-core.js', defaultExtension: 'js'},
'ng2-alfresco-datatable': { main: './bundles/ng2-alfresco-datatable.js', defaultExtension: 'js'},
'ng2-activiti-form': { main: './bundles/ng2-activiti-form.js', defaultExtension: 'js'},
'ng2-activiti-tasklist': { main: './bundles/ng2-activiti-tasklist.js', defaultExtension: 'js'},
'ng2-activiti-processlist': { main: './bundles/ng2-activiti-processlist.js', defaultExtension: 'js'}
}
});
})(this);

View File

@@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl": ".",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
@@ -16,6 +17,7 @@
"noFallthroughCasesInSwitch": true,
"removeComments": true,
"declaration": true,
"outDir": "./dist",
"lib": [
"es2015",
"dom"
@@ -23,7 +25,9 @@
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"node_modules"
"demo",
"node_modules",
"dist"
],
"angularCompilerOptions": {
"strictMetadataEmit": false,

View File

@@ -1,124 +1,118 @@
{
"rules": {
"align": [
true,
"parameters",
"arguments",
"statements"
],
"ban": false,
"class-name": true,
"comment-format": [
true,
"check-space",
"check-lowercase"
],
"curly": true,
"eofline": true,
"forin": true,
"indent": [
true,
"spaces"
],
"interface-name": false,
"jsdoc-format": true,
"label-position": true,
"label-undefined": true,
"max-line-length": [
true,
180
],
"member-ordering": [
true,
"public-before-private",
"static-before-instance",
"variables-before-functions"
],
"no-any": false,
"no-arg": true,
"no-bitwise": false,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-constructor-vars": false,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-require-imports": false,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unreachable": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"no-var-requires": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single",
"avoid-escape"
],
"radix": true,
"semicolon": true,
"switch-default": true,
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef": false,
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"use-strict": false,
"variable-name": [
true,
"check-format",
"allow-leading-underscore",
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-operator",
"check-separator",
"check-type",
"check-module",
"check-decl"
]
}
"rules": {
"align": [
true,
"parameters",
"statements"
],
"ban": false,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"indent": [
true,
"spaces"
],
"interface-name": false,
"jsdoc-format": true,
"label-position": true,
"max-line-length": [
true,
180
],
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-any": false,
"no-arg": true,
"no-bitwise": false,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-constructor-vars": false,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-require-imports": false,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"no-var-requires": false,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single",
"avoid-escape"
],
"radix": true,
"semicolon": true,
"switch-default": true,
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef": false,
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"use-strict": false,
"variable-name": [
true,
"check-format",
"allow-leading-underscore",
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-operator",
"check-separator",
"check-type",
"check-module",
"check-decl"
]
}
}

View File

@@ -0,0 +1 @@
module.exports = require('./config/webpack.dev.js');

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -29,7 +29,9 @@ import {
ActivitiProcessInstanceVariables,
ActivitiProcessComments,
ActivitiProcessInstanceDetails,
ActivitiStartProcessInstance
ActivitiStartProcessInstance,
ActivitiProcessAttachmentListComponent,
ActivitiCreateProcessAttachmentComponent
} from './src/components/index';
import { ActivitiProcessService } from './src/services/activiti-process.service';
@@ -39,6 +41,8 @@ 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/adf-process-attachment-list.component';
export * from './src/components/adf-create-process-attachment.component';
// models
export * from './src/models/index';
@@ -54,7 +58,9 @@ export const ACTIVITI_PROCESSLIST_DIRECTIVES: [any] = [
ActivitiProcessInstanceTasks,
ActivitiProcessInstanceVariables,
ActivitiProcessComments,
ActivitiStartProcessInstance
ActivitiStartProcessInstance,
ActivitiProcessAttachmentListComponent,
ActivitiCreateProcessAttachmentComponent
];
export const ACTIVITI_PROCESSLIST_PROVIDERS: [any] = [

View File

@@ -8,16 +8,14 @@ module.exports = function (config) {
files: [
'./node_modules/hammerjs/hammer.js',
{pattern: './node_modules/@angular/material/prebuilt-themes/indigo-pink.css', included: true, watched: false},
//diagrams
'./node_modules/chart.js/dist/Chart.js',
'./node_modules/alfresco-js-api/dist/alfresco-js-api.js',
'./node_modules/raphael/raphael.js',
'./node_modules/moment/min/moment.min.js',
'./node_modules/md-date-time-picker/dist/js/mdDateTimePicker.js',
{pattern: './node_modules/ng2-translate/**/*.js', included: false, watched: false},
{pattern: './node_modules/ng2-charts/**/*.js', included: false, served: true, watched: false},
{pattern: './node_modules/md-date-time-picker/**/*.js', included: false, served: true, watched: false},
{pattern: './node_modules/moment/**/*.js', included: false, served: true, watched: false},
@@ -27,7 +25,7 @@ module.exports = function (config) {
{pattern: './src/**/*.ts', included: false, served: true, watched: false}
],
webpack: webpackConfig,
webpack: (config.mode === 'coverage') ? require('./webpack.coverage') : require('./webpack.test'),
webpackMiddleware: {
stats: 'errors-only'

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,17 @@
{
"name": "ng2-activiti-processlist",
"description": "Show active processes from the Activiti Process Services suite",
"version": "1.5.0",
"version": "1.6.0",
"author": "Alfresco Software, Ltd.",
"scripts": {
"clean": "rimraf dist node_modules typings bundles coverage .npmrc",
"clean-lock": "rimraf package-lock.json",
"rimraf": "rimraf",
"build": "webpack --config webpack.build.js --progress --profile --bail",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run --component",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run --mode coverage",
"test-browser": "karma start karma.conf.js --reporters kjhtml --component",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish" : "npm run build"
"prepublishOnly": "npm run build"
},
"main": "bundles/ng2-activiti-processlist.js",
"repository": {
@@ -42,18 +43,17 @@
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"@angular/material": "2.0.0-beta.1",
"alfresco-js-api": "~1.5.0",
"@angular/material": "2.0.0-beta.6",
"alfresco-js-api": "~1.6.0",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
"md-date-time-picker": "2.2.0",
"moment": "2.15.1",
"ng2-activiti-form": "1.5.0",
"ng2-activiti-tasklist": "1.5.0",
"ng2-alfresco-core": "1.5.0",
"ng2-alfresco-datatable": "1.5.0",
"ng2-translate": "5.0.0",
"ng2-activiti-form": "1.6.0",
"ng2-activiti-tasklist": "1.6.0",
"ng2-alfresco-core": "1.6.0",
"ng2-alfresco-datatable": "1.6.0",
"@ngx-translate/core": "^7.0.0",
"reflect-metadata": "0.1.10",
"rxjs": "5.1.0",
"systemjs": "0.19.27",
@@ -71,6 +71,8 @@
"cssnano": "^3.8.1",
"extract-text-webpack-plugin": "^2.0.0-rc.3",
"file-loader": "0.11.1",
"fork-ts-checker-webpack-plugin": "^0.2.3",
"happypack": "3.0.0",
"html-loader": "^0.4.4",
"html-webpack-plugin": "^2.28.0",
"istanbul-instrumenter-loader": "0.2.0",
@@ -89,12 +91,14 @@
"karma-webpack": "^2.0.2",
"loader-utils": "^1.1.0",
"merge-stream": "^1.0.1",
"node-sass": "^4.5.3",
"null-loader": "^0.1.1",
"package-json-merge": "0.0.1",
"raw-loader": "^0.5.1",
"remap-istanbul": "^0.6.3",
"rimraf": "^2.5.4",
"rimraf": "^2.6.1",
"run-sequence": "^1.2.2",
"sass-loader": "^6.0.5",
"script-loader": "0.7.0",
"source-map-loader": "^0.1.6",
"style-loader": "^0.13.1",
@@ -105,7 +109,7 @@
"ts-node": "^1.7.0",
"tslint": "^4.4.2",
"tslint-loader": "^3.3.0",
"typescript": "^2.1.6",
"typescript": "^2.3.4",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0",
"webpack-merge": "2.6.1",

View File

@@ -51,6 +51,19 @@ export let exampleProcess = new ProcessInstance({
}
});
export let processEnded = new ProcessInstance({
id: '123',
name: 'Process 123',
started: '2016-11-10T03:37:30.010+0000',
startedBy: {
id: 1001,
firstName: 'Bob',
lastName: 'Jones',
email: 'bob@app.activiti.com'
},
ended: '2016-11-11T03:37:30.010+0000'
});
export let exampleProcessNoName = new ProcessInstance({
id: '123',
name: null,

View File

@@ -29,8 +29,14 @@ describe('ActivitiFilters', () => {
let logService: LogServiceMock;
let fakeGlobalFilter = [];
fakeGlobalFilter.push(new FilterProcessRepresentationModel({name: 'FakeInvolvedTasks', filter: { state: 'open', assignment: 'fake-involved'}}));
fakeGlobalFilter.push(new FilterProcessRepresentationModel({name: 'FakeMyTasks', filter: { state: 'open', assignment: 'fake-assignee'}}));
fakeGlobalFilter.push(new FilterProcessRepresentationModel({
name: 'FakeInvolvedTasks',
filter: { state: 'open', assignment: 'fake-involved' }
}));
fakeGlobalFilter.push(new FilterProcessRepresentationModel({
name: 'FakeMyTasks',
filter: { state: 'open', assignment: 'fake-assignee' }
}));
let fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
resolve(fakeGlobalFilter);
@@ -71,7 +77,7 @@ describe('ActivitiFilters', () => {
it('should return the filter task list, filtered By Name', (done) => {
let fakeDeployedApplicationsPromise = new Promise(function (resolve, reject) {
resolve({});
resolve({ id: 1 });
});
spyOn(activitiService, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeDeployedApplicationsPromise));
@@ -121,7 +127,12 @@ describe('ActivitiFilters', () => {
});
it('should emit an event when a filter is selected', (done) => {
let currentFilter = new FilterProcessRepresentationModel({filter: { state: 'open', assignment: 'fake-involved'}});
let currentFilter = new FilterProcessRepresentationModel({
filter: {
state: 'open',
assignment: 'fake-involved'
}
});
filterList.filterClick.subscribe((filter: FilterProcessRepresentationModel) => {
expect(filter).toBeDefined();
@@ -164,7 +175,10 @@ describe('ActivitiFilters', () => {
});
it('should return the current filter after one is selected', () => {
let filter = new FilterProcessRepresentationModel({name: 'FakeMyTasks', filter: { state: 'open', assignment: 'fake-assignee'}});
let filter = new FilterProcessRepresentationModel({
name: 'FakeMyTasks',
filter: { state: 'open', assignment: 'fake-assignee' }
});
expect(filterList.currentFilter).toBeUndefined();
filterList.selectFilter(filter);
expect(filterList.getCurrentFilter()).toBe(filter);

View File

@@ -18,7 +18,7 @@
import { Component, Output, EventEmitter, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
import { Observable, Observer } from 'rxjs/Rx';
import { AlfrescoTranslationService, LogService } from 'ng2-alfresco-core';
import { FilterProcessRepresentationModel } from './../models/filter-process.model';
import { FilterProcessRepresentationModel, FilterParamsModel } from './../models/filter-process.model';
import { ActivitiProcessService } from './../services/activiti-process.service';
declare let componentHandler: any;
@@ -30,6 +30,9 @@ declare let componentHandler: any;
})
export class ActivitiProcessFilters implements OnInit, OnChanges {
@Input()
filterParam: FilterParamsModel;
@Output()
filterClick: EventEmitter<FilterProcessRepresentationModel> = new EventEmitter<FilterProcessRepresentationModel>();
@@ -61,7 +64,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
this.filter$ = new Observable<FilterProcessRepresentationModel>(observer => this.filterObserver = observer).share();
if (translate) {
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
}
@@ -88,7 +91,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
* Return the filter list filtered by appId
* @param appId - optional
*/
getFiltersByAppId(appId?: number) {
getFiltersByAppId(appId?: string) {
this.activiti.getProcessFilters(appId).subscribe(
(res: FilterProcessRepresentationModel[]) => {
if (res.length === 0 && this.isFilterListEmpty()) {
@@ -99,7 +102,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
this.filterObserver.next(filter);
});
this.selectFirstFilter();
this.selectTaskFilter(this.filterParam);
this.onSuccess.emit(resDefault);
},
(errDefault: any) => {
@@ -112,7 +115,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
this.filterObserver.next(filter);
});
this.selectFirstFilter();
this.selectTaskFilter(this.filterParam);
this.onSuccess.emit(res);
}
},
@@ -129,8 +132,8 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
getFiltersByAppName(appName: string) {
this.activiti.getDeployedApplications(appName).subscribe(
application => {
this.getFiltersByAppId(application.id);
this.selectFirstFilter();
this.getFiltersByAppId(application.id.toString());
this.selectTaskFilter(this.filterParam);
},
(err) => {
this.onError.emit(err);
@@ -149,11 +152,26 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
/**
* Select the first filter of a list if present
*/
public selectFirstFilter() {
public selectTaskFilter(filterParam: FilterParamsModel) {
if (filterParam) {
this.filters.filter((taskFilter: FilterProcessRepresentationModel, index) => {
if (filterParam.name && filterParam.name.toLowerCase() === taskFilter.name.toLowerCase() ||
filterParam.id === taskFilter.id || filterParam.index === index) {
this.currentFilter = taskFilter;
}
});
}
if (this.isCurrentFilterEmpty()) {
this.selectDefaultTaskFilter();
}
}
/**
* Select as default task filter the first in the list
*/
public selectDefaultTaskFilter() {
if (!this.isFilterListEmpty()) {
this.currentFilter = this.filters[0];
} else {
this.currentFilter = null;
}
}
@@ -178,6 +196,10 @@ export class ActivitiProcessFilters implements OnInit, OnChanges {
*/
private resetFilter() {
this.filters = [];
this.currentFilter = null;
this.currentFilter = undefined;
}
private isCurrentFilterEmpty(): boolean {
return this.currentFilter === undefined || null ? true : false;
}
}

View File

@@ -59,7 +59,7 @@ export class ActivitiProcessComments implements OnChanges {
private activitiProcess: ActivitiProcessService) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
this.comment$ = new Observable<Comment>(observer => this.commentObserver = observer).share();

View File

@@ -1,7 +1,10 @@
<div *ngIf="!processInstanceDetails">{{ 'DETAILS.MESSAGES.NONE'|translate }}</div>
<div *ngIf="processInstanceDetails">
<h2 class="mdl-card__title-text">{{ getProcessNameOrDescription('medium') }}</h2>
<activiti-process-instance-header [processInstance]="processInstanceDetails"></activiti-process-instance-header>
<activiti-process-instance-header
[processInstance]="processInstanceDetails"
(showProcessDiagram)="onShowProcessDiagram($event)">
</activiti-process-instance-header>
<div class="mdl-card mdl-shadow--2dp activiti-process-container">
<div class="mdl-cell mdl-cell--12-col">
<activiti-process-instance-tasks

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { DatePipe } from '@angular/common';
import { Component, Input, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
import { AlfrescoTranslationService, LogService } from 'ng2-alfresco-core';
import { TaskDetailsEvent } from 'ng2-activiti-tasklist';
import {DatePipe} from '@angular/common';
import {Component, Input, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges} from '@angular/core';
import {AlfrescoTranslationService, LogService} from 'ng2-alfresco-core';
import {TaskDetailsEvent} from 'ng2-activiti-tasklist';
import { ActivitiProcessService } from './../services/activiti-process.service';
import { ActivitiProcessInstanceHeader } from './activiti-process-instance-header.component';
import { ActivitiProcessInstanceTasks } from './activiti-process-instance-tasks.component';
import { ProcessInstance } from '../models/process-instance.model';
import {ActivitiProcessService} from './../services/activiti-process.service';
import {ActivitiProcessInstanceHeader} from './activiti-process-instance-header.component';
import {ActivitiProcessInstanceTasks} from './activiti-process-instance-tasks.component';
import {ProcessInstance} from '../models/process-instance.model';
@Component({
selector: 'activiti-process-instance-details',
@@ -58,6 +58,9 @@ export class ActivitiProcessInstanceDetails implements OnChanges {
processInstanceDetails: ProcessInstance;
@Output()
showProcessDiagram: EventEmitter<any> = new EventEmitter<any>();
/**
* Constructor
* @param translate Translation service
@@ -68,7 +71,7 @@ export class ActivitiProcessInstanceDetails implements OnChanges {
private logService: LogService) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
}
@@ -136,4 +139,9 @@ export class ActivitiProcessInstanceDetails implements OnChanges {
this.logService.error(`ProcessListInstanceHeader: error parsing date ${value} to format ${format}`);
}
}
onShowProcessDiagram(event: any) {
this.showProcessDiagram.emit(event);
}
}

View File

@@ -15,5 +15,8 @@
<span class="activiti-label">{{ 'DETAILS.LABELS.ENDED' | translate }}</span>:
<span class="activiti-process-header__value">{{getFormatDate(processInstance.ended, 'medium')}}</span>
</div>
<button data-automation-id="header-show-diagram" id="show-diagram-button" md-raised-button *ngIf="isShowDiagram()" [attr.disabled]="isDiagramDisabled()" (click)="showDiagramEvent()" >
{{ 'DETAILS.BUTTON.SHOW_DIAGRAM' | translate }}
</button>
</div>
</div>

View File

@@ -20,7 +20,7 @@ import { By } from '@angular/platform-browser';
import { AlfrescoTranslationService, CoreModule } from 'ng2-alfresco-core';
import { ActivitiProcessInstanceHeader } from './activiti-process-instance-header.component';
import { TranslationMock } from './../assets/translation.service.mock';
import { exampleProcess } from './../assets/activiti-process.model.mock';
import { exampleProcess, processEnded } from './../assets/activiti-process.model.mock';
import { ProcessInstance } from './../models/process-instance.model';
import { ActivitiProcessComments } from './activiti-process-comments.component';
import { ActivitiProcessService } from './../services/activiti-process.service';
@@ -30,6 +30,7 @@ describe('ActivitiProcessInstanceHeader', () => {
let componentHandler: any;
let component: ActivitiProcessInstanceHeader;
let fixture: ComponentFixture<ActivitiProcessInstanceHeader>;
let element: HTMLElement;
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -51,6 +52,7 @@ describe('ActivitiProcessInstanceHeader', () => {
fixture = TestBed.createComponent(ActivitiProcessInstanceHeader);
component = fixture.componentInstance;
element = fixture.nativeElement;
component.processInstance = new ProcessInstance(exampleProcess);
@@ -98,4 +100,34 @@ describe('ActivitiProcessInstanceHeader', () => {
expect(formValueEl.nativeElement.innerText).toBe('Nov 10, 2016, 3:37:30 AM');
});
it('should render the button show diagram as default', () => {
fixture.detectChanges();
let formValueEl = fixture.debugElement.query(By.css('[data-automation-id="header-show-diagram"]'));
expect(formValueEl).not.toBeNull();
});
it('should render the button show diagram enabled as default', () => {
fixture.detectChanges();
let showButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#show-diagram-button');
expect(showButton).toBeDefined();
expect(showButton.disabled).toBeFalsy();
});
it('should render the button show diagram disabled', () => {
component.processInstance = new ProcessInstance(processEnded);
fixture.detectChanges();
fixture.whenStable().then(() => {
let showButton: HTMLButtonElement = <HTMLButtonElement> element.querySelector('#show-diagram-button');
expect(showButton).toBeDefined();
expect(showButton.disabled).toBeTruthy();
});
});
it('should NOT render the button show diagram is the property showDiagram is false', () => {
component.showDiagram = false;
fixture.detectChanges();
let formValueEl = fixture.debugElement.query(By.css('[data-automation-id="header-show-pippo"]'));
expect(formValueEl).toBeNull();
});
});

View File

@@ -29,17 +29,23 @@ declare let componentHandler: any;
})
export class ActivitiProcessInstanceHeader {
@Input()
showDiagram: boolean = true;
@Input()
processInstance: ProcessInstance;
@Output()
onError: EventEmitter<any> = new EventEmitter<any>();
@Output()
showProcessDiagram: EventEmitter<any> = new EventEmitter<any>();
constructor(private translate: AlfrescoTranslationService,
private logService: LogService) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
}
@@ -64,4 +70,16 @@ export class ActivitiProcessInstanceHeader {
isRunning(): boolean {
return this.processInstance && !this.processInstance.ended;
}
isDiagramDisabled(): boolean {
return !this.isRunning() ? true : undefined;
}
showDiagramEvent() {
this.showProcessDiagram.emit({value: this.processInstance.id});
}
isShowDiagram(): boolean {
return this.showDiagram;
}
}

View File

@@ -70,7 +70,7 @@ export class ActivitiProcessInstanceTasks implements OnInit, OnChanges {
private activitiProcess: ActivitiProcessService,
private logService: LogService) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
this.task$ = new Observable<TaskDetailsModel>(observer => this.taskObserver = observer).share();

View File

@@ -70,7 +70,7 @@ export class ActivitiProcessInstanceVariables implements OnInit, OnChanges {
private activitiProcess: ActivitiProcessService) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
}

View File

@@ -71,7 +71,7 @@ export class ActivitiProcessInstanceListComponent implements OnChanges, AfterCon
constructor(private processService: ActivitiProcessService,
private translate: AlfrescoTranslationService) {
if (translate !== null) {
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
}

View File

@@ -50,7 +50,7 @@ describe('ActivitiStartProcessInstance', () => {
ActivitiStartProcessInstance
],
providers: [
{ provide: AlfrescoTranslationService, useClass: TranslationMock },
{provide: AlfrescoTranslationService, useClass: TranslationMock},
ActivitiProcessService,
FormService
]
@@ -80,7 +80,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should call service to fetch process definitions', () => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
fixture.detectChanges();
expect(getDefinitionsSpy).toHaveBeenCalled();
@@ -88,7 +88,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should call service to fetch process definitions with appId when provided', () => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
fixture.detectChanges();
expect(getDefinitionsSpy).toHaveBeenCalledWith('123');
@@ -96,7 +96,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should display the correct number of processes in the select list', () => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
fixture.detectChanges();
let selectElement = debugElement.query(By.css('select'));
@@ -105,7 +105,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should display the correct process def details', async(() => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -118,7 +118,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should indicate an error to the user if process defs cannot be loaded', async(() => {
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.throw({}));
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -131,7 +131,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should show no process available message when no process definition is loaded', async(() => {
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.of([]));
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -158,12 +158,12 @@ describe('ActivitiStartProcessInstance', () => {
}));
it('should reload processes when appId input changed', () => {
component.ngOnChanges({ appId: change });
component.ngOnChanges({appId: change});
expect(getDefinitionsSpy).toHaveBeenCalledWith('456');
});
it('should reload processes when appId input changed to null', () => {
component.ngOnChanges({ appId: nullChange });
component.ngOnChanges({appId: nullChange});
expect(getDefinitionsSpy).toHaveBeenCalledWith(null);
});
@@ -179,7 +179,7 @@ describe('ActivitiStartProcessInstance', () => {
beforeEach(() => {
component.name = 'My new process';
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
});
it('should call service to start process if required fields provided', async(() => {
@@ -207,11 +207,11 @@ describe('ActivitiStartProcessInstance', () => {
}));
it('should call service to start process with the variables setted', async(() => {
let inputProcessVariable = [];
let inputProcessVariable: RestVariable[] = [];
let variable: any = {};
let variable: RestVariable = {};
variable.name = 'nodeId';
variable.value ='id';
variable.value = 'id';
inputProcessVariable.push(variable);
@@ -234,7 +234,7 @@ describe('ActivitiStartProcessInstance', () => {
it('should throw error event when process cannot be started', async(() => {
let errorSpy = spyOn(component.error, 'error');
let error = { message: 'My error' };
let error = {message: 'My error'};
startProcessSpy = startProcessSpy.and.returnValue(Observable.throw(error));
component.onProcessDefChange('my:process1');
component.startProcess();
@@ -266,7 +266,7 @@ describe('ActivitiStartProcessInstance', () => {
beforeEach(async(() => {
component.name = 'My new process';
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
fixture.detectChanges();
component.onProcessDefChange('my:process1');
fixture.whenStable();
@@ -298,7 +298,7 @@ describe('ActivitiStartProcessInstance', () => {
beforeEach(() => {
getDefinitionsSpy.and.returnValue(Observable.of(fakeProcessDefWithForm));
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'appId': change });
component.ngOnChanges({'appId': change});
component.onProcessDefChange('my:process1');
fixture.detectChanges();
fixture.whenStable();

View File

@@ -37,7 +37,7 @@ export class ActivitiStartProcessInstance implements OnChanges {
appId: string;
@Input()
variables: RestVariable;
variables: RestVariable[];
@Output()
start: EventEmitter<ProcessInstance> = new EventEmitter<ProcessInstance>();
@@ -60,7 +60,7 @@ export class ActivitiStartProcessInstance implements OnChanges {
private activitiProcess: ActivitiProcessService) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-processlist', 'node_modules/ng2-activiti-processlist/src');
translate.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
}

View File

@@ -0,0 +1,19 @@
.upload-attachment-container {
border: 1px solid rgb(224, 224, 224);
background: #fff;
text-align: left;
border-top: none;
padding: 10px;
text-align: center;
}
.drag-area {
border: 1px solid #eee;
padding: 100px 10px;
margin-bottom: 10px;
}
.upload-attachment-container button {
color: rgb(253, 145, 0);
opacity: 0.64;
}

View File

@@ -0,0 +1,17 @@
<div class="upload-attachment-container">
<div class="drag-area"
id="add_new_process_content_area"
(upload-files)="onFileUpload($event)"
mode="['click', 'drop']"
[adf-upload]="true">
{{ 'DETAILS.BUTTON.DRAG-ATTACHMENT' | translate }}
</div>
<button class="mdl-button mdl-js-button mdl-button--raised"
id="add_new_process_content_button"
[adf-upload]="true"
mode="['click']"
[multiple]="true"
(upload-files)="onFileUpload($event)">
{{ 'DETAILS.BUTTON.UPLOAD-ATTACHMENT' | translate }}
</button>
</div>

View File

@@ -0,0 +1,160 @@
/*!
* @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 { AlfrescoTranslationService, CoreModule } from 'ng2-alfresco-core';
import { ActivitiContentService } from 'ng2-activiti-form';
import { ActivitiCreateProcessAttachmentComponent } from './adf-create-process-attachment.component';
declare let jasmine: any;
describe('Activiti Process Create Attachment', () => {
let componentHandler: any;
let service: ActivitiContentService;
let component: ActivitiCreateProcessAttachmentComponent;
let fixture: ComponentFixture<ActivitiCreateProcessAttachmentComponent>;
let element: HTMLElement;
let file = new File([new Blob()], 'Test');
let fileObj = { entry: null, file: file, relativeFolder: '/' };
let customEvent = { detail: { files: [fileObj] } };
let fakeUploadResponse = {
id: 9999,
name: 'BANANA.jpeg',
created: '2017-06-12T12:52:11.109Z',
createdBy: { id: 2, firstName: 'fake-user', lastName: 'fake-user', email: 'fake-user' },
relatedContent: false,
contentAvailable: true,
link: false,
mimeType: 'image/jpeg',
simpleType: 'image',
previewStatus: 'queued',
thumbnailStatus: 'queued'
};
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
CoreModule.forRoot()
],
declarations: [
ActivitiCreateProcessAttachmentComponent
],
providers: [
{ provide: AlfrescoTranslationService },
ActivitiContentService
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ActivitiCreateProcessAttachmentComponent);
component = fixture.componentInstance;
service = fixture.debugElement.injector.get(ActivitiContentService);
element = fixture.nativeElement;
componentHandler = jasmine.createSpyObj('componentHandler', [
'upgradeAllRegistered',
'upgradeElement'
]);
window['componentHandler'] = componentHandler;
component.processInstanceId = '9999';
fixture.detectChanges();
});
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('should update the processInstanceId when it is changed', () => {
component.processInstanceId = null;
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({ 'processInstanceId': change });
expect(component.processInstanceId).toBe('123');
});
it('should emit content created event when the file is uploaded', async(() => {
component.contentCreated.subscribe((res) => {
expect(res).toBeDefined();
expect(res).not.toBeNull();
expect(res.id).toBe(9999);
});
component.onFileUpload(customEvent);
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeUploadResponse)
});
}));
it('should allow user to drag&drop files', async(() => {
let dragArea: HTMLElement = <HTMLElement> element.querySelector('#add_new_process_content_area');
expect(dragArea).toBeDefined();
expect(dragArea).not.toBeNull();
component.contentCreated.subscribe((res) => {
expect(res).toBeDefined();
expect(res).not.toBeNull();
expect(res.id).toBe(9999);
});
let dropEvent = new CustomEvent('upload-files', customEvent);
dragArea.dispatchEvent(dropEvent);
fixture.detectChanges();
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeUploadResponse)
});
}));
it('should allow user to upload files via button', async(() => {
let buttonUpload: HTMLElement = <HTMLElement> element.querySelector('#add_new_process_content_button');
expect(buttonUpload).toBeDefined();
expect(buttonUpload).not.toBeNull();
component.contentCreated.subscribe((res) => {
expect(res).toBeDefined();
expect(res).not.toBeNull();
expect(res.id).toBe(9999);
});
let dropEvent = new CustomEvent('upload-files', customEvent);
buttonUpload.dispatchEvent(dropEvent);
fixture.detectChanges();
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeUploadResponse)
});
}));
});

View File

@@ -0,0 +1,69 @@
/*!
* @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 } from 'ng2-alfresco-core';
import { ActivitiContentService } from 'ng2-activiti-form';
@Component({
selector: 'adf-create-process-attachment',
styleUrls: ['./adf-create-process-attachment.component.css'],
templateUrl: './adf-create-process-attachment.component.html'
})
export class ActivitiCreateProcessAttachmentComponent implements OnChanges {
@Input()
processInstanceId: string;
@Output()
creationError: EventEmitter<any> = new EventEmitter<any>();
@Output()
contentCreated: EventEmitter<any> = new EventEmitter<any>();
constructor(private translateService: AlfrescoTranslationService,
private activitiContentService: ActivitiContentService) {
if (translateService) {
translateService.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist/src');
}
}
ngOnChanges(changes: SimpleChanges) {
if (changes['processInstanceId'] && changes['processInstanceId'].currentValue) {
this.processInstanceId = changes['processInstanceId'].currentValue;
}
}
onFileUpload(event: any) {
let filesList: File[] = event.detail.files.map(obj => obj.file);
for (let fileInfoObj of filesList) {
let file: File = fileInfoObj;
let opts = {
isRelatedContent: true
};
this.activitiContentService.createProcessRelatedContent(this.processInstanceId, file, opts).subscribe(
(res) => {
this.contentCreated.emit(res);
},
(err) => {
this.creationError.emit(err);
});
}
}
}

View File

@@ -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;
}

View File

@@ -0,0 +1,15 @@
<div class="no-attachment-message" *ngIf="isEmpty()">
No Attachments Found
</div>
<alfresco-datatable *ngIf="!isEmpty()"
[rows]="attachments"
[actions]="true"
(rowDblClick)="openContent($event)"
(showRowActionsMenu)="onShowRowActionsMenu($event)"
(executeRowAction)="onExecuteRowAction($event)">
<data-columns>
<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="created" type="date" format="shortDate" title="Created On"></data-column>
</data-columns>
</alfresco-datatable>

View File

@@ -0,0 +1,222 @@
/*!
* @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 } from 'ng2-alfresco-datatable';
import { ActivitiProcessAttachmentListComponent } from './adf-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<ActivitiProcessAttachmentListComponent>;
let getProcessRelatedContentSpy: jasmine.Spy;
let deleteContentSpy: jasmine.Spy;
let getFileRawContentSpy: jasmine.Spy;
let mockAttachment: any;
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);
mockAttachment = {
'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'
}]
};
getProcessRelatedContentSpy = spyOn(service, 'getProcessRelatedContent').and.returnValue(Observable.of(mockAttachment));
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 emit a success event when the attachments are loaded', () => {
let change = new SimpleChange(null, '123', true);
component.success.subscribe((attachments) => {
expect(attachments[0].name).toEqual(mockAttachment.data[0].name);
expect(attachments[0].id).toEqual(mockAttachment.data[0].id);
});
component.ngOnChanges({'taskId': change});
});
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);
});
});
});

View File

@@ -0,0 +1,166 @@
/*!
* @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: 'adf-process-attachment-list',
styleUrls: ['./adf-process-attachment-list.component.css'],
templateUrl: './adf-process-attachment-list.component.html'
})
export class ActivitiProcessAttachmentListComponent implements OnChanges {
@Input()
processInstanceId: string;
@Output()
attachmentClick = new EventEmitter();
@Output()
success = new EventEmitter();
@Output()
error: EventEmitter<any> = new EventEmitter<any>();
attachments: any[] = [];
constructor(private translateService: AlfrescoTranslationService,
private activitiContentService: ActivitiContentService,
private contentService: ContentService) {
if (translateService) {
translateService.addTranslationFolder('ng2-activiti-processlist', 'assets/ng2-activiti-processlist');
}
}
ngOnChanges(changes: SimpleChanges) {
if (changes['processInstanceId'] && changes['processInstanceId'].currentValue) {
this.loadAttachmentsByProcessInstanceId(changes['processInstanceId'].currentValue);
}
}
reset () {
this.attachments = [];
}
reload(): void {
this.loadAttachmentsByProcessInstanceId(this.processInstanceId);
}
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)
});
});
this.success.emit(this.attachments);
},
(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);
}
);
}
downloadContent(content: any): void {
this.activitiContentService.getFileRawContent(content.id).subscribe(
(blob: Blob) => this.contentService.downloadBlob(blob, content.name),
(err) => {
this.error.emit(err);
}
);
}
}

View File

@@ -23,3 +23,5 @@ 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 './adf-process-attachment-list.component';
export * from './adf-create-process-attachment.component';

View File

@@ -24,7 +24,10 @@
"TASK_SUBTITLE": "Assigned to {{user}}, created {{created}}"
},
"BUTTON": {
"CANCEL": "Cancel Process"
"CANCEL": "Cancel Process",
"SHOW_DIAGRAM": "Show Diagram",
"DRAG-ATTACHMENT": "Drop Files Here...",
"UPLOAD-ATTACHMENT": "Upload Attachment"
},
"MESSAGES": {
"NONE": "No process details found."

View File

@@ -46,6 +46,25 @@ export class FilterProcessRepresentationModel {
}
}
/**
*
* This object represent the parameters to filter a filter.
*
*
* @returns {FilterParamsModel} .
*/
export class FilterParamsModel {
id: string;
name: string;
index: number;
constructor(obj?: any) {
this.id = obj && obj.id || null;
this.name = obj && obj.name || null;
this.index = obj && obj.index;
}
}
/**
*
* This object represent the parameters of a process filter.

View File

@@ -595,12 +595,12 @@ describe('ActivitiProcessService', () => {
it('should call the API without an appId defined by default', () => {
service.getProcessFilters(null);
expect(getFilters).toHaveBeenCalledWith({});
expect(getFilters).toHaveBeenCalled();
});
it('should call the API with the correct appId when specified', () => {
service.getProcessFilters(226);
expect(getFilters).toHaveBeenCalledWith({appId: 226});
service.getProcessFilters('226');
expect(getFilters).toHaveBeenCalledWith({appId: '226'});
});
it('should return the task filter by id', (done) => {
@@ -638,7 +638,7 @@ describe('ActivitiProcessService', () => {
}));
it('should return the default filters', (done) => {
service.createDefaultFilters(1234).subscribe(
service.createDefaultFilters('1234').subscribe(
(res: FilterProcessRepresentationModel []) => {
expect(res).toBeDefined();
expect(res.length).toEqual(3);

View File

@@ -68,11 +68,8 @@ export class ActivitiProcessService {
}).catch(err => this.handleError(err));
}
getProcessFilters(appId: number): Observable<FilterProcessRepresentationModel[]> {
let filterOpts = appId ? {
appId: appId
} : {};
return Observable.fromPromise(this.callApiGetUserProcessInstanceFilters(filterOpts))
getProcessFilters(appId: string): Observable<FilterProcessRepresentationModel[]> {
return Observable.fromPromise(this.callApiProcessFilters(appId))
.map((response: any) => {
let filters: FilterProcessRepresentationModel[] = [];
response.data.forEach((filter: FilterProcessRepresentationModel) => {
@@ -99,13 +96,14 @@ export class ActivitiProcessService {
/**
* Retrieve the process filter by name
* @param processName - string - The name of the filter
* @param filterName - string - The name of the filter
* @param appId - string - optional - The id of app
* @returns {Observable<FilterProcessRepresentationModel>}
*/
getProcessFilterByName(processName: string, appId?: string): Observable<FilterProcessRepresentationModel> {
return Observable.fromPromise(this.callApiGetUserProcessInstanceFilters(appId))
getProcessFilterByName(filterName: string, appId?: string): Observable<FilterProcessRepresentationModel> {
return Observable.fromPromise(this.callApiProcessFilters(appId))
.map((response: any) => {
return response.data.find(filter => filter.name === processName);
return response.data.find(filter => filter.name === filterName);
}).catch(err => this.handleError(err));
}
@@ -114,7 +112,7 @@ export class ActivitiProcessService {
* @param appId
* @returns {FilterProcessRepresentationModel[]}
*/
public createDefaultFilters(appId: number): Observable<FilterProcessRepresentationModel[]> {
public createDefaultFilters(appId: string): Observable<FilterProcessRepresentationModel[]> {
let runnintFilter = this.getRunningFilterInstance(appId);
let runnintObservable = this.addFilter(runnintFilter);
@@ -150,13 +148,13 @@ export class ActivitiProcessService {
});
}
private getRunningFilterInstance(appId: number): FilterProcessRepresentationModel {
private getRunningFilterInstance(appId: string): FilterProcessRepresentationModel {
return new FilterProcessRepresentationModel({
'name': 'Running',
'appId': appId,
'recent': true,
'icon': 'glyphicon-random',
'filter': {'sort': 'created-desc', 'name': '', 'state': 'running'}
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'running' }
});
}
@@ -165,13 +163,13 @@ export class ActivitiProcessService {
* @param appId
* @returns {FilterProcessRepresentationModel}
*/
private getCompletedFilterInstance(appId: number): FilterProcessRepresentationModel {
private getCompletedFilterInstance(appId: string): FilterProcessRepresentationModel {
return new FilterProcessRepresentationModel({
'name': 'Completed',
'appId': appId,
'recent': false,
'icon': 'glyphicon-ok-sign',
'filter': {'sort': 'created-desc', 'name': '', 'state': 'completed'}
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'completed' }
});
}
@@ -180,13 +178,13 @@ export class ActivitiProcessService {
* @param appId
* @returns {FilterProcessRepresentationModel}
*/
private getAllFilterInstance(appId: number): FilterProcessRepresentationModel {
private getAllFilterInstance(appId: string): FilterProcessRepresentationModel {
return new FilterProcessRepresentationModel({
'name': 'All',
'appId': appId,
'recent': true,
'icon': 'glyphicon-th',
'filter': {'sort': 'created-desc', 'name': '', 'state': 'all'}
'filter': { 'sort': 'created-desc', 'name': '', 'state': 'all' }
});
}
@@ -210,15 +208,15 @@ export class ActivitiProcessService {
getProcessTasks(id: string, state?: string): Observable<TaskDetailsModel[]> {
let taskOpts = state ? {
processInstanceId: id,
state: state
} : {
processInstanceId: id
};
processInstanceId: id,
state: state
} : {
processInstanceId: id
};
return Observable.fromPromise(this.apiService.getInstance().activiti.taskApi.listTasks(taskOpts))
.map(this.extractData)
.map(tasks => tasks.map((task: any) => {
task.created = moment(task.created, 'YYYY-MM-DD').format();
task.created = moment(task.created, 'YYYY-MM-DD').format();
return task;
}))
.catch(err => this.handleError(err));
@@ -255,8 +253,8 @@ export class ActivitiProcessService {
*/
addProcessInstanceComment(id: string, message: string): Observable<Comment> {
return Observable.fromPromise(
this.apiService.getInstance().activiti.commentsApi.addProcessInstanceComment({message: message}, id)
)
this.apiService.getInstance().activiti.commentsApi.addProcessInstanceComment({ message: message }, id)
)
.map((response: Comment) => {
return new Comment(response.id, response.message, response.created, response.createdBy);
}).catch(err => this.handleError(err));
@@ -265,20 +263,20 @@ export class ActivitiProcessService {
getProcessDefinitions(appId?: string): Observable<ProcessDefinitionRepresentation[]> {
let opts = appId ? {
latest: true,
appDefinitionId: appId
} : {
latest: true
};
latest: true,
appDefinitionId: appId
} : {
latest: true
};
return Observable.fromPromise(
this.apiService.getInstance().activiti.processApi.getProcessDefinitions(opts)
)
)
.map(this.extractData)
.map(processDefs => processDefs.map((pd) => new ProcessDefinitionRepresentation(pd)))
.catch(err => this.handleError(err));
}
startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: any, variables?: RestVariable): Observable<ProcessInstance> {
startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: any, variables?: RestVariable[]): Observable<ProcessInstance> {
let startRequest: any = {
name: name,
processDefinitionId: processDefinitionId
@@ -294,7 +292,7 @@ export class ActivitiProcessService {
}
return Observable.fromPromise(
this.apiService.getInstance().activiti.processApi.startNewProcessInstance(startRequest)
)
)
.map((pd) => new ProcessInstance(pd))
.catch(err => this.handleError(err));
}
@@ -302,14 +300,14 @@ export class ActivitiProcessService {
cancelProcess(processInstanceId: string): Observable<void> {
return Observable.fromPromise(
this.apiService.getInstance().activiti.processApi.deleteProcessInstance(processInstanceId)
)
)
.catch(err => this.handleError(err));
}
getProcessInstanceVariables(processDefinitionId: string): Observable<ProcessInstanceVariable[]> {
return Observable.fromPromise(
this.apiService.getInstance().activiti.processInstanceVariablesApi.getProcessInstanceVariables(processDefinitionId)
)
)
.map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd)))
.catch(err => this.handleError(err));
}
@@ -317,21 +315,17 @@ export class ActivitiProcessService {
createOrUpdateProcessInstanceVariables(processDefinitionId: string, variables: ProcessInstanceVariable[]): Observable<ProcessInstanceVariable[]> {
return Observable.fromPromise(
this.apiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processDefinitionId, variables)
)
)
.catch(err => this.handleError(err));
}
deleteProcessInstanceVariable(processDefinitionId: string, variableName: string): Observable<void> {
return Observable.fromPromise(
this.apiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processDefinitionId, variableName)
)
)
.catch(err => this.handleError(err));
}
private callApiGetUserProcessInstanceFilters(filterOpts) {
return this.apiService.getInstance().activiti.userFiltersApi.getUserProcessInstanceFilters(filterOpts);
}
private callApiAddFilter(filter: FilterProcessRepresentationModel) {
return this.apiService.getInstance().activiti.userFiltersApi.createUserProcessInstanceFilter(filter);
}

View File

@@ -35,7 +35,9 @@
"ng2-alfresco-viewer": ["../ng2-alfresco-viewer/"],
"ng2-alfresco-webscript": ["../ng2-alfresco-webscript/"],
"ng2-alfresco-userinfo": ["../ng2-alfresco-userinfo"],
"alfresco-js-api": ["../node_modules/alfresco-js-api/"]
"alfresco-js-api": ["./node_modules/alfresco-js-api/"],
"@angular/*": ["./node_modules/@angular/*"],
"rxjs/*": ["./node_modules/rxjs/*"]
},
"lib": [
"es2015",

View File

@@ -1,17 +1 @@
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const commonConfig = require('./config/webpack.common.js');
module.exports = webpackMerge(commonConfig, {
output: {
filename: './bundles/[name].js',
library: '[name]',
libraryTarget: 'umd',
chunkFilename: '[id].chunk.js'
},
entry: {
"ng2-activiti-processlist": "./index.ts"
}
});
module.exports = require('./config/webpack.build.js');

View File

@@ -0,0 +1 @@
module.exports = require('./config/webpack.coverage.js');

View File

@@ -1,8 +1 @@
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const testConfig = require('./config/webpack.test.js');
module.exports = webpackMerge(testConfig, {
});
module.exports = require('./config/webpack.test.js');