Skip to content
Snippets Groups Projects
Commit 65907b7b authored by kbeyro's avatar kbeyro
Browse files

dont trigger refresh in backgroud

parent b969f254
No related branches found
No related tags found
1 merge request!218Template paging
import { Component } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import {DashboardService} from '../../service/dashboard.service'; import {DashboardService} from '../../service/dashboard.service';
import {UserDataService} from '../../service/userdata.service'; import {UserDataService} from '../../service/userdata.service';
import {AppImagesService, AppsService} from '../../service'; import {AppImagesService, AppsService} from '../../service';
...@@ -10,7 +10,7 @@ import {AuthService} from '../../auth/auth.service'; ...@@ -10,7 +10,7 @@ import {AuthService} from '../../auth/auth.service';
templateUrl: './admin-dashboard.component.html', templateUrl: './admin-dashboard.component.html',
styleUrl: './admin-dashboard.component.css' styleUrl: './admin-dashboard.component.css'
}) })
export class AdminDashboardComponent { export class AdminDashboardComponent implements OnInit, OnDestroy {
popularAppsChartData: any; popularAppsChartData: any;
basicOptions: any; basicOptions: any;
...@@ -26,6 +26,8 @@ export class AdminDashboardComponent { ...@@ -26,6 +26,8 @@ export class AdminDashboardComponent {
startDate; startDate;
endDate; endDate;
private refresh : any;
constructor(protected dashboardService: DashboardService, constructor(protected dashboardService: DashboardService,
private userDataService: UserDataService, private userDataService: UserDataService,
public appImagesService: AppImagesService, public appImagesService: AppImagesService,
...@@ -35,10 +37,10 @@ export class AdminDashboardComponent { ...@@ -35,10 +37,10 @@ export class AdminDashboardComponent {
} }
ngOnInit() { public ngOnInit() {
this.setDefaultDate(); this.setDefaultDate();
this.getAdmin() this.getAdmin()
this.userDataService.selectedDomainId.subscribe((domainId) => { this.refresh = this.userDataService.selectedDomainId.subscribe((domainId) => {
this.domainId = domainId this.domainId = domainId
this.getDomainAdmin() this.getDomainAdmin()
}); });
...@@ -84,6 +86,11 @@ export class AdminDashboardComponent { ...@@ -84,6 +86,11 @@ export class AdminDashboardComponent {
}; };
} }
public ngOnDestroy(): void {
this.refresh.unsubscribe();
this.refresh = null;
}
chartData() { chartData() {
const entries = Object.entries(this.adminData.popularApps); const entries = Object.entries(this.adminData.popularApps);
const sortedEntries = entries.sort((a, b) => Number(b[1]) - Number(a[1])); const sortedEntries = entries.sort((a, b) => Number(b[1]) - Number(a[1]));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment