Start adding ecmUser component

This commit is contained in:
Vito Albano
2016-09-16 11:46:16 +01:00
parent 79fc3085c0
commit 18fbdb75d0
29 changed files with 1138 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
root = true
[{src,scripts}/**.{ts,json,js}]
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

View File

@@ -0,0 +1,5 @@
typings/
node_modules/
.idea
dist/
!systemjs.config.js

View File

@@ -0,0 +1,19 @@
# ng2-alfresco-userinfo - Demo
* To install dependencies
```sh
$ npm install
```
* To provide a live demo
```sh
$ npm run start
```
* To clean npm_modules and typings folder
```sh
$ npm run clean
```

View File

@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ng2-alfresco-userinfo Angular 2</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">
<!-- 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>
<!-- Additional Alfresco libraries -->
<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>
<my-app>
<div id="loader-spin" class="mdl-progress mdl-js-progress mdl-progress__indeterminate"></div>
</my-app>
</body>
</html>

View File

@@ -0,0 +1,56 @@
{
"name": "ng2-alfresco-userinfo-demo",
"description": "This component will show the user information for ECM and BPM - Demo",
"version": "0.1.0",
"author": "vito albano <vito.albano@alfresco.com>",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts": {
"clean": "rimraf dist node_modules typings",
"typings": "typings install",
"postinstall": "npm run typings && npm run build",
"start": "npm run tslint && rimraf dist && tsc && concurrently \"tsc -w\" \"npm run server\" ",
"server": "wsrv -o -l -s",
"build": "npm run tslint && rimraf dist && tsc",
"build:w": "npm run tslint && rimraf dist && tsc -w",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts"
},
"keywords": [
"ng2",
"angular",
"angular2",
"alfresco",
"demo"
],
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@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",
"material-design-icons": "^2.2.3",
"material-design-lite": "^1.1.3",
"ng2-translate": "2.2.2",
"ng2-alfresco-userinfo": "file:../",
"ng2-alfresco-core": "^0.3.0",
"alfresco-js-api": "^0.3.0"
},
"devDependencies": {
"concurrently": "^2.0.0",
"rimraf": "2.5.2",
"tslint": "^3.8.1",
"typescript": "^1.8.10",
"typings": "^1.0.4",
"wsrv": "^0.1.4"
}
}

View File

@@ -0,0 +1,57 @@
import { Component, OnInit } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { UserInfoComponent } from 'ng2-alfresco-userinfo';
import { HTTP_PROVIDERS } from '@angular/http';
import {
AlfrescoSettingsService,
AlfrescoAuthenticationService,
ALFRESCO_CORE_PROVIDERS
} from 'ng2-alfresco-core';
@Component({
selector: 'my-app',
template: `<h4>START</h4><ng2-alfresco-userinfo></ng2-alfresco-userinfo>`,
directives: [ UserInfoComponent ],
providers: [AlfrescoAuthenticationService, AlfrescoSettingsService]
})
class UserInfoDemo implements OnInit {
private authenticated: boolean;
private ticket: string;
// private ecmHost: string;
constructor(private authService: AlfrescoAuthenticationService,
private settingsService: AlfrescoSettingsService) {
this.settingsService.setProviders('ECM');
}
public ngOnInit(): void {
this.login();
}
login() {
this.authService.login('test', 'test').subscribe(
ticket => {
console.log(ticket);
this.ticket = this.authService.getTicketEcm();
this.authenticated = true;
},
error => {
console.log(error);
this.authenticated = false;
});
}
}
bootstrap(UserInfoDemo, [
UserInfoComponent,
HTTP_PROVIDERS,
ALFRESCO_CORE_PROVIDERS
]);

View File

@@ -0,0 +1,56 @@
'use strict';
(function(/*global*/) {
// map tells the System loader where to look for things
var map = {
app: 'dist/',
'@angular': 'node_modules/@angular',
rxjs: 'node_modules/rxjs',
'ng2-translate': 'node_modules/ng2-translate',
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/dist',
'ng2-alfresco-userinfo': 'node_modules/ng2-alfresco-userinfo/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' },
'ng2-translate': { defaultExtension: 'js' },
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' },
'ng2-alfresco-userinfo': { 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

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