metrics-modal.component.ts 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { Component, OnInit } from '@angular/core';
  2. import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
  3. @Component({
  4. selector: 'jhi-metrics-modal',
  5. templateUrl: './metrics-modal.component.html'
  6. })
  7. export class JhiMetricsMonitoringModalComponent implements OnInit {
  8. threadDumpFilter: any;
  9. threadDump: any;
  10. threadDumpAll = 0;
  11. threadDumpBlocked = 0;
  12. threadDumpRunnable = 0;
  13. threadDumpTimedWaiting = 0;
  14. threadDumpWaiting = 0;
  15. constructor(public activeModal: NgbActiveModal) {}
  16. ngOnInit() {
  17. this.threadDump.forEach(value => {
  18. if (value.threadState === 'RUNNABLE') {
  19. this.threadDumpRunnable += 1;
  20. } else if (value.threadState === 'WAITING') {
  21. this.threadDumpWaiting += 1;
  22. } else if (value.threadState === 'TIMED_WAITING') {
  23. this.threadDumpTimedWaiting += 1;
  24. } else if (value.threadState === 'BLOCKED') {
  25. this.threadDumpBlocked += 1;
  26. }
  27. });
  28. this.threadDumpAll = this.threadDumpRunnable + this.threadDumpWaiting + this.threadDumpTimedWaiting + this.threadDumpBlocked;
  29. }
  30. getBadgeClass(threadState) {
  31. if (threadState === 'RUNNABLE') {
  32. return 'badge-success';
  33. } else if (threadState === 'WAITING') {
  34. return 'badge-info';
  35. } else if (threadState === 'TIMED_WAITING') {
  36. return 'badge-warning';
  37. } else if (threadState === 'BLOCKED') {
  38. return 'badge-danger';
  39. }
  40. }
  41. }