mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Adapt the Login component to works also with activiti
This commit is contained in:
@@ -1 +1,11 @@
|
||||
<alfresco-login (onSuccess)="onLogin($event)" (onError)="onError($event)"></alfresco-login>
|
||||
<div style="position: absolute; background-color: papayawhip; color: cadetblue; left: 10px; top: 10px; z-index: 1;">
|
||||
<p style="width:120px;margin: 10px;">
|
||||
<small style="float: left;">ECM</small>
|
||||
<input class="mdl-slider mdl-js-slider" type="range" (click)="toggleECM(ecm.value)" #ecm id="s1" min="0" max="10" value="10" step="10">
|
||||
</p>
|
||||
<p style="width:120px;margin: 10px;">
|
||||
<small style="float: left;">BPM</small>
|
||||
<input class="mdl-slider mdl-js-slider" type="range" (click)="toggleBPM(bpm.value)" #bpm id="s2" min="0" max="10" value="0" step="10">
|
||||
</p>
|
||||
</div>
|
||||
<alfresco-login [providers]="providers" (onSuccess)="onLogin($event)" (onError)="onError($event)"></alfresco-login>
|
||||
|
@@ -33,6 +33,8 @@ export class LoginDemoComponent {
|
||||
constructor(public router: Router) {
|
||||
}
|
||||
|
||||
providers: string [] = ['ECM'];
|
||||
|
||||
onLogin($event) {
|
||||
console.log($event);
|
||||
this.router.navigate(['Home']);
|
||||
@@ -42,4 +44,20 @@ export class LoginDemoComponent {
|
||||
console.log($event);
|
||||
}
|
||||
|
||||
toggleECM(value) {
|
||||
if (value === '10') {
|
||||
this.providers[0] = 'ECM';
|
||||
} else {
|
||||
this.providers[0] = '';
|
||||
}
|
||||
}
|
||||
|
||||
toggleBPM(value) {
|
||||
if (value === '10') {
|
||||
this.providers[1] = 'BPM';
|
||||
} else {
|
||||
this.providers[1] = '';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,6 +22,10 @@ import {
|
||||
ObjectDataTableAdapter
|
||||
} from 'ng2-alfresco-datatable';
|
||||
|
||||
import {
|
||||
AlfrescoAuthenticationService
|
||||
} from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
selector: 'tasks-demo',
|
||||
template: `
|
||||
@@ -38,20 +42,22 @@ export class TasksDemoComponent implements OnInit {
|
||||
tasks: ObjectDataTableAdapter;
|
||||
|
||||
constructor(
|
||||
private activitiService: ActivitiService) {}
|
||||
private activitiService: ActivitiService,
|
||||
private auth: AlfrescoAuthenticationService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activitiService
|
||||
.login('denys.vuika@alfresco.com', 'test')
|
||||
.then(() => {
|
||||
this.activitiService
|
||||
.getTasks()
|
||||
.then((data) => {
|
||||
let tasks = data || [];
|
||||
console.log(tasks);
|
||||
this.loadTasks(tasks);
|
||||
});
|
||||
});
|
||||
if (this.auth.isLoggedIn('BPM')) {
|
||||
this.activitiService
|
||||
.getTasks()
|
||||
.then((data) => {
|
||||
let tasks = data || [];
|
||||
console.log(tasks);
|
||||
this.loadTasks(tasks);
|
||||
});
|
||||
} else {
|
||||
console.error('User unauthorized');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private loadTasks(tasks: any[]) {
|
||||
|
Reference in New Issue
Block a user