diff --git a/EcoSonar-API/services/retrieveAnalysisService.js b/EcoSonar-API/services/retrieveAnalysisService.js index c2fc2e5..318b3f7 100644 --- a/EcoSonar-API/services/retrieveAnalysisService.js +++ b/EcoSonar-API/services/retrieveAnalysisService.js @@ -130,6 +130,7 @@ RetrieveAnalysisService.prototype.getUrlAnalysis = async function (projectName, reject(new SystemError()) } else { const analysis = { + allowW3c: process.env.ECOSONAR_ENV_ALLOW_EXTERNAL_API || 'false', deployments: { greenit: greenitAnalysisDeployment, lighthouse: lighthouseResultDeployment, diff --git a/EcoSonar-SonarQube/src/main/js/ecosonar_analysis_page/components/AnalysisPerUrlPanel.js b/EcoSonar-SonarQube/src/main/js/ecosonar_analysis_page/components/AnalysisPerUrlPanel.js index 6f54000..bd3d970 100644 --- a/EcoSonar-SonarQube/src/main/js/ecosonar_analysis_page/components/AnalysisPerUrlPanel.js +++ b/EcoSonar-SonarQube/src/main/js/ecosonar_analysis_page/components/AnalysisPerUrlPanel.js @@ -66,7 +66,7 @@ export default class AnalysisPerUrlPanel extends React.PureComponent { }) getAnalysisUrlConfiguration(this.state.projectName, this.state.selectedUrl) .then((res) => { - if (res !== undefined) { + if (res !== undefined && res.lastAnalysis.greenit !== null && res.lastAnalysis.lighthouse !== null && res.deployments.greenit.length !== 0 && res.deployments.lighthouse.length !== 0) { this.setState({ greenItLastAnalysis: res.lastAnalysis.greenit, lighthouseLastAnalysis: res.lastAnalysis.lighthouse, diff --git a/EcoSonar-SonarQube/src/main/js/ecosonar_analysis_page/components/EcoSonarAnalysisPage.js b/EcoSonar-SonarQube/src/main/js/ecosonar_analysis_page/components/EcoSonarAnalysisPage.js index 6accff8..5bb0f59 100644 --- a/EcoSonar-SonarQube/src/main/js/ecosonar_analysis_page/components/EcoSonarAnalysisPage.js +++ b/EcoSonar-SonarQube/src/main/js/ecosonar_analysis_page/components/EcoSonarAnalysisPage.js @@ -69,7 +69,7 @@ export default class EcoSonarAnalysisPage extends React.PureComponent { initEcoSonarAnalysisPage (projectName) { getAnalysisForProjectConfiguration(projectName) .then((analysis) => { - if (analysis !== undefined && analysis.lastAnalysis.greenit !== null && analysis.deployments.greenit.length !== 0) { + if (analysis !== undefined && analysis.lastAnalysis.greenit !== null && analysis.lastAnalysis.lighthouse !== null && (analysis.allowW3c === 'false' || analysis.lastAnalysis.w3c !== null) && analysis.deployments.greenit.length !== 0 && analysis.deployments.lighthouse.length !== 0 && (analysis.allowW3c === 'false' || analysis.deployments.lighthouse.w3c.length !== 0)) { const dateGreenitLastAnalysis = analysis.lastAnalysis.greenit !== null && analysis.lastAnalysis.greenit.dateAnalysis ? `${new Date(analysis.lastAnalysis.greenit.dateAnalysis).toDateString()} - ${new Date(analysis.lastAnalysis.greenit.dateAnalysis).toLocaleTimeString([], { hour12: false })} ` : null