mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#878 fix documentation diagrams,login,analytics,core and package.json dependencies
This commit is contained in:
@@ -15,16 +15,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NgModule, Component } from '@angular/core';
|
||||
import { NgModule, Component, OnInit } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { CoreModule } from 'ng2-alfresco-core';
|
||||
import { CoreModule, AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { AnalyticsModule } from 'ng2-activiti-analytics';
|
||||
|
||||
@Component({
|
||||
selector: 'activiti-analytics-demo',
|
||||
template: `
|
||||
<label for="ticket"><b>Insert a valid 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 Activiti instance:</b></label><br>
|
||||
<input id="host" type="text" size="48" (change)="updateHost()" [(ngModel)]="host"><br><br>
|
||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid ticket to perform
|
||||
operations.
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="page-content">
|
||||
<label for="appId"><b>Insert the appId:</b></label><br>
|
||||
<input id="appId" size="10" type="text" [(ngModel)]="appId">
|
||||
@@ -39,14 +48,56 @@ import { AnalyticsModule } from 'ng2-activiti-analytics';
|
||||
</div>`
|
||||
})
|
||||
|
||||
export class AnalyticsDemoComponent {
|
||||
export class AnalyticsDemoComponent implements OnInit {
|
||||
|
||||
appId: number;
|
||||
|
||||
report: any;
|
||||
|
||||
authenticated: boolean;
|
||||
|
||||
host: string = 'http://localhost:9999';
|
||||
|
||||
ticket: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) {
|
||||
settingsService.bpmHost = this.host;
|
||||
settingsService.setProviders('BPM');
|
||||
|
||||
if (this.authService.getTicketBpm()) {
|
||||
this.ticket = this.authService.getTicketBpm();
|
||||
}
|
||||
}
|
||||
|
||||
onReportClick(event: any) {
|
||||
this.report = event;
|
||||
}
|
||||
|
||||
public updateTicket(): void {
|
||||
localStorage.setItem('ticket-BPM', this.ticket);
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.settingsService.bpmHost = this.host;
|
||||
this.login();
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.login();
|
||||
}
|
||||
|
||||
login() {
|
||||
this.authService.login('admin', 'admin').subscribe(
|
||||
ticket => {
|
||||
console.log(ticket);
|
||||
this.ticket = this.authService.getTicketBpm();
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
this.authenticated = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
@@ -55,9 +106,10 @@ export class AnalyticsDemoComponent {
|
||||
CoreModule.forRoot(),
|
||||
AnalyticsModule
|
||||
],
|
||||
declarations: [ AnalyticsDemoComponent ],
|
||||
bootstrap: [ AnalyticsDemoComponent ]
|
||||
declarations: [AnalyticsDemoComponent],
|
||||
bootstrap: [AnalyticsDemoComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
export class AppModule {
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||
|
Reference in New Issue
Block a user