import { Component } from '@angular/core' ; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' ; import { HealthKey , HealthDetails } from '../health.model' ; @ Component ( { selector : 'jhi-health-modal' , templateUrl : './health-modal.component.html' , } ) export class HealthModalComponent { health ? : { key : HealthKey ; value : HealthDetails ; } ; constructor ( private activeModal ) { } readableValue ( value ) { if ( this . health ?. key === 'diskSpace' ) { const val = value / 1073741824 ; if ( val > 1 ) { return `${ val . toFixed ( 2 ) } GB` ; } return `${ ( value / 1048576 ) . toFixed ( 2 ) } MB` ; } if ( typeof value === 'object' ) { return JSON . stringify ( value ) ; } return String ( value ) ; } dismiss ( ) { this . activeModal . dismiss ( ) ; } }