mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Rebased branch
This commit is contained in:
@@ -1,75 +1,43 @@
|
||||
# Alfresco Tag 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-alfresco-tag'>
|
||||
<img src='https://img.shields.io/npm/dt/ng2-alfresco-tag.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>
|
||||
# Alfresco User Info Component for Angular 2
|
||||
This component will show the user information for ECM and BPM
|
||||
|
||||
### Node
|
||||
To correctly use this component check that on your machine is running Node version 5.0.0 or higher.
|
||||
|
||||
## Install
|
||||
## Prerequisites
|
||||
|
||||
```sh
|
||||
npm install --save ng2-alfresco-tag
|
||||
Before you start using this development framework, make sure you have installed all required software and done all the
|
||||
necessary configuration, see this [page](https://github.com/Alfresco/alfresco-ng2-components/blob/master/PREREQUISITES.md).
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install ng2-alfresco-userinfo --save
|
||||
```
|
||||
|
||||
Components included:
|
||||
|
||||
* Alfresco Tag Component
|
||||
|
||||
#### Dependencies
|
||||
## Dependencies
|
||||
|
||||
Add the following dependency to your index.html:
|
||||
|
||||
```html
|
||||
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
||||
```
|
||||
|
||||
You must separately install the following libraries for your application:
|
||||
|
||||
- [ng2-translate](https://github.com/ocombe/ng2-translate)
|
||||
- [ng2-alfresco-core](https://www.npmjs.com/package/ng2-alfresco-core)
|
||||
|
||||
The following component needs to be added to your systemjs.config:
|
||||
```sh
|
||||
npm install --save ng2-translate ng2-alfresco-core
|
||||
```
|
||||
|
||||
#### Material Design Lite
|
||||
|
||||
- ng2-translate
|
||||
- ng2-alfresco-core
|
||||
|
||||
Please refer to the following example to have an idea of how your systemjs.config should look like :
|
||||
|
||||
https://github.com/Alfresco/alfresco-ng2-components/blob/master/ng2-components/ng2-alfresco-tag/demo/systemjs.config.js
|
||||
|
||||
#### Style
|
||||
The style of this component is based on material design, so if you want to visualize it correctly you have to add the material
|
||||
The style of this component is based on [material design](https://getmdl.io/), so if you want to visualize it correctly you have to add the material
|
||||
design dependency to your project:
|
||||
|
||||
```sh
|
||||
npm install --save material-design-icons material-design-lite
|
||||
```
|
||||
|
||||
Also make sure you include these dependencies in your .html page:
|
||||
Also make sure you include these dependencies in your `index.html` file:
|
||||
|
||||
```html
|
||||
<!-- Google Material Design Lite -->
|
||||
@@ -77,293 +45,29 @@ Also make sure you include these dependencies in your .html page:
|
||||
<script src="node_modules/material-design-lite/material.min.js"></script>
|
||||
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
|
||||
```
|
||||
|
||||
#### Basic usage
|
||||
|
||||
In this component are present three different tags :
|
||||
|
||||
* alfresco-tag-node-actions-list
|
||||
* alfresco-tag-list
|
||||
* alfresco-tag-node-list
|
||||
|
||||
## alfresco-tag-node-actions-list
|
||||
|
||||
## Example
|
||||
|
||||
```html
|
||||
<alfresco-tag-node-actions-list [nodeId]="nodeId"></alfresco-tag-node-actions-list>
|
||||
```
|
||||
|
||||
```ts
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||
import { HTTP_PROVIDERS } from '@angular/http';
|
||||
import {
|
||||
ALFRESCO_CORE_PROVIDERS,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoAuthenticationService
|
||||
} from 'ng2-alfresco-core';
|
||||
import { TAGCOMPONENT, TAGSERVICES } from 'ng2-alfresco-tag';
|
||||
|
||||
@Component({
|
||||
selector: 'alfresco-tag-demo',
|
||||
template: `
|
||||
<div class="container" *ngIf="authenticated">
|
||||
<alfresco-tag-node-actions-list [nodeId]="nodeId"></alfresco-tag-node-actions-list>
|
||||
</div>
|
||||
`,
|
||||
directives: [TAGCOMPONENT],
|
||||
providers: [TAGSERVICES]
|
||||
})
|
||||
class TagDemo implements OnInit {
|
||||
|
||||
@Input()
|
||||
nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
|
||||
|
||||
authenticated: boolean;
|
||||
|
||||
ecmHost: string = 'http://127.0.0.1:8080';
|
||||
|
||||
ticket: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
settingsService.setProviders('ECM');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.login();
|
||||
}
|
||||
|
||||
login() {
|
||||
this.authService.login('admin', 'admin').subscribe(
|
||||
ticket => {
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
this.authenticated = false;
|
||||
});
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
logData(data) {
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
bootstrap(TagDemo, [
|
||||
HTTP_PROVIDERS,
|
||||
ALFRESCO_CORE_PROVIDERS
|
||||
]);
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
Attribute | Options | Default | Description | Mandatory
|
||||
--- | --- | --- | --- | ---
|
||||
`nodeId` | *string* | | The identifier of a node.|
|
||||
|
||||

|
||||
|
||||
## alfresco-tag-node-list
|
||||
|
||||
```html
|
||||
<alfresco-tag-node-list [nodeId]="nodeId"></alfresco-tag-node-list>
|
||||
```
|
||||
|
||||
```ts
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||
import { HTTP_PROVIDERS } from '@angular/http';
|
||||
import {
|
||||
ALFRESCO_CORE_PROVIDERS,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoAuthenticationService
|
||||
} from 'ng2-alfresco-core';
|
||||
|
||||
import { TAGCOMPONENT, TAGSERVICES } from 'ng2-alfresco-tag';
|
||||
|
||||
@Component({
|
||||
selector: 'alfresco-tag-demo',
|
||||
template: `
|
||||
<div class="container" *ngIf="authenticated">
|
||||
<alfresco-tag-node-list [nodeId]="nodeId"></alfresco-tag-node-list>
|
||||
</div>
|
||||
`,
|
||||
directives: [TAGCOMPONENT],
|
||||
providers: [TAGSERVICES]
|
||||
})
|
||||
class TagDemo implements OnInit {
|
||||
|
||||
@Input()
|
||||
nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
|
||||
|
||||
authenticated: boolean;
|
||||
|
||||
ecmHost: string = 'http://127.0.0.1:8080';
|
||||
|
||||
ticket: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
settingsService.setProviders('ECM');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.login();
|
||||
}
|
||||
|
||||
login() {
|
||||
this.authService.login('admin', 'admin').subscribe(
|
||||
ticket => {
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
this.authenticated = false;
|
||||
});
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
logData(data) {
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
bootstrap(TagDemo, [
|
||||
HTTP_PROVIDERS,
|
||||
ALFRESCO_CORE_PROVIDERS
|
||||
]);
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
Attribute | Options | Default | Description | Mandatory
|
||||
--- | --- | --- | --- | ---
|
||||
`nodeId` | *string* | | The identifier of a node.|
|
||||
|
||||

|
||||
|
||||
## alfresco-tag-list
|
||||
|
||||
```html
|
||||
<alfresco-tag-list></alfresco-tag-list>
|
||||
```
|
||||
|
||||
```ts
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||
import { HTTP_PROVIDERS } from '@angular/http';
|
||||
import {
|
||||
ALFRESCO_CORE_PROVIDERS,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoAuthenticationService
|
||||
} from 'ng2-alfresco-core';
|
||||
|
||||
import { TAGCOMPONENT, TAGSERVICES } from 'ng2-alfresco-tag';
|
||||
|
||||
@Component({
|
||||
selector: 'alfresco-tag-demo',
|
||||
template: `
|
||||
<div class="container" *ngIf="authenticated">
|
||||
<alfresco-tag-list></alfresco-tag-list>
|
||||
</div>
|
||||
`,
|
||||
directives: [TAGCOMPONENT],
|
||||
providers: [TAGSERVICES]
|
||||
})
|
||||
class TagDemo implements OnInit {
|
||||
|
||||
authenticated: boolean;
|
||||
|
||||
ecmHost: string = 'http://127.0.0.1:8080';
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
settingsService.setProviders('ECM');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.login();
|
||||
}
|
||||
|
||||
login() {
|
||||
this.authService.login('admin', 'admin').subscribe(
|
||||
ticket => {
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
this.authenticated = false;
|
||||
});
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
logData(data) {
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
bootstrap(TagDemo, [
|
||||
HTTP_PROVIDERS,
|
||||
ALFRESCO_CORE_PROVIDERS
|
||||
]);
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
## Build from sources
|
||||
Alternatively you can build component from sources with the following commands:
|
||||
|
||||
|
||||
```sh
|
||||
npm install
|
||||
npm run build
|
||||
<ng2-alfresco-userinfo></ng2-alfresco-userinfo>
|
||||
```
|
||||
This will show a round icon with user and on click some user information are showed.
|
||||
If user is logged in with ECM and BPM the ECM image will be showed.
|
||||
|
||||
##Build the files and keep watching for changes
|
||||
## NPM scripts
|
||||
|
||||
```sh
|
||||
npm run build:w
|
||||
```
|
||||
|
||||
## Running unit tests
|
||||
| Command | Description |
|
||||
| --- | --- |
|
||||
| npm run build | Build component |
|
||||
| npm run build:w | Build component and keep watching the changes |
|
||||
| npm run test | Run unit tests in the console |
|
||||
| npm run test-browser | Run unit tests in the browser
|
||||
| npm run coverage | Run unit tests and display code coverage report |
|
||||
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
## History
|
||||
|
||||
## Running unit tests in browser
|
||||
For detailed changelog, check [Releases](https://github.com/alfresco/ng2-alfresco-userinfo/releases).
|
||||
|
||||
```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
|
||||
```
|
||||
## Contributors
|
||||
|
||||
[Contributors](https://github.com/alfresco/ng2-alfresco-userinfo/graphs/contributors)
|
10
ng2-components/ng2-alfresco-userinfo/demo/.editorconfig
Normal file
10
ng2-components/ng2-alfresco-userinfo/demo/.editorconfig
Normal 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
|
@@ -1,6 +1,6 @@
|
||||
typings/
|
||||
node_modules/
|
||||
node_modules
|
||||
.idea
|
||||
dist/
|
||||
coverage
|
||||
dist
|
||||
typings
|
||||
!systemjs.config.js
|
||||
!browser-sync-config.js
|
||||
|
3
ng2-components/ng2-alfresco-userinfo/demo/.npmignore
Normal file
3
ng2-components/ng2-alfresco-userinfo/demo/.npmignore
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
typings
|
@@ -1,19 +1,13 @@
|
||||
# ng2-alfresco-tag - Demo
|
||||
# User info demo
|
||||
|
||||
* To install dependencies
|
||||
Install:
|
||||
|
||||
```sh
|
||||
$ npm install
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
* To provide a live demo
|
||||
Run the project:
|
||||
|
||||
```sh
|
||||
$ npm run start
|
||||
```
|
||||
|
||||
* To clean npm_modules and typings folder
|
||||
|
||||
```sh
|
||||
$ npm run clean
|
||||
```
|
||||
npm start
|
||||
```
|
@@ -2,38 +2,33 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Alfresco Angular 2 Tag - Demo</title>
|
||||
<title>Angular 2 TaskList - Demo</title>
|
||||
<base href="./">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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);
|
||||
});
|
||||
System.import('app').catch(function(err){ console.error(err); });
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<alfresco-tag-demo></alfresco-tag-demo>
|
||||
<alfresco-userinfo-demo></alfresco-userinfo-demo>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
77
ng2-components/ng2-alfresco-userinfo/demo/package.json
Normal file
77
ng2-components/ng2-alfresco-userinfo/demo/package.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "ng2-activiti-tasklist-demo",
|
||||
"description": "Alfresco Angular2 Task List Component - Demo",
|
||||
"version": "0.1.0",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules",
|
||||
"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 && rimraf dist && npm run tsc",
|
||||
"tsc": "tsc",
|
||||
"tsc:w": "tsc -w",
|
||||
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@angular/common": "2.0.0",
|
||||
"@angular/compiler": "2.0.0",
|
||||
"@angular/core": "2.0.0",
|
||||
"@angular/forms": "2.0.0",
|
||||
"@angular/http": "2.0.0",
|
||||
"@angular/platform-browser": "2.0.0",
|
||||
"@angular/platform-browser-dynamic": "2.0.0",
|
||||
"@angular/router": "3.0.0",
|
||||
"@angular/upgrade": "2.0.0",
|
||||
"core-js": "^2.4.1",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rxjs": "5.0.0-beta.12",
|
||||
"systemjs": "0.19.27",
|
||||
"zone.js": "^0.6.23",
|
||||
|
||||
"material-design-icons": "2.2.3",
|
||||
"material-design-lite": "1.2.1",
|
||||
"ng2-translate": "2.5.0",
|
||||
|
||||
"alfresco-js-api": "^0.3.0",
|
||||
"ng2-alfresco-core": "^0.3.0",
|
||||
"ng2-alfresco-userinfo": "0.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/core-js": "^0.9.32",
|
||||
"@types/jasmine": "^2.2.33",
|
||||
"concurrently": "^2.2.0",
|
||||
"rimraf": "2.5.2",
|
||||
"tslint": "3.8.1",
|
||||
"license-check": "1.1.5",
|
||||
"typescript": "^2.0.2",
|
||||
"wsrv": "^0.1.5"
|
||||
},
|
||||
"keywords": [
|
||||
"angular2",
|
||||
"typescript"
|
||||
],
|
||||
"license-check-config": {
|
||||
"src": [
|
||||
"**/*.js",
|
||||
"**/*.ts",
|
||||
"!/**/coverage/**/*",
|
||||
"!/**/demo/**/*",
|
||||
"!/**/node_modules/**/*",
|
||||
"!/**/typings/**/*",
|
||||
"!*.js"
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Vito Albano",
|
||||
"email": "vito.albano@alfresco.com"
|
||||
}
|
||||
],
|
||||
"path": "assets/license_header.txt",
|
||||
"blocking": true,
|
||||
"logInfo": false,
|
||||
"logError": true
|
||||
}
|
||||
}
|
@@ -15,100 +15,130 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NgModule, Component, Input, OnInit } from '@angular/core';
|
||||
import { NgModule, Component } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { UserInfoComponentModule } from 'ng2-alfresco-userinfo';
|
||||
import { CoreModule, MDL } from 'ng2-alfresco-core';
|
||||
|
||||
import { CoreModule, AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { TagModule } from 'ng2-alfresco-tag';
|
||||
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'alfresco-tag-demo',
|
||||
template: `
|
||||
<label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
|
||||
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
||||
<label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
|
||||
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="ecmHost"><br><br>
|
||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||
Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid ticket to perform
|
||||
operations.
|
||||
selector: 'alfresco-userinfo-demo',
|
||||
template: `<h4> START DEMO USERINFO </h4>
|
||||
<div style="border-radius: 8px; position: absolute; background-color:papayawhip; color: cadetblue; left: 320px; top: 30px; z-index: 1;">
|
||||
<p style="width:120px;margin: 20px;">
|
||||
<label for="switch1" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||
<input type="checkbox" id="switch1" class="mdl-switch__input"
|
||||
(click)="toggleECM(ecm.checked)" #ecm>
|
||||
<span class="mdl-switch__label">ECM</span>
|
||||
</label>
|
||||
</p>
|
||||
<p style="width:120px;margin: 20px;">
|
||||
<label for="switch2" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||
<input type="checkbox" id="switch2" class="mdl-switch__input" checked
|
||||
(click)="toggleBPM(bpm.checked)" #bpm>
|
||||
<span class="mdl-switch__label">BPM</span>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
<hr>
|
||||
<label for="nodeId"><b>Insert Node Id</b></label><br>
|
||||
<input id="nodeId" type="text" size="48" [(ngModel)]="nodeId"><br>
|
||||
<div class="container" *ngIf="authenticated">
|
||||
<div class="mdl-grid">
|
||||
<div class="mdl-cell mdl-cell--4-col"><alfresco-tag-node-actions-list [nodeId]="nodeId"></alfresco-tag-node-actions-list></div>
|
||||
<div class="mdl-cell mdl-cell--4-col">List Tags ECM <alfresco-tag-list></alfresco-tag-list></div>
|
||||
<div class="mdl-cell mdl-cell--4-col">
|
||||
Tag list By Node ID
|
||||
<alfresco-tag-node-list [nodeId]="nodeId"></alfresco-tag-node-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
<div *ngIf="isLoggedIn()">
|
||||
<ng2-alfresco-userinfo></ng2-alfresco-userinfo>
|
||||
</div>
|
||||
<p></p>
|
||||
<div>
|
||||
<p>
|
||||
<span>Username</span>
|
||||
<input id="user" type="text" [(ngModel)]="userToLogin" value="admin"/>
|
||||
</p>
|
||||
<p>
|
||||
<span>Password</span>
|
||||
<input id="passw" type="password" [(ngModel)]="password" value="admin"/>
|
||||
</p>
|
||||
<button type="submit" (click)="attemptLogin()"> Login !</button>
|
||||
</div>
|
||||
<span>{{loginErrorMessage}}</span>
|
||||
<button (click)="logout()">Logout</button>`,
|
||||
styles: [
|
||||
':host > .container {padding: 10px}',
|
||||
'.p-10 { padding: 10px; }'
|
||||
]
|
||||
})
|
||||
class TagDemo implements OnInit {
|
||||
class UserInfoDemo implements onInit{
|
||||
|
||||
@Input()
|
||||
nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
|
||||
public userToLogin: string = 'admin';
|
||||
public password: string = 'admin';
|
||||
public loginErrorMessage: string;
|
||||
public providers: string = 'BPM';
|
||||
private authenticated: boolean;
|
||||
private token: any;
|
||||
|
||||
authenticated: boolean;
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
}
|
||||
|
||||
ecmHost: string = 'http://127.0.0.1:8080';
|
||||
ngOnInit() {
|
||||
this.settingsService.setProviders(this.providers);
|
||||
}
|
||||
|
||||
ticket: string;
|
||||
attemptLogin() {
|
||||
this.loginErrorMessage = '';
|
||||
this.login(this.userToLogin, this.password);
|
||||
}
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private settingsService: AlfrescoSettingsService) {
|
||||
logout() {
|
||||
this.authService.logout();
|
||||
}
|
||||
|
||||
settingsService.ecmHost = this.ecmHost;
|
||||
settingsService.setProviders('ECM');
|
||||
login(user, password) {
|
||||
this.settingsService.setProviders(this.providers);
|
||||
this.authService.login(user, password).subscribe(
|
||||
token => {
|
||||
console.log(token);
|
||||
this.token = token;
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
this.authenticated = false;
|
||||
this.loginErrorMessage = error;
|
||||
});
|
||||
}
|
||||
|
||||
if (this.authService.getTicketEcm()) {
|
||||
this.ticket = this.authService.getTicketEcm();
|
||||
}
|
||||
}
|
||||
isLoggedIn(): boolean {
|
||||
return this.authService.isLoggedIn();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.login();
|
||||
}
|
||||
toggleECM(checked) {
|
||||
if (checked && this.providers === 'BPM') {
|
||||
this.providers = 'ALL';
|
||||
} else if (checked) {
|
||||
this.providers = 'ECM';
|
||||
} else {
|
||||
this.providers = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
login() {
|
||||
this.authService.login('admin', 'admin').subscribe(
|
||||
ticket => {
|
||||
console.log(ticket);
|
||||
this.ticket = this.authService.getTicketEcm();
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
this.authenticated = false;
|
||||
});
|
||||
}
|
||||
toggleBPM(checked) {
|
||||
if (checked && this.providers === 'ECM') {
|
||||
this.providers = 'ALL';
|
||||
} else if (checked) {
|
||||
this.providers = 'BPM';
|
||||
} else {
|
||||
this.providers = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
public updateTicket(): void {
|
||||
localStorage.setItem('ticket-ECM', this.ticket);
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.settingsService.ecmHost = this.ecmHost;
|
||||
this.login();
|
||||
}
|
||||
|
||||
logData(data) {
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CoreModule.forRoot(),
|
||||
TagModule
|
||||
UserInfoComponentModule.forRoot()
|
||||
],
|
||||
declarations: [ TagDemo ],
|
||||
bootstrap: [ TagDemo ]
|
||||
declarations: [ UserInfoDemo ],
|
||||
bootstrap: [ UserInfoDemo ]
|
||||
})
|
||||
export class AppModule { }
|
||||
|
||||
|
49
ng2-components/ng2-alfresco-userinfo/demo/systemjs.config.js
Normal file
49
ng2-components/ng2-alfresco-userinfo/demo/systemjs.config.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* 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: 'dist',
|
||||
// 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',
|
||||
// other libraries
|
||||
'rxjs': 'npm:rxjs',
|
||||
'ng2-translate': 'npm:ng2-translate',
|
||||
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist',
|
||||
'ng2-alfresco-login': 'npm:ng2-alfresco-login/dist',
|
||||
'ng2-alfresco-userinfo': 'npm:ng2-alfresco-userinfo/dist',
|
||||
'alfresco-js-api': 'npm:alfresco-js-api/dist'
|
||||
},
|
||||
// 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'
|
||||
},
|
||||
'ng2-translate': { defaultExtension: 'js' },
|
||||
|
||||
'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'},
|
||||
'ng2-alfresco-login': { main: './index.js', defaultExtension: 'js'},
|
||||
'ng2-alfresco-userinfo': { main: './index.js', defaultExtension: 'js'},
|
||||
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'}
|
||||
}
|
||||
});
|
||||
})(this);
|
26
ng2-components/ng2-alfresco-userinfo/demo/tsconfig.json
Normal file
26
ng2-components/ng2-alfresco-userinfo/demo/tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
"removeComments": true,
|
||||
"declaration": true,
|
||||
"noLib": false,
|
||||
"allowUnreachableCode": false,
|
||||
"allowUnusedLabels": false,
|
||||
"noImplicitAny": false,
|
||||
"noImplicitReturns": false,
|
||||
"noImplicitUseStrict": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"outDir": "dist",
|
||||
"types": ["core-js", "jasmine"]
|
||||
},
|
||||
"exclude": [
|
||||
"demo",
|
||||
"node_modules",
|
||||
"dist"
|
||||
]
|
||||
}
|
@@ -1,124 +1,121 @@
|
||||
{
|
||||
"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": 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"
|
||||
]
|
||||
}
|
||||
"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,
|
||||
"label-undefined": 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": 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": false,
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"watch": [
|
||||
"node_modules/ng2-alfresco-tag/dist/**/*.{html,htm,css,js}"
|
||||
]
|
||||
}
|
@@ -34,3 +34,6 @@
|
||||
|
||||
(cd ng2-alfresco-tag; npm update;)
|
||||
(cd ng2-alfresco-tag/demo; npm update;)
|
||||
|
||||
(cd ng2-alfresco-userinfo; npm update;)
|
||||
(cd ng2-alfresco-userinfo/demo; npm update;)
|
||||
|
Reference in New Issue
Block a user