import { TreeElement } from "../../../../classes/TreeElement" ; import { lazyInject } from "../../../../inversify.config" ; import SonarQubeMeasuresApiService from "./SonarQubeMeasuresApiService" ; import SonarQubeTransformerService from "./SonarQubeTransformerService" ; export default class SonarQubeMeasuresTreeService { @ lazyInject ( "SonarQubeMeasuresApiService" ) private readonly measureApiService ! : SonarQubeMeasuresApiService ; @ lazyInject ( "SonarQubeTransformerService" ) private readonly sonarQubeTransformerService ! : SonarQubeTransformerService ; public loadTree ( parent , metricKeys ) { return new Promise < void > ( ( resolve , reject ) => { this . measureApiService . loadMeasures ( parent . key , metricKeys ) . then ( ( result ) => { for ( const file of result . components ) { const element = this . sonarQubeTransformerService . createTreeElement ( file ) ; this . sonarQubeTransformerService . add ( parent , element , true ) ; } resolve ( ) ; } ) . catch ( ( error ) => { reject ( error ) ; } ) ; } ) ; } }