import { BackendService } from "./BackendService" ; export interface SonarQubeComponentInfo { id : number ; key : string ; name : string ; analysisDate : Date ; leakPeriodDate : Date ; } export default class SonarQubeComponentInfoService extends BackendService { /**
     * Only available (with the implemented parameters) from SQ version 6.4.
     *
     * Error handling should be done by the caller.
     */ public loadComponentInfo ( ) { const componentStore = this . componentStatusStore ; const params = { component : componentStore . appConfiguration . projectKey } ; this . callApi ( "/components/show" , { params } ) . then ( ( response ) => { const component = response . data . component ; const nextAnalysusDate = new Date ( component . analysisDate ) ; if ( componentStore . lastAnalysisDate ?. valueOf ( ) !== nextAnalysusDate . valueOf ( ) ) { componentStore . lastAnalysisDate = nextAnalysusDate ; } const nextLeakPeriodDate = new Date ( component . leakPeriodDate ) ; if ( componentStore . leakPeriodDate ?. valueOf ( ) !== nextLeakPeriodDate . valueOf ( ) ) { componentStore . leakPeriodDate = nextLeakPeriodDate ; } } ) . catch ( ( error ) => { /**
             * Does not throw an application error because the api/component/show web-api changed in version 6.4
             * and we currently support SQ versions > 6.3.
             */ componentStore . lastAnalysisDate = undefined ; componentStore . leakPeriodDate = undefined ; console . error ( error . response . data ) ; } ) ; } }