|
|
@ -5,7 +5,8 @@ |
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
import { Component, OnDestroy, OnInit } from '@angular/core'; |
|
|
|
|
|
import { Subscription } from 'rxjs'; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
AppContext, |
|
|
AppContext, |
|
|
@ -28,7 +29,9 @@ declare var _urq: any; |
|
|
fadeAnimation |
|
|
fadeAnimation |
|
|
] |
|
|
] |
|
|
}) |
|
|
}) |
|
|
export class DashboardPageComponent implements OnInit { |
|
|
export class DashboardPageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
private subscriptions: Subscription[] = []; |
|
|
|
|
|
|
|
|
public profileDisplayName = ''; |
|
|
public profileDisplayName = ''; |
|
|
|
|
|
|
|
|
public chartStorageCount: any; |
|
|
public chartStorageCount: any; |
|
|
@ -68,21 +71,32 @@ export class DashboardPageComponent implements OnInit { |
|
|
) { |
|
|
) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
|
|
for (let subscription of this.subscriptions) { |
|
|
|
|
|
subscription.unsubscribe(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.subscriptions = []; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
public ngOnInit() { |
|
|
|
|
|
this.subscriptions.push( |
|
|
this.app |
|
|
this.app |
|
|
.switchMap(app => this.usagesService.getTodayStorage(app.name)) |
|
|
.switchMap(app => this.usagesService.getTodayStorage(app.name)) |
|
|
.subscribe(dto => { |
|
|
.subscribe(dto => { |
|
|
this.assetsCurrent = dto.size; |
|
|
this.assetsCurrent = dto.size; |
|
|
this.assetsMax = dto.maxAllowed; |
|
|
this.assetsMax = dto.maxAllowed; |
|
|
}); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
this.subscriptions.push( |
|
|
this.app |
|
|
this.app |
|
|
.switchMap(app => this.usagesService.getMonthCalls(app.name)) |
|
|
.switchMap(app => this.usagesService.getMonthCalls(app.name)) |
|
|
.subscribe(dto => { |
|
|
.subscribe(dto => { |
|
|
this.callsCurrent = dto.count; |
|
|
this.callsCurrent = dto.count; |
|
|
this.callsMax = dto.maxAllowed; |
|
|
this.callsMax = dto.maxAllowed; |
|
|
}); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
this.subscriptions.push( |
|
|
this.app |
|
|
this.app |
|
|
.switchMap(app => this.usagesService.getStorageUsages(app.name, DateTime.today().addDays(-20), DateTime.today())) |
|
|
.switchMap(app => this.usagesService.getStorageUsages(app.name, DateTime.today().addDays(-20), DateTime.today())) |
|
|
.subscribe(dtos => { |
|
|
.subscribe(dtos => { |
|
|
@ -115,8 +129,9 @@ export class DashboardPageComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
this.subscriptions.push( |
|
|
this.app |
|
|
this.app |
|
|
.switchMap(app => this.usagesService.getCallsUsages(app.name, DateTime.today().addDays(-20), DateTime.today())) |
|
|
.switchMap(app => this.usagesService.getCallsUsages(app.name, DateTime.today().addDays(-20), DateTime.today())) |
|
|
.subscribe(dtos => { |
|
|
.subscribe(dtos => { |
|
|
@ -145,7 +160,7 @@ export class DashboardPageComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
}; |
|
|
}; |
|
|
}); |
|
|
})); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public showForum() { |
|
|
public showForum() { |
|
|
|