2025-05-23 12:59:06 +10:00
|
|
|
import { Component, OnDestroy } from '@angular/core';
|
2018-06-21 15:16:53 +03:00
|
|
|
import { NbThemeService } from '@nebular/theme';
|
2025-05-23 12:59:06 +10:00
|
|
|
import { takeWhile } from 'rxjs/operators';
|
2018-06-21 15:16:53 +03:00
|
|
|
|
2018-06-21 19:01:32 +03:00
|
|
|
interface CardSettings {
|
2018-06-21 15:16:53 +03:00
|
|
|
title: string;
|
2025-05-23 12:59:06 +10:00
|
|
|
value: string;
|
|
|
|
|
unitOfMeasurement: string;
|
2018-06-21 15:16:53 +03:00
|
|
|
iconClass: string;
|
|
|
|
|
type: string;
|
|
|
|
|
}
|
2017-04-13 14:24:23 +03:00
|
|
|
|
|
|
|
|
@Component({
|
2017-05-06 15:35:15 +03:00
|
|
|
selector: 'ngx-dashboard',
|
2017-06-12 19:43:44 +03:00
|
|
|
styleUrls: ['./dashboard.component.scss'],
|
|
|
|
|
templateUrl: './dashboard.component.html',
|
2017-04-13 14:24:23 +03:00
|
|
|
})
|
2018-06-21 15:16:53 +03:00
|
|
|
export class DashboardComponent implements OnDestroy {
|
|
|
|
|
|
|
|
|
|
private alive = true;
|
|
|
|
|
|
2025-05-23 12:59:06 +10:00
|
|
|
// Key metrics for IdentityPulse
|
|
|
|
|
verificationCard: CardSettings = {
|
|
|
|
|
title: 'Total Verifications',
|
|
|
|
|
value: '1,247',
|
|
|
|
|
unitOfMeasurement: 'today',
|
|
|
|
|
iconClass: 'nb-checkmark-circle',
|
2018-06-21 15:16:53 +03:00
|
|
|
type: 'primary',
|
|
|
|
|
};
|
2025-05-23 12:59:06 +10:00
|
|
|
|
|
|
|
|
matchRateCard: CardSettings = {
|
|
|
|
|
title: 'Average Match Rate',
|
|
|
|
|
value: '87.3',
|
|
|
|
|
unitOfMeasurement: '%',
|
|
|
|
|
iconClass: 'nb-bar-chart',
|
2018-06-21 15:16:53 +03:00
|
|
|
type: 'success',
|
|
|
|
|
};
|
2025-05-23 12:59:06 +10:00
|
|
|
|
|
|
|
|
countriesCard: CardSettings = {
|
|
|
|
|
title: 'Active Countries',
|
|
|
|
|
value: '4',
|
|
|
|
|
unitOfMeasurement: 'regions',
|
|
|
|
|
iconClass: 'nb-location',
|
2018-06-21 15:16:53 +03:00
|
|
|
type: 'info',
|
|
|
|
|
};
|
2025-05-23 12:59:06 +10:00
|
|
|
|
|
|
|
|
apiResponseCard: CardSettings = {
|
|
|
|
|
title: 'API Response Time',
|
|
|
|
|
value: '245',
|
|
|
|
|
unitOfMeasurement: 'ms',
|
|
|
|
|
iconClass: 'nb-gear',
|
2018-06-21 15:16:53 +03:00
|
|
|
type: 'warning',
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-23 12:59:06 +10:00
|
|
|
statusCards: CardSettings[];
|
2018-06-21 15:16:53 +03:00
|
|
|
|
2018-06-21 19:01:32 +03:00
|
|
|
commonStatusCardsSet: CardSettings[] = [
|
2025-05-23 12:59:06 +10:00
|
|
|
this.verificationCard,
|
|
|
|
|
this.matchRateCard,
|
|
|
|
|
this.countriesCard,
|
|
|
|
|
this.apiResponseCard,
|
2018-06-21 15:16:53 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
statusCardsByThemes: {
|
2018-06-21 19:01:32 +03:00
|
|
|
default: CardSettings[];
|
|
|
|
|
cosmic: CardSettings[];
|
|
|
|
|
corporate: CardSettings[];
|
2019-07-02 16:18:09 +03:00
|
|
|
dark: CardSettings[];
|
2025-05-23 12:59:06 +10:00
|
|
|
marketsoft: CardSettings[];
|
2018-06-21 15:16:53 +03:00
|
|
|
} = {
|
|
|
|
|
default: this.commonStatusCardsSet,
|
|
|
|
|
cosmic: this.commonStatusCardsSet,
|
2025-05-23 12:59:06 +10:00
|
|
|
corporate: this.commonStatusCardsSet,
|
2019-07-02 16:18:09 +03:00
|
|
|
dark: this.commonStatusCardsSet,
|
2025-05-23 12:59:06 +10:00
|
|
|
marketsoft: this.commonStatusCardsSet,
|
2018-06-21 15:16:53 +03:00
|
|
|
};
|
|
|
|
|
|
2025-05-23 12:59:06 +10:00
|
|
|
constructor(private themeService: NbThemeService) {
|
2018-06-21 15:16:53 +03:00
|
|
|
this.themeService.getJsTheme()
|
|
|
|
|
.pipe(takeWhile(() => this.alive))
|
|
|
|
|
.subscribe(theme => {
|
|
|
|
|
this.statusCards = this.statusCardsByThemes[theme.name];
|
2019-01-08 16:17:20 +03:00
|
|
|
});
|
2018-06-21 15:16:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
|
this.alive = false;
|
|
|
|
|
}
|
2025-05-23 12:59:06 +10:00
|
|
|
}
|