Browse Source

Dashboard fixed

pull/164/head
Sebastian Stehle 8 years ago
parent
commit
4f590e5e0e
  1. 12
      src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts
  2. 4
      src/Squidex/app/shared/components/app-context.ts

12
src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts

@ -66,19 +66,22 @@ export class DashboardPageComponent implements OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.usagesService.getTodayStorage(this.ctx.appName) this.ctx.appChanges
.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.usagesService.getMonthCalls(this.ctx.appName) this.ctx.appChanges
.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.usagesService.getStorageUsages(this.ctx.appName, DateTime.today().addDays(-20), DateTime.today()) this.ctx.appChanges
.switchMap(app => this.usagesService.getStorageUsages(app.name, DateTime.today().addDays(-20), DateTime.today()))
.subscribe(dtos => { .subscribe(dtos => {
this.chartStorageCount = { this.chartStorageCount = {
labels: createLabels(dtos), labels: createLabels(dtos),
@ -111,7 +114,8 @@ export class DashboardPageComponent implements OnInit {
}; };
}); });
this.usagesService.getCallsUsages(this.ctx.appName, DateTime.today().addDays(-20), DateTime.today()) this.ctx.appChanges
.switchMap(app => this.usagesService.getCallsUsages(app.name, DateTime.today().addDays(-20), DateTime.today()))
.subscribe(dtos => { .subscribe(dtos => {
this.chartCallsCount = { this.chartCallsCount = {
labels: createLabels(dtos), labels: createLabels(dtos),

4
src/Squidex/app/shared/components/app-context.ts

@ -30,6 +30,10 @@ export class AppContext implements OnDestroy {
return this.appField; return this.appField;
} }
public get appChanges(): Observable<AppDto> {
return this.appsStore.selectedApp;
}
public get appName(): string { public get appName(): string {
return this.appField ? this.appField.name : ''; return this.appField ? this.appField.name : '';
} }

Loading…
Cancel
Save