From 74e89cef1ecef5695c24a9e237e814d54da03ea6 Mon Sep 17 00:00:00 2001 From: Mario Romano Date: Tue, 31 May 2016 14:12:30 +0100 Subject: [PATCH] test login demo --- .../{app => assets}/license_header.txt | 2 +- ng2-components/ng2-alfresco-login/README.md | 48 +++---- .../ng2-alfresco-login/demo/index.html | 4 +- .../ng2-alfresco-login/demo/package.json | 118 ++++++++++-------- .../demo/src/components/app-component.ts | 51 -------- .../ng2-alfresco-login/demo/src/main.ts | 38 +++++- .../ng2-alfresco-login/demo/tsconfig.json | 9 +- 7 files changed, 129 insertions(+), 141 deletions(-) rename demo-shell-ng2/{app => assets}/license_header.txt (99%) delete mode 100644 ng2-components/ng2-alfresco-login/demo/src/components/app-component.ts diff --git a/demo-shell-ng2/app/license_header.txt b/demo-shell-ng2/assets/license_header.txt similarity index 99% rename from demo-shell-ng2/app/license_header.txt rename to demo-shell-ng2/assets/license_header.txt index 5cae403293..83fd1531a3 100644 --- a/demo-shell-ng2/app/license_header.txt +++ b/demo-shell-ng2/assets/license_header.txt @@ -1,4 +1,4 @@ -/** +/*! * @license * Copyright 2016 Alfresco Software, Ltd. * diff --git a/ng2-components/ng2-alfresco-login/README.md b/ng2-components/ng2-alfresco-login/README.md index 3799a6dc1f..51d4ab2ef6 100644 --- a/ng2-components/ng2-alfresco-login/README.md +++ b/ng2-components/ng2-alfresco-login/README.md @@ -85,41 +85,24 @@ Example of an App that use Alfresco login component : main.ts ```ts -import { bootstrap } from 'angular2/platform/browser'; -import { AppComponent } from './components/app-component'; -import { ALFRESCO_AUTHENTICATION } from 'ng2-alfresco-login/dist/ng2-alfresco-login'; +import { bootstrap } from 'angular2/platform/browser'; +import { Component } from 'angular2/core'; +import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router'; +import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core'; +import { AlfrescoLoginComponent } from 'ng2-alfresco-login/dist/ng2-alfresco-login'; import { ROUTER_PROVIDERS } from 'angular2/router'; -import { HTTP_PROVIDERS } from 'angular2/http'; +import { HTTP_PROVIDERS } from 'angular2/http'; import { ALFRESCO_CORE_PROVIDERS, AlfrescoTranslationService, AlfrescoTranslationLoader } from 'ng2-alfresco-core/dist/ng2-alfresco-core'; -bootstrap(AppComponent, [ - ROUTER_PROVIDERS, - HTTP_PROVIDERS, - AlfrescoTranslationLoader, - AlfrescoTranslationService, - ALFRESCO_AUTHENTICATION, - ALFRESCO_CORE_PROVIDERS -]); - -``` - -app-components.ts -```ts - -import { Component } from 'angular2/core'; -import { AlfrescoLoginComponent, AlfrescoAuthenticationService } from 'ng2-alfresco-login/dist/ng2-alfresco-login'; -import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router'; -import { AlfrescoSettingsService } from 'ng2-alfresco-core/dist/ng2-alfresco-core'; - -@Component({ - selector: 'my-login', - template: '', - directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent] -}) @RouteConfig([ {path: '/', name: 'Login', component: AlfrescoLoginComponent, useAsDefault: true} ]) +@Component({ + selector: 'my-app', + template: '', + directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent] +}) export class AppComponent { constructor(public auth: AlfrescoAuthenticationService, @@ -139,6 +122,15 @@ export class AppComponent { } +bootstrap(AppComponent, [ + ROUTER_PROVIDERS, + HTTP_PROVIDERS, + AlfrescoTranslationLoader, + AlfrescoTranslationService, + AlfrescoAuthenticationService, + ALFRESCO_CORE_PROVIDERS +]); + ``` #### Events **onSuccess**: The event is emitted when the login is done diff --git a/ng2-components/ng2-alfresco-login/demo/index.html b/ng2-components/ng2-alfresco-login/demo/index.html index d678ed58bd..2b73a958a4 100644 --- a/ng2-components/ng2-alfresco-login/demo/index.html +++ b/ng2-components/ng2-alfresco-login/demo/index.html @@ -2,7 +2,7 @@ - Angular 2 Testing + Alfresco Angular 2 Testing - Demo @@ -31,7 +31,7 @@ - + diff --git a/ng2-components/ng2-alfresco-login/demo/package.json b/ng2-components/ng2-alfresco-login/demo/package.json index f4c5772a75..2d15f55709 100644 --- a/ng2-components/ng2-alfresco-login/demo/package.json +++ b/ng2-components/ng2-alfresco-login/demo/package.json @@ -1,54 +1,70 @@ { - "name": "ng2-alfresco-login-demo", - "description": "Alfresco Angular2 Login Component - Demo", - "version": "0.1.0", - "author": "Alfresco Software, Ltd.", - "main": "index.js", - "scripts": { - "postinstall": "npm run build && npm run typings", - "typings": "typings install", - "start": "rm -rf dist && npm install && npm run server", - "server": "lite-server", - "build": "npm run tslint && rm -rf 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", - "contributors": [ - { - "name": "Maurizio Vitale", - "email": "maurizio.vitale@alfresco.com" + "name": "ng2-alfresco-login-demo", + "description": "Alfresco Angular2 Login Component - Demo", + "version": "0.1.0", + "author": "Alfresco Software, Ltd.", + "main": "index.js", + "scripts": { + "postinstall": "npm run typings && npm run typings", + "typings": "typings install", + "start": "rm -rf dist && npm install && npm run server", + "server": "lite-server", + "build": "npm run tslint && rm -rf 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", + "contributors": [ + { + "name": "Denys Vuika", + "email": "denis.vuyka@gmail.com" + }, + { + "name": "Mario Romano", + "email": "mario.romano83@gmail.com" + }, + { + "name": "Will Abson", + "email": "will.abson@alfresco.com" + }, + { + "name": "Eugenio Romano", + "email": "eugenio.romano@alfresco.com" + }, + { + "name": "Maurizio Vitale", + "email": "maurizio.vitale@alfresco.com" + } + ], + "keywords": [ + "ng2", + "angular", + "angular2", + "alfresco" + ], + "dependencies": { + "alfresco-core-rest-api": "^0.1.0", + "angular2": "2.0.0-beta.15", + "es6-shim": "^0.35.0", + "material-design-icons": "^2.2.3", + "material-design-lite": "^1.1.3", + "ng2-alfresco-core": "^0.1.0", + "ng2-alfresco-login": "^0.1.0", + "reflect-metadata": "0.1.2", + "rxjs": "5.0.0-beta.2", + "systemjs": "0.19.26", + "zone.js": "0.6.10" + }, + "devDependencies": { + "browser-sync": "^2.10.0", + "concurrently": "^2.0.0", + "lite-server": "^2.2.0", + "tslint": "^3.8.1", + "typescript": "^1.8.10", + "typings": "^0.7.12" + }, + "publishConfig": { + "registry": "http://devproducts.alfresco.me:4873/" } - ], - "keywords": [ - "ng2", - "angular", - "angular2", - "alfresco" - ], - "dependencies": { - "alfresco-core-rest-api": "^0.1.0", - "angular2": "2.0.0-beta.15", - "es6-shim": "^0.35.0", - "material-design-icons": "^2.2.3", - "material-design-lite": "^1.1.3", - "ng2-alfresco-core": "^0.1.0", - "ng2-alfresco-login": "^0.1.0", - "reflect-metadata": "0.1.2", - "rxjs": "5.0.0-beta.2", - "systemjs": "0.19.26", - "zone.js": "0.6.10" - }, - "devDependencies": { - "browser-sync": "^2.10.0", - "concurrently": "^2.0.0", - "lite-server": "^2.2.0", - "tslint": "^3.8.1", - "typescript": "^1.8.10", - "typings": "^0.7.12" - }, - "publishConfig": { - "registry": "http://devproducts.alfresco.me:4873/" - } } diff --git a/ng2-components/ng2-alfresco-login/demo/src/components/app-component.ts b/ng2-components/ng2-alfresco-login/demo/src/components/app-component.ts deleted file mode 100644 index e7d3400269..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/src/components/app-component.ts +++ /dev/null @@ -1,51 +0,0 @@ -/// - -/** - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Component } from 'angular2/core'; -import { AlfrescoLoginComponent, AlfrescoAuthenticationService } from 'ng2-alfresco-login/dist/ng2-alfresco-login'; -import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router'; -import { AlfrescoSettingsService } from 'ng2-alfresco-core/dist/ng2-alfresco-core'; - -@Component({ - selector: 'my-login', - template: '', - directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent] -}) - -@RouteConfig([ - {path: '/', name: 'Login', component: AlfrescoLoginComponent, useAsDefault: true} -]) -export class AppComponent { - - constructor(public auth: AlfrescoAuthenticationService, - public router: Router, - alfrescoSettingsService: AlfrescoSettingsService) { - alfrescoSettingsService.host = 'http://192.168.99.100:8080'; - - } - - mySuccessMethod($event) { - console.log('Success Login EventEmitt called with: ' + $event.value); - } - - myErrorMethod($event) { - console.log('Error Login EventEmitt called with: ' + $event.value); - } - -} diff --git a/ng2-components/ng2-alfresco-login/demo/src/main.ts b/ng2-components/ng2-alfresco-login/demo/src/main.ts index 6b484c0209..2f9b357e38 100644 --- a/ng2-components/ng2-alfresco-login/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-login/demo/src/main.ts @@ -1,4 +1,4 @@ -/** +/*! * @license * Copyright 2016 Alfresco Software, Ltd. * @@ -16,17 +16,47 @@ */ import { bootstrap } from 'angular2/platform/browser'; -import { AppComponent } from './components/app-component'; -import { ALFRESCO_AUTHENTICATION } from 'ng2-alfresco-login/dist/ng2-alfresco-login'; +import { Component } from 'angular2/core'; +import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router'; +import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core/dist/ng2-alfresco-core'; +import { AlfrescoLoginComponent } from 'ng2-alfresco-login/dist/ng2-alfresco-login'; import { ROUTER_PROVIDERS } from 'angular2/router'; import { HTTP_PROVIDERS } from 'angular2/http'; import { ALFRESCO_CORE_PROVIDERS, AlfrescoTranslationService, AlfrescoTranslationLoader } from 'ng2-alfresco-core/dist/ng2-alfresco-core'; + +@RouteConfig([ + {path: '/', name: 'Login', component: AlfrescoLoginComponent, useAsDefault: true} +]) +@Component({ + selector: 'my-app', + template: '', + directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent] +}) +export class AppComponent { + + constructor(public auth: AlfrescoAuthenticationService, + public router: Router, + alfrescoSettingsService: AlfrescoSettingsService) { + alfrescoSettingsService.host = 'http://192.168.99.100:8080'; + + } + + mySuccessMethod($event) { + console.log('Success Login EventEmitt called with: ' + $event.value); + } + + myErrorMethod($event) { + console.log('Error Login EventEmitt called with: ' + $event.value); + } + +} + bootstrap(AppComponent, [ ROUTER_PROVIDERS, HTTP_PROVIDERS, AlfrescoTranslationLoader, AlfrescoTranslationService, - ALFRESCO_AUTHENTICATION, + AlfrescoAuthenticationService, ALFRESCO_CORE_PROVIDERS ]); diff --git a/ng2-components/ng2-alfresco-login/demo/tsconfig.json b/ng2-components/ng2-alfresco-login/demo/tsconfig.json index 0c6b9dc687..aca217c6cc 100644 --- a/ng2-components/ng2-alfresco-login/demo/tsconfig.json +++ b/ng2-components/ng2-alfresco-login/demo/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "target": "ES5", - "module": "commonjs", + "target": "es5", + "module": "system", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, @@ -11,8 +11,9 @@ "outDir": "dist" }, "exclude": [ + "dist", "node_modules", - "typings", - "dist" + "typings/main", + "typings/main.d.ts" ] }