Rename activiti component and add demo folder

This commit is contained in:
mauriziovitale84
2016-07-20 09:58:55 +01:00
parent ec3d3ef647
commit 596e88126d
34 changed files with 427 additions and 17 deletions

View File

@@ -16,7 +16,7 @@
*/
import { Component, OnInit } from '@angular/core';
import { ActivitiTaskList } from 'ng2-alfresco-activiti-tasklist';
import { ActivitiTaskList } from 'ng2-activiti-tasklist';
import { ObjectDataTableAdapter, ObjectDataColumn } from 'ng2-alfresco-datatable';
@Component({

View File

@@ -83,7 +83,7 @@
"ng2-alfresco-upload": "0.2.0",
"ng2-alfresco-viewer": "0.2.0",
"ng2-activiti-form": "0.2.0",
"ng2-activiti-tasklist": "0.2.0"
"ng2-activiti-tasklist": "0.2.0",
"ng2-alfresco-webscript": "file:../ng2-components/ng2-alfresco-webscript"
},
"devDependencies": {

View File

@@ -20,7 +20,7 @@
'ng2-activiti-form': 'node_modules/ng2-activiti-form/dist',
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer/dist',
'ng2-alfresco-webscript': 'node_modules/ng2-alfresco-webscript/dist',
'ng2-alfresco-activiti-tasklist': 'node_modules/ng2-alfresco-activiti-tasklist/dist'
'ng2-activiti-tasklist': 'node_modules/ng2-activiti-tasklist/dist'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
@@ -38,7 +38,7 @@
'ng2-alfresco-upload': { main: 'index.js', defaultExtension: 'js'},
'ng2-alfresco-viewer': { main: 'index.js', defaultExtension: 'js'},
'ng2-activiti-form': { main: 'index.js', defaultExtension: 'js'},
'ng2-alfresco-activiti-tasklist': { main: 'index.js', defaultExtension: 'js'}
'ng2-activiti-tasklist': { main: 'index.js', defaultExtension: 'js'},
'ng2-alfresco-webscript': { main: 'index.js', defaultExtension: 'js'}
};
var ngPackageNames = [

View File

@@ -0,0 +1,6 @@
node_modules
.idea
coverage
dist
typings
!systemjs.config.js

View File

@@ -0,0 +1,3 @@
node_modules
dist
typings

View File

@@ -0,0 +1,13 @@
# DataTable demo
Install:
```
npm install
```
Run the project:
```
npm start
```

View File

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Angular 2 TaskList - Demo</title>
<base href="./">
<!-- 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">
<!-- 1. Load libraries -->
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<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="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<activiti-tasklist-demo></activiti-tasklist-demo>
</body>
</html>

View File

@@ -0,0 +1,78 @@
{
"name": "ng2-activiti-tasklist-demo",
"description": "Alfresco Angular2 DataTable Component - Demo",
"version": "0.1.0",
"author": "Alfresco Software, Ltd.",
"contributors": [
{
"name": "Maurizio Vitale",
"email": "maurizio.vitale84@gmail.com"
}
],
"main": "index.js",
"scripts": {
"clean": "rimraf dist node_modules typings",
"postinstall": "npm run typings && npm run build",
"typings": "typings install",
"start": "rimraf dist && npm install && npm run server",
"server": "wsrv -o",
"build": "npm run tslint && rimraf dist && tsc",
"tslint": "npm run tslint-src && npm run tslint-root",
"tslint-src": "tslint -c tslint.json src/{,**/}**.ts",
"tslint-root": "tslint -c tslint.json *.ts"
},
"license": "Apache-2.0",
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/forms": "0.1.1",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.3",
"systemjs": "0.19.27",
"core-js": "2.4.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "0.6.12",
"license-check": "1.1.5",
"material-design-icons": "2.2.3",
"material-design-lite": "1.1.3",
"ng2-translate": "2.2.2",
"ng2-alfresco-datatable": "^0.1.12",
"ng2-alfresco-core": "^0.1.36"
},
"devDependencies": {
"browser-sync": "2.10.0",
"concurrently": "2.0.0",
"rimraf": "2.5.2",
"tslint": "3.8.1",
"typescript": "1.8.10",
"typings": "1.0.4",
"wsrv": "0.1.3"
},
"keywords": [
"angular2",
"typescript"
],
"license-check-config": {
"src": [
"**/*.js",
"**/*.ts",
"!/**/coverage/**/*",
"!/**/demo/**/*",
"!/**/node_modules/**/*",
"!/**/typings/**/*",
"!*.js"
],
"path": "assets/license_header.txt",
"blocking": true,
"logInfo": false,
"logError": true
}
}

View File

@@ -0,0 +1,64 @@
/*!
* @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, OnInit } from '@angular/core';
import { HTTP_PROVIDERS } from '@angular/http';
import { ALFRESCO_CORE_PROVIDERS, AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { ActivitiTaskList } from 'ng2-activiti-tasklist';
import { ObjectDataTableAdapter, ObjectDataColumn } from 'ng2-alfresco-datatable';
declare let AlfrescoApi: any;
@Component({
selector: 'activiti-tasklist-demo',
template: `
<activiti-tasklist [data]="data"></activiti-tasklist>
`,
styles: [
':host > .container {padding: 10px}',
'.p-10 { padding: 10px; }'
],
directives: [ActivitiTaskList],
providers: [AlfrescoAuthenticationService]
})
class ActivitiTaskListDemo implements OnInit {
data: ObjectDataTableAdapter;
constructor(private setting: AlfrescoSettingsService) {
this.setting.setProviders(['BPM']);
this.data = new ObjectDataTableAdapter([], []);
}
ngOnInit() {
let schema = [
{type: 'text', key: 'id', title: 'Id'},
{type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true},
{type: 'text', key: 'formKey', title: 'Form Key', sortable: true},
{type: 'text', key: 'created', title: 'Created', sortable: true}
];
let columns = schema.map(col => new ObjectDataColumn(col));
this.data.setColumns(columns);
}
}
bootstrap(ActivitiTaskListDemo, [
HTTP_PROVIDERS,
ALFRESCO_CORE_PROVIDERS]
);

View File

@@ -0,0 +1,57 @@
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'dist', // 'dist',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
'ng2-translate': 'node_modules/ng2-translate',
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/dist',
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable/dist',
'ng2-activiti-tasklist': 'node_modules/ng2-activiti-tasklist/dist'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' },
'ng2-alfresco-datatable': { main: 'index.js', defaultExtension: 'js' },
'ng2-activiti-tasklist': { main: 'index.js', defaultExtension: 'js' }
};
var ngPackageNames = [
'common',
'compiler',
'core',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade'
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
map: map,
packages: packages
};
System.config(config);
})(this);

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ES5",
"module": "system",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"outDir": "dist"
},
"exclude": [
"dist",
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}

View File

@@ -0,0 +1,124 @@
{
"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,
140
],
"member-ordering": [
true,
"public-before-private",
"static-before-instance",
"variables-before-functions"
],
"no-any": false,
"no-arg": true,
"no-bitwise": true,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": false,
"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": true,
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-require-imports": true,
"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"
]
}
}

View File

@@ -1,5 +1,5 @@
{
"name": "ng2-alfresco-activiti-tasklist",
"name": "ng2-activiti-tasklist",
"description": "Activiti Angular2 Task List Component",
"version": "0.2.0",
"author": "Alfresco Software, Ltd.",

View File

@@ -1,6 +1,6 @@
<div [ngStyle]="locationCss" class="menu-container">
<ul class="context-menu">
<li (click)="selectFilter(filter)" *ngFor="#filter of filtersList | async">
<li (click)="selectFilter(filter)" *ngFor="let filter of filtersList | async">
{{filter.name}}
</li>
</ul>

View File

@@ -91,11 +91,9 @@ describe('ActivitiTaskList', () => {
taskList.filtersList.subscribe((res: any) => {
expect(res).toBeDefined();
expect(res.size).toEqual(2);
expect(res.total).toEqual(2);
expect(res.data.length).toEqual(2);
expect(res.data[0].name).toEqual('FakeInvolvedTasks');
expect(res.data[1].name).toEqual('FakeMyTasks');
expect(res.length).toEqual(2);
expect(res[0].name).toEqual('FakeInvolvedTasks');
expect(res[1].name).toEqual('FakeMyTasks');
done();
});
});

View File

@@ -57,18 +57,17 @@ export class ActivitiTaskList implements OnInit {
this.filter$ = new Observable<FilterModel>(observer => this.filterObserver = observer).share();
if (translate) {
translate.addTranslationFolder('node_modules/ng2-alfresco-activiti-tasklist');
translate.addTranslationFolder('node_modules/ng2-activiti-tasklist');
}
}
ngOnInit() {
this.filtersList = this.activiti.getTaskListFilters();
this.filtersList = this.activiti.getTaskListFilters().map(res => (res.data));
this.filter$.subscribe((filter: FilterModel) => {
this.activiti.getTasks(filter).subscribe(
(res) => {
let tasks = res.data;
this.loadTasks(tasks);
this.loadTasks(res.data);
}, (err) => {
console.error(err);
});

View File

@@ -32,7 +32,9 @@ export class ActivitiTaskListService {
*/
getTaskListFilters(): Observable<any> {
return Observable.fromPromise(this.callApiTaskFilters())
.map((res: Response) => res.json())
.map((res: Response) => {
return res.json();
})
.catch(this.handleError);
}
@@ -47,7 +49,9 @@ export class ActivitiTaskListService {
data = JSON.stringify(data);
return Observable.fromPromise(this.callApiTasksFiltered(data))
.map((res: Response) => res.json())
.map((res: Response) => {
return res.json();
})
.catch(this.handleError);
}

View File

@@ -0,0 +1,7 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
"node": "registry:dt/node#4.0.0+20160509154515"
}
}

View File

@@ -45,4 +45,8 @@ export class AlfrescoSettingsService {
getProviders(): string [] {
return this.providers;
}
setProviders(providers: string []) {
this.providers = providers;
}
}