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
|
# Alfresco User Info Component for Angular 2
|
||||||
<p>
|
This component will show the user information for ECM and BPM
|
||||||
<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>
|
|
||||||
|
|
||||||
### Node
|
|
||||||
To correctly use this component check that on your machine is running Node version 5.0.0 or higher.
|
|
||||||
|
|
||||||
## Install
|
## Prerequisites
|
||||||
|
|
||||||
```sh
|
Before you start using this development framework, make sure you have installed all required software and done all the
|
||||||
npm install --save ng2-alfresco-tag
|
necessary configuration, see this [page](https://github.com/Alfresco/alfresco-ng2-components/blob/master/PREREQUISITES.md).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install ng2-alfresco-userinfo --save
|
||||||
```
|
```
|
||||||
|
## Dependencies
|
||||||
Components included:
|
|
||||||
|
|
||||||
* Alfresco Tag Component
|
|
||||||
|
|
||||||
#### Dependencies
|
|
||||||
|
|
||||||
Add the following dependency to your index.html:
|
Add the following dependency to your index.html:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
<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
|
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
|
||||||
- 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
|
|
||||||
design dependency to your project:
|
design dependency to your project:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install --save material-design-icons material-design-lite
|
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
|
```html
|
||||||
<!-- Google Material Design Lite -->
|
<!-- 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>
|
<script src="node_modules/material-design-lite/material.min.js"></script>
|
||||||
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
|
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Basic usage
|
## Example
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<alfresco-tag-node-actions-list [nodeId]="nodeId"></alfresco-tag-node-actions-list>
|
<ng2-alfresco-userinfo></ng2-alfresco-userinfo>
|
||||||
```
|
|
||||||
|
|
||||||
```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
|
|
||||||
```
|
```
|
||||||
|
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
|
| Command | Description |
|
||||||
npm run build:w
|
| --- | --- |
|
||||||
```
|
| npm run build | Build component |
|
||||||
|
| npm run build:w | Build component and keep watching the changes |
|
||||||
## Running unit tests
|
| 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
|
## History
|
||||||
npm test
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running unit tests in browser
|
For detailed changelog, check [Releases](https://github.com/alfresco/ng2-alfresco-userinfo/releases).
|
||||||
|
|
||||||
```sh
|
## Contributors
|
||||||
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](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
|
.idea
|
||||||
dist/
|
coverage
|
||||||
|
dist
|
||||||
|
typings
|
||||||
!systemjs.config.js
|
!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">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Alfresco Angular 2 Tag - Demo</title>
|
<title>Angular 2 TaskList - Demo</title>
|
||||||
<base href="./">
|
<base href="./">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
|
|
||||||
<!-- Google Material Design Lite -->
|
<!-- Google Material Design Lite -->
|
||||||
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
|
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
|
||||||
<script src="node_modules/material-design-lite/material.min.js"></script>
|
<script src="node_modules/material-design-lite/material.min.js"></script>
|
||||||
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
|
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
|
||||||
|
|
||||||
|
<!-- 1. Load libraries -->
|
||||||
<!-- 1. Load libraries -->
|
<!-- 1. Load libraries -->
|
||||||
<!-- Polyfill(s) for older browsers -->
|
<!-- Polyfill(s) for older browsers -->
|
||||||
<script src="node_modules/core-js/client/shim.min.js"></script>
|
<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/zone.js/dist/zone.js"></script>
|
||||||
<script src="node_modules/reflect-metadata/Reflect.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/systemjs/dist/system.src.js"></script>
|
||||||
|
|
||||||
<!-- Additional Alfresco libraries -->
|
|
||||||
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
||||||
|
|
||||||
<script src="systemjs.config.js"></script>
|
<script src="systemjs.config.js"></script>
|
||||||
<script>
|
<script>
|
||||||
System.import('app').catch(
|
System.import('app').catch(function(err){ console.error(err); });
|
||||||
function (err) {
|
|
||||||
console.error(err);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<alfresco-tag-demo></alfresco-tag-demo>
|
<alfresco-userinfo-demo></alfresco-userinfo-demo>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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.
|
* 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 { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
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 { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||||
import { TagModule } from 'ng2-alfresco-tag';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'alfresco-tag-demo',
|
selector: 'alfresco-userinfo-demo',
|
||||||
template: `
|
template: `<h4> START DEMO USERINFO </h4>
|
||||||
<label for="ticket"><b>Insert a valid access ticket / ticket:</b></label><br>
|
<div style="border-radius: 8px; position: absolute; background-color:papayawhip; color: cadetblue; left: 320px; top: 30px; z-index: 1;">
|
||||||
<input id="ticket" type="text" size="48" (change)="updateTicket()" [(ngModel)]="ticket"><br>
|
<p style="width:120px;margin: 20px;">
|
||||||
<label for="host"><b>Insert the ip of your Alfresco instance:</b></label><br>
|
<label for="switch1" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||||
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="ecmHost"><br><br>
|
<input type="checkbox" id="switch1" class="mdl-switch__input"
|
||||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
(click)="toggleECM(ecm.checked)" #ecm>
|
||||||
Authentication failed to ip {{ ecmHost }} with user: admin, admin, you can still try to add a valid ticket to perform
|
<span class="mdl-switch__label">ECM</span>
|
||||||
operations.
|
</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>
|
</div>
|
||||||
<hr>
|
<div *ngIf="isLoggedIn()">
|
||||||
<label for="nodeId"><b>Insert Node Id</b></label><br>
|
<ng2-alfresco-userinfo></ng2-alfresco-userinfo>
|
||||||
<input id="nodeId" type="text" size="48" [(ngModel)]="nodeId"><br>
|
</div>
|
||||||
<div class="container" *ngIf="authenticated">
|
<p></p>
|
||||||
<div class="mdl-grid">
|
<div>
|
||||||
<div class="mdl-cell mdl-cell--4-col"><alfresco-tag-node-actions-list [nodeId]="nodeId"></alfresco-tag-node-actions-list></div>
|
<p>
|
||||||
<div class="mdl-cell mdl-cell--4-col">List Tags ECM <alfresco-tag-list></alfresco-tag-list></div>
|
<span>Username</span>
|
||||||
<div class="mdl-cell mdl-cell--4-col">
|
<input id="user" type="text" [(ngModel)]="userToLogin" value="admin"/>
|
||||||
Tag list By Node ID
|
</p>
|
||||||
<alfresco-tag-node-list [nodeId]="nodeId"></alfresco-tag-node-list>
|
<p>
|
||||||
</div>
|
<span>Password</span>
|
||||||
</div>
|
<input id="passw" type="password" [(ngModel)]="password" value="admin"/>
|
||||||
</div>
|
</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()
|
public userToLogin: string = 'admin';
|
||||||
nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
|
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,
|
logout() {
|
||||||
private settingsService: AlfrescoSettingsService) {
|
this.authService.logout();
|
||||||
|
}
|
||||||
|
|
||||||
settingsService.ecmHost = this.ecmHost;
|
login(user, password) {
|
||||||
settingsService.setProviders('ECM');
|
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()) {
|
isLoggedIn(): boolean {
|
||||||
this.ticket = this.authService.getTicketEcm();
|
return this.authService.isLoggedIn();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
toggleECM(checked) {
|
||||||
this.login();
|
if (checked && this.providers === 'BPM') {
|
||||||
}
|
this.providers = 'ALL';
|
||||||
|
} else if (checked) {
|
||||||
|
this.providers = 'ECM';
|
||||||
|
} else {
|
||||||
|
this.providers = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
login() {
|
toggleBPM(checked) {
|
||||||
this.authService.login('admin', 'admin').subscribe(
|
if (checked && this.providers === 'ECM') {
|
||||||
ticket => {
|
this.providers = 'ALL';
|
||||||
console.log(ticket);
|
} else if (checked) {
|
||||||
this.ticket = this.authService.getTicketEcm();
|
this.providers = 'BPM';
|
||||||
this.authenticated = true;
|
} else {
|
||||||
},
|
this.providers = undefined;
|
||||||
error => {
|
}
|
||||||
console.log(error);
|
}
|
||||||
this.authenticated = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
CoreModule.forRoot(),
|
CoreModule.forRoot(),
|
||||||
TagModule
|
UserInfoComponentModule.forRoot()
|
||||||
],
|
],
|
||||||
declarations: [ TagDemo ],
|
declarations: [ UserInfoDemo ],
|
||||||
bootstrap: [ TagDemo ]
|
bootstrap: [ UserInfoDemo ]
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
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": {
|
"rules": {
|
||||||
"align": [
|
"align": [
|
||||||
true,
|
true,
|
||||||
"parameters",
|
"parameters",
|
||||||
"arguments",
|
"statements"
|
||||||
"statements"
|
],
|
||||||
],
|
"ban": false,
|
||||||
"ban": false,
|
"class-name": true,
|
||||||
"class-name": true,
|
"comment-format": [
|
||||||
"comment-format": [
|
true,
|
||||||
true,
|
"check-space"
|
||||||
"check-space",
|
],
|
||||||
"check-lowercase"
|
"curly": true,
|
||||||
],
|
"eofline": true,
|
||||||
"curly": true,
|
"forin": true,
|
||||||
"eofline": true,
|
"indent": [
|
||||||
"forin": true,
|
true,
|
||||||
"indent": [
|
"spaces"
|
||||||
true,
|
],
|
||||||
"spaces"
|
"interface-name": false,
|
||||||
],
|
"jsdoc-format": true,
|
||||||
"interface-name": false,
|
"label-position": true,
|
||||||
"jsdoc-format": true,
|
"label-undefined": true,
|
||||||
"label-position": true,
|
"max-line-length": [
|
||||||
"label-undefined": true,
|
true,
|
||||||
"max-line-length": [
|
180
|
||||||
true,
|
],
|
||||||
180
|
"member-ordering": [
|
||||||
],
|
true,
|
||||||
"member-ordering": [
|
"static-before-instance",
|
||||||
true,
|
"variables-before-functions"
|
||||||
"public-before-private",
|
],
|
||||||
"static-before-instance",
|
"no-any": false,
|
||||||
"variables-before-functions"
|
"no-arg": true,
|
||||||
],
|
"no-bitwise": false,
|
||||||
"no-any": false,
|
"no-conditional-assignment": true,
|
||||||
"no-arg": true,
|
"no-consecutive-blank-lines": false,
|
||||||
"no-bitwise": true,
|
"no-console": [
|
||||||
"no-conditional-assignment": true,
|
true,
|
||||||
"no-consecutive-blank-lines": false,
|
"debug",
|
||||||
"no-console": [
|
"info",
|
||||||
true,
|
"time",
|
||||||
"debug",
|
"timeEnd",
|
||||||
"info",
|
"trace"
|
||||||
"time",
|
],
|
||||||
"timeEnd",
|
"no-construct": true,
|
||||||
"trace"
|
"no-constructor-vars": false,
|
||||||
],
|
"no-debugger": true,
|
||||||
"no-construct": true,
|
"no-duplicate-key": true,
|
||||||
"no-constructor-vars": false,
|
"no-duplicate-variable": true,
|
||||||
"no-debugger": true,
|
"no-empty": false,
|
||||||
"no-duplicate-key": true,
|
"no-eval": true,
|
||||||
"no-duplicate-variable": true,
|
"no-inferrable-types": false,
|
||||||
"no-empty": true,
|
"no-internal-module": true,
|
||||||
"no-eval": true,
|
"no-require-imports": true,
|
||||||
"no-inferrable-types": false,
|
"no-shadowed-variable": true,
|
||||||
"no-internal-module": true,
|
"no-switch-case-fall-through": true,
|
||||||
"no-require-imports": true,
|
"no-trailing-whitespace": true,
|
||||||
"no-shadowed-variable": true,
|
"no-unreachable": true,
|
||||||
"no-switch-case-fall-through": true,
|
"no-unused-expression": true,
|
||||||
"no-trailing-whitespace": true,
|
"no-unused-variable": true,
|
||||||
"no-unreachable": true,
|
"no-use-before-declare": true,
|
||||||
"no-unused-expression": true,
|
"no-var-keyword": true,
|
||||||
"no-unused-variable": true,
|
"no-var-requires": true,
|
||||||
"no-use-before-declare": true,
|
"object-literal-sort-keys": false,
|
||||||
"no-var-keyword": true,
|
"one-line": [
|
||||||
"no-var-requires": true,
|
true,
|
||||||
"object-literal-sort-keys": false,
|
"check-open-brace",
|
||||||
"one-line": [
|
"check-catch",
|
||||||
true,
|
"check-else",
|
||||||
"check-open-brace",
|
"check-whitespace"
|
||||||
"check-catch",
|
],
|
||||||
"check-else",
|
"quotemark": [
|
||||||
"check-whitespace"
|
true,
|
||||||
],
|
"single",
|
||||||
"quotemark": [
|
"avoid-escape"
|
||||||
true,
|
],
|
||||||
"single",
|
"radix": true,
|
||||||
"avoid-escape"
|
"semicolon": true,
|
||||||
],
|
"switch-default": true,
|
||||||
"radix": true,
|
"trailing-comma": [
|
||||||
"semicolon": true,
|
true,
|
||||||
"switch-default": true,
|
{
|
||||||
"trailing-comma": [
|
"multiline": "never",
|
||||||
true,
|
"singleline": "never"
|
||||||
{
|
}
|
||||||
"multiline": "never",
|
],
|
||||||
"singleline": "never"
|
"triple-equals": [
|
||||||
}
|
true,
|
||||||
],
|
"allow-null-check"
|
||||||
"triple-equals": [
|
],
|
||||||
true,
|
"typedef": false,
|
||||||
"allow-null-check"
|
"typedef-whitespace": [
|
||||||
],
|
true,
|
||||||
"typedef": false,
|
{
|
||||||
"typedef-whitespace": [
|
"call-signature": "nospace",
|
||||||
true,
|
"index-signature": "nospace",
|
||||||
{
|
"parameter": "nospace",
|
||||||
"call-signature": "nospace",
|
"property-declaration": "nospace",
|
||||||
"index-signature": "nospace",
|
"variable-declaration": "nospace"
|
||||||
"parameter": "nospace",
|
}
|
||||||
"property-declaration": "nospace",
|
],
|
||||||
"variable-declaration": "nospace"
|
"use-strict": false,
|
||||||
}
|
"variable-name": [
|
||||||
],
|
true,
|
||||||
"use-strict": false,
|
"check-format",
|
||||||
"variable-name": [
|
"allow-leading-underscore",
|
||||||
true,
|
"ban-keywords"
|
||||||
"check-format",
|
],
|
||||||
"allow-leading-underscore",
|
"whitespace": [
|
||||||
"ban-keywords"
|
true,
|
||||||
],
|
"check-branch",
|
||||||
"whitespace": [
|
"check-operator",
|
||||||
true,
|
"check-separator",
|
||||||
"check-branch",
|
"check-type",
|
||||||
"check-operator",
|
"check-module",
|
||||||
"check-separator",
|
"check-decl"
|
||||||
"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; npm update;)
|
||||||
(cd ng2-alfresco-tag/demo; 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